Consensus in Blockchain

In this Blockchain tutorial, we are going to learn about the concept of consensus in Blockchain. Here we will also learn about different types of consensus mechanisms and different consensus algorithms.

Here is the list of topics that we will discuss in this tutorial.

  • Introduction to consensus
  • Consensus Mechanism
  • Consensus Algorithms
  • Types of Consensus Algorithms
  • Proof-of-Work in Blockchain
  • Proof-of-Stake in Blockchain
  • Proof-of-Capacity in Blockchain
  • Proof-of-Elapsed-Time in Blockchain
  • Proof-of-Burn in Blockchain
  • Proof-of-Activity in Blockchain

Introduction to consensus in blockchain

Consensus is a method of achieving agreement on the final state of the data by multiple nodes in a distributed network. Now, this consensus is a distributed computing concept, and It is the backbone of blockchain technology.

Consensus in blockchain
Consensus in Blockchain

Now, achieving agreement between two nodes is very easy. But, in a blockchain, multiple nodes are participating in a distributed manner. In this case, approval of the final value or state of data is a challenging task.

This method of achieving the agreement on a common state or value among several nodes even with the failure of some nodes is known as distributed consensus.

Also, read, Blockchain Architecture

Consensus Mechanism

So, in a centralized system like banks, databases there is a central authority to manage data. For example, inserting a new record, updating an existing one, etc. And the central authority is the sole in charge of maintaining genuine records.

Whereas blockchains serve as decentralized, self-regulating systems. And these systems operate worldwide without any central authority.

This system involves the contribution of hundreds of thousands of participants in that network. And these participants help in the verification and authentication of blockchain transactions.

Now, to verify that all transactions on the network are authentic, all participants in the blockchain need to agree on the state or value of the transaction. And this crucial task is performed by the consensus mechanism.

For the last three decades, the concept of consensus mechanism has been researched by computer scientists. But, this concept has resurfaced in the spotlight thanks to the introduction of blockchain and Bitcoin.

Consensus Mechanism in blockchain
Consensus Mechanism in Blockchain

A consensus mechanism is a set of actions that all nodes in a blockchain follow to agree on a particular state or value. And a consensus mechanism must satisfy a set of requirements. These requirements are summarised as follows:

  • Agreement: In the blockchain network, all the genuine nodes must choose the same value.
  • Integrity: According to this rule no node can make a decision more than once in the single consensus phase.
  • Validity: All genuine nodes must agree on a value that is the same as the initial value offered by at least one genuine node.
  • Fault-tolerant: The consensus algorithm should function properly even in the presence of faulty or malicious nodes.
  • Termination: The consensus process is eventually terminated by all nodes, and a conclusion is reached.

Also, check out, Types Of Blockchain

Consensus Algorithms

A consensus algorithm is a method through which all peers in a Blockchain network reach a consensus on the current state of the distributed ledger. Thus, the consensus algorithms help to establish trust between the unknown peers in a distributed environment.

In essence, the consensus algorithm ensures that each new block added to the Blockchain is the only version of the truth that all nodes in the Blockchain agree on.

Types of Consensus Algorithms

Now we’ll look at a few different consensus algorithms and how they function.

Proof-of-Work (PoW)

Proof-of-Work is one of the very first consensus algorithms which was used in a blockchain application.

This consensus algorithm relies on proof that appropriate computational resources have been used before presenting a value for acceptance by the network.

It works by computing hash values and validating transactions until the hash value contains a predefined number of trailing zeros. The value that generates the hash with the required number of trailing zeros is known as a nonce.

Proof of Work in blockchain
Proof-of-Work (PoW)

Now, let’s take a look at some of the key features of this algorithm.

  • Proof-of-Work is a consensus algorithm created for permissionless public ledgers. And it relies on the computational capacity of the nodes in the network.
  • It is a decentralized consensus technique that requires participants to solve an arbitrary mathematical puzzle in order to prevent the system from being hacked.
  • In cryptocurrency mining, proof-of-work is extensively used to validate transactions and mine new tokens.
  • Proof-of-Work demands a large amount of energy, which only grows as the network size increases.
  • Bitcoin and Litecoin are two widely known cryptocurrencies using Proof-of-work.

But the main issue of this mechanism is that it uses a lot of energy and resources. In comparison to the consensus algorithms, this approach wastes a lot of processing resources and electricity solving cryptographic puzzles.

Read Decentralization in Blockchain

Proof-of-Stake (PoS)

The Proof of stake consensus algorithm was developed in 2011 as a replacement for the PoW.

Although both PoS and PoW have similar goals, they have several key differences and features, particularly when it comes to the validation of new blocks on the blockchain network.

According to the Proof of Stake (PoS) algorithm, a participant can mine or validate a transaction based upon how many coins (cryptocurrency) they hold. This implies that the more coins a miner holds, the greater their mining power.

This method is based on the idea that a node or user has a sufficient stake in the system. Therefore, the user has invested enough in the system so that any harmful attack by that user on the network would outweigh the benefits.

However, there is one more important concept in PoS which is called the coin age. The coin age is a criterion determined by the amount of time and number of coins that have not been spent. In this approach, the possibility of proposing and signing the next block rise with the coin age.

Proof of Stake in blockchain
Proof-of-Stake (PoS)

Now, let’s take a look at some of the key features of this algorithm.

  • In PoS, a validator is selected based upon its financial investment in the network.
  • The goal of this method is to minimize the centralization of mining centers and provide all miners a chance to validate.
  • In this method, there is no computational challenge to solve, hence it is energy efficient. Also, it does not reqiure any special hardware for minning.
  • Peercoin was the first to present this concept, and it will be implemented in the Ethereum.

Still, in terms of security, the PoS algorithm isn’t as reliable as PoW. As validators with a lot of coins can have a great influence on transaction verification.

Read Introduction to Quorum Blockchain

Proof-of-Capacity (PoC)

This consensus algorithm differs from Proof-of-Work, which makes use of CPU resources. This method uses the hard drive space as a resource to mine the blocks.

Proof-of-Capacity allows mining devices on the blockchain network, commonly known as nodes, to mine available cryptocurrency using free space on their hard drives.

Instead of repeatedly hashing for the solution value, PoC tends to work by maintaining a list of possible solutions on the hard drive of the mining device even before the mining starts.

Proof of Capacity in blockchain
Proof-of-Capacity (PoC)

So, validators or miners with more hard drive space have a better chance of being chosen to mine the next block and winning the block reward.

Now, let’s take a look at some of the key features of this algorithm.

  • The main advantage of a PoC system over proof-of-work (PoW) and proof-of-stake (PoS) systems is its efficiency.
  • The BurstCoin cryptocurrency was the first to implement this concept.
  • Additionally, Storj, Burst, Chia, and SpaceMint are examples of blockchains that use proof-of-capacity.
  • There is no need for dedicated hardware or frequent hard disc upgrades.

But, till now, this technology has been adopted by a limited number of developers. Also, while using this consensus method, malware in a mining device could affect the whole mining operation.

Proof-of-elapsed-time (PoET)

This algorithm is introduced in the year 2016 by Intel Corporation. And it only uses fair techniques to determine the next block. It is normally used on permission-based blockchain networks to determine mining rights and block winners.

Proof-of-elapsed-time (PoET) is a consensus technique that uses a fair lottery system to prevent high utilization and energy consumption while keeping the process efficient.

On a blockchain network, this algorithm decides mining rights and block winners using a randomly generated elapsed time.

Additionally, this algorithm improves transparency by ensuring lottery results are verifiable by external participants by running a trustworthy code in a safe environment.

Proof of elapsed time in blockchain
Proof-of-elapsed-time (PoET)

Using this algorithm, each participating node needs to wait for a randomly picked time. And, the first node to do so wins the new block. In this system, every node in the network takes a random wait time and then, proceeds to sleep for that amount of time.

The first to awaken that is, the one who has waited the least amount of time adds a new block to the chain. And also sends the essential information to the whole network of peers.

This cycle is then repeated to find the next block. Hyperledger Sawtooth is one of the main examples of this algorithm.

This algorithm’s main drawback is its reliance on specialized hardware Intel Software Guarded Extension (SGX). Due to the lack of established and tried-and-true protocols, it is vulnerable to a variety of security flaws.

Proof-of-Burn (PoB)

Proof-of-Burn (PoB) is another consensus algorithm that intends to tackle the immense energy consumption problem of PoW. And the PoB is also referred to as a PoW system without energy waste.

This algorithm works on the principle of permitting the validators to “burn” virtual currency tokens. And based upon the currency burned, a validator is granted access to add blocks in the blockchain.

Proof of Burn in blockchain
Proof-of-Burn (PoB)

In this method, validators ‘burn’ some value of coins by transmitting them to an unrecoverable address. By transferring coins to an unreachable address, validators acquire the right to execute mining based on a random selection method.

The greater coins the validators burn, the more likely it is that they will be chosen to mine the future block.

This implies that the validators have a long-term commitment in return for a short-term loss.

Proof-of-Activity (PoA)

This consensus algorithm is the combination of both Proof-of-Work (PoW) and Proof of Stake (PoS). The main aim of this algorithm is to ensure that all transactions on the blockchain are valid, also all miners come to a consensus.

In comparison to PoW, this is a more energy-efficient technique. It makes use of a new technique known as “Follow the Satoshi.”

The PoA algorithm intends to incorporate the best aspects of both the PoW and PoS systems; the mining process starts as a PoW system. But after a new block has been successfully mined, the system transforms into a PoS system.

Proof of activity in blockchain
Proof-of-Activity (PoA)

The mining process in the method starts the same way it does in PoW. In which different miners competing for higher processing power to find a new block. But this time, the newly discovered block simply holds a header value and the reward address of the miner.

Now, once a new block is mined or found the system transforms from PoW to PoS. Where a new, random cluster of validators from the blockchain network is chosen based on the header details.

And the selected validators need to sign or validate a block. The more coins a validator holds, the better their chances of being elected as a signer.

Now, when all the validators sign the new block, the block acquires the status of the complete block. After this, the block is added to the blockchain where transactions are recorded on it.

The most well-known cryptocurrency that utilizes the PoA consensus process is Decred (DCR).

In this tutorial, we have learned about the concept of consensus in Blockchain. And we discussed different types of consensus algorithms used in blockchain.

Here is the list of topics that we have discussed in this tutorial.

  • Introduction to consensus
  • Consensus Mechanism
  • Consensus Algorithms
  • Types of Consensus Algorithms
  • Proof-of-Work in Blockchain
  • Proof-of-Stake in Blockchain
  • Proof-of-Capacity in Blockchain
  • Proof-of-Elapsed-Time in Blockchain
  • Proof-of-Burn in Blockchain
  • Proof-of-Activity in Blockchain