Role and types of consensus protocols in blockchains: How does the consensus protocol affect the abilities of the blockchains? What are the advantages of different consensus protocols? What is new in Avalanche’s consensus protocols?
A consensus protocol can be defined as a fault-tolerant mechanism used in blockchains to achieve the necessary agreement on a data value or a state of the network. These protocols are commonly used in cryptocurrency transections and digital assets’ trades. A consensus protocol is a must in blockchains. There are several recently proposed consensus protocols with different properties. This article aims to overview differences between commonly used consensus protocols and to compare with the new Avalanche consensus protocol.
Types of consensus protocols and their governance mechanisms
Blockchains recruited more than 20 different types of consensus protocols in the last decade. The first protocols were mainly based on Proof of Work (PoW) i.e. consensus protocol of Bitcoin’s blockchain. The consensus protocols using ‘PoW’ cause competition between validators and lead consuming increased amounts of energy. To eliminate the competitive approach of PoW consensus and to save energy, an alternate consensus protocol using ‘Proof of Stake (PoS)’ was proposed in 2011 (1). PoS protocol was used by the crytpocurrency Peercoin (also known as PPcoin) in 2012 (2).
The miners of networks using PoS were called forgers and the mining process was referred to as forging. In this method validators should deposit predefined amounts of their own cryptocurrency coins in the network as stake. The consensus protocol decides the next forger from the network via two selection methods using coin-age selection (depending on staking duration calculated with the formula; Coin age = Total coins staked × number of days of staking, i.e. 200 coins hold for 20 days means a coin age of 4,000 coin days) (2) and randomized block selection (depending on the calculation of a hit value using the forger’s private key) (3). The hit value is calculated with a formula described before (3). In this method forgers encrypt the hash of the previous block using their private keys. The encrypted value is hashed and its first 8-bytes are converted to a unique number which is the hit value of the forger. According to the protocol if the hit value is less than a predefined threshold the user is selected as the forger. In this system staking more coins increase the chance of selection as forger.
Delegated proof of stake (DPoS) was defined by Larimer in 2014 to provide a more democratic validation process and to solve the problem of rich getting richer in the PoS by an election of forgers rather than on a selection mechanism depending on amount of staked coins (4). In this method a group of nodes are selected with votes of all node owners in the network. Nodes can vote regarding their coin proportion weight. DPoS consensus protocol is used by Bitshares (5), Nano (6) and Cardano (7) platforms.
There are lots of other consensus mechanisms proposed and used including; Proof of Burn, Proof of Space, Proof of History, Proof of Importance, Proof of Authority, and Proof of Elapsed Time etc.
Disadvantages of classical consensus protocols
The classical protocols i.e. Practical Byzantine Fault Tolerance (PBFT), Libra’s HotStuff or Tendermint/Cosmos, are based on all-to-all voting mechanism. A leader initiates the decision process and a series of rounds of all-to-all communication is required in these protocols and this is an expensive process. All-to-all communication requires O (N2) messages that limit the number of participants as much as possible. The Nakamoto family of protocols recruit proof-of-work mining that vast enormous amounts of energy. Nowadays it is estimated that it reached at least the yearly energy consumption of the Republic of Ireland. Unfortunately they are still increasing to consume more energy since these systems should be always switched on. The competition between miners, slow finalization of transactions (it takes about an hour for the finalization of Bitcoin transaction) are some of the reasons that can explain why Nakamoto protocols consume more energy.
The Avalanche platform and consensus protocols: a new hope?
General properties and architecture
Avalanche is a network of blockchains in which there are 3 main blockchains inherent to the network. These chains are validated by the default subnetwork. The first chain is the X-Chain (coming from the word ‘exchange’) which works like a decentralized platform allowing to create and trade smart digital assets. These assets are ruled automatically by the smart digital contracts and act according to the algorithms defined in their smart contract. The platform’s native token is ‘AVAX’ and it will be traded over the X-Chain in near future. It is also possible to create and trade novel digital assets on the X-Chain. The second chain is so called ‘P-Chain’ (platform chain) which manages metadata of the Avalanche network. Clients may create subnets, add validators to subnets and create other blockchains via the application programming interface of the P-Chain. Finally the C-Chain (contract chain) allows users to create smart contracts and use the Ethereum Virtual Machine powered by Avalanche to do whatever they want or need via the application programming interface of the C-Chain.
The Avalanche platform proposed a promising, new, secure, performant and energy saver consensus protocol in 2018 (8). The platform recruits consensus protocols that work over repeated sub-sampled voting algorithms. In brief, the Avalanche protocol asks to a small, random subset of validators to validate or to reject a transaction and if the validators think the transaction is invalid, rejected or conflicting they reply that the transaction should be rejected. Otherwise, the subset of validators reply that the transaction should be accepted. The proposals of sufficiently large portion (alpha) of the validators affect the decision of the validator either to accept or reject the transaction. The validator repeats this sampling process until alpha of the validators queried reply the same way (accept/reject) for beta consecutive rounds. For example a transaction without any conflicting proposals from the network is finalized very quickly. In case of conflicts, validators quickly cluster around preferring one of the conflicting transactions. A positive feedback loop occurs and goes on until all validators accept or reject the transaction. This cascading process inspired the developers to name it as Avalanche (9).
Speed, energy consumption
The consensus protocols of the Avalanche network (Avalanche and Snowman) provided very fast transections with precise finalization within 1–2 seconds in Denali test net. The system supported over 4500 transection per second with a relatively small sub-sample of validators. Avalanche protocols are lightweight and sustainable. In contrast with ‘Nakamoto protocols’, Avalanche protocols consume very low energy since when there is no transection to validate, the system can wait in a low energy consumption state and there is no competition between nodes.
Security
The Avalanche consensus protocols are reported to be highly secure. There is no leader in these protocols which make them resistant to several kind of attacks. The large number of validators ensures immutability and censorship resistance. In Avalanche every validator have a first-hand say in consensus and Avalanche is supporting decentralization (9).
Final remarks
Consensus protocols are very important for blockchains’ outcomes and success. They are the decisive units of the platform and they are expected to be fast, secure, smart and accurate. A protocol providing these properties may become the consensus protocol of choice in the ecosystem. Avalanche protocol appears to be one of the good candidates, perhaps the best so far, and we will experience it very soon. Nowadays the latest testnet of Avalanche, Everest testnet, is been accomplished with success and the community is waiting termination of final arrangements before mainnet.
References
1. Proof of stake instead of proof of work. https://bitcointalk.org/index.php?topic=27787.0. (Accessed on 01/10/2019).
2. King, S.; Nadal, S. PPCoin: Peer-to-Peer Crypto-Currency with Proof-of-Stake 2018.
3. Whitepaper:Nxt — Nxt Wiki. http://nxtwiki.org/wiki/Whitepaper:Nxt. (Accessed on 01/10/2019).
4. Larimer, D. Delegated Proof-of-Stake Consensus. https://bitshares.org/technology/delegated-proof-ofstake-consensus, 2014. (Accessed on 01/23/2019).
5. bitshares.foundation/BitSharesBlockchain.pdf at master · bitshares-foundation/bitshares.foundation · GitHub. https://github.com/bitshares-foundation/bitshares.foundation/blob/master/download/ articles/BitSharesBlockchain.pdf. (Accessed on 01/23/2019).
6. Nano — an instant, zero-fee, scalable currency. https://nano.org/en. (Accessed on 01/23/2019).
7. Cardano — Home of the Ada cryptocurrency and technological platform. https://www.cardano.org/en/ home/. (Accessed on 01/23/2019).
8. https://docs.avax.network/v1.0/en/core-concepts/overview/
9. Team Rocket, Maofan Yin, Kevin Sekniqi, Robbert van Renesse, and Emin Gun Sirer. Scalable and Probabilistic Leaderless BFT Consensus through Metastability. https://arxiv.org/pdf/1906.08936.pdf