Skip to content
TechLearnFeatured

Explained: Blockchain Consensus Mechanisms

Table of Contents

Consensus mechanisms are a form of digital governance on decentralised networks.

Because there are no intermediaries or centralised authorities like a bank that can authenticate a transaction and ensure its validity, blockchains have to adopt a mechanism whereby every independent node (supercomputer) can come to a consensus; to unanimously agree that a transaction is valid.

This is also what “decentralisation” really means – no single entity maintains and controls the system. Rather, a network of people around the world are always maintaining it, creating a trustless environment.

The Byzantine Generals Problem

To know blockchain consensus mechanisms, it’s imperative to understand why there’s a need to come to a consensus in a decentralised network.

Imagine a group of Byzantine generals each commanding a platoon of soldiers surrounding a city they want to attack.

The city is massive and hence different groups have to attack from several sides.

However, because the groups cannot communicate with each other, they are unable to come to a consensus on when they should attack.

Some may attack while others may choose to retreat, creating a fragmented battle plan. There is a need to mount a coordinated attack to ensure victory.

That’s the inherent issue with decentralised systems. It’s a trustless and potentially global network where participants are unable to guarantee the behaviour of other participants.

Therefore, because there is no single controlling authority coordinating the blockchain’s activities, a consensus mechanism has to be established to ensure that transactions are legitimate and accurately authenticated.

Types of Consensus Mechanisms

There are two commonly used consensus mechanisms: Proof-of-Work (PoW) and Proof-of-Stake (PoS).

Proof-of-Work (PoW)

PoW is a consensus mechanism currently adopted by Bitcoin and Ethereum. In PoW blockchains, supercomputers (nodes) on the network compete to solve a complex mathematical equation by expending their computational power. Think of them as extremely powerful and automated calculators.

The supercomputer that solves the problem wins the competition, therefore proving its “work”. It will then approve the newest block of transactions. The block is then shared to every single participant in the network, which will confirm its validity and add it to their copy of the blockchain (because they all have access to the same ledger).

Once consensus is reached, the transaction is considered successful and the new block is added to the blockchain. This process is also known as mining. Miners (the supercomputers/nodes) that successfully confirm a transaction are then rewarded with the blockchain’s native cryptocurrency (e.g. ETH on Ethereum or BTC on Bitcoin).

However, because there’s a need to expend large amounts of computational power, PoW blockchains are believed to be too exclusive, as only miners with superior hardware are able to consistently authenticate transfers. This also puts PoW blockchains at a higher risk of a 51% attack, whereby miners can gain control of the majority of computing power and manipulate transactions (e.g. approve the same transaction twice)

PoW is not an environmentally friendly mechanism. It’s estimated that bitcoin mining consumes 91 terawatt-hours of electricity per year – higher than the consumption of entire countries like Finland, Chile or Denmark.

This is also why bitcoin is often labelled an “unsustainable” cryptocurrency.

Proof-of-Stake (PoS)

Ethereum has plans to transition to the PoS mechanism in its upgrade to Ethereum 2.0. This is a greener mechanism as there is no need for energy-consuming mining. Instead, validators are randomly chosen based on the amount of cryptocurrency they put up at “stake”.

For example, proof-of-stake on Ethereum 2.0 will require validators to put up 32 ETH at stake – a collateral that will allow them to propose new blocks of transactions.

When there’s a new transaction, the blockchain randomly selects a validator to validate the transaction. Validators that are not selected will then “attest” the block and the network will reach a consensus on the block’s validity.

Validators are rewarded for proposing and attesting blocks. However, If transactions are inaccurately validated, or if validators attempt to undermine the system, they will lose their stake (collateral).

PoS blockchains are less likely to suffer a 51% attack as attackers would need to hold 51% of the staked cryptocurrency. It’s both expensive and pointless – an attack would send prices crashing, with the attackers suffering extreme losses.

However, because of the large amount of cryptocurrency that has to be staked, it also promotes exclusivity and centralisation because the power to validate transfers is in the hands of a select few.

To sum up, let’s revisit the Byzantine Generals Problem.

A blockchain ensures that every general has access to the same “ledger”, and the actions of each general can be collectively viewed and confirmed on the ledger. A consensus mechanism enables the generals to agree on a course of action before deciding on a coordinated attack on the city.

No single general can jeopardise the attack, because the consensus mechanism ensures that every action has to be endorsed by all of the other generals.

On public blockchains, the actions of each participating miner/validator has to be confirmed and this is achieved by the network collectively reaching consensus. No consensus mechanism is perfect, but they aim to maintain the integrity and security of the blockchain while ensuring the validity of every transaction.

Latest