Consensus in blockchain is a process, or rather a mechanism that dictates how all blockchain participants (nodes or miners) agree on the validity of transactions. When a new transaction is added, it needs to be recorded on a blockchain. However, to be recorded, it has to comply with some rules, and all blockchain participants shall agree that it does so. This is called consensus.
Table of contents
- How Consensus Mechanisms Work
- Main Types of Consensus Algorithms
- Proof of Work (PoW)
- Proof of Stake (PoS)
- Other Types of Consensus Mechanisms
- Why Consensus Mechanisms Matter
- The Future of Consensus Mechanisms
Once the consensus among all nodes is reached, the transaction is recorded on the blockchain and cannot be changed.
Consensus ensures that all copies of the blockchain are consistent and tamper-proof. It also prevents fraudulent transactions, double spending, and attacks on the network. Consensus makes the entire blockchain ecosystem stable and ensures that all nodes work together based on the same rules.
How Consensus Mechanisms Work
Decentralized networks have no single authority that dictates the rules. A blockchain is stored on multiple computers (nodes) located all around the globe. These computers confirm transactions and add them to the blockchain.
But how do nodes know which transactions are fine, and which ones shall be discarded?
Here is when a consensus mechanism helps. It determines specific rules for a transaction. If it complies with all the rules, it is fine, and can be recorded on the blockchain. If it doesn’t comply with the rules, it is not recorded on the blockchain.
A good consensus mechanism ensures security, scalability, and decentralization. Security provides the network with the resistance to attacks. Scalability allows the network to handle an increasing number of transactions without major delays. Decentralization ensures that the network isn’t controlled by a single authority or by a few participants.
Main Types of Consensus Algorithms
There are different types of consensus mechanisms. The most important are:
- Proof-of-Work (PoW)
- Proof-of-Stake (PoS)
Other consensus mechanisms are mostly their variations.
Different consensus mechanisms work in different ways. Depending on how a consensus mechanism works, it impacts the performance of the entire network.
Proof of Work (PoW) – The Work-Based Consensus
Proof of Work (PoW) is one of the first and most used consensus mechanisms. In PoW networks, blockchain participants are called miners. They solve complex cryptographical puzzles to validate transactions. When a miner solves the puzzle, a new block is added to the blockchain, and it is broadcast to the entire blockchain. The blockchain is upgraded, and a new block can be added. The first miner that adds a new block receives a reward in the form of newly minted coins. This reward is called a mining reward.
Proof-of-work is one of the most secure mechanisms, but it has some drawbacks. Miners use a lot of energy to mine. The computational difficulty is constantly increasing, and this causes an increase in energy consumption. In the case of popular blockchains, such as Bitcoin, big mining pools dominate the market, and it leads to mining centralization.
Proof of Stake (PoS) – The Stake-Based Consensus Mechanism
Proof of Stake (PoS) is an alternative to PoW. It works differently. In PoS blockchains, user stake some amount of coins (lock them in a special wallet) and becomes a validator. An algorithm selects a validator randomly from all users who have staked the coins. The more coins you take, the higher your chances are to be selected. Then, the selected validator confirms a new block and receives transaction fees for transactions included in that block.
PoS doesn’t consume energy for computations, this is why it is less energy-demanding and more environmentally-friendly. It also doesn’t require expensive mining hardware.
Proof of Stake offers some advantages. It is much more energy-efficient than proof-of-work, it is more decentralized and more secure. If validators do not act properly, their coins are confiscated.
Considering that normally, one needs to lock a lot of money (for example, to become an Ethereum validator, you need to stake 32 ETH), this penalty is enough to discourage validators from behaving maliciously.
The most popular blockchains that operate on the proof-of-stake mechanism are Solana, Ethereum 2.0, Cardano, and many others.
Other Types of Consensus Mechanisms
PoW and PoS are not the only consensus mechanisms. Now, a lot of them exist, and each offers its benefits and has its drawbacks. Here are the most popular consensus mechanisms:
- Delegated Proof of Stake (DPoS): This is a variation of PoS. But instead of locking a specific number of tokens, users lock as many tokens as they can afford, and delegate their validating rights. When a validator verifies a new block and receives its transaction fees, users who have delegated their coins receive their share based on the amount they’ve delegated. This lowers the entry barrier to becoming a participant in block verification but it can lead to centralization when users start entrusting their coins to one validator only.
- Proof of Authority (PoA): In such blockchains, a small group of trusted validators verify transactions. Normally, this consensus mechanism is applied in private and permissionless blockchains.
- Proof of History (PoH): This is a unique consensus mechanism, it is used by Solana. In this case, the blockchain timestamps transactions before validation. It helps to improve efficiency and boost scalability.
- Byzantine Fault Tolerance (BFT): This is a set of algorithms that ensure the network consensus when nodes start acting in a malicious way or fail.
- Hybrid Consensus Models: Some blockchains combine several consensus mechanisms. It helps them to find a perfect balance between security and efficiency.
Why Consensus Mechanisms Matter
Consensus mechanisms are used to make blockchain secure and decentralized. Validators confirm new transactions based on the rules that a consensus mechanism determines.
The consensus mechanism allows many users to validate transactions and add new blocks. It helps to prevent centralization.
The Blockchain scalability and efficiency depend on which consensus mechanism is used. For example, blockchains that use PoS, give priority to lower fees and faster transaction confirmation speed. Blockchains that use PoW focus on security and decentralization, even though transaction confirmation speed may suffer. This is why before developing a blockchain, we recommend to select a consensus mechanism for it.
The Future of Consensus Mechanisms
Blockchain is not something static, it continues to evolve. Developers create new consensus mechanisms and try to fix the issues with the existing ecosystems. This is why in the future, we may see new solutions that combine all the benefits and solve all the issues of today’s blockchains.