Today, more and more blockchains are being created with various new offerings they seek to provide. This article seeks to briefly explore the different consensus algorithms used. A consensus’ main purpose is to achieve agreement on agreed transactions among a distributed system (on the blockchain).
As we all know, a common danger we often hear of decentralisation highlights a hypothetical scenario of the 51% attack on a blockchain. In this scenario, a group of miners (which are people/groups/organisations who are providing computing resources to the blockchain to verify and add new transaction records to the blockchain ledger) that controls more than 50% of the network will be able to prevent other transactions from occurring, and allow their own coins to be spent multiple times — a process called double spending.
Common consensus algorithms that will be explored in this article include: Proof-of-Work (PoW), Proof-of-Stake (PoS), Delegated Proof-of-Stake (DPoS), Proof-of-Authority (PoA), and Proof-of-Importance (PoI).
Simply put, consensus is defined as a general agreement of a state that the blockchain is in. That means, if Alice sends $100 worth of Bitcoin to Bob, Alice will lose $100 worth of Bitcoin from her wallet, and Bob will gain $100 worth of Bitcoin in his wallet. The catch is that every clean transaction has to be recorded on the Bitcoin public ledger, and a consensus algorithm ensures no malicious transactions nor changes can be made on the blockchain itself.
This example brings us to the purpose of having a consensus mechanism — in a decentralised blockchain ecosystem, a solution to the Byzantine Generals’ Problem is essential.
Byzantine Fault Tolerance (BFT)
The Byzantine Generals Problem was published in 1982 by Lamport, Shostak and Pease, to ensure that malfunctioning components that give conflicting information are handled within a computer system.
BFT is the characteristic of a system that handles the different types of faults that belongs to the Byzantine Generals’ Problem. Having BFT is not solely used on the blockchain itself. However, in the consensus algorithms explored below, they are explained in relation to the blockchain.
There are various methods of ensuring each transaction remains valid, and that brings us to the main segment — consensus algorithms.
Before we dive into the consensus algorithms, a side note, it is interesting to note that these ‘proofs’ are not mathematically proven, but instead ‘to be proven’… For example, PoW has been implemented in Bitcoin for the past 10 years and had no occurrence of a failure, whereas PoS security is a much younger concept which is to be proven.
Most of us would have heard of PoW, especially since the first public blockchain — Bitcoin, uses PoW. In this example, PoW is explained with Bitcoin.
PoW is conducted through miners (the people keeping the blockchain running by providing a huge amount of computing resources) competing to solve a cryptographic problem — also known as a hash puzzle. These miners help to verify every Bitcoin transaction, where it involves producing a hash-based (SHA256) PoW that is based off previous transaction blocks (read up on the Merkle Tree for more information) and forms a new branch with a new transaction block. This means that the work is moderately difficult for the miners to perform but easy for the network to verify. The first miner who manages to produce the PoW will be then awarded some Bitcoins. Over time, the amount of Bitcoin awarded decreases over time.
Over the years, as the difficulty level in mining Bitcoin has increased tremendously, resulting in PoW being notorious for the amount of energy it requires to keep the blockchain running.
-
Unlike PoW where new transaction blocks are created based on computational work done by solving a complex cryptographic puzzle, PoS allows a forger (instead of a miner) to stake any amount of cryptocurrency she has, to be probabilistically assigned a chance to be the one validating the block — the probability based on the amount of cryptocurrency staked.
Additionally, for most PoS systems, instead of receiving a cryptocurrency reward (in the above case, the Bitcoin miners receives some Bitcoins for solving a PoW), the forgers instead takes the transaction fees as rewards.
The idea of putting coins to be ‘staked’ prevents bad actors from making fraudulent validations — upon false validation of transactions, the amount staked will be forfeited. Hence, this incentivises forgers to validate legitimately.
In the recent year, PoS has gained attention, with Ethereum switching towards a PoS from a PoW consensus system.
-
DPoS is similar to PoS in regard to staking but has a different and a more democratic system that is said to be fair. Like PoS, token holders stake their tokens in this consensus protocol.
Instead of the probabilistic algorithm in PoS, token holders within a DPoS network are able to cast votes proportional to their stake to appoint delegates to serve on a panel of witnesses — these witnesses secure the blockchain network. In DPoS, delegates do not need to have a large stake, but they must compete to gain the most votes from users.
It provides better scalability compared to PoW and PoS as there are fully dedicated nodes who are voted to power the blockchain. Block producers can be voted in or out at any time, and hence the threat of tarnishing their reputation and loss of income plays a major role against bad actors. No doubt, DPoS seem to result in a semi-centralised network, but its traded off for scalability.
Like PoS, DPoS has also gained attention over the years with several projects adopting this consensus algorithm. Since it was invented by Dan Larimer, DPoS has been refined continuously, from BitShares to Steem and now in EOS.
-
PoA is known to bear many similarities to PoS and DPoS, where only a group of pre-selected authorities (called validators) secure the blockchain and are able to produce new blocks. New blocks on the blockchain are created only when a super majority is reached by the validators.
The identities of all validators are public and verifiable by any third party — resulting in the validator’s public identity performing the role of proof of stake. As these validators identity are at stake, the threat of their identity being ruined incentivises them to act in the best interest of the network.
Due to the fact that PoA’s trust system is predetermined, concerns has been raised that there might be a centralised element with this consensus algorithm. However, it can be argued that semi-centralisation could actually be appropriate within private/consortium blockchains — in exchange for better scalability.
Newer blockchain startups has ventured into implementing PoA. In addition, Ethereum testnets like Rinkeby and Kovan explores the use of a PoA consensus algorithm.
—
As these few consensus algorithms are explored in this article, it is important to note that it is non-exhaustive. Newer/modified consensus algorithms are being developed and experimented with, with the surge in blockchain projects in the recent years.