Digital Assets

Concepts: Consensus Algorithms in Blockchain

On Blockchain, there is no central entity validating and verifying the transactions, yet every transaction on Blockchain is considered to be trusted and verified. What makes this possible?

Gunnar Jaerv   Gunnar Jaerv · Published on 17 August 2020
   

What is a Consensus Algorithm?

A consensus algorithm is the pre-determined process by which a blockchain reaches consensus. When a blockchain reaches consensus, enough nodes agree about the content and veracity of a block to mint a fresh block.

For each user, and for the blockchain as a whole, a consensus algorithm has two main jobs. First, it has to unequivocally establish one record as the source of truth (create a block). Second, it has to prevent any single actor from taking over the blockchain and creating false blocks.

So a consensus algorithm is really the core of how a blockchain works.

Proof of Work (PoS)

It might be easiest to explain how they all work by looking at a specific consensus algorithm: Bitcoin’s. Bitcoin uses a Proof-of-Work algorithm.

How does Bitcoin’s consensus algorithm work?

The Proof-of-Work algorithm Bitcoin uses establishes consensus by having users race each other to solve complex mathematical puzzles.

The Work in Proof-of-Work is the mathematical work required to complete these complex puzzles. They’re built in such a way that proofs have to cover all the data in the block, so the proof is inextricably linked with the block, and the output (referred to as a ‘hash’) is smaller than the original ‘target’ — the 256-bit number shared by all Bitcoin clients. This lets each block include within itself a demonstration that work has been done to mint it.

While PoW puzzles are hard to solve, they’re easy to verify. Once one person in the Bitcoin network has produced the correct output , it’s quick and simple for everyone else to verify that the hash is correct. The rules for PoW are arranged to manage a trade-off between block generation time and likelihood of hash generation.

You want the fastest block generation time possible, because that makes all the operations on the blockchain faster. But you also want the lowest probability of generation to be as low as possible, because as the probability becomes lower, it becomes more uncertain which network participant will come up with the right answer.

The Bitcoin blockchain strikes a balance intended to make a block creation rate fast enough to work with while retaining security and decentralization.

Security depends on both the security of the cryptography and the security of the consensus algorithm itself.

The cryptography is to all intents and purposes impregnable, impossible to ‘brute force’ without knowing both public and private keys, and is also modular; access to one address or node doesn’t give an intruder control over the network in the way that access to a highly-privileged account in a centralized network would.

The consensus algorithm is highly decentralized and doesn’t allow attacks from inside the network. However, PoW algorithms do depend on miners and mining is a resource-intensive activity, tending to concentrate in few hands. Just a few Chinese businesses control the majority of Bitcoin mining and there is the theoretical possibility of a 51% attack, in which the same organization controls over half the nodes in the network and can use this power to attack the network. This has never happened with Bitcoin but has happened with other, smaller PoW blockchains.

Of course, PoW isn’t the only consensus algorithm.

Other commonly used consensus algorithms include:

Proof of Stake (PoS)

Proof of Stake algorithms use a totally different structure from mining-based PoW blockchains. In a PoS blockchain, all the coins exist from the start, and nodes are chosen to validate blocks rather than create new coins. The process of selection depends on the fraction of coins in the system each node owns.

PoS consensus algorithms are sometimes criticised for being insufficiently decentralized and for creating the conditions for a plutocracy where the whole network can some under the sway of a few large investors.

Delegated Proof of Stake (DPoS)

Delegated Proof-of-Stake algorithms are designed to solve the decentralization and democratization issues presented by standard PoS algorithms. In a DPoS network, all coins already exist and new blocks are validated by only a small number of nodes. The whole network votes on which nodes are to act as validators, meaning that simply possessing a high percentage of the total coins isn’t enough to guarantee a user control. And since the whole network selects nodes, the actual number of validating nodes can be correspondingly smaller, reducing computational load and allowing for far faster block times.

Proof of Activity (PoA)

Proof of Activity consensus algorithms exist to address a perceived shortcoming of the PoW system: at some point, all the coins that can be minted will be minted. Fees for maintaining the network will fall since mining fees will cease and only transaction fees will continue. This runs the risk of disincentivising good actors, so PoA proposes to combine PoW with PoS to ensure rewards for miners continue and there is a continued incentive to maintain the network.

Proof of Elapsed Time (PoET)

Proffered by chipmaker Intel, this consensus algorithm works in a similar way to PoW but is far less energy-intensive. The algorithm uses a trusted execution environment such as SGX to ensure that blocks are produced in a random, lottery-like way but without the associated computational cycles and electricity expenditure.

Disclaimer


This publication is general in nature and is not intended to constitute any professional advice or an offer or solicitation to buy or sell any financial or investment products. You should seek separate professional advice before taking any action in relation to the matters dealt with in this publication. Please note our full disclaimer here.