Our previous article titled “Blockchain Technology Explained for Dummies“, briefly discussed about consensus algorithms (i.e., consensus protocols) used in a blockchain system. In this article, we will dive deep into understanding different types of consensus protocols used in different blockchain use cases.

The need for consensus algorithms in blockchain

As we already know, a blockchain network uses distributed network architecture. Generally, in a blockchain network, nodes (computing devices) are autonomous i.e., nodes are independent and belong to different owners. In order for all nodes in a network to maintain consistent data (or values), they need to coordinate with each other to attain data consistency.

In case of blockchain, all nodes must coordinate to finalize a single snapshot of the blockchain database as the canonical copy. So, a consensus algorithm enables nodes to coordinate and achieve database consistency across a blockchain network. Thereby, a consensus algorithm provides reliability and security for the system.

To secure a blockchain system, a consensus algorithm should be resilient to the following 3 types of attacks.

  • 51% attack
  • Denial of Service (DoS) attack
  • Byzantine faults
  • Sybil attack

51% attack:

If a set of rogue nodes collude to control 51% of the blockchain’s consensus mechanism, then they can control the network and manipulate the canonical snapshot of the blockchain database. E.g., in Bitcoin, a pool of nodes possessing 51% of total network’s “hash computing capacity” can reverse a transaction or manipulate historical transactions. Similar attack can take place in Ethereum if pool of nodes control 51% of total “deposit” at stake. Alternatively, even a single node can launch 51% attack if its individual “capacity” (i.e., computing power or total wealth) is equal or greater than the combined capacity of other 51% of nodes.

DoS attack:

The primary objective of a DoS attack is to disrupt a blockchain service. Malicious nodes can launch a DoS attack by overloading the network by creating massive number of blocks in a very short period of time, or employ any other mechanisms to overload a blockchain network and disrupt the service.

Byzantine faults:

In a public blockchain system, any node can join the network just by downloading the client software. Therefore, chances of malicious nodes joining the network can be very high. Besides, some honest nodes could unintentionally make arbitrary decisions as result of software or hardware errors. Both the former and latter nodes are known as byzantine nodes that can hamper a networks’ consensus process. Therefore, the presence of byzantine nodes will cause byzantine faults that hamper the consensus process in blockchain systems.

Sybil attack:

A node in a blockchain system must be associated with only one unique identity. In a sybil attack, a node generates many false or spoofed identities to deliberately influence the consensus process in its favour.

Properties of consensus algorithms

Besides being resilient to the attacks discussed above, consensus protocols must also satisfy the following fundamental properties to ensure uniform consensus among nodes across the network.

  • Safety: A consensus protocol must ensure that any two nodes should not have two different states. That is, all nodes should have the same state at the end of a consensus period.
  • Liveness: It implies that all nodes should coordinate together to come to a uniform consensus at the same time period. Otherwise, a network may fall into loop and no consensus could be achieved.

Types of consensus algorithms used in different blockchain use cases

Following are some popular consensus algorithms used in several blockchain uses cases.

1. Proof of Work (PoW) consensus algorithm

In PoW consensus mechanism, all nodes come to a consensus to accept a newly created block only when the “miner” (i.e., the block-creator node) has provided a proof of computation (work) to create the block.

Basically, a PoW mechanism makes all nodes to compete against each other to find a fairly difficult hash of the (new) block. Computing the block hash is difficult because, the hash must meet the difficulty level set by the PoW algorithm. An example for a difficulty level could be finding a target hash that must contain 17 leading zeros. As hash size is normally 256 bits, so there are a total 1.157×10⁷⁷ combinations of hashes possible. Therefore, finding a target hash, that meets the difficulty level, from this large hash pool is computationally intensive task. That is, time taken to create and finalize a block will be longer and can extend up to 10 minutes.

Basically, the PoW introduces fixed-time computational delay between block creations. So if a malicious node manipulates an older block in the chain, then he needs to provide computational proof for all the blocks starting from the older to the latest block in the chain, which is practically infeasible.

Blockchains using the Proof of Work

Bitcoin is the first blockchain implementation to adopt the Proof of Work consensus protocol. For more detailed working of Bitcoin’s PoW mechanism, please refer our previous article. Other blockchain-based systems that adopt PoW are Ethereum (also uses PoS), Litecoin and Bitcoin Cash (hard fork of Bitcoin).

Advantages:

  • Byzantine fault tolerant.
  • Protection against DoS attack.
  • Decentralized approach.

Disadvantages:

  • Huge energy wastage by all nodes during target hash finding.
  • Risk of 51% attack if pool of malicious nodes control 51% of total computing power.
  • Scalability is an issue.
  • Higher block interval time (up to 10 minutes).

2. Proof of Stake (PoS) consensus algorithm

While the Proof of Work consensus mechanism requires computational proof, the Proof of Stake consensus mechanism demands economic stake as the proof. Nodes in a PoS-based blockchain must deposit a minimum amount of cryptocurrency tokens as stake to be accepted as block creators, also called as “forgers”. The node that deposits the highest amount will have a higher chance to create blocks. Example, a node’s whose deposit is 10% of the total deposit from all other nodes, may have chance to create 10% of total blocks in the chain. This deposit is locked for a fixed period of time as surety against nodes’ nefarious activities. That is, if a node attacks the network or creates invalid blocks, its deposit will be confiscated and the vandal node would be blocked from the network.

So basically, the PoS mechanism creates higher economic incentive for nodes to be honest and simultaneously introduce a large economic constraint to deter malicious nodes. That is, in PoS, the cost of cheating will be significantly larger than the benefit obtained from cheating.

Blockchains using the Proof of Stake

Peercoin is the first cryptocurrency-based blockchain to adopt the Proof of Stake consensus mechanism. Next, several blockchain system such as NavCoin, Blackcoin, Hyperledger Burrow, Cosmos Network, and (recently) Ethereum have adopted the Proof of Stake consensus mechanism.

Advantages:

  • Faster transaction processing compared to Proof of Work.
  • Block interval time is as low as 15 seconds.
  • Byzantine fault tolerant.
  • Protection against DoS attack.
  • More resilient against 51% attack.
  • Scalable.
  • Energy efficient compared to PoW.

Disadvantages:

  • May orient towards centralization as wealthier nodes may become more wealthier by staking higher deposits.

3. Delegated Proof of Stake (DPoS) consensus algorithm

In PoS, any node can have a chance to become a block creator depending on the proportion of their deposit staked. While in DPoS, all nodes (called as stakeholders) who stake their deposits, vote to appoint a set of block creators, also called as “witnesses” nodes. The weightage of a stakeholder’s vote is proportional to its deposit size. Among witnesses, nodes are selected in round-robin fashion to produce blocks. The stakeholders can vote-out a witness node and confiscate its deposit if the witness is found malicious.

This method of delegating the block creation to only a set of “witness” nodes speeds up the consensus process and the block creation process. Besides, the stakeholders also elect a set of nodes as delegates. The delegates are responsible for recommending network parameters such as block size, block interval, transaction fee, block reward, etc. But the stakeholders are the final authority to approve the settings recommended by the delegates.

Blockchains using the Delegated Proof of Work

Blockchain platforms such as BitShares, STEEM and Lisk have adopted DPoS as their consensus mechanism.

Advantages:

  • Faster transaction processing than PoS.
  • Block interval as low as 10 seconds.
  • Scalable.
  • More decentralized process by adopting a democratic approach.
  • Energy efficient.

Disadvantages:

  • Vulnerable to centralization due to limited appointment of “witness” nodes who propose blocks.
  • Wealthier nodes may become more wealthier by staking higher deposits.

4. Proof of Elapsed Time (PoET) consensus algorithm

Propesed by Intel, the Proof of Elapsed Time is a consensus mechanism used in permission-based blockchain platforms. Instead of utilizing computational delay as the proof for creating a block in PoW, the PoET consensus algorithm uses waiting for random duration before creating a new block. Once a node finishes waiting, it starts creating a new block. During this period, if it receives a new valid block announced by another node, then it would append the received block to its database chain and discards its own block (under progress) and waits again for a random duration.

To prove that a node had indeed waited and not bluffed, PoET requires nodes to use tamper-proof specialized hardware (e.g., Intel’s SGX-based CPUs) which runs a trusted code inside the protected space of the hardware. The trusted code sets the waiting timer for a random duration and once the wait is over, it sends a signed message attached to the new block to declare the proof of waiting. The tamper-proof hardware also protects against manipulating the timer being set to shorter waiting duration.

Blockchains using the Proof of Elapsed Time

The Hyperedge Sawtooth platform by Linux Foundation is based on PoET consensus mechanism.

Advantages:

  • Faster than PoW.
  • Highly scalable; suitable for large networks.
  • Energy efficient.
  • Very decentralized; as there is no staking of cyrptocurrencies.

Disadvantages:

  • Suitable for permission-based blockchains.
  • Not very efficient for small networks.
  • Nodes cannot be part of the network using personal hardware. Requires to use authorized tamper-proof hardware and trusted code provided by the system.

5. Proof of Capacity (PoC) consensus algorithm

The Proof of Capacity uses random waiting concept similar to PoET and also uses the hashing concept used in PoW. In PoC, each node pre-computes a very large dataset of hash codes and stores them in a plot file. A plot file can consume storage space anywhere from 6 TB to 200 TB, or even more. This consumption of large storage space acts as the proof during block creation.

While PoW introduces computational delay (via finding a difficult hash) between block creation, PoC computes a waiting-deadline using a random hash record from the plot file. Next, the node waits for a specified time period until the deadline expires and then proceeds to create a new block.

The deadline value and the exact hash record used for computing the deadline is verified to check if the deadline value is not manipulated. Next, other nodes can verify whether the block creator has indeed waited until the deadline by checking the difference between the previous block’s timestamp and the timestamp of the newly announced block and comparing it with the deadline value. If the deadline value is lesser or equal than the timestamps difference, then it proves that the node has actually waited. Also, the node’s unique account address is bound to the plot file to prevent node from creating multiple plot files per account.

Blockchains using the Proof of Capacity

The Burst cryptocurrency uses the PoC mechanism as its consensus algorithm.

Advantages:

  • Faster than PoW.
  • Byzantine fault tolerant.
  • Protection against DoS attack.
  • Uses regular hard drive space instead of computing power to create blocks.
  • Energy efficient.

Disadvantages:

  • Huge hard drive space (of several tera-bytes) is dedicated only for a single purpose, i.e., for block creation.
  • Higher block interval time (up to 4 minutes).
  • Scalability is an issue.

6. Proof of Authority (PoAuth) consensus algorithm

Proof of Authority consensus algorithm relies on a set of trusted parties who have the authority to verify transactions and create blocks. In PoAuth, the nodes have to undergo a strict identity verification process before they can become block creators, also called as “validators”. The core idea of PoAuth is basically staking the nodes’ reputation as a collateral towards any misbehaviour, because of the assumption that a lost reputation is harder to regain.

Blockchains using the Proof of Authority

PoAuth consensus algorithm is used on permissioned blockchains such as the Ethereum’s public testnet “Kovan” and “Rinkeby” to immunize the network against spam attacks. Another permission-based blockchain platform that adopt PoA mechanism is the POA Network.

Advantages:

  • Higher transactions per second, therefore faster transaction processing.
  • Block interval time as low as 4 seconds.
  • Scalable.
  • Trustworthy nodes.

Disadvantages:

  • Not a true decentralized system. Takes a centralized approach by appointing a set of identifiable authority nodes.
  • No node anonymity. Identities of nodes are made public. Therefore not suitable for public blockchains consisting of pseudonymous nodes.

7. Proof of Activity (PoAct) consensus algorithm

The PoAct is a hyrbrid of PoW and PoS consensus mechanism. Similar to PoS, nodes must stake their crypto-currencies as deposits in order to participate in block validation process. While in PoS, it is in fact the depositors who can create blocks. But in PoAct, the block creation process works similar to the PoW, where each node is racing to find a difficult target hash, but for an “empty” block that consists only the header information and no data section.

Next, the node that finds the target hash for the empty block announces it to all other nodes. After receiving the empty block, other nodes would first verify whether the hash meets the target difficulty set by the algorithm. Next, if the hash satisfies the difficulty level, then all nodes perform a complex mathematical operation using this hash and generates a list of “N” addresses of the validators. Next, each node would check if its address is present in this address list or not. The ‘N’ number of “lucky” nodes whose addresses are in the list would fill the empty block with transaction data and seal it with their signatures. Finally, the transaction fees received for the new block are shared between the N validators and the node that found the hash for the empty block.

Blockchains using the Proof of Activity

Decred and Expers are two the blockchain implementations that have adopted PoAct as their consensus mechanism.

Advantage:

  • Higher security against 51% attack due to the combined effect of PoW and PoS mechanism.

Disadvantages:

  • Energy wastage while finding the target hash using the PoW mechanism.
  • Scalability.
  • Higher block interval time (up to 5 minutes).
  • Staking of cryptocurrencies can orient the system to towards centralization.
  • Wealthy nodes with large deposits have higher chance to become validators and collect transaction fees and become more wealthier.

Summary

Consensus algorithms are like chief cornerstones of distributed systems like the blockchain. A consensus algorithm is essential in enabling consistency, reliability and security in a blockchain system. In this article, we discussed few common types of consensus algorithms used in different blockchain uses cases. We also discussed the advantages and disadvantages of each consensus protocol. Since no consensus algorithms are fool-proof against all types of attacks, the blockchain industry is working towards building consensus mechanisms that are resilient against majority types of attacks. Example, Ethereum is working on a new consensus protocol called “Casper“.

Next, most of the legacy blockchain systems came with consensus algorithms that were hard-coded into them. This method has caused great complexity while upgrading the old consensus algorithms to new efficient algorithms. Therefore, several new blockchain systems such as Hyperedge Fabric, have developed a plug-and-play like interface to work with multiple consensus algorithms. The plug-and-play interface enables a blockchain system to work with any consensus algorithms as per the blockchain’s use case. On other hand, even consensus algorithms such as Tendermint Core are developed as platforms, that are intended to work with any blockchain systems.