A Brief Guide to Blockchain Consensus Algorithms

Blockchain is a decentralized peer-to-peer system with all of its nodes widely distributed across the internet. The data stored on the ledger from every node is in sync with each other and modifying data without consensus is nearly impossible. The most significant achievement of blockchain technology is that it manages to maintain trust in networks on a global scale without any central authority. At the center of this technology, are consensus algorithms. A consensus algorithm is a protocol to achieve agreements on data values among distributed nodes in the network. Consensus algorithms are designed to achieve reliability in a network involving multiple unreliable nodes. There are many different types of consensus algorithms, and each has its own pros and cons. In this article, we will briefly introduce several popular consensus algorithms and analyze their differences in methodology and economics.

Proof of Work (PoW)

Pros: most decentralized consensus algorithm

Cons: long block time, low scalability, high energy cost

Proof of Work is the first blockchain consensus algorithm. It is used by Bitcoin and has been proven to be the most reliable and decentralized system so far. Proof of Work requires its participants (miners) to compete with each other to solve for hash values. The first one that solves such puzzle wins the block reward and transactions fees, and is entitled to add the next block into the chain.

Among the major issues with PoW, high energy cost and long block time are the most prominent. By design, there is no formula to calculate the correct hash value and the only way to find it is through brute force. As every node tries to solve for the same value at the same time, PoW systems require an enormous amount of computing power, thus, high energy cost as well as long block time. Bitcoin blockchain, for example, cost more than $7,000 worth of electricity to mine one bitcoin at this moment, and it takes 10 minutes on average to add a new block, which significantly limits the scalability of the network. Fortunately, verifying whether a hash value is correct or not is a simple process, and the new block can be added quickly once it is verified. PoW is designed like this to trade speed and cost for decentralization.

In general, PoW network is most decentralized. Because all miners are collectively verifying transactions on the network, there is no central authority. Therefore, an attack on the network would require the offender to acquire more than half of the hashing power that is available in the network. An attack is not only expensive but also extremely unlikely to succeed. As long as more than 50% of the work being done is honest, the network is secure and stable. However, the community is increasingly concerned that the hashing power is becoming concentrated in the hands of a few mining pools and they could potentially achieve over 51% of the total hashing power to attack the blockchain.

Proof of Stake (PoS)

Pros: energy efficient, and fast block time

Cons: potentially not as decentralized as PoW

Due to the computation power required, PoW blockchains are costly and energy inefficient to sustain. Proof of Stake is a relatively new consensus algorithm that doesn’t require miners with expensive computing equipment but instead chooses validators who must stake their cryptocurrency as long as they are participating in the forging of the next block.

At the current stage of blockchain development, PoS is the most commonly accepted alternative to PoW for faster block time and thus large scale business applications. In a PoS blockchain, validators are required to show ownership of a certain amount of cryptocurrency units (“stake”) and are chosen in a pseudo-random way to produce the next new block. Because there is no need for block producers/miners to solve for computational intensive hashing problems, PoS systems usually consume much less energy while being more efficient (higher tps) than PoW systems. Furthermore, since participation doesn’t require an expensive set of equipment nor capitals to pay for costly electricity bills, all coin holders in the system can have the opportunity to take an interest in the block forging process.

Delegate Proof of Stake (DPoS)

Pros: cheap transactions, scalable, energy efficient

Cons: less decentralized.

Delegated Proof of Stake (DPoS) is a variation of PoS and was proposed to improve the efficiency of PoS further. It gives its stakeholders the right to vote for delegates who produce blocks for the network. Delegated Proof of Stake (DPoS) is one of the most popular consensus algorithms for the next generation of blockchains.

Compared to PoS networks which simulate direct democracies, a DPoS system essentially mirrors a representative democracy. Every token holder in a DPoS system is entitled to vote for their preferred delegates. Those delegates, once chosen, act as validators and are responsible for producing blocks on the blockchain. In general, DPoS networks have fewer delegates than the number of validators on PoS networks. As a result, DPoS has an improved processing speed when compared to PoS.

However, there is a trade-off to the improved efficiency of DPoS. To achieve higher transaction per second (TPS), the number of validators in a DPoS system is typically limited. Thus, the duty of securing the network falls on a few dozen of validators, resulting in a more centralized network. It is in everyone’s best interest to vote for delegates that are trustworthy and are well qualified. Because reliable delegates are imperative to the success of the network, dishonest delegates will be voted out by the community, and new trusted delegates is elected to fill the vacant spots. As an incentive to stay as trustworthy delegates, transactions fee and block rewards are paid to delegates.

Proof of Authority (PoA)

Pros: scalable, high TPS, energy efficient

Cons: more centralized

Proof of Authority is a modified PoS with the validators’ identity, or authority, at stake instead of the monetary value of tokens. This modification means that only trusted nodes are allowed to participate as block producers. The ideology behind PoA is that trust requires time to establish and is not something one party can buy in the market, such as tokens (PoS) and computing equipment(PoW). Once the trust is broken, it is hard to get it back. Therefore, validators have the incentive to retain the position they have gained. The high degree of control over the network gave it a high throughput but also made it centralized. Due to its centralized nature, and the lack of anonymity, PoA networks are also called permissioned network and are often optimized for private chains.

Byzantine Fault Tolerance (BFT)

Pros: scalable, fast, low-cost

Cons: more centralized

Blockchains are inherently decentralized networks that require distributed consensus to function but also has different parties that act on their self-interests. Byzantine Fault Tolerance refers to a type of consensus algorithms that allow a network to reach consensus when facing Byzantine Fault (BF).

The algorithm got its name from the famous Byzantine Generals (BG) problem where several generals have to work with each other to attack enemies, but all of them have imperfect information regarding other generals’ status. The Byzantine Fault in the Byzantine Generals problems refers to a potential traitor among the generals. On blockchain networks, a Byzantine fault could be a disconnected server, a delegate that’s lagged behind, or even malicious attacks.

One potential solution to the BG problems is Practical Byzantine Fault Tolerance (PBFT). With PBFT, each node (“general”) keeps a record of its internal state and when it receives a new message the node uses this new message along with its internal state to run a computation (different from hashing). The result of the computation is the decision the node had reached regarding the new message. Then, this node will send its decision to all the other nodes on the network. Once enough responses are reached, the final decision is made, and the transactions are verified as valid. Because a high hash rate is not required, PBFT networks are fast, scalable, and are low cost. However, because there is no anonymity (you wouldn’t trust an unknown “general”), PBFT only works on a permissioned network.

Another variation of BFT is called VBFT which was designed to address concerns with public chain stability and blockchain network governance. It is a consensus algorithm that combines PoS, Verifiable Random Function (VRF), and BFT. With VBFT, nodes are selected by a verifiable random number generated by VRF to take the responsibility of proposing, verifying, and voting for new blocks. In summary, VBFT achieves chain scalability by consensus node selection with VRF, security by randomness and PoS, and fast state finality by utilizing BFT.

Conclusion

There are many other consensus algorithms out there that we have not yet covered in this article. This article provides an overview of the potential aspects of a consensus algorithm you should consider when investigating a blockchain project. If there is one take away we would like you to have; it is that all consensus algorithms need to make trade-offs between speed, scalability, and the degree of decentralization. So these are the three angles you should consider when assessing the design of a consensus algorithm. As blockchain technology evolves, it will be intriguing to see which consensus would win over the majority of our community.

About Infinity Stones

Infinity Stones a Silicon Valley based company, providing cloud management services and security solutions for Blockchains.

Twitter: twitter.com/infstones

Telegram: t.me/infstones