Running a smart contract on the blockchain network



Considering that Hyperledger Fabric has several order service implementations (including Solo, Kafka and Raft), you, the developer, must understand the advantages and disadvantages of each implementation before opting for a design. As the new standard for production blockchain networks, the Raft consensus algorithm is a fault-tolerant ordering service implementation, which is easier to configure and manage than Kafka. Most importantly, Raft allows different organizations to contribute nodes to the ordering service, allowing for a more decentralized network architecture.


Given that there are many possible ways that nodes in a blockchain network can reach an agreement (or consensus), and that agreement is essential for a distributed computing network, it is not surprising that the debate about the most efficient consensus algorithm is often heated, and even religious. At the heart of consensus algorithms is the need to resolve a difficult, popular and distributed computing issue: how can we (computers) agree on a result (reach consensus) among a group of computers when we know that computers are unreliable ? Although there is no perfect way to solve this problem, the pattern, in fact, since 1989, has been the Paxos algorithm. The problem with Paxos is that it can take years for doctoral students to master it. Even the most brilliant engineers who try to implement this algorithm in practice find it difficult to understand and thus implement their solution.

That’s where Raft comes in. Designed as an alternative consensus algorithm for Paxos, Raft is much easier to understand and is now used in some of the most successful software projects, such as Docker. Since the launch of Hyperledger Fabric, the consensus has been designed as pluggable, and you, the developer, can choose which type of consensus your order nodes will use. Raft allows for a much easier configuration than Kafka, a more decentralized approach, as several organizations can contribute with us to the ordering service and greater tolerance to collision failures than Solo, which has a single node request. This code pattern helps you understand how to build and deploy a smart contract on a Hyperledger Fabric network running Raft and allows you to test the network’s tolerance by stopping and starting some order nodes.

When you complete this code pattern, you will understand:

How the Raft algorithm works;
How to build and execute a Raft order service with several organizations in Hyperledger Fabric;
How to send transactions and run a blockchain network using a Raft ordering service;
How to test the fault tolerance of the order service by deleting (locking) one of the order nodes.


Please enter your comment!
Please enter your name here