Open In App

Consensus in Hyperledger Fabric

Hyperledger Fabric is a Distributed Ledger technology developed by Linux, it is open-source and enterprise-grade. It was primarily developed to help in the development of Decentralized Applications that use Blockchain Technology. Consensus plays a vital role in Hyperledger Fabric because it confirms the agreement of all the participants (blocks) in a network based on the validity of the transaction happening and the current step of the ledger. The article focuses on discussing the consensus in Hyperledger Fabric.

What is Consensus?

The term “consensus” means an agreement or a decision taken by a group of individuals. It also states that regarding a certain topic or problem, all the members of a team or group have come to the conclusion that everyone will accept the certain way or method using which they will solve the problem.

This is why Consensus is very important in the case of Blockchain Technology and Hyperledger Fabric.

Comparison of the Different Types of Consensus:

Consensus Name

Brief Description



Proof of Work

Here, the miners solve complex mathematical problems and whoever solves it first gets to add the block to the Chain.

1. Very secure due to complex mathematical processes.

2. It is Decentralized and used in major cryptocurrencies like Bitcoin.

1. Very high energy consumption, which affects the environment.

2. Slow transaction.

3. Vulnerable to attacks if only one person controls the majority of the mining and adding.

Proof of Stake

Here, validators, i.e. miners are invited to create a new block based on the number of cryptocurrencies they put at “stake.”

1. Environment-friendly and energy efficient.

2. Faster transaction speed compared to PoW.

3. Not vulnerable to 51% attack

1. Those “Validators” who have a greater “stake” have greater control over the chain.

2. Those who put bigger stakes receive bigger rewards.

Delegated Proof of Stake

Everyone is given the opportunity to vote for a limited amount of people who are responsible for new block creation and validation.

1. Scalable and Fast transaction.

2. uses less energy than PoW and is more decentralized than normal PoS.

1. As it depends on voting, those who get the maximum votes hold most of the power.

2. Due to this there might be some problems between them. People tend to vote less so that they could be selected as a candidate.

Proof of Importance

Consensus which is used in NEM Blockchain. Considers both the number of coins held as well as the number of transactions done by a single account while creating a block.

1. Anyone can participate.

2. Those who actively participate and contributes gets rewarded.

1. Finding the importance of an account becomes tough sometimes.

2. Prone to Sybil attacks

Proof of Capacity/ Proof of Space

Miners need to use their own storage to solve and my cryptocurrencies.

1. Energy efficiency as compared to PoW.

2. The more storage they use, the better rewards they get

1. Miners allocating more space has the advantage.

2. Setup cost is high as the miners need to use their own device’s space.

3. Miners can have some evil intentions.

Proof of Elapsed Time This is developed by Intel, here the miners need to prove that they have waited a certain amount of time. 1. Energy efficient.
2. easily scalable.
1. Requires trusted hardware (mostly Intel’s own hardware).
2. Limited decentralization.
3. Prone to time manipulation attacks.

Hybrid Proof of Activity

Combination of both PoW and PoS. PoW is used for block creation due to its secure nature, PoS is used for validation due to its energy efficiency.

1. Uses the advantages of both PoW and PoS.

2. More secure due to the use of PoW and energy efficient due to the use of PoS.

1. Implementation is complex.

2. Centralization risk due to the use of PoW.

Proof of Authority

The network approves some Block validators who validate already created blocks and can also create new blocks.

1. High transaction throughput with low latency.

2. Efficient, Scalable, uses less energy

1. It relies upon very few validators.

2. Less censorship due to more centralized control.

Proof of Burn

Miners burn coins allocated to them by the network to earn the rights to mine blocks.

1. Alternative of PoW and PoS.

2. Due to burning, reduces the supply of coins, the value of coins increases

1. Destruction process can’t be reversed.

2. Limited use

3. Distribution of coins might not be the same.

Byzantine Fault Tolerance

Even if there are faulty blocks, a consensus is reached amongst others so that the network works.

1. High fault tolerance.

2. Fast and efficient finality.

3. Compatible with permission and private networks

1. Limited scalability.

2. Communication overhead increases with the increase in number of nodes.

3. Requires a set of trusted nodes.

Consensus and Its Interaction with Other Architectural Layers

1. Network Layer

Every consensus requires smooth and reliable communication between each node in the network to reach an agreement. Networking protocols are used to exchange information and do transactions.

2. Data Layer

Every node in the network consists of validated transaction information, consensus protocol ensures the order of these blocks by discussing with other nodes.

3. Cryptography Layer

Cryptography plays a crucial role in doing transactions and keeping the network secure. Different techniques like Hash Function, Digital Signature, etc. are used in various consensus mechanisms.

4. Smart Contract Layer

These are executed based on the condition of the network, consensus mechanisms ensure the state of the network which ensures consistent execution of transactions among each node.

5. Incentive Layer

Many consensus mechanisms use Incentive mechanisms or reward mechanisms to encourage more miners to join.

6. Governance Layer

Some mechanisms of voting are used to select miners, validators, etc. This layer controls all the governance-related things such as voting to select the miner, upgrading the network protocols, etc.

7. Security Layer

The use of the Proper consensus mechanism plays a vital role in securing the network.

8. User Interface Layer

This provides information about the current state of the network i.e. entire Blockchain. The consensus mechanism makes sure that all the nodes are in a stable state and that the transactions are happening smoothly.

Property of Consensus:

There are two properties of Consensus that must be satisfied to guarantee agreement among the participating nodes/blocks. They are:

1. Liveness

Liveness means that all the participating nodes in the network will receive complete information regarding the transaction that is happening so that they can agree to that, and the transaction is moved to the next node.

2. Safety

Safety means that each participating node must receive the same sequence of input and input details and the same sequential output. When a single node receives some sequential input from another node, it changes its state, and all the states of each node should be identical in the entire network. Which signifies that the transaction has been done by an authorized party and is valid.

3. Finality

It ensures that after a transaction has been made and validated and stored in the block, it can’t be reversed.

4. Decentralization

It means distributing the ownership and decision-making capability amongst the participants of the network. So that no one can single-handedly manipulate the network.

5. Scalability

It means that the consensus can handle the growing number of nodes in the network without causing any problems.

6. Energy Efficiency

Being energy efficient is very important as the number of nodes is growing very fast, miners need to keep in mind that the mining process doesn’t harm the environment heavily.

Phases of Consensus in Hyperledger Fabric:

There are three phases of consensus used in Hyperledger Fabric.

1. Endorsement

Endorsement works on the principle that how many nodes vote for the transaction to be valid, i.e., endorse it. It is like collecting signatures for a petition. The more there are the stronger the support for the petition. This logic is used here, the more endorsements by nodes, the sure you are that the transaction is valid.

2. Ordering

The ordering phase comes after the Endorsement phase, it agrees to the sequential order of the execution of the Hyperledger decided earlier.

3. Validation

Validation, as the name suggests, is the validation of the data stored in any node. It takes into account the nodes in which the transactions are occurring in the order decided in the earlier stage. Checks the input and the result stored in the node and gives validation.

Kafka in Hyperledger Fabric Ordering Service:

Kafka also known as Voting-Based consensus is the most common type of consensus used in Hyperledger Fabric.

Phases of Consensus and Kafka:

In the world of Distributed Systems and messaging systems like Kafka, the term “consensus” refers to a certain number of nodes or systems agreeing on a term or decision. This ensures that even if there are some faults present in the network, it reaches a constant stable state.

Phases of Consensus:

  1. Electing a Leader: Deciding and Electing a leader is one of the most important things in any Distributed Network because that leader will be responsible for carrying out the consensus process and trying to convince everyone to agree on a certain conclusion so that the network can be formed.
  2. Proposal and Acceptance: After electing the leader, they will propose a condition to the other nodes upon which they will agree or share their views to reach a consensus.
  3. Agreement: When the majority of the follower nodes accept the decision made by the elected leader, the consensus stage is achieved.
  4. Commitment: Once the consensus is reached, all the follower nodes are committed to follow what has been agreed upon. In a system like Kafka, these agreed-upon values are either committed to the database or added to the log.

Phases of Kafka:

  1. Producer Phase: Producers are those who publish messages related to Kafka topics. They write the data to the leader partition of the selected topic and the leader is responsible to order the incoming messages and sort them in a manner so that no duplication arises.
  2. Broker Phase: Kafka brokers are responsible for forming the Kafka Cluster, they receive and store messages from the producers and serve the customers. They also replicate the stored data across different nodes to ensure fault tolerance and data availability.
  3. Consumer Phase: Consumers are those who read those messages from Kafka Topics. They can be a part of a certain Kafka consumer group and each of those groups reads messages from a subset of partitions. Consumers can also use their offsets to track their consumed message progress.
  4. Replication Phase: Kafka uses Data redundancy for more durability, Each Kafka partition consists of a leader and multiple follower replicas. The leader’s responsibility is to read and write requests for a certain partition while the followers replicate those data to stay in a synchronized manner with the leader.
  5. Data Retention Phase: Kafka supports a data retention policy that ensures that for how long a message should stay in that certain topic. Once the retention phase is reached, those messages can be compacted based on the retention strategy decided by Kafka.

RAFT in Hyperledger Fabric:

RAFT offers many of the same features as KAFKA but in a simpler and easier-to-use package. It introduces a number of new concepts on existing concepts to Fabric.

  1. In this consensus mechanism, the nodes can be leaders, followers, or a candidate where a leader is nominated by the nodes through election.
  2. In the election process, when a leader completes a term or is unreachable then based on a time-out value the nodes nominate themselves as candidates. The time-out value is 150ms to 300ms.
  3. The remaining nodes then nominate a leader by voting.
  4. Once a leader is elected all the messages are sent via the leader.

Log Replication:

When a leader receives a message, the following happens:

  1. It propagates the message to all the nodes.
  2. The nodes then validate and write the messages and will also send a response back to the leader informing them that the message has been validated and written.
  3. When the leader receives the response from all the nodes then it commits the message and informs all the nodes that the message has been committed.
  4. The follower nodes commit the message, and the consensus is achieved.
  5. RAFT requires 2f+1 nodes and replicas and must have f+1 nodes active. It is crash fault tolerant but is not BFT.

Byzantine Fault Tolerance:

Byzantine Fault Tolerance is a property that ensures that the Hyperledger network will eventually reach a consensus, even if there are some faults present in the network or some nodes are corrupted.


As we saw, consensus plays a vital role in the Hyperledger Fabric as well as Blockchain Technology. It is one of the core concepts behind Blockchain Technology and without which the entire Blockchain Technology will not come into existence. There are many Consensus Algorithms used like Proof of Work (PoW), Delayed Proof of Work (dPoW), Proof of Stake (PoS), Delegated Proof of Stake (dPoS), etc.

Article Tags :