A blockchain is a decentralised, immutable storage system akin to a database, but where data is chained together in a series of timestamped, cryptographically secure blocks.
Compared to your standard database, a blockchain is unique in that data is decentralised (distributed among many different computers/nodes) and each node has a copy of the entire chain.
For data to be added, there needs to be consensus in the network that the data being added is legitimate and every node agrees.
This consensus is based on the blockchain set of protocols which need to be adhered to to validate and append new blocks onto the blockchain.
What is a Consensus Algorithm
A consensus algorithm is a system which ensures acceptance of a given piece of data among all or most of the nodes which host the data.
To succeed, Consensus Algorithms need to have certain characteristics including:
- Fault Tolerance
- Verification Speed
Efficient performance of both of these points will help the blockchain achieve higher throughput – a necessary prerequisite to achieve scalability and wide-spread adaptability.
Consensus algorithms require the majority of the nodes on the network to agree and accept the data which meets protocol, even if there are nodes which fail or try to act malicious. In this way, the blockchain algorithm needs to be fault-tolerant.
Fault tolerance requires the system to achieve two things:
- Crash Fault Tolerance – Processes may crash or nodes may fail for a variety of reasons. It is critical for the blockchain to still be able to reach consensus even if one of the nodes fails.
- Byzantine Fault Tolerance – this term takes its name from the “Byzantine Generals Problem” – and in its simplest form it helps a distributed network reach consensus even if there is incorrect information or failure of response from some of the nodes. If more than ⅔ of the nodes agree, then there is consensus. This prevents rogue nodes from propagating incorrect / malicious entries into the blockchain.
One of the biggest issues facing blockchain from entering mainstream adoption is the verification (and therefore transaction) speed.
Bitcoin – the most popular blockchain network – processes less than 5 transactions per second. Compared with Visa which processes 1,700 transactions per second it becomes apparent the current incarnation of blockchain will have scalability issues if we’re ever to reach the magnitude of everyday finance.
Why is this an issue? Imagine when paying for something in the shop, you’d need to wait until your transaction is verified. At 5 per second, it could take minutes, hours or sometimes days depending on the network traffic before your transaction was approved onto the block chain.
Types of Consensus Algorithms
Proof of Work (PoW)
A Proof of Work algorithm is one method of showing the network that a node has expended a certain amount of computational resources to complete the task.
The work required is usually to create a hash which meets the protocol’s requirements. The work is done by Miners, who use their computing power to go through a race of trial and error of finding the correct integer to create the correct hash for the new block.
Whichever Miner gets the hash first, wins. The winner shares the new block with the rest of the network and is rewarded in coin (Bitcoin/ Ether).
Benefits of PoW
1 – Secure
With PoW, you need a consensus of 51% of the network nodes to approve a transaction. As such, to defraud and manipulate data a hacker would need to obtain control of over 51% of the network nodes (unlikely) or buy enough computing power to become the largest node operator in the network (also unlikely due to cost of infrastructure).
Drawbacks of PoW
1 – Inefficiency
It’s greatest strength is also its weakness. By requiring massive computational effort to be expended on creating a new hash and racing other miners to outcompete to win rewards, a PoW system consumes a lot of power.
The biggest PoW blockchain – bitcoin, consumes more power than the entire country of New Zealand.
This only gets worse. As the price continues to go up, more miners are incentivised to join the bitcoin network to mine new blocks onto the chain and earn bitcoin as their reward.
2 – Monopolistic
Perhaps an unintended consequence – ironically the decentralised network using a PoW consensus algorithm may find itself to be controlled by a monopoly, or handful of organisations who control the mining power.
As the mining difficulty increases and more nodes enter the system to compete for coins, coupled with increasing prices for computing resources and graphics cards needed to successfully mine – most home computer users no longer find it profitable to mine and compete with mining farms.
With this, and coupled with the relative anonymity of blockchain, comes the risk that most of the nodes are or can be operated by a handful of operators which poses the risk of centralisation.
Proof of Stake (PoS)
Proof of Stake (PoS) consensus algorithms allow for block mining as a percentage of how many coins the user holds. The more coins staked by a user, the more mining power they have.
The PoS model was designed to counter the environmental concerns of the PoW model, as you can only mine in proportion to how much coin you have invested.
Benefits of PoS
1 – Energy Efficiency.
Proof of Stake models are inherently more efficient than PoW models as mining is directly correlated with the number of coins you hold and the length of time they’ve been held. This reduces the race to compete for block-rewards and levels the playing field.
2 – Lower Barrier to Entry
By reducing the requirement for investing in ASIC machinery or expensive GPUs and mining rigs, the proof-of-stake consensus mechanism helps lower the barrier to entry in becoming a “miner” or “validator” and achieves the goal of distributability and decentralisation more than a proof-of-work system.
3 – Secure
Users are incentivised to be honest validators. If the network detects fraud or malicious activity, the validating node loses a portion of their stake and the right to participate in future stakes.
The more coins a node has, the more they have to lose – so it becomes in their best interest to maintain the validity of the network and play ball.
Drawbacks of PoS
1 – 51% Control
It is potentially easier for a wealthy user to accumulate 51% of the currency in distribution and become the largest validator in the network.
2 – Future Scalability
Ethereum2, which will be based on a Proof of Stake algorithm, will require validators to hold a minimum of 32ETH before they can validate.
While this has the benefit of keeping a heavy stake and therefore higher-risk of loss if intention is malicious, it could potentially put off individual home based consumers from entering the network. At the time of writing (5th June 2021) the price of ETH is short of £2k per unit. 32 ETH will come at a heavy cost of £64,000.
Other Consensus Algorithms
DPoS – Delegated Proof of Stake
In a DPoS system, the token holders delegate the work of block validation to a changing pool of delegates. The primary difference between a PoS and DPoS is it creates a democratic mining system which is maintained by the voters. If a delegate is trying to abuse the system, they get voted out – thereby creating the security and trust in the system.
A Delegated-Proof-of-Stake model is inherently faster than both a PoS and PoW model by utilising more validators.
PoW – Proof of Weight
Proof of Weight bases the node’s probability of “mining” the next block by weighting against how many coins or other value is owned.
In this way, it’s similar to a PoS system where Weight is prescribed based on the amount of tokens a user holds. Other values can be prescribed to Weight, i.e. Filecoin’s Proof-of-Spacetime model considers how much IPFS data the user is storing to determine the node’s Weight (the more data being stored, the more weight the node is given to validate and mine the next block).
This model has potential issues of scalability and trust concerns.
PoA – Proof of Activity
A hybrid approach combining a PoW and PoS model.
The system begins with a PoW model where miners solve the block-hash and announce their solution to the network. The difference being, this block contains no transactions.
The system then switches to a PoS model which selects a random group of validators based on their percentage stake held in tokens of the blockchain. It is up to this group to then validate the block before it is successfully added to the chain.
Being a hybrid approach – this system takes both the benefits and negatives of the Proof-of-Work and Proof-of-Stake models. Frankly, this model contains little benefit by combining the two other than to assist with higher security and risk against 51% attacks. It doesn’t address the issue of environmental damage caused by validation.
While there are several other consensus algorithms, Proof-of-Work and Proof-of-Stake are the largest well documented being used in blockchains.
The future scalability of blockchains requires their consensus algorithms to feature (at the very least):
- Security (including Fault Tolerance)
- Energy Efficiency
- True decentralisation
Proof-of-Work has its benefits. A Proof-of-Work system which works on random selection across the network and a Weight model based on Stake and Reputation to validate transactions is more along the lines of what is required – expending less computational energy and racing to “win” while ensuring the democratic and distributed validation of data.