Blockchain 1.0 – How Bitcoin works

Blockchain revolution is broken down into three categories: Blockchain 1.0, 2.0, and 3.0.

  • Blockchain 1.0 is currency, the deployment of cryptocurrencies in applications related to cash, such as money transfer, remittance, and digital payment systems.
  • Blockchain 2.0 Contracted, the entire slate of economic, market, and financial applications using the blockchain that are more extensive than simple cash transactions: stocks, bonds, futures, loans, mortgages, titles, smart property, and smart contracts.
  • Blockchain 3.0 is blockchain applications beyond currency, finance, and markets—particularly in the areas of government, health, science, literacy, culture, and art.

Untitled2

Bitcoin

  • Bitcoin is digital cash. It is a digital currency and online payment system in which encryption techniques are used to regulate the generation of units of currency and verify the transfer of funds, operating independently of a central bank.
  • Bitcoin is pseudonymous (not anonymous) in the sense that public key addresses (27–32 alphanumeric character strings; similar in function to an email address) are used to send and receive Bitcoins and record transactions, as opposed to personally identifying information.
  • Bitcoins are created as a reward for computational processing work, known as mining, in which users offer their computing power to verify and record payments into the public ledger. Individuals or companies engage in mining in exchange for transaction fees and newly created Bitcoins. Besides mining, Bitcoins can, like any currency, be obtained in exchange for fiat money, products, and services. Users can send and receive Bitcoins electronically for an optional transaction fee using wallet software on a personal computer, mobile device, or web application
  • Bitcoin: A Peer-to-Peer Electronic Cash System

Bitcoin Landscape

Piture3

How Bitcoin Works

Suppose Alice wants to buy a coffee in Bob’s café, and her friend Bob wants to send money to bob’s café who accepts money into Bitcoin

The payment requests QR code

encodes the following URL, defined in BIP0021:

  • bitcoin:1GdK9UzpHBzqzX2A9JFP3Di4weBwqgmoQA?
  • amount=0.015&
  • label=Bob%27s%20Cafe&
  • message=Purchase%20at%20Bob%27s%20Cafe
  • The bitcoin network can transact in fractional values, e.g., from millibitcoins (1/1000th of a bitcoin) down to 1/100,000,000th of a bitcoin, which is known as a Satoshi,
  • In simple terms, a transaction tells the network that the owner of some bitcoins has authorized the transfer of some of those bitcoins to another owner. The new owner can now spend these bitcoins by creating another transaction that allows to transfer to another owner, and so on, in a chain of ownership.

Bitcoin Transactions

Transactions move value from transaction inputs to transaction outputs.An input is where the coin value is coming from, usually a previous transaction’s output. A transaction output assigns a new owner to the value by associating it with a key. The  destination key is called an encumbrance.

Constructing a Bitcoin Transaction 

  • Step 1 – Alice’s wallet application contains all the logic for selecting appropriate inputs and outputs to build a transaction to Alice’s specification, Alice only needs to specify a destination and an amount and the rest happens in the wallet application without her seeing the details
  • Step 2 –If the wallet application does not maintain a copy of unspent transaction outputs, it can query the bitcoin network to retrieve this information, using a variety of APIs available by different providers or by asking a full-index node using the bitcoin JSON RPC APIPictur2e1.png 
  • Getting the Bitcoin Wallet balance in sync with the network.
    • Step 3 – With this information, Alice’s wallet application can construct a transaction to transfer that value to new owner addresses.

     

  • Creating the output
    • Step 4 – In simpler terms, Alice’s transaction output will contain a script that says something like, “This output is payable to whoever can present a signature from the key corresponding to Bob’s public address.”

     

  • Getting the balances back in Alice wallet
    • Step 5 – This transaction will also include a second output, because Alice’s funds are in the form of a 0.10 BTC output, too much money for the 0.015 BTC cup of coffee. Alice will need 0.085 BTC in change. Alice’s change payment is created by Alice’s wallet in the very same transaction as the payment to Bob

     

  • Adding the transaction fees
    • Step 6 for the transaction to be processed by the network in a timely fashion, Alice’s wallet application will add a small fee. Alice creates only 0.0845 as the second output, there will be 0.0005 BTC left over. The resulting difference is the transaction fee that is collected by the miner as a fee for including the transaction in a block and putting it on the blockchain ledger

    hh

Adding the Transaction to the Ledger

  • The transaction created by Alice’s wallet application is 258 bytes long and contains everything necessary to confirm ownership of the funds and assign new owners. Now, the transaction must be transmitted to the bitcoin network where it will become part of the distributed ledger (the blockchain).
  • If Bob’s bitcoin wallet application is directly connected to Alice’s wallet application, Bob’s wallet application might be the first node to receive the transaction. However, even if Alice’s wallet sends the transaction through other nodes, it will reach Bob’s wallet within a few seconds. Bob’s wallet will immediately identify Alice’s transaction as an incoming payment because it contains outputs redeemable by Bob’s keys. Bob’s wallet application can also independently verify that the transaction is well formed, uses previously unspent inputs, and contains sufficient transaction fees to be included in the next block.

1221.JPG

Reference – Minimum Viable Blockchain

Thanks

Abhinav Gupta

Next Topic – Bitcoin Mining for Dummies