Demystifying Consensus Mechanisms: A Comprehensive Guide
What you should know about the consensus mechanism and algorithm
12 min read
Table of contents
- What is a consensus mechanism/algorithm?
- Role of Consensus Mechanism in Blockchain Networks
- Types of Consensus Mechanisms
- Proof of Work (PoW)
- Proof of Stake (PoS)
- Proof of Authority (PoA)
- Proof of History (PoH)
- Delegated Proof-of-Stake (DPoS)
- Proof of Capacity
- Proof of Elapsed Time (PoET)
- Proof of Identity
- Proof of Activity
- Practical Byzantine Fault Tolerance (pBFT)
- Byzantine Fault Tolerance (BFT)
- Proof of Importance (PoI)
- Proof of Burn (PoB)
- Further Reading
The consensus mechanism is a crucial concept in the world of blockchain technology, and it can vary widely depending on the specific use case or application. In centralized systems, a single administrator wields control and authority over data, allowing them to add, delete, or modify information as they see fit. This closely mirrors the control that big tech companies exert in the Web2 world. However, decentralized networks distribute decision-making among participants in a more democratic manner, which creates a more transparent and secure system.
In this article, we will delve into how decision-making is distributed among participants in a decentralized blockchain network. We will explore the different consensus mechanisms employed in various blockchain applications, providing insights into their unique advantages and challenges.
What is a consensus mechanism/algorithm?
The consensus algorithm is a critical component that enables coordination among users or machines in a distributed environment. It establishes a set of rules that all participants in the network must accept, providing authorization for the system to function. The choice of consensus mechanism depends on the specific features of the project designed by the team.
In a blockchain network, consensus algorithms play a crucial role in achieving agreements among distributed nodes since public (decentralized) blockchains do not rely on a central authority. This ensures that protocol rules are followed, transactions are verified in a trustworthy manner, and coins are spent only once. Consensus establishes a standard system that all participants must agree on to determine the state of the blockchain network in terms of security and transaction verification. It is a fault-tolerant mechanism used in distributed networks to reach an agreement on a value or process state among network members, based on predefined rules and procedures collectively known as the consensus protocol.
Let us now explore the role of the consensus mechanism in blockchain networks
Role of Consensus Mechanism in Blockchain Networks
In a distributed network, transactions are processed in a decentralized manner across multiple nodes located at different locations, without relying on a central authority. However, these nodes can experience failures or intentional misbehavior, such as planned attacks. To ensure the stability and usability of the network, a consensus mechanism is necessary to monitor the situation and facilitate agreement among the network participants.
The consensus mechanism is designed to ensure that all participating nodes agree on the state of the network, ensuring data consistency and security decision-making processes. Transactions are secured using cryptography and replicated across all nodes in the network. Transaction data is stored chronologically as blocks, without relying on a central authority.
The agreement among participating nodes is crucial, as without consensus, the blockchain network can be vulnerable to security attacks and hacks, resulting in loss of funds or denial of service for nodes. Therefore, the consensus mechanism plays a critical role in maintaining the integrity and security of the distributed network, enabling secure transactions, and ensuring the proper functioning of the network.
Common security threats associated with a blockchain network include:
51% attack: As the price of ETH increases, the difficulty for bad actors to carry out a 51% attack on the blockchain also increases. This is because higher prices result in higher costs for acquiring a majority of the network's hash rate, which is required for a successful 51% attack. Additionally, the more control an individual or entity has over the total supply of tokens, the more influence they could potentially exert over the network. Therefore, by increasing the price of ETH, it becomes more resource-intensive for anyone attempting to gain control of the network through token accumulation.
Distributed Denial of Service (DDoS).
Border Gateway Protocol Hacking (BGPH).
P + Epsilon attack.
The balanced attack.
Types of Consensus Mechanisms
Proof of Work (PoW)
The proof-of-work (PoW) consensus mechanism, used in cryptocurrencies such as Bitcoin and EthereumPoW (Ethereum 1), requires miners to solve cryptographic puzzles using high processing power to add new blocks to the blockchain. This is the first consensus algorithm and involves a mining process that confirms and adds valid transactions to the public ledger.
Transactions on the Bitcoin network require PoW consensus, which involves significant computing power and electricity. Miners validate a new block of transactions and add it to the blockchain only if distributed nodes in the network reach consensus and agree that the block hash provided by the miner is valid PoW. Miners with a higher hash rate have better chances of finding a valid solution for the next block, and every node in the distributed network verifies the newly mined block before it is added to the blockchain. The miner of a new transaction is randomly chosen once the mathematical problem is solved and is rewarded with Bitcoin.
In a scenario where two miners resolve the computational problem and add new blocks to the network, the new block with a longer chain or that consumed more computing power will be chosen. This PoW consensus mechanism is less vulnerable to attacks or hacks because it requires high energy consumption, typically around 51% of the computing power, to gain control of the network. The most well-known PoW function is called SHA256, which is used in Bitcoin.
In contrast to other consensus mechanisms, PoW requires a significant amount of energy and computing power to reach consensus, making it an expensive option. Miners compete to be the first to solve mathematical puzzles using hash functions to execute transactions, and once a new block is validated, it is linked to the previous block as a chain of verified transactions in the blockchain.
Proof of Stake (PoS)
The Proof of Stake (PoS) consensus algorithm was introduced as a solution to overcome the limitations and challenges of the proof of work (PoW) mechanism. PoS is based on the amount of coin held and staked (referred to as Forging Power), and involves the validation of new blocks based on the stake of the user or participant, without requiring computational power. Validators, also known as forgers or minters, are pseudonymously and randomly chosen based on their stake, coin age (duration of coins being locked or staked), and node wealth. The stake serves as a financial motivator for users to validate transactions and create new blocks, as they earn a proportion of the transaction fees as rewards based on their stake.
Projects such as Ethereum, Dash, and Neo have implemented the PoS mechanism, with Ethereum transitioning from PoW to PoS in 2022 to increase scalability. In PoS, the voting power of a miner is based on the percentage of tokens held, rather than computing power. The larger the share of tokens owned, the higher the likelihood of being selected to mine the next block. Validators are rewarded with transaction fees or a specific amount of coins due to inflation for their work, providing incentives to maintain the blockchain network.
One advantage of PoS is its energy efficiency compared to PoW and other consensus mechanisms. PoS also employs randomized block selection, using factors such as the lowest hash value and size of the stake to predict the next generator, which prevents centralization. However, PoS also has some disadvantages, such as the "Nothing-to-stake" problem, where validators need a stake to add new blocks and can create blocks on multiple branches to collect rewards even when only one branch is selected.
Variants of Proof of Stake (POS) include;
Proof of Authority (PoA)
This consensus mechanism offers users a chance to choose system moderators to validate transactions based on their reputation. The selected validators are usually institutional investors. Here, the validators of new blocks are a group of pre-selected authorities.
The Proof of Authority mechanism is a modified version of Proof of Stake, where the identities of validators in the network are at stake. The nodes that become validators are the only ones allowed to produce new blocks and are incentivized. These validators stake their reputations on the network. It is used in the Ethereum Classic (ETC) network.
Proof of History (PoH)
This consensus mechanism establishes the order and timing of blockchain records and transactions. The goal of incorporating time encoding into the blockchain is to reduce the processing burden on network nodes. In traditional blockchains, achieving consensus on the timing of block mining is as essential as reaching consensus on the validity of transactions. Timestamping is crucial as it establishes the sequence of transactions, allowing the network and observers to track their occurrence. This approach is employed in Solana and Avalanche, where validators maintain an internal clock based on a historical protocol that certifies the timing of events.
Delegated Proof-of-Stake (DPoS)
Delegated Proof of Stake (DPoS) is a democratic consensus mechanism that promotes participation from all token holders, unlike Proof of Stake (PoS) where only the highest stakes have a say in the mining process. DPoS is decentralized, scalable, and often referred to as digital democracy as it involves users staking their tokens to select a group of delegates. The weight of a user's vote is based on their stake, and the delegate with the highest votes produces new blocks and is rewarded with transaction fees or coins. DPoS is utilized in projects like EOS cryptocurrency and Lisk.
DPoS provides dependable verification and approval of transactions in a blockchain. These elected representatives, also known as block producers, are chosen by participants in the blockchain network based on the percentage of digital tokens they hold. Block producers have two roles - mining blocks and validating transactions while ensuring the network's smooth functioning. They receive cryptocurrencies as rewards. This consensus protocol promotes cooperation among block producers instead of competition, as seen in mining-based methods like Bitcoin. DPoS also consumes less energy and offers faster network speeds. However, it is a more centralized system compared to other consensus mechanisms.
Proof of Capacity
The Proof of Capacity(also known as Proof of Space) mechanism is similar to PoW, but instead of using computer power, miners use their hard disk space to mine blocks. The more storage space a node provides on its hard disk, the higher its chances of validating the next block and receiving rewards. PoC works by proving that a certain amount of hard disk space is reserved for mining, where a prover (a node) sends data to a verifier (usually a project team member) to verify the reserved space. Once verified, the node is entitled to mine blocks and receive rewards via the PoS process. This mechanism is known for its lower energy consumption compared to PoW, making it a greener alternative. In the PoC, solutions to complex mathematical puzzles are based on allocating a significant volume of hard drive space for mining, a process known as plotting.
Proof of Elapsed Time (PoET)
Proof of Elapsed Time (PoET) is an energy-efficient consensus protocol and an alternative to the PoW protocol. PoET employs a fair lottery system to decide the producer of a new block based on a random and fair wait time for each user. In the PoET, each participating node in the network is required to wait for a randomly chosen period, and the node that completes the designated wait time first wins the new block. This process of generating a random wait time, sleeping for that duration, and committing a new block is repeated for subsequent blocks. This consensus mechanism relies on the system's ability to verify that no user can run multiple nodes and that the wait time is truly random.
Proof of Identity
Proof of Identity is a mechanism that verifies a user's private key by comparing it with an authorized identity. It serves as cryptographic evidence for a user's private key, which is cryptographically attached to a specific transaction. Once a user is identified within the blockchain network, they can create a block of data that can be presented to anyone on the network. This ensures the integrity and authenticity of the data created, adding a layer of security to the blockchain system. One example of a blockchain network that utilizes Proof of Identity as a consensus mechanism is Sovrin.
Proof of Activity
The Proof of Activity consensus mechanism combines the principles of Proof of Work and Proof of Stake, requiring participants to either mine or stake tokens for a chance to process new transactions. In this consensus mechanism, miners attempt to find the solution to a puzzle for reward. The blocks created in this mechanism contain the mining reward address and header information, used to randomly select a group of validators for signing the block. Validators with larger stakes have higher chances of being selected to sign a new block. The block miner and the validators are rewarded with the generated network fees.
Practical Byzantine Fault Tolerance (pBFT)
Practical Byzantine Fault Tolerance proposed in 1999 by Castro and Liskov optimizes the concept of Byzantine Fault Tolerance (BFT) in solving the Byzantine general's problem. PBFT is an algorithm designed to achieve consensus in the presence of faulty nodes in a network. It operates asynchronously and is optimized for low overhead time, eliminating the need for complex computations or multiple confirmations. In PBFT, all nodes are sequentially ordered with one node serving as the primary node and the others as backups.
Variants of Practical Byzantine Fault Tolerance (PBFT) include;
Redundant Byzantine Fault Tolerance (RBFT)
Istanbul Byzantine Fault Tolerance (IBFT)
Speculative Byzantine Fault Tolerance (SBFT)
Byzantine Fault Tolerance (BFT)
Byzantine Fault Tolerance (BFT) enables correct consensus despite the presence of malicious nodes in the network that fail or provide incorrect information. It refers to the ability of a distributed system to reach a consensus, even in the face of failures or malicious behavior by nodes. BFT helps systems resist failures derived from the Byzantine Generals' Problem, a logical dilemma that illustrates communication challenges among Byzantine generals trying to agree on their next move. Thus, BFT systems can continue to operate even if some nodes fail or act maliciously.
The objective of Byzantine fault tolerance is to defend against Byzantine failures, where system components fail with symptoms that prevent agreement among themselves, necessary for correct operation. Correctly functioning components in a Byzantine fault-tolerant system can provide the system's service, assuming the number of faulty components is within acceptable limits.
Proof of Importance (PoI)
The Proof of Importance consensus algorithm is based on a user account score - the transaction history and quantity of coins. This determines the chance of being chosen to harvest a block and collects the transaction fees as a reward.
Proof of Burn (PoB)
In this consensus mechanism, miners burn coins by sending them to an unspendable address, ensuring that they cannot be spent again. This approach is energy efficient and requires miners to burn coins in order to gain the right to mine new blocks in a blockchain network.
Consensus mechanisms are fundamental to the operation of distributed systems, as they ensure that nodes participating in transaction validation follow predefined rules and procedures known as consensus protocols. Among the various consensus algorithms, Proof of Work (PoW) and Proof of Stake (PoS) is widely discussed, but there are also other protocols such as Proof of Burn (PoB), Proof of Activity, Proof of Capacity, and more that utilize different methods to confirm transactions. As blockchain technology continues to advance, we can expect to see further innovations in consensus protocols, shaping the future of distributed systems.
If you enjoyed this article, why not stay connected by following my blog? You'll get access to even more valuable content!
For more information about blockchain consensus, see the following resources: