What are Consensus Protocols?
The blockchain is a decentralized, distributed, peer-to-peer ledger system. All nodes or peers on the network have to maintain the same ledger, thus any new transactions that are added to the ledger only can be done so once they are verified and validated via the “consensus mechanism”.
The consensus mechanism is a dynamic way of achieving agreement across all network nodes to ensure the validity and security of the distributed ledger. The larger the size of the network, the more challenging it becomes to achieve consensus and verify which data or transactions being added to the ledger are valid. This problem is called the “Byzantine Generals’ Problem”.
WHAT IS “BYZANTINE GENERALS' PROBLEM”?
The Byzantine Generals’ Problem presents a scenario whereby several generals have a common enemy. They will only overcome the common enemy if they attack simultaneously at the same time. Thus, they need to send messages to one another to ensure that they achieve consensus on the time at which they will simultaneously attack the common enemy.
The problem lies in how the messages are being transmitted, as follows:
- How do we guarantee that the message being transmitted from one general to the other generals is delivered successfully?
- How do the generals that receive the message transmit acknowledgment back to the general that sent the message successfully?
- How can we guarantee that the messages being transmitted to and fro are not tampered or corrupted because the messenger may be captured by the common enemy?
- What if one of the generals within the group is a traitor and may lie about whether they will attack at the agreed time?
Thus, an ideal consensus mechanism must be Byzantine Fault Tolerant that addresses the four issues highlighted above.
CAN WE DESCRIBE THE BYZANTINE GENERALS’ PROBLEM IN TERMS OF BLOCKCHAIN?
In blockchain, a new block of transactions need to be added to the blockchain. This new block of transactions need to be verified, validated, and added across all nodes in the blockchain network to ensure that the same ledger is being stored across all nodes.
Thus, in ensuring the the same data is being transmitted and stored across all nodes, the issues are as follows:
- How do we guarantee that the new block of transactions for the distributed ledger are being transmitted correctly across the network?
- How do we guarantee that all nodes respond that the new block of transactions have been added successful to their ledgers?
- How do we guarantee that the new block of transactions is not corrupted or maliciously changed during the transmission process?
- How do we guarantee that none of our nodes have a malicious intent to corrupt the distributed ledger?
Below we describe the most popular consensus protocols for permissionless blockchains like Bitcoin, Ethereum, EOS, and Tomochain.
POW is the most common consensus mechanism and is used in Bitcoin and Ethereum. When a new block of transactions is being added to the blockchain, to verify these transactions, POW is performed by miners (i.e., powerful computers or processors) that are competing with one another to solve a cryptographic problem (i.e., hash puzzle). The cryptographic problem is based on the new block of transactions and also all other previous transactions block in the blockchain. The cryptographic problem is designed such that it is extremely difficult and time consuming to solve it (i.e., hashing) but once found by one of the miners, the solution is easily verifiable on the network by all other miners. Once the cryptographic solution has been verified as valid, the miner who solved it receives a mining reward for the computational work being done to solve the cryptographic problem.
Criticisms of POW are as follows:
- The process of block production is based upon solving the cryptographic problem (i.e., hashing) that is an energy intensive process and considered an excessive waste of resources.
- People or organizations that have the resources to purchase powerful computers have a higher chance of mining the blocks and receiving the transaction fee.
- Although many cryptocurrencies such as Bitcoin claim to be decentralized, the hashrate distribution (i.e., the diversity of miners that are hashing or solving the cryptographic problem) is concentrated across as few as five mining pools.
POS is a consensus mechanism designed to mitigate some of the criticisms of POW. The concept is based on the idea that miners that hold a large amount of cryptocurrency have a larger stake in ensuring the validity of the blockchain.
In POS, a miner has to submit a portion of coins as their stake. The coins being staked have a “Coin Age”, which is basically a measure of how long a coin holder has held onto coins without spending or moving them. When a new block of transactions is being added, selecting which miner produces the new block is based on the total Coin Age of all the coins that are being staked and the cryptographic problem. There are no block rewards, and each miner receives a transaction fee. POS is faster, more resource-friendly, and energy efficient compared to POW. To improve the security of the consensus mechanism, newer versions of POS include miners also staking a bet of coins on the validity of a block that is being added to the blockchain. If the block is successfully (not successfully) appended, the miners will get a transaction fee proportionate to their bets (some or all of their stake will be penalized/removed).
Criticisms of POS are as follows:
In POW, you are selected to create a new block based on how fast you can complete the hashing process; however, in POS this is also dependent on how many coins you stake in that blockchain system. Thus, POS is skewed towards miners that have large stakes.
In DPOS, stakeholders (i.e., individuals that stake a portion of their coins in the blockchain) can outsource the block production process to a third-party, also known as delegates (also known as witnesses or block producers). Thus, multiple stakeholders can vote for a few delegates that are responsible for achieving consensus and will perform the generation and validation of new blocks to the blockchain. Each delegate submits an individual proposal requesting for votes, and stakeholders have voting power proportional to the number of coins that are staked to elect their delegate of choice. Generally, the mining rewards collected by the delegates are shared proportionally to their respective electors.
Thus, DPOS is a voting system that is dependent on the delegate’s/miner’s reputation. If the elected delegate/miner does not operate efficiently or acts maliciously, they are immediately expelled and replaced by another delegate. DPOS is more efficient and scalable in block production compared to POS or POW.
Criticisms of DPOS are as follows:
- DPOS is perceived as a methodology to streamline and improve the efficiency of block production.
- DPOS is fast, but not as fair as the competition-based system of POW where being a block producer is purely based on the solution to the cryptographic problem.
Proof-of-stake Velocity (POSV)
It can be seen from the graph above that the PoS Coin Age value increases linearly with age; however, the PoSV Weighted Coin Age value is greater in the first few days and weeks rather than in later weeks. Thus, coin stakeholders are incentivized to stake their coins as much as possible as the coin age value is greater the “younger” the coin.
We have described the main consensus protocols used for popular permissionless blockchains such as Bitcoin (POW), Ethereum (POW transitioning to POS), EOS (DPOS), and TomoChain (DPOSV). Each consensus protocols involves trade-offs thus there is no perfect consensus mechanism in solving the Byzantine Generals’ Problem.
An Honorary Senior Fellow at the University of Queensland with professional experience as a quantitative researcher for BlackRock and Bank of America Merrill Lynch in New York, USA. He led research teams in the development of capital models, securitized products and factor models in both equities and fixed income asset classes. Rand has several academic publications in cryptocurrency, portfolio management, systemic risk & quantitative trading