In a decentralized system, where trustlessness is an important feature, reliability and fault tolerance is important. In such a system reaching an agreement is important. Agreement is consensus.
It is thus very important to understand the properties of a distributed network before jumping into consensus in the blockchain.
Agreement and Validity – Deciding on a particular value by all nodes of the network
Integrity and Termination – Every node gets to decide one single value and the agreed upon value or final value has been proposed by the most number of people
Consensus in Public Blockchain
In a public blockchain, the network is open to everyone. Anyone can join as a participant and be a part of the consensus process. Ensuring consensus in such a system is a challenge.
For example, say Rajesh joins such a network and performs a transaction. This transaction needs to be validated by the nodes of the blockchain network. Since it is a system where all the nodes do not know each other, there can be a case where one or more nodes try to be malicious.
Secondly, there can be many blocks at a given point of time. The question is which block do you add to the chain? The work of the miner Another challenge rises – the miners do not know each other. The solution is that every miner/node gets a problem or puzzle to solve. The miner who proves to have solved it first is provided the opportunity to add his choice of the block.
This essentially brings us to the consensus protocols that you will study in the next lesson.
Blockchain Consensus Protocols
Consensus protocols are very important to how blockchain transactions happen. Consensus is agreement.
In a blockchain ecosystem, a block gets added to the system or better to say a transaction is approved and updated to the ledger when majority or all the members of the network agree on the value of a transaction.
So basically consensus protocols are a set of rules by which members of the network decide whether a transaction is valid or invalid.
Consensus help the nodes to agree on a certain state of the blockchain.
In this session I will discuss the two most important consensus protocols of a blockchain ecosystem.
Here’s a quick recap of blockchain – Today your VISA, MasterCard and bank transactions are all connected to a centralized system. You must trust this centralized system because they have history of all your previous transactions.
Whenever you do a transaction it goes through the server of this centralized system which first validates your transaction before it returns a success message.
Now with blockchain everything is decentralized and you dont have to trust anyone. Everyone has a copy of all the transactions called the decentralized ledger. Whenever a transaction goes through a decentralized ledger it must be verified by the network which is called distributed consensus.
Remember, yours is not the only transaction happening at the time. All transactions happening leave through something which we call as a block.
In the next lessons, we will take a look at and understand various consensus protocols used in the blockchain.