Introduction to Blockchain
Bhaskar S | 10/01/2016 |
We have been hearing a lot about Blockchain these days. So what is Blockchain and what is it about ???
Before we answer the question 'what is it', let us answer the question 'what is the purpose'.
Let us consider the example of a car ownership to explain 'what is the purpose of Blockchain ?'.
In todays world, we need a trusted central authority like the Motor Vehicles division to verify and establish ownership of the car to a person. This way one can prevent fraud and/or any disputes related to the ownership.
The following steps establish the process of ownership through a trusted central authority (in a simplistic way):
A Person interested in a car makes a financial commitment
The Dealer sells a car to a Person after the financial commitment
The Dealer and the Person submit their legal contract to a trusted central authority called the Motor Vehicles. The trusted central authority exists to prevent any kind of fraud or dispute amongst the Dealer and the Person
The Motor Vehicles verifies the sale, makes a record of the transaction in its system, and issues a physical document called the Title to the Person that establishes the ownership of the car to the Person
The following Figure-1 illustrates the above process:
In the above process, the Motor Vehicle division acting as a trusted central authority takes some time to process the Title and also charges some fees for the processing and maintaining of records in its system.
Now, imagine a future trustless world, where everything is digitized - identities, documents, etc. Trust is established through consensus from a completely decentralized peer-to-peer network without the need for a trusted central authority.
The following steps establish the process of ownership without a trusted central authority through consensus (in a simplistic way):
Both the Dealer and the Person have unique digital identities. A digital identity comprises of a Public and a Private key and a unique id or account number. The Hash of the Public key forms the unique id or account number, while the Private key is used to digitally sign a transaction
A Person interested in a car makes a financial commitment. This financial transaction is broadcast as a digitally immutable transaction (with the digital signature of the Person) on the peer-to-peer network where multiple Participants (commonly referred to as Nodes), including the Dealer and the Motor Vehicles, are actively listening and make a record of the financial transaction
The Dealer transfers the Title of ownership of the car to the Person. This ownership transaction is broadcast as a digitally immutable transaction (with the digital signature of the Dealer) on the peer-to-peer network here multiple Participants, including the Dealer and the Motor Vehicles, are actively listening and make a record of ownership transaction
Since everyone in the peer-to-peer network have a copy of all the transactions, when the time comes to prove the ownership, everyone can independently verify and establish the ownership of the car to the Person through consensus
The following Figure-2 illustrates the above process:
In the above process, the Participants in the peer-to-peer network verify and establish trust through consensus without the need for a trusted central authority. It should be noted that it would be very difficult for anyone to commit fraud by trying to change any of the transactions in the peer-to-peer network as there are multiple copies of the transactions (one with each of the Participants).
This is in essense the purpose of Blockchain at a very high level, to move away from centralized to decentralized model of trust, there by improving processing times and reducing costs.
Now, we can answer the question 'what is Blockchain ?'.
Blockchain is a decentralized, distributed, and secure ledger containing immutable blocks of transactions.
The following steps explain the technicalities behind Blockchain:
As transactions are propagated through the peer-to-peer network, certain special Participants (Nodes) called Miners collect the arriving transactions into a Block
Once a Block is created, Miners race to solve a difficult mathematical problem. This is referred to as the Proof-of-Work, which is based on a cryptographic Hash, such as finding a Hash that begins with 5 zeros
Proof-of-Work is processing intensive and exists to prevent Participants (Nodes) from abusing the system. The Proof-of-Work algorithm involves taking the Hash of the Hash of the Block of transactions plus the Hash of the previously accepted Block plus a nonce. The nonce is incremented iteratively to arrive at the desired outcome (such as finding a Hash that begins with 5 zeros)
The first Miner to solve the problem wins the competition and that Miners' Block is accepted for inclusion into a chain of previously processed and accepted Blocks. Hence the name Blockchain
The winning Miner gets to collect a Transaction fee as the reward for their processing effort
Note that each Block refers to the previously accepted Block. The first Block (Root Block that has no parent Block) that initializes the system is called the Genesis Block
Any of the Participants trying to alter the contents of a Block (trying to commit fraud) implies they will have to alter all the Blocks in the chain and perform very expensive Proof-of-Work computation on each block. Hence the reason why Blockchains are immutable and secure
The following Figure-3 illustrates the chain of Blocks (Blockchain):
One of the concepts related to the Blockchain is the Smart Contracts.
A Smart Contract is a digital legal contract that consists of some data elements along with some computer code that resides in the Blockchain. When some event satisfying the terms and conditions of the contract occurs, the code self executes and potentially updates the Blockchain by generating additional transaction(s).
The following steps illustrate the process of Smart Contract using the Motor Vehicles example (in a simplistic way):
A Person interested in a car makes a financial commitment. This financial transaction is broadcast as a digitally immutable transaction (with the digital signature of the Person) on the peer-to-peer network
The Dealer transfers the Title of ownership of the car to the Person. This ownership transaction is broadcast as a digitally immutable transaction (with the digital signature of the Dealer) on the peer-to-peer network
The Motor Vehicles creates a car Registration Smart Contract that will get activated only when the Person makes a payment for the Registration. This contract transaction is broadcast as a digitally immutable transaction (with the digital signature of the Motor Vehicles) on the peer-to-peer network
The Person makes a payment to the Motor Vehicles for the car Registration. This financial transaction is broadcast as a digitally immutable transaction (with the digital signature of the Person) on the peer-to-peer network
The event of making a payment to the Motor Vehicles for the car Registration triggers the execution of the Smart Contract (created in step 3) and makes it legal for the Person to use the car. Note that every Participant in the peer-to-peer independently executes the computer code that is associated with the Smart Contract since all of them have a copy of the contract transaction (hence the number 5 in the network)
The following Figure-4 illustrates the above process: