Consensus Algorithm – Building Trust


Blockchain as the name indicates is a chain of blocks. Blocks are a set of transactions that are bundled together and presented to the nodes in the network which is verified and then added to the network.

In this article, we take a closer look at what happens under the hood of adding a block to the existing Blockchain network.

What are Transactions?

The starting point in a Blockchain is a transaction. A transaction is an exchange of an asset or information between two entities.

It could be a financial transaction involving exchange of crypto-currency or an exchange of digital asset vis-à-vis, a document containing steps to carry out a task.

Anatomy of a Transaction

In a traditional sense, a transaction would mean ‘give and take’ of an asset which involves monetary exchange.

In the Blockchain parlance, let us look at what makes up a transaction, or in short, what are the attributes of a transaction.

Each transaction is unique and carries a unique identifier by which it can be referenced.

This unique number is often referred to as a Transaction Hash which is derived by applying a cryptographic algorithm to arrive at a hash.

The most trending & Cutting edge technology and we offer it to you as a service

Blockchain Development

In a typical crypto network, a transaction entails transfer of cryptocurrency/token along with a transaction fee which goes towards the processing of the transaction and the block.

The transaction record also has a record of the Transaction status (Success/Failure). The success/failure of the transaction depends on various factors.

In the crypto world, a failed transaction may not result in transfer of tokens/crypto, however the transaction fee gets deducted irrespective of the transaction status.

How Blocks are Made?

Blocks are created at defined intervals and it consists of number of transaction sequenced together.

The block contains a hash which is generated at the time of creation and this is called the Block Hash.

The block also contains another special hash which helps in quickly locating a transaction within the block. This hash is called as “Merkle Hash”, named after the person who patented it.

Merkle Tree

Merkle tree is a tree wherein

  • the leaf nodes are labeled with the hash of a data block and
  • A non-leaf node is labeled with the cryptographic hash of the labels of its child nodes.
  • Each node in a Merkle tree has 2 child nodes.

A representation of the Merkle tree is given below

The advantage of using a Merkle tree is that they are efficient in data verification in distributed systems because they use hashes instead of the full files.

This way the size also is relatively small.

Adding to the Blockchain

The main component of the Blockchain are the blocks which are the containers of the transactions.

Before a block can be added to the existing chain of blocks, each block has to be validated.

This process usually contains a computation of sorts to arrive at a number that is close to the hash of the generated block.

There are a number of ways (algorithms) by which the blocks are added to the Blockchain. We will take a look at the popular 2 method, aka Consensus algorithms.

Proof of Work

Proof-of-Work, or PoW, is one of the consensus algorithm used in a Blockchain network. The PoW algorithm is used to confirm transactions and add new blocks to the existing Blockchain.

In this, miners compete against each other to compute a mathematical puzzle to arrive at a hash in the least amount of time.

The first node to do that is called the “Miner” (of the block) and is rewarded. Bitcoin was the first Blockchain to implement Proof of Work, where the new blocks added would entail creation of new Bitcoins and being rewarded to the miner of the block.

Later, many other Blockchain networks have adopted this algorithm under their hood.

Proof of work is typically used in a crypto-based Blockchain which is permissionless.

Proof of Stake

Proof of stake (PoS) is a type of algorithm in which a Blockchain network aims to achieve distributed consensus.

In PoS-based networks, the creator of the next block is chosen via the stake (combinations of random selection and wealth or age).

As compared to PoW, where the miners solve a puzzle using computation power and are rewarded in the process with crypto-currencies, the PoS system does not carry a monetary reward for the “ownership” to add the block.

Leverge your Biggest Asset Data

Inquire Now

Some of the other known consensus algorithms are:

  • Proof of Authority (PoA)
  • Delegated Proof of Stake (DPoS)
  • Proof of elapsed time (PoET)

Blockchain solutions based on non-crypto models function a bit different when it comes to the consensus algorithm.

One of the commonly used non-crypto Blockchain framework , Hyperledger, allows for easy pluggable consensus mechanism, which is a topic that has not been covered in this post,

Karthik Rangamani has over 21 years of experience having worked extensively in the Data Storage domain. He has worked for companies like Legato, EMC (now DELL-EMC), Hewlett-Packard, Commvault. He has tremendous experience and expertise in Blockchain, Karthik is responsible for growing the Blockchain practice at Indium Software. He is a certified Project Management Professional from PMI, Certified Storage Professional from SNIA. He has delivered talks in Technical forums conducted by SNIA.