How Blockchain works

One of the most compact definition of BlockChain – “A BlockChain is just another type of database for recording transactions — one that is copied to all the computers in a participating network.” The blocks are arranged in fixed structures that include a header and the content. The header block contains all the metadata like a time-stamp, reference number, and a link to the previous block. The content block contains digital asset(s). When you pull down the latest block, you also gain access to all previous blocks linked together in a chain of database records, giving you an easy way to verify and audit transactions.

BlockChain was invented to create the alternative currency BitCoin. But may be used for other crypto currency, online signature services and many other applications.  Let’ see how BlockChain works with a problem that it attempts to solve – Money transfer

Consider person A wants to transfer money to person B say from Japan to Singapore. This is typically done through third trusted party. The trusted party identifies both A and B and then enables transaction of money. This might take couple of days to complete the transaction and trusted party usually takes some charges for enabling the transaction.  What block chain is attempting to solve is

  1. Transfer money without the third trusted party
  2. Faster transaction
  3. Cheaper transaction

Concept of open ledger

Let’s see how BlockChain works with an example –

Let’s consider we have 4 parties (A,B,C and D) who want to participate in transactions and want to move money from one another

  • A has $10 from the beginning and wants to transfer to B $5
  • Link it with already existing transaction in open ledge
  • B wants to move to D $3
  • Link the transaction to already existing transaction in open ledge
  • D wants to move to C $1.
  • Link the transaction to already existing transaction in open ledge

The open ledger essentially a chain of transactions. And hence it is referred as BlockChain. It is open and public to everyone. Everyone on the network can see – where is the money, how much money every one has and can decide whether the transaction is valid or not. For example – If A attempts to move $15 to C. Then everyone on network can immediately see that it is not a valid transaction and this transaction will not be part of the open ledger.

Now we have a centralized place to manage the transactions. But one of the goal of BlockChain is to move away from the centralized ledger.So second principle is distributed ledger. This means A can have a copy of the ledge and hold it. Similarly B, C and D. Similarly anyone else who participate can have a copy of ledge and hold it. So essentially now we do not need the centralized place to hold ledger anymore. This way we got rid of the centralized 3rd trusted party. But we created another problem. While there are various copies of the ledger, we need to ensure that all of them are synchronized and all the participants see the same version of the ledge. This leads to the third principle of synchronized ledger with all nodes.

Let’s see how all participants or Nodes get updated with the latest version of the ledger. Example – B wants to move to C $5. B is going to broadcast the intended transaction and all nodes see that B wants to move $5 to C. So far this transaction is not validated and is not available in ledger. The nodes who hold copy of the ledger are called as Miners. Let’s consider A and D are miners. The miners competes with each other to ensure that this is a validate transaction and put it in the ledger. The first miner who does it first gets monitory/financial reward. The miner needs to validate if B has enough money to make this transaction and find a special key that will enable it to find previous transaction and lock the new transaction. For this miner needs to invest computational power and time because the key generated is random. The miner is repetitively guessing the key until it finds a matching key. The one who finds the matching key first gets reward. Let’s consider D finds the matching key first and add the transaction to its own ledger. Then D publishes the transaction along with the valid key. The other miners catches the transaction and updates its ledger.    And look for a new transaction and hopefully to find a valid key first and get reward next time.