What is Consensus Algorithm In Blockchain & Different Types Of Consensus Models

In the past couple of years, we heard a lot about how blockchains are going to transform the business world and financial transactions. Few of the most crucial aspects of blockchain are speed, applications, and security. In our previous blog posts, we have highlighted blockchain technology’s potential for speed and applications. But to function on a global scale, a public ledger needs efficient security. And the security is because of the consensus algorithm. Those who are familiar with the blockchain technology, understand that we keep the ledger transactions synchronized across the network to ensure that ledgers only approved when the participants confirm transactions. In this blog post, we are going to discuss what is consensus algorithm and various types of consensus mechanisms.

Consensus Algorithm: A Brief Background

A consensus algorithm is like Bitcoin’s PoW (Proof-of-Work), which requires miners to solve complex cryptographic mathematical puzzles for which they get rewarded with certain amount of Bitcoins. It is important to understand that each block which is added to the network must follow a set of consensus rules. E.g. Bitcoin’s consensus rules are no double spending, correct format of blocks, a certain amount of reward for miners etc. Blocks that fail to follow these consensus rules will be rejected. A blend of PoW consensus algorithms and the consensus rules offers a strong and reliable network which is secure and ensures that all the nodes in the network agree on a regular global state of the blockchain.

A consensus protocol has 3 basic features based on which its efficiency can be determined.

Without a central intermediary, the network of participating users that develop this system need to agree on the validity of what’s being added to the ledger (using a set of predefined rules). A consensus needs to be reached for the majority of the nodes in the network. But just how effective it is to implement such a consensus remains a work in progress till today.

The sole goal of the consensus protocol is to allow the node to communicate among themselves and offer a common set of the validated transaction which can be added to the ledger. This is designed to prevent unethical miners from adding false transactions and blocks. The type of mechanism to be used depends on the type of network. Let’s discuss few of the mechanisms.

Proof-of-Work (PoW)

As we have already discussed in our previous blogs, PoW is currently the most common and one of the most robust consensus mechanism for blockchain technology. The miner has to solve mathematically complex puzzles on the new block before approving the block to the ledger. After solving the puzzle, the solution is then forwarded to other miners and verified by them before being accepted to their respective copies of the ledger. The PoW method defines that the nodes must adopt the fork which carries work, and it is very unlikely that the two competing forks will generate the next block together.

Blockchain core network protects against double-spending by the verification of each transaction with the use of Proof-of-Work (PoW) mechanism. Transactions are finalized and approved by the minors after verification. If anyone tries to duplicate a transaction, it will show in the network that it is counterfeit and would not be accepted. You can’t double spend, once a transaction is approved.

Proof-of-Stake (PoS)

PoS is a substitute approach for PoW which requires fewer CPU computations for mining. Though this is also an algorithm, and the purpose is same as PoW, the process is quite different here. As in case of PoW, a miner is rewarded by resolving mathematical problems and creating new blocks, in Proof-of- Stake, the creator of a new block is chosen in a deterministic way, depending on its wealth, also defined as stake. This means that in the PoS mechanism, there is no block reward. So, the miners take the transaction fees. PoS mechanism has its own pros and cons, and the actual implementations are quite complex.

Delegated Proof-of-Stake (DPoS)

DPoS is very different from PoS. Here, token holders don’t work on the validity of the blocks by themselves, but they select delegates to do the validation for them. In a DPoS system, there are usually in between 21–100 selected delegates. The selected delegates are being changed periodically and assigned an order to deliver their blocks. If you have less number of delegates, it allows them to organize themselves efficiently and create designed time slots to publish blocks. If the delegates miss their blocks on a regular basis or publish invalid transactions, the token holders vote them out and replace them with some other selected delegate. Unlike PoW and PoS, in DPoS miners can collaborate to develop blocks. With a collaborative effort and a partially centralized process, DPoS has been able to run orders of magnitude which are faster than any other consensus algorithms.

Byzantine Fault Tolerance (BFT)

BFT name came from a solution to “Byzantine generals’ problem,” a logical dilemma that researchers Leslie Lamport, Robert Shostak and Marshall Pease explained in an academic paper. BFT is being used to fix the issue of a rogue or unreliable node. If any member of the community sends inconsistent information to others about transactions, the reliability of the blockchain breaks down, and there is no central authority that can step in to correct it. To solve this, PoW already offers BFT through its processing power. On the other hand, PoS needs a more definite solution. Nodes will regularly vote in order to identify the true transaction. Using a version of PoS which works with BFT looks like the most promising approach to approving transactions in the blockchain.

Practical Byzantine Fault Tolerance (PBFT)

Hyperledger supports two consensus algorithms– Practical Byzantine Fault Tolerance algorithm (PBFT) and SIEVE, which is ready to handle non-deterministic chain code execution. PBFT was the first solution to achieve consensus in case of Byzantine failure. Stellar, and Ripple also use PBFT mechanism. In PBFT mechanism, each ‘general’ manages an internal state which is an ongoing information status. After receiving a message, a general use the message in connection with their internal state to start a computation process. This computation process asks the individual general about the opinion on the message. After reaching a conclusion, the general shares the decision with other generals in the system. A consensus decision is made based on the total number of decisions submitted by all the generals. This approach forces a low overhead on the performance of the replicated service.

SIEVE

SIEVE consensus mechanism is being used by Hyperledger Fabric which allows the network to detect and remove possible non-deterministic requests, and also achieve consensus on the output of the suggested transactions.

Proof-of-Weight (PoW)

PoW is a wide classification of consensus algorithms based around the Algorand consensus model. When PoS, the percentage of tokens owned in the network presents a probability of “discovering” the next block, other relatively weighted value is being used. Filecoin’s Proof-of-Spacetime is weighted on how much IPFS data is being stored. There are few other systems include weights for things like Proof-of-Reputation.

Unique Node Lists (UNL)

Ripple use “collectively trusted sub-networks” consensus algorithms called “Unique Node Lists”(UNL) to deal with high latency, which usually characterizes BFT-tolerant systems. To reach consensus, a node requires to ask its own UNL in place of the entire network. This mechanism allows less than one-fifth of its nodes being faulty.

Proof-of-Burn (PoB)

In Proof-of-Burn, rather than spending money on expensive computer equipment, you ‘burn’ coins by sending them to an address where they are unrecoverable. You can earn a lifetime privilege to mine on a system based on a random selection process. Miners can burn the native currency or any currency of an alternative chain. The more number of coins you burn, the chances are high that you will be selected to mine the next block. If your stake in the system fails, so eventually, you will want to burn more coins to increase your odds of being selected for the next block. PoB is a good alternative for PoW, although the protocol wastes resources. Slimcoin is the only coin who uses Proof-of-Burn. Slimcoin uses a combination of PoW, PoS, and PoB.

Proof-of-Activity (PoA)

PoA was invented as an alternative incentive structure for Bitcoin miners. This combines both PoW & PoS. In PoA, miners start with a PoW approach to solve the puzzle. If the blocks mined don’t contain any transactions, the system switches to PoS. Based on the header information, a group of validators is assigned to sign the new block. If a validator owns more coin, he has the highest chance to be chosen. As soon as all the selected validators sign the template becomes a block. If the validators failed to complete the block, a new group of validators are being chosen, and this process goes on until a block receives the correct amount of signatures. Rewards are been divided between the miner and the validators. PoA requires too much energy like PoW, PoS. Decred is the only coin using Proof-of-Activity for validation right now.

Proof-of-Capacity (PoC)

This consensus algorithm mechanism is different from others. Here you pay for your hard disk space. The more hard disk space you have, the chances are high that you will mine the next block & earn rewards. Before mining in a PoC, the algorithm generates a large number of data sets known as ‘plots’, which you store on your hard drive. The more number of plots you have, you have better chances of finding the next block. To use this mechanism, you have to spend a lot on hard drive space. Burstcoin is the only cryptocurrency to use a form of proof of capacity.

Conclusion

Consensus algorithms used by various blockchain platforms are mainly driven by the type of applications the platform expects to offer and intimidations it conceives to the integrity of the chain. The permission less platforms are reaching consensus among a very high number of untrusted peers using computational complexities. While approved blockchains are opting for a less scalable but higher throughput model that assures faster transactions. At the time of choosing the right consensus model for a particular network, various things are being considered like intended network, the relationships between participants, and both functional and non-functional aspects. We hope this blog post sheds light on the current landscape of the consensus algorithm & various models. Contact us today.