Consensus, in English, is simply a general agreement. In the context of blockchain, the meaning is not very different.
Consensus in blockchain implies nodes of the network agreeing to the same state of blockchain. In other words, when the same version of the truth is agreed upon by all nodes of blockchain, the consensus is said to be reached.
Consensus in blockchain acts as a self-auditing feature that removes the need of a third party to establish the authenticity of a transaction.
Consensus in blockchain ensures the following:
- Agreement is reached unanimously (no monopoly)
- Block containing the data or transaction is added to the blockchain after consensus is reached (expansion of blockchain)
Consensus is a critical aspect of blockchain and the authenticity of a transaction relies solely on consensus. Consensus protocols must be designed in a way that they are hard to replicate as well as incur considerable costs, in terms of time, resource, tokens (or cryptocurrency), etc.
The following are some consensus protocols.
Proof of Work (PoW)
This consensus mechanism relies upon the proof that a substantial amount of computation power has been spent before proposing to add a new transaction block to the blockchain. In simpler terms, a difficult mathematical problem is required to be solved, which requires high computational power.
The problem is difficult to be solved but easier to be verified. Therefore, the correct answer serves as the proof of work. This process is also called mining and is used in the context of Bitcoin. The node which arrive at the correct answer first is incentivized with Bitcoin.
Proof of Stake (PoS)
In this consensus protocol, nodes, known as Validators (not miners), freeze some of their cryptocurrency tokens as a stake in the blockchain ecosystem. Validator with higher stake stands chance to validate a transaction and gets rewarded for it. The idea behind this approach is that a node which has invested more in the network is least likely to cause any malicious activity and risking its stake.
Ethereum is going to replace PoW by PoS as the consensus mechanism. PoW is by far the most popular choice as consensus protocol but its a resource-intensive mechanism. Therefore, PoS seems to be a worthy candidate to replace PoW in the near future.
Delegated Proof of Stake (DPoS)
This mechanism is an improvement over the PoS consensus protocol. Here, each node which has a stake in the blockchain network has the capability to delegate the validation of transaction to any node by voting.
The voting power of a node is determined based on the size of its stake. In the end, the node which gets the maximum number of votes is selected to validate a transaction.
In an improved version of DPoS protocol, a chosen delegate node must confirm its commitment towards the network by locking some of the funds in a time-locked security account. These funds are confiscated in case any fraud by the delegate node is detected.