DISCLAIMER : A minimum knowledge of the blockchain, Bitcoin and other major altcoins is recommended for reading this article. Some aspects are not addressed in their entirety.
In a system that has no central authority guaranteeing security and maintaining its overall functionality, consensus among users becomes paramount. For the blockchain, a consensus protocol dictates the rules by which the nodes should play and abide in principle, to keep the system operating and not prone to attacks from malicious parties. For instance, the protocol would provide answers to questions like: How do the miners in the Bitcoin network recognise that a block is valid? How often should a block be generated? What happens if the chain splits? How does a miner get a reward and how much is it? … etc. With that being said, we briefly explore three types of consensus protocols that exist and / or being experimented.
- Proof of Work (PoW)
- Proof of Stake (PoS)
- Proof of Activity (PoA)
The choice of these protocols result from their popularity and consistency with the current state of blockchain development. We list out their main characteristics, pros and cons and describe succinctly how they work.
1. The PoW protocol
This is the most well-known protocol so far thanks to its first and successful implementation to the Bitcoin network. Basically, it is the combination of cryptography and computational power that create consensus and ensure the authenticity of data recorded on the blockchain. To prove that work has been done, a node (miner) must find a hash value that is less than a certain number (the target or difficulty level) – usually a number of leading zeros. To achieve this, random guesses are generated by adding and varying a nonce (an integer value) . Although it resembles a lottery, the computational power that a miner possesses, plays an essential role in the PoW: the bigger the capacity to generate guesses (measured in hash per second), the higher the probability to find a solution. When a chain splits, miners should always choose the longest chain since it has the most work done. Put it simply, here’s how it works:
- A miner finds a solution and creates his / her own block X by including the hash of the previous block, the timestamp, transactions that he / she wants and a transaction of the reward generally to his / her own address
- The miner broadcasts the newly created block X to the network
- Other miners verify the transactions in it and validate the block X
- The block is considered as legitimate when other miners continue working on extending the chain from this block X
- The creator of the block X gets the reward and collect the fees (output – input > 0) from the transactions he / she included in the block
We will take the example of Bitcoin – which seems to be the most relevant – to illustrate the main characteristics of the PoW protocol.
- Other applications: Ethereum, Litecoin and other altcoins
- Process of creating blocks: mining
- Nodes are called: miners
- Algorithm: Secure Hash Algorithm 256 function squared (SHA256^2)
- Difficulty readjustment: every 2016 blocks ~ a fortnight
- Block generation rate: 10~12 minutes
- Reward type: bounty + transaction fees
- Reward amount: 12.5 currently for bounty + variable transaction fees
- Reward correction: halves every 210,000 blocks ~ four years
- Resource(s) used: computational power
- Pros: seniority, push for innovation in reducing energy consumption, fair coin distribution mechanism
- Cons: [very] high energy consumption, outsiders can become miners, scale problems, inevitable inflationary phase, mining pool collusion can entail 51% attacks, what happens when bounty reward equals 0?
The PoW design varies greatly among cryptoccurencies, e.g. for Litecoin, block generation rate is around 2.5 minutes so we can think of it as more suitable for small transactions that require only a few confirmations (= number of blocks after the one containing the transaction) like buying coffee and it uses the S-Crypt algorithm instead of SHA-256^2.
2. The PoS protocol
There is no application of a pure PoS protocol so far. To solve the problem of wasteful resource and high energy consumption (electricity) of the PoW, the mining process should be replaced by a minting / validating process that do not employ computational power to solve cryptographic puzzles. Ownership of a currency or having a deposit / stake in the system allow the nodes to participate in the process of validating transactions and creating blocks. It stills works like a lottery but the bigger the stake, the higher the chance of being selected as a / the creator of the next block. Instead of miners, we have minters / validators / stakeholders. As the PoS is still premature and being experimented, the selection process and the number of validators differ from one alternate model to another. If we consider the pure form of PoS, there would be no creation of new coins so the total money supply shall be issued since the beginning. Peercoin uses the Coinage concept in its PoW / PoS protocol to limit the power of big stakeholders and increase the chance of other minters being selected. The Ethereum blockchain plans to move to a PoS system with their own algorithm called Casper which uses Checkpoints and introduces the Inactivity leaks to counter offline validators and slashing conditions to combat double-voters – it is a hybrid protocol so we will not address it in this section. Here’s how it would work:
- When a node (minter) is selected, it creates a block Y, points to the previous one, includes transactions and timestamp and broadcast to the network
- Other minters verify the transactions and accept the block Y by working on extending the chain like in the PoW
- Block Y minter collects the fees from the transactions contained in the block
Below are the main characteristics of the PoS that differentiate itself from the PoW:
- Process of creating blocks: minting / validating
- Nodes are called: minters / validators / stakeholders
- Reward type: transaction fees only
- Reward amount: variable transaction fees
- Pros: not a resource-intensive protocol, consistency with the stakeholders of the system, faster confirmation time by greatly incentivising the minters to include transactions in their block to gain the fees?
- Cons: difficult to find a solution to the nothing-at-stake problem and bribe attacks, fair initial coin issuance problem, selection process of validators and their numbers is challenging
In reality, the protocol is much more complicated to implement because more in-depth mechanisms must be carefully studied, e.g. it must penalise minters that double-vote or simply only allow minters to vote for one block at a time but what happens if there are delays in the network and the minters only receive information from the shorter chain…etc.
3. The PoA protocol
The protocol is a combination of PoW and PoS first proposed by Bentov, Lee, Mizrahi and Rosenfeld in 2014. It is still being studied and there is no application of it yet. Once again the protocol seeks to combat the resource-intensive design of the PoW and introduced a new selection process of validators for the PoS called follow-the-satoshi. It consists of pseudo-randomly tracking back the owner of a satoshi (the smallest unit of a currency) from the moment it was mined. A multi-signature block creation method is also a new feature in this protocol. Here’s how it works:
- When a miner finds a nonce, it creates an empty block header (with no transactions) and broadcast it to the network
- The N hashes of each combination of the concatenation of the hash of this empty block header with the hash of the previous block and a pre-defined number N determine the N validators for this block
- Other stakeholders verify the block header and check if they are selected among the N validators
- The N-1 validators sign the block using their private key and broadcast to the network
- Finally the Nth validator creates a wrapped block and includes transactions
- The transaction fees are shared amongst the miner and the N validators
Below are the main characteristics of the PoA:
- Process of creating blocks is called: follow-the-satoshi
- Nodes are called: miners AND stakeholders
- Reward type: transaction fees only
- Pros: higher costs for attacks than PoW
- Cons: still employs the PoW scheme, many technical details to be implemented and improved
An extension and improvement of the PoA is the Chains of Activity (CoA) which details further the implementation and offers a more complete technical analysis of the protocol.
4. Towards hybrid forms of consensus protocols
If one type of consensus protocols cannot perfectly reflect a sustainable model in the long run for the blockchain, perhaps a hybrid one that combines two or more protocols could be the answer. We remind that other types of protocols also exist and are currently [partially] in application: Proof of Burn (Slimcoin), Proof of Capacity (Burstcoin), Proof of Elapsed Time (Intel), Practical Byzantine Fault Tolerance (PBFT) algorithm (HyperLedger), Federated Byzantine Agreement (FBA) algorithm (Ripple and Stellar).
An interesting protocol is the Zero-knowledge proof (ZKP) used by Zcash. Basically, the ZKP consists in proving that a statement is true by not revealing the content of the statement. In other words, proving that a transaction is legitimate without the need to know the amount of the transaction and the sender’s and the receiver’s information. Most well-known illustrations of the ZKP are the Ali Baba cave and the color-blind friend (you can simply check them on Wikipedia).
No human being is perfect and no human-designed system is perfect either. We admit that it is difficult to achieve consensus in a decentralised and distributed system and it is even more challenging to have one protocol that fits all systems. I believe future designs will take into account the issues of existing models and create a consensus protocol that is sustainable and near-perfect.
Leave a comment to express what you think about this or if you believe I made mistakes somewhere in the post.
Cheers.