In the previous blog post, we described the general principles of consensus protocols. In this post, we focus on the main consensus protocols used as of today notably Proof-of-Work, Proof-of-Stake, Proof-of-Authority, Raft and Federated Consensus
Principle: a difficult solution to find but easy to verify
Proof-of-Work is the underlying consensus of the first blockchain: Bitcoin. In order to validate a block of transactions, several nodes of the distributed ledger (called Miners) compete to solve a complicated mathematical problem. The principle is that the solution of the problem is hard to find, but easy to verify by the rest of the network. Once the first Miner has found the solution, it provides the other nodes with the solution. The solution is then verified and the consensus is reached.
What is the mathematical problem?
The Miners compete to find an unknown nonce (an integer) that, if hashed with the details of the transactions, the signatures of the parties and the Hash of the previous blocks, will result in a Hash (see - Blog Post #4 - Consensus Protocols - How to create trust between parties with different incentives?) starting with a certain number of 0’s (defined by the consensus rules). This nonce is very hard to find (the probability to find it quickly is very low) and the Miners have to iterate through many nonces in order to find the right solution.
However, the solution is easy to verify: the other nodes just have to Hash the details of the transactions, the signatures of the parties, the Hash of the previous transactions along with the solution found and verify that the resulting Hash starts with the required number of 0’s.
Main issues with the Proof-of-Work consensus
The Proof-of-Work consensus has some issues that impact the scalability of distributed ledgers that rely on it:
These issues have led to the development of new consensus protocols.
Principle: the higher the stake of a validating node in the network, the more chances and legitimacy it has to validate transactions
The Proof-of-Stake consensus is used for distributed ledgers with an underlying cryptocurrency (notably Ethereum - see Blog Post #6 - Who are the major providers of distributed ledgers technologies?). The principle is that the higher the stake of a validating node in the underlying crypto-currency, the less interest it has to corrupt the validation process.
In the Proof-of-Stake consensus, validators of transactions are called Minters. Each Minter will commit some of the stake it owns in the network (to simplify, they “deposit” some cryptocurrency as a sort of collateral). Then, an algorithm will select one of the Minters based on the stake they own. In basic terms, if a node has a 5% stake, it will validate 5% of the transactions. It is then easy for the other nodes to verify that transactions have been validated by Minters that effectively have corresponding stakes in the distributed ledger.
Principle: validation through randomly won elections
Raft consensus is based on a randomly won election that will designate a Leader in charge of the validation of the transactions. In Raft consensus, the nodes of a distributed ledger can be in three different states with different underlying missions:
The Raft consensus is divided in two steps: the Leader Election and the Log Replication (when the transactions are effectively validated) that are described in the graphic below
You can watch a very usefull video that explains in more detail each sub-step of the process by following this link
Principle: blocks are validated if signed by a specified quorum of signers
Depending on the business and security requirements, the distributed ledger will define a “M-of-N multisignature” rule, with M representing the number of signatures needed for a transaction to be valid and N the number of validators (signers). Then, as long as less than 2M - N - 1 block signers don’t violate the protocol, the consensus is considered as secure. This consensus fits distributed ledger where participants trust a certain subset of validators.
If the number of signatures required, N, compared to the number of signers, M, is met, the transactions are then validated. It is easy for nodes in the distributed ledger to validate the “M-of-N multisignature”.
This consensus is used by Chain.