Blockchain Consensus Mechanisms – An Overview

This article originally appeared on the Finxter blog—our companion blog for learning programming languages.

We know what a blockchain is and its wide applications. Blockchain is a distributed computing technology involving multiple nodes distributed across geographies. The problem is to ensure that each node gets the exact copy of the data. Hence, some protocol is needed to achieve this unison or consensus. This post tries to cover the need for consensus in-depth, followed by various consensus mechanisms used in the blockchains today. This post also discusses the several pros and cons associated with consensus techniques.

Consensus – The Need

As we know, Blockchain has hundreds or even thousands of distributed computers across the globe. The challenge is to ensure that every computer gets an exact copy of the data. Hence we need a common consensus or agreement among all the nodes intrinsic to the Blockchain network. A typical centralized database never has a problem with consensus, since it has a leader or central authority in charge of making all the decisions, validating the data, and storing it. The Blockchain, on the other hand, is a multi-peer public ledger. So, how can all parties agree on the present state of the Blockchain and achieve a shared consensus for data storage when they don’t trust each other?

Secondly, another problem faced by all the distributed systems is the Byzantines General Problem that is described next.

Byzantines Generals Problem

This problem was originally discussed by Leslie Lamport in a 1980 paper, some crucial points are highlighted below.

β€œWe imagine that several divisions of the Byzantine army are camped outside an enemy city, each division commanded by its own general. The generals can communicate with one another only by messenger. After observing the enemy, they must decide upon a common plan of action. However, some of the generals may be traitors, trying to prevent the loyal generals from reaching an agreement. The generals must have an algorithm to guarantee that plan -A. All loyal generals decide upon the same plan of action….[and] B. A small number of traitors cannot cause the loyal generals to adopt a bad plan.”

Blockchain consensus algorithms, as they’re known, are attempting to tackle this problem. How do the generals (in this case, computer nodes) reach an agreement (everyone agrees on the same course of action β€” or transaction ledger) while avoiding being led astray by a few traitors (faulty equipment and hackers)?

There are various algorithms available that are trying to solve this problem. Here, we discuss the most crucial algorithms widely used and briefly cover the advantages and disadvantages the algorithms have. Some consensus systems widely used include Proof of Work(PoW), Proof of Stake (PoS), Delegated Proof of Stake (DPoS), Proof of Authority (PoA), and Proof of Burn (PoB).

Proof of Work (PoW)

Core-Idea

It forces the miner to do some work. In simple words, the miner node uses some computational power before it submits the block to the Blockchain. In PoW, the miner solves in a way a mathematics puzzle. This puzzle must be complicated enough to make use of the computational power but not so complex that it will take too long to validate, making the addition of transactions slower.

Upsides

  • It surely works. No other method for achieving and maintaining consensus has a track record as lengthy and flawless as Proof of Work.
  • Prevents network spamming from malicious miners.
  • Fair distribution of power, as power is spread over a wide range of miners and not concentrated into the hands of only a few miners.

Downsides

  • Too many resources are needed to perform the work. All the miners in the network try to solve the puzzle first. It is thousands of computers trying to do the same thing. Although only one computer gets the right to add the block, resulting in a wastage of a lot of electricity.
  • A lot of computing cycles are wasted to solve the puzzle. As only the computer that solved the puzzle first adds the block to the Blockchain, there is no residual value to all the computing power pooled in by multiple miners.

Usage

Some cryptocurrency examples using PoW include Bitcoin, Ethereum (called Ethash), Litecoin, Monero, etc.

Proof of Stake (PoS)

Core- Idea

Instead of a specialized puzzle such as meeting the target hash as in PoW, in PoS the miner will stake an amount of cryptocurrency they want to mine to create a new block. In other words, staking is thought-out as making a refundable deposit. The goal behind this requirement is to prove that the miner has a genuine interest in whatever cryptocurrency is being mined. To be more precise, before you mine a cryptocurrency, you need to prove that you own some of it, and will be staked during mining (i.e. locked during the mining process).

Upsides

  • Compared to PoW, Proof of Stake consumes less or reduced energy.
  • The scalability i.e. transactions per second increases significantly depending on the number of validating nodes utilized.

Downsides

  • Has larger barrier to entry for new miners. As in PoS, you need to have some cryptocurrency to stake through premined coins, the miners who already own these premined coins get a better control of the system. As a result it becomes more like a centralized system.
  • The PoS systems face an issue called Nothing at Stake problem. As the miner’s profit or get incentivized from adding blocks to the chain, they can as well add any number of invalid blocks to the Blockchain creating forks or multiple chains. Thus, if one validator or miner adds an invalid block, other miners may accept it and build on it as the miners earn transaction fees for mining, which creates a loophole where only a few control the system, as opposed to decentralization.

Usage

Future Ethereum version (possibly in 2022, details here) will have PoS, NXT coin, and Blackcoin.

Note: Due to the PoW’s energy consumption problem and the PoS’s Nothing at Stake problem, many systems have hybrid consensus mechanisms where both PoS and PoW are used. A miner may carry out both PoS + PoW or only PoS or just PoW. Examples of such systems include DASH coin and Peer coin.

Delegated Proof of Stake (dPoS)

Core-Idea

A validating node’s stake in the network determines how many votes it can delegate to another trusted node to execute the validation. It can be termed as digital democracy due to its stake-weighted voting system. Participants in DPoS earn one vote for having a token. By placing their tokens on specific candidates, users of a DPoS-based blockchain vote for “witnesses” and “delegates.” This varies from the PoS approach, in which anyone with tokens in their wallet can, in principle, become a validator for a new block.

Upsides

  • Better decentralization compared to PoS, because you tend to choose delegates that give back most rewards. This means any user can benefit from it as it is more democratic and performance based.
  • More scalable as it provides faster transactions compared to PoW and PoS.
  • Reduced energy due to reduced equipment, only a PC is enough, unlike PoW.

Downsides

  • The DPoS blockchain is vulnerable to weighted voting issues. Users with a minor stake in the game can opt out of voting if they believe their vote is inconsequential.
  • As validation is in the hands of a few, they may tend to form cartels making the system more centralized over time.

Usage

Used in EOS, Cardano, Bitshares, etc.

Proof of Authority

Core-Idea

In the blockchain, a select group of N-established members has elevated authority; any participant with such authority can propose the next block, and it is added to the blockchain if a subset of participants signs it. In PoA the nodes are not staking their coins but rather staking their identities (e.g. public key) or in other words, they are staking their reputation instead. Thus in the case of PoA, only certain nodes called authorities can create new blocks.

Upsides

  • As PoA is non-democratic, it is mostly suitable for private or permissioned ledgers such as supply chain applications of a company.
  • It is difficult to obtain the tag of a validator node, making it more secured compared to other techniques.
  • It is highly scalable or number of transactions is much faster due to limited number of validators.

Downsides

  • Due to its nature, PoA foregoes decentralization as it is mostly suitable for only private blockchains or large corporations and not suitable for general cryptocurrency blockchains.
  • The threat of harming one’s reputation does not always deter people from engaging in malevolent behaviour. The size of the gains that can be accumulated as a result of a reputation-destroying incident may be more valuable than the community’s reputation. This issue also exposes the network to third-party interference, leaving an opportunity for covering the costs of the damage caused by the malicious action.

Usage

Used in Ethereum testnets such as Kovan, Rinkeby. Other chains include Vechain, Eurus.

Proof of Elapsed Time (PoET)

Core-Idea

Like PoA, PoET is a consensus mechanism algorithm, that is, frequently used in permission blockchain networks to determine who gets to mine. Permissioned blockchain networks are those, that require potential participants to verify their identity before being allowed to join. PoET aspires to achieve a more democratic consensus by providing each participant a level of participation that is fair to them. Only PoET currently allows for a “one CPU, one vote” solution that is not reliant on computational power or other resources. This is accomplished mostly through the use of a trusted execution environment (TEE), which is a secure enclave within the CPU.
Each node has a distinct timer. Every network participant is given a random length of time to wait, and the first person to finish waiting is given the opportunity to commit the next block to the blockchain.

Upsides

  • Does not consume high power like PoW and very energy efficient.
  • Very reliable and secure due to use of TEE.

Downsides

  • Needs specific hardware from Intel as it was designed with Intel specific TEE.
  • Not suitable for public blockchain.

Usage

Hyperledger Sawtooth

Practical Byzantine Fault Tolerance (PBFT)

Core-Idea

Is based upon the Byzantine general’s problem that was already discussed above. Let’s describe in brief the problem with an example. If we have an enemy fort to be attacked by an army of generals. It becomes crucial for all the generals to work in unison. To achieve this task of capturing the fort, all the generals need to attack at the same time. Let’s say general A sends a message to other generals B, C, and D to attack the fort at 6 pm. All of them agree and acknowledge, however, one of them is a traitor and does not oblige.

Thus, the consensus in such systems is like capturing the enemy fort can be achieved if the minimum possible threshold, that is, at least two-thirds of the nodes are actually loyal and work in unison and meet the desired goal.

Upsides

  • High transaction throughput and very efficient (reduced energy usage)
  • Has transaction finality. In PoW, it is necessary for many nodes to validate the transactions before the block is added, whereas in PBFT, the block is final if the majority of the nodes agree on it.

Downsides

  • Suitable for small networks as it requires cumbersome communication among nodes. Hence better works for permissioned or private ledgers.
  • Susceptible to sybil attacks, where a single party can manipulate or control a majority of identities or nodes in a network.

Usage

Used in Hyperledger, Ripple, and Stellar.

Conclusion

This post covered a lot of mining mechanisms that are widely used in various blockchains. It stated the principle idea, the advantages, disadvantages, and its application usage example. Other mining mechanisms not discussed here but need to be mentioned, some of which include Proof of Burn, Tendermint, Directed Acyclic Graphs, Proof of Activity, other hybrid mixtures, etc. Mining is a very vital part of the blockchain networks and hence it is important to wisely choose the mining mechanism considering the properties such as efficiency, scalability, security, tolerance, resources used, and permissioned /permissionless networks. Happy blockchain mining.!