What is a blockchain consensus mechanism?
The beginner’s guide
Imagine you are the commander of an army comprising several platoons of soldiers, each located at a different drop off point. You plan to attack a single fortified area at a specific time. To do this, you must coordinate with each of your platoons to ensure they all know the correct time, location and plan of action.
But this poses a number of problems. What if one or multiple platoons decide to retreat at the last minute? What if they attack too early? What if they arrive at the wrong location? What if there are traitors in a platoon that attempt to sabotage the plan?
For the attack to work, it’s vital everyone reaches a unanimous agreement— also known as reaching consensus— on what the plan is. This example is based on the Byzantine Generals’ Problem; a concept published in a 1982 paper that illustrates the problems of building a robust communication system where its assumed participants in that system may act dishonestly.
Bitcoin became the first decentralized system to solve this long-standing problem by implementing something called a consensus mechanism.
Other types of consensus mechanisms
Beyond PoW and PoS, there have emerged dozens of different consensus mechanisms that represent novel or hybridized versions of the aforementioned mechanisms. Each attempt to solve the Byzantine Generals’ Problem in various ways. These include:
- Proof-of-Activity (PoA)
- Proof-of-History (PoH)
- Proof-of-Importance (PoI)
- Proof-of-Capacity (PoC)
- Proof-of-Burn (PoB)
- Proof-of-Authority (PoA)
- Delegated Proof-of-Stake (DPoS)
- Proof-of-Elapsed Time (PoET)
What is a consensus mechanism?
A blockchain consensus mechanism is a type of automated system that aims to accomplish two main objectives.
- Ensure a distributed, leaderless community of network validators are able to efficiently and unanimously agree on new and existing data on the blockchain ledger.
- Ensure all network validators follow the rules of the protocol and perform their roles honestly.
Data validation refers to verifying new information is accurate and valid. This is incredibly important in a decentralized system, especially a decentralized monetary system. If invalid transaction information is allowed to be added to the blockchain such as a false balance or a double-spend transaction, it would completely undermine the integrity of that database.
Without an integral database, nobody would trust it and no one would use it.
There is also one other key problem that consensus mechanisms are used to solve: network security.
Satoshi Nakamoto, the creator of Bitcoin, was the first to recognize that consensus mechanisms could also double up as an efficient system for deterring bad actors from attempting to take over the network through a majority attack (gaining control of more than 50% of a network.) This was a revolutionary innovation and one that helped cement the Bitcoin protocol as the first globally viable decentralized cryptocurrency.
How do consensus mechanisms work?
While there are many types of consensus mechanisms used by different blockchains, most of them fundamentally work by requiring validator nodes to make some sort of investment and/or expend an amount of effort before they’re granted the right to propose and validate new blocks of data.
The idea behind this is simple. Validators who have invested their own time and money to participate in the network are theoretically less likely to try and corrupt it because they have something to lose if they do.
In short, consensus mechanisms are simply systems that encourage validators to abide by the rules through coercion (threat of punishment) and/or incentivization (earning rewards for good behavior).
What are the main consensus mechanisms?
As we’ve mentioned, there are many different methods employed by various blockchains to achieve consensus in today’s crypto industry. However, the two most popular are known as the proof-of-work (PoW) and the proof-of-stake (PoS) consensus mechanisms.
Proof-of-work is the consensus mechanism used by bitcoin and a wide range of other cryptocurrencies.
First developed in 1993 by computer scientists Cynthia Dwork and Moni Naor as a means of preventing email spam, Nakamoto took the concept and adapted it for use in a decentralized monetary system.
PoW works by requiring validators, dubbed “miners,” to purchase, rent or outsource computing equipment and direct that power towards winning a cryptography-based competition in exchange for rewards. This process is more commonly known as crypto mining.
The full details of mining can be found here.
By requiring validators to invest in computing equipment and cover the ongoing costs associated with running it, the idea behind PoW is that potential malicious agents would be put off going through all that effort. Similarly, the incentive structure of block rewards— the rewards earned from winning the mining competition— means honest participation can be well compensated.
In terms of providing security, as more miners join the network and the sophistication of equipment rises, the cost of attacking the Bitcoin blockchain rises exponentially. This is because a perpetrator would have to source an extremely large amount of computational power to gain a 51% majority over the rest of the network. Even then, there would be no guarantee they’d win the mining competition every ten minutes to successfully establish an invalid chain of new blocks.
Proof-of-stake is a relatively new type of consensus mechanism pioneered by Sunny King and Scott Nadal in 2012. Like proof-of-work, PoS fulfills the same key objectives of a consensus mechanism but in a uniquely different way.
In order to become a validator on a PoS-based blockchain, participants are required to purchase and lock away an amount of the corresponding project’s native cryptocurrency in a smart contract. This is known as staking.
A staking smart contract essentially acts like an escrow account and locks up tokens for a fixed or variable duration depending on the specific conditions of each blockchain protocol.
Validators are chosen at random by the protocol to propose new blocks inside set time slots—often called epochs. Stakers can increase the likelihood of being selected to propose new blocks by increasing the amount of tokens or coins they dedicate to staking.
This system works similarly to a lottery system, whereby the more tickets you have the greater your odds of winning the jackpot. But again, there’s no guarantee you’ll win every time, just like a lottery. Someone with a single ticket can still beat someone with thousands of lottery tickets. The same applies to crypto staking.
In addition to locking up tokens, some PoS consensus mechanisms like the one Ethereum uses administer penalties for dishonest behavior through a process called “slashing.”
If the protocol suspects malicious activity, a person’s locked funds can be confiscated, or “slashed,” partially or fully without warning. This coercively dissuades bad behavior and helps to ensure all network participants follow the rules.
What is the best blockchain consensus mechanism?
While there is no clear winner in terms of the best consensus mechanism, many regard the PoS and PoW systems as being the most effective.
The main advantages of PoW (mining) over PoS (staking) is that it offers significantly greater security against 51% majority attacks. However, huge amounts of energy are collectively consumed by miners to achieve this high security; something many environmentalists, regulators and global businesses have voiced great concern over in recent years. The energy usage of PoW is a complex topic and something we discussed in greater depth in our article Busting Crypto Myths: “Bitcoin is Destroying the Environment."
PoS on the other hand is significantly more energy efficient. No electricity guzzling machines are required to stake and multiple blocks have the potential to be validated in tandem through scaling solutions such as sharding.
That being said, neither is perfect and both have their own centralization problems. In both cases, those with the most money can gain an unfair advantage over other participants in the network.
In PoW systems, large mining firms dominate the industry and make it financially unfeasible for small hobby miners to participate.
In PoS systems, those who stake huge amounts of tokens are far more likely to propose new blocks and earn rewards compared to everyone else in the network.
Nevertheless, it can be argued that this is a natural byproduct of most, if not all, consensus mechanisms.
Start buying crypto
Now that you know all about consensus mechanisms, are you ready to take the next step and buy some crypto with Kraken? Click the button below to invest in cryptocurrency on Kraken today!