How can a network of nodes communicate efficiently if they are distributed? The decentralization of the blockchain urges the nodes operating the network to agree on the ledger’s state independently. Since there is no central governance operating the blockchain, the network’s participants might face communication problems that will lead to double spending. Hence, the blockchain is said to have reached a consensus if all nodes can agree on a single truth. So, what is a consensus mechanism?Â
The Byzantine FaultÂ
Any distributed system needs to be fault-tolerant in order to be efficient. What does that mean? Well, a game theory problem known as the Byzantine generals problem suggests that distributed systems have difficulty agreeing on a certain reality. The theory makes an analogy of miscommunication happening between generals that are besieging Byzantium. If all generals attack at the same time, they win, if not, they lose.Â
The same thing happens in distributed systems such as the blockchain. Nodes have to process and validate transactions correctly in order to avoid double-spending. Let’s better understand this idea.Â
Crypto mining or validation process takes place when a user conducts a transaction. Each node operating the blockchain receives the transaction and validates it. Then, each node adds the transaction to its own block. So, who gets to add the block to the blockchain?Â
If two nodes add their blocks with the same transaction, this means that the transaction is spent twice. So, there must be a system that prioritizes who gets to add his block. This is known as a consensus mechanism.Â
So, What Is a Consensus Mechanism?Â
A consensus mechanism is a system that dictates who gets to publish the subsequent block to the blockchain. Since there are thousands of nodes competing for a chance to add their blocks, a consensus mechanism will coordinate between them to avoid mishaps. Also, the node’s motivation to add blocks is usually monetary gains. That’s because the node that successfully mines a block gets block rewards.Â
That means, that most nodes’ motivation is not always the welfare of other nodes or the network. Therefore, consensus mechanisms allow people to cooperate despite their mutual mistrust. However, consensus mechanisms are not an easy thing to implement.Â
Consensus algorithms need to be immune to node failure, message delays, malicious nodes, corrupted message attacks, and much more mishaps. This has caused the emergence of several consensus mechanisms that address these issues. Some mechanisms prioritize efficiency and speed while others prioritize security.Â
These consensus mechanisms protect the network from attacks where one node can gain more than half of the hashing power. These are called Sybil attacks, and consensus mechanisms use chain selection rules to mitigate these attacks. For instance, in some blockchains, the network refers to the longest chain rule where the longest chain is the one that is considered valid.Â
Here are some of the characteristics of consensus mechanisms:Â
- Security: An Efficient consensus would be one where all nodes produce the same valid output.Â
- Fault Tolerance: A consensus mechanism should mitigate the Byzantine fault by ensuring that all nodes continue to work together if one of them goes down.Â
- Liveness: Consensus mechanisms need to guarantee that they can exchange messages between nodes, allowing the network to reach a consensus. Â
Types of Consensus Mechanisms
There are many types of consensus mechanisms with each their own principles. Although proof-of-work and proof-of-stake dominate the blockchain space, there are other mechanisms that are worthy to note.Â
Proof-of-Work (PoW)
Proof-of-work is considered to be the father of all consensus mechanisms. Satoshi Nakamoto (the creator of Bitcoin) was the first to implement the algorithm for cryptocurrencies. Proof-of-Work blockchains operate through mining.Â
Nodes are incentivized to mine a block in return for block rewards and transaction fees. The higher the transaction fees, the more likely a node will verify it. PoW requires nodes to compete with each other to solve a complex computational problem. So, they are proving the amount of work they’ve put in. The winner will get to add thor block to the blockchain, and thus, a consensus would be reached that creates valid sequential blocks.Â
The computational puzzle is basically miners looking for the right nonce to reach the target hash set by the protocol. Each block has a hash function, in order to become a valid block, a numeric value known as nonce has to be altered again and again to get the desired hash. This requires huge amounts of computational resources, and miners sometimes have to join a mining pool in order to use the resources efficiently.Â
Advantages:
- Decentralization: The even distribution of the PoW consensus guarantees the decentralization of the network, eliminating the possibility of one entity’s selfish control.Â
- Security: PoW is extremely secure since it requires massive computational power. That means the chance of a single entity acquiring this much power is almost negligible.Â
- Scalability: Although not ideally scalable, PoW blockchains are scalable just enough to have them operating.
Disadvantages:
- Energy-intensive: Since PoW consensus requires huge amounts of computational power, that means that the mechanism is energy-hungry and inefficient. This can have major negative consequences on the environment.Â
- Hardware Dependency: Mining requires specialized hardware that can be very expensive. Since each year the mining difficulty increases, mining is no longer efficient on high GPU and CPU systems. It now requires specialized Application-Specific Integrated Circuits (ASICs).Â
- Slow Block Time: The process of validating a block can take a long time, which creates delays and ultimately a bad user experience.
Notable Blockchains: Bitcoin (BTC), Dogecoin (DOGE), Litecoin (LTC).
Proof-of-Stake (PoS)
The second most famous consensus mechanism is Proof-of-Stake which came as a solution to PoW’s energy inefficiency. Although both mechanisms have the same goal, they approach validation in different ways. Miners in PoS blockchains are now Stakers or Validators. This is because mining is not a part of the PoS process.Â
Staking means locking up assets to get rewards. Validators are required to lock up their assets for a chance to add their blocks to the blockchain. Validators are then selected randomly by a staking function to confirm blocks. This eliminates the need for expensive sophisticated hardware that consumes a lot of energy. The new blocks in PoS blockchains are referred to as minted rather than mined.Â
If a validator wanted to abuse the network maliciously, they would be punished by losing their staked crypto. In an update known as the Merge, Ethereum shifted its consensus mechanism from PoW to PoS and reduced over 90% of its energy consumption.Â
It is important to note that not just anyone can become a validator. Each blockchain will have a minimum amount of staked crypto needed in order to participate in the validation process. For example, Ethereum’s required staked crypto is 32 ETH. The more a validator stake crypto, the higher its chance to be chosen by the algorithm.Â
Advantages:
- Energy-Efficient: PoS uses 99% less energy than PoW consensus mechanisms, which means it is more eco-friendly.Â
- Independent to Hardware: It is easier to become a validator in PoS blockchains than PoW since there is no required hardware.Â
- Fast Block Time: PoS consensus can create blocks within seconds, which is much faster than PoW consensus.Â
Disadvantages:
- Can be Centralized: It is hard to acquire more than half of the computational power in PoW blockchains, however, it is not that hard in PoS blockchains. That’s because a small entity can acquire a large amount of locked assets, and therefore influence the network. Which can lead to the ledger’s centralization.Â
Notable Blockchains:Â Ethereum (ETH), Binance (BNB), Cardano (ADA).Â
Delegated Proof-of-Stake (DPoS)
The delegated Proof-of-Stake is a consensus mechanism that improves upon the regular PoS consensus. Instead of having all stakers participate in the validation process, only a number of delegates get to do the job. Each validator would vote for a delegate by staking their tokens and associating them with a desired delegate.Â
The elected delegates will receive the transaction fees for validating a block, which they will share with the voters. The delegates are also referred to as witnesses.Â
Advantages:Â
- Scalability: DPoS consensus is more scalable than regular PoS. That’s because not all stakers have to validate transactions, only a small number of delegates get to participate in the validation process.Â
- Energy-Efficient: Since it’s a variation of PoS, it does not require energy-intensive computational resources.Â
Disadvantages:
- Can be Centralized: Since only a small number of delegates control the validation process, the mechanism is prone to centralization.Â
- Low-Security: The lack of decentralization makes the network prone to 51% attacks.Â
Notable Blockchains: Solana (SOL), TRON (TRX), EOS (EOS).Â
Proof-of-Weight (PoWeight)
This consensus mechanism was first created for the Algorand blockchain. Basically, the PoWeight consensus gives the validator a certain weight based on how much cryptocurrency they’re holding. It’s important to note that PoWeight doesn’t require the lock-up of assets like it is in PoS. Validators only have to have tokens.Â
The weight of users is determined by how much cryptocurrency they own. The algorithm will then pick random validators depending on their weight. Honest users must have approximately around ⅔ of the network’s money.
Advantages:
- Scalability: Since only the committee members participate in the validation process, the confirming time is faster than other consensus algorithms.Â
- Energy-Efficient: The PoWeight consensus doesn’t require power consumption, only validators to hold cryptocurrencies.Â
Disadvantages:
- No Rewards: Other consensus mechanisms such as PoW, PoS, and others give incentives to validators via block rewards and transaction fees. However, PoWeight validators don’t receive any monetary rewards.Â
- Can be Centralized: Just like DPoS, the committee can become centralized.Â
Proof-of-Authority (PoA)
The Proof-of-Authority consensus mechanism utilizes the identity of validators. Instead of staking their crypto, validators are somewhat staking their reputation. The algorithm then selects a validator randomly based on their trustworthy aspect. This also makes it easier to detect any malicious player by referring to his identity.Â
Advantages:
- Security: This consensus mechanism ensures the network’s security by acknowledging the participants’ identities, which can make it easy to take legal action in case of an attack.Â
- Fast Block Time: PoA has few trustworthy participants which can make the verification process more efficient.Â
- Energy-Efficient: Although this consensus uses energy to operate, it is in no way near the energy consumed in PoW blockchains.Â
Disadvantages:
- Can be Centralized: The consensus power is only concentrated in a few participants, which can put a threat to the network’s decentralization.Â
- No Anonymity: Although it is an obvious one, however, blockchains are data ledgers that protect the anonymity of the users. However, PoA exposes the identity of users.Â
Proof-of-Importance (PoI)
Just like the Proof-of-Weight consensus mechanism, Proof-of-Importance ranks validators based on their importance in the network. The importance however is not only based on how much crypto they hold, nor on how much they’ve staked like in PoS consensus. Instead, PoI takes it to the next level.Â
This consensus was introduced for the NEM blockchain, where eligible validators have to have in their account at least 10,000 XEM. The criteria for deciding the importance of a validator are:
- The amount of crypto in an account.
- The amount of activity the account conducts.
- The volume of each transaction.Â
Advantages:
- Security: It is unlikely for validators to corrupt the blockchain since it is very costly to be eligible in the first place.Â
- Rewards Participation: PoI rewards general participation and keeps everyone involved in the network.Â
Disadvantages:
- Unfair: This consensus mechanism is unfair since it only favors the rich who are eligible to be validators. Which can keep people from participating simply because they don’t have the funds.Â
- Little Incentive: There isn’t much incentive that motivates validators to participate in the network.Â
The Bottom Line
Consensus mechanisms are a vital element of the blockchain ecosystem. Without these algorithms, decentralized networks would ultimately fail from the lack of communication. Consensus algorithms provide a systemized way where all network participants agree on a certain truth.Â
The different types of consensus mechanisms offer blockchain a different approach to navigate scalability, security, and decentralization, in hopes of answering the blockchain trilemma.Â