Deploying a Multi-Node Hyperledger Fabric Network in 5 Steps

While there are many blockchain workshops and tutorials, most of these cover only single-host deployment. Let's fix this.

As blockchain networks become more sophisticated and heterogeneous, you will probably need more than one node in your deployment. At a Hyperledger meetup in Amsterdam, Vitaliy Chernov of Altoros provided attendees with a 5-step process for deploying a multi-node Hyperledger Fabric network. Vitaliy’s presentation involved an Orderer and three organizations, featuring a demonstration on invoking transactions.

Vitaliy Chernov at the meetup in Amsterdam

 

Prerequisites

Before getting started on deployment, anyone following Vitaliy’s guide will need four work stations or cloud instances with:

  • Linux Ubuntu 16.04 (or Cent OS 7)
  • Docker-CE (v17.12.1-ce) and Docker-Compose (v1.8.0)

In his presentation, Vitaliy set up his environment on Amazon Web Services (AWS). In case updates are needed, the following console commands can be run:

$ sudo apt-get update && sudo apt-get -y install docker-compose git jq
$ sudo usermod -aG docker $USER
$ exit

Once the prerequisites are met, simply follow the process step by step.

A network architecture with multiple nodes

 

Step 1: Get Fabric Starter

First, get Fabric Starter from GitHub.

$ git clone https://github.com/Altoros/fabric-starter.git
$ cd fabric-starter

This tool—created by Altoros—will help you to get started with Hyperledger Fabric.

Run the commands on all four nodes

 

Step 2: Network configuration—mapping nodes

Map the domain names of the nodes to real IP addresses.

$ export IP_ORDERER=18.222.125.243 IP1=18.191.152.58 IP2=18.222.145.192 IP3=18.191.209.53

Run the command on all four nodes

Once a node is mapped, it becomes publicly accessible.

Node details can be checked on AWS

 

Step 3: Generating certificates

Generate the certificates of the organizations on their nodes. Enter the following line on organization A’s host:

$ ./network.sh -m generate-peer –o a

Enter this line on organization B’s host:

$ ./network.sh -m generate-peer –o b

And this line on organization C’s host:

$ ./network.sh -m generate-peer –o c

Generating a certificate takes 7 seconds

Once a certificate is generated, it can be viewed using the following console command:

$ ls -lha

 

Step 4: Generating the Orderer

Use this code to generate the Orderer:

$ ./network.sh -m generate-orderer

The Orderer generates and writes a genesis block

Start the Orderer:

A genesis block combines the certificates of all the organizations

 

Step 5: Connecting orgs and peers

Finally, connect the organizations to their peers. Run the following line on organization A’s host:

$ ./network.sh -m up-1

This line is for organization B’s host:

$ ./network.sh -m up-2

And this line for organization C’s host:

$ ./network.sh -m up-3

The organizations are now connected on the network

 

Launch the Fabric API

Once the five steps are accomplished, the Hyperledger Fabric network is now ready to be tested and used. Each organization’s node can be accessed by entering its IP address on a web browser. The port 4000 should be opened. After that, go to the admin section.

Connecting to organization A

Using this process, one can easily deploy a multi-node blockchain network. More importantly, we hope it helps with providing valuable hands-on experience using blockchain. If you want to learn more about Fabric Starter, download this cheat sheet.

 

Want details? Watch the video!

Table of contents

  1. Meeting prerequisites (6’40”)
  2. Step 1. Get Fabric-Starter (7’17”)
  3. Step 2. Map the nodes (8’03”)
  4. Step 3. Generate certificates (9’25”)
  5. Step 4. Generate the Orderer (11’05”)
  6. Step 5. Connect the organizations (12’08”)
  7. Demo: invoking transactions (13’25”)
  8. Questions and answers (25’07”)

 

 

Related slides

 

Further reading

 

About the expert

Vitaliy Chernov is VP of Blockchain Practice at Altoros. He has an engineering background in Electronics and holds an MBA degree majoring in Finance from Manchester Business School. His career started in banking—trading in capital markets helped him to accumulate knowledge of financial instruments and trading systems. Later on, Vitaliy worked as a Finance Director focusing on FinTech solutions that gave profound knowledge of business processes in various industries: consumer goods production, telco, retail, and real estate development. With emergence of blockchain, he has realized new potential as an investor and ICO researcher and now contributes as a blockchain business trainer focusing on business solutions.

This article was written by Carlo Gutierrez with assistance from Alex Khizhniak and Vitaliy Chernov.