Consensus is a term that anyone who deals with blockchain and distributed ledger technologies will inevitably come across. Every crypto trader and investor encounters these terms at some point in their trading career. Most tend to ignore them - probably because of the technicalities involved with understanding how everything works. In this article, we break down what consensus is in the simplest way possible.
What is a Consensus Algorithm?
A consensus consists of the algorithm and a protocol. The protocol defines the rules; the algorithm implements them. Proof-of-Work, Proof-of-Stake, and many others are consensus mechanisms and are an essential part of blockchains.
If the system is distributed among all parties involved, there is no possibility of unilateral abuse. This is the ideology of decentralized systems and made possible by consensus algorithms.
A consensus algorithm can be defined as the mechanism by which a blockchain network reaches consensus. Public blockchains are built as decentralized systems, and since they do not rely on a central authority, the decentralized nodes must agree on the +validity of transactions. This is where consensus algorithms come into play. They ensure compliance with protocol rules and guarantee that all transactions are processed reliably to avoid double-spending and fraud within the blockchain.
They are a crucial element of any blockchain network, as they ensure the maintenance of the integrity and security of these decentralized systems. The first consensus algorithm developed for cryptocurrencies was the Proof-of-Work (PoW), designed by Satoshi Nakamoto and applied to the Bitcoin protocol. Since then, several other consensus algorithms have been developed.
Why are Consensus Algorithms Necessary?
Private and public blockchains use consensus to ensure security and data integrity across all nodes. Consensus ensures the integrity of the blocks and their consistent synchronization across the network.
To best describe why consensus algorithms are necessary, we must revisit the story of the Byzantine generals since it’s the basis of the common problem in blockchains.
The Byzantine Generals
The underlying problem was first described in 1982 by Leslie Lamport and his colleagues in a fictional story about the Byzantine generals. In it, an army led by several equal generals surrounds a city. To capture them, the generals must follow the suggestion of one of them and attack from different directions simultaneously. The generals have no way to meet but can only communicate through messengers without relying on the messengers to deliver their messages on time. At the same time, some generals might decide to send a message containing false information, thereby provoking an uncoordinated attack that would lead to the destruction of all honest generals.
If you relate this analogy to the blockchain, the generals are the nodes. They have to decide again and again whether they accept a block that one of them has proposed or wait for the next proposal. Since the blocks are numbered sequentially and contain a uniquely sorted list of transactions, an agreement on the blocks also means a regarding the order of transactions.
In order to agree whether a block should be accepted or not, a common set of rules is needed that all honest nodes can adhere to. This set of rules is called consensus and helps nodes decide independently and automatically when they consider a transaction to be valid.
With that said, here are some of the most popular consensus used in crypto.
Different Types of Consensus in Blockchain
For Proof-of-Work, network users are rewarded for solving complicated cryptographic tasks. The solution of these tasks is marked in the blockchain by the generation of a new block. By solving the calculation problem, it is proven that the calculation path, i.e. the transactions, were carried out error-free. Many major cryptocurrencies rely on PoW, including Bitcoin with its SHA-256 algorithm, Litecoin with Script, or Monero with CryptoNight.
Although many cryptocurrencies use PoW, the mechanism does not come without its drawbacks. Solving arithmetic tasks requires a lot of time and energy, which makes it very costly. Due to the increasing difficulty of computing tasks, hardly any conventional graphics cards are used anymore. Specific mining hardware (ASICs) are used since they have a high level of data processing.
A Proof-of-Stake mechanism decides which participant from a network is authorized to generate the respective block. The participant is determined by weighted random selection. For each new block, a new participant from the network will be drawn.
In principle, each participant could take over the validation. The prerequisite is that there are currently tokens in their wallet. The selection of the validator is random in the Proof-of-Stake, similar to a lottery.
Here, miners are randomly selected from a pool of node operators. Node operators must have a fixed minimum number of coins/tokens available in the wallet. It decides the stake (share) of a node in tokens/ coins in the network.
PoS uses, among other things, a weighting of the duration of participation in the network and the number of tokens/coins of the node, together with a random selection. However, the choice is weighted, i.e. those who stake more tokens have a higher chance of being selected as validators - as if you had bought several tickets for the lottery and thus a higher chance of winning the draw.
Delegated Proof-of-Stake (DPoS)
DPoS works roughly similar to the somewhat more widespread Proof-of-Stake (PoS) but introduces additional rules into the selection process for validators. DPoS is often referred to as a democratic variant of the PoS.
While with PoS, generally, every node is eligible to validate new blocks, depending on the number of tokens/coins in the wallet, the nodes in DPoS only receive one voting right. Multiple nodes vote on the delegate, who then validates new blocks. The system is generally faster than PoS and PoW and generally more insecure, as the election process of delegates and witnesses can be manipulated.
To summarize, the consensus consists of the algorithm and a protocol. The protocol defines the rules; the algorithm implements them. The most popular consensus algorithms are PoW, PoS, and DPoS; however, there are many other consensus algorithms like Proof-of-Activity (PoA), Proof-of-Capacity (PoC), Proof-of-Burn (PoB), Proof-of-Elapsed Time (PoET).
As the blockchain industry continues to evolve, it is to be expected that a lot will change in the next few years. Is there any consensus algorithm you particularly like - and if so, for what reasons?