Hyperledger Fabric

Basic details and installation process


Hyperledger project is an opensource collaborative effort created to advance cross-industry blockchain technology.

It is a collection of the project under hyperledger initiative created by Linux Foundation.

There are two types of projects-

  1. A framework, like Hyperledger Composer
  2. A tool, like Hyperledger Fabric

Hyperledger fabric is a Distributed Ledger Technology (DLT) framework for building Business Blockchain Applications.

It has four characteristics which make it suitable for a business environment-

  1. Permissioned Network
  2. Member identities are known among network users.
  3. Participants have role-based access to the network application.
  4. Confidential transaction
  5. Not all transactions should be visible to all the members of the network.
  6. Members of the network have the option to transact privately.
  7. No cryptocurrency
  8. No incentivization needed.
  9. No crypto tokens needed for the transaction.
  10. Programmable
  11. The smart contract can be made according to the Business need.
  12. Business Logic Implementation is possible on the blockchain network.

Blockchain Network

All the blockchain technologies have the concept os nodes, which are connected to other nodes to form a blockchain network.

Node are of three types

  1. Orderer
  2. Peer (Leader, Anchor)
  3. Client

1. Orderer

a. Communication channel for fabric.

b. Responsible for consistent ledger state across the network. Provides consensus mechanism. Ensures order of transaction.

c. Creates the blocks and generates atomic delivery.

d. Implemented with Message Oriented Middleware.

2. Peer

a. Maintain its own copy of the ledger.

b. Anchor Peers are known outside the Organization, Discoverable, Each organization must have at least one anchor peer.

c. Leader Peers receive blocks from Orderer. May be assigned statically or dynamically. Leadership is at the channel level.

3. Client

  1. Act on behalf of the end-user.
  2. Creates transaction requests and submits to the network.


  1. Transactions can be isolated within the channel.
  2. Chain code is deployed to a channel, not the network.
  3. Ordering System channel gets automatically created at the time of network initialization.
  4. Organizations/Peers may join multiple channels.


An association of two or more individuals, companies, organizations, or governments with the objective of achieving a common goal.

Types of consortium

  1. Industry consortium –
  • Here, the members are from the same industry.
  • These are also known as Business Consortium or Consortia.
  1. Technology consortium –
  • It is focused on the technology like WC3, Hyperledger, Enterprise Ethereum Alliance.

Benefits of Consortium –

  1. Standardization
  2. Collaboration
  3. Efficiencies

Members of the consortium make decisions like

  • Rules for Addition/Removal of members
  • Access/Authorization policies
  • Configuration of the system

Installation Process


Step 1. Update the package list

sudo apt-get update

Step 2. Install cURL

sudo apt install curl

Step 3. Check curl version

curl — version


Step 1. Update the package list

sudo apt-get update

Step 2. Install the required packages

sudo apt-get install apt-transport-https ca-certificates gnupg-agent software-properties-common

Step 3. Add Docker’s official GPG key:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add –

Step 4. Setup the Docker stable repository

sudo add-apt-repository “deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable”

Step 5. Update the package list

sudo apt-get update

Step 6. Install the latest version of Docker engine

sudo apt-get install docker-ce docker-ce-cli containerd.io

Step 7. Add user to Docker group

In order to run the docker commands without sudo, you need to add the current user to the docker group with the below command.

sudo usermod -aG docker $USER

To confirm if the user is added to the docker group, try the command

id -nG

Step 8. Check Docker version

docker version

Docker version 19.03.8, build afacb8b7f0

Step 9. Verify the Docker Engine

The below command downloads a test image and runs it in a container. When the container runs, it prints an informational message and exits.

docker run hello-world

Install Docker Compose

Step 1. Download the latest version of the Docker Compose

sudo curl -L “https://github.com/docker/compose/releases/download/1.25.5/docker-compose-$(uname -s)-$(uname -m)” -o /usr/local/bin/docker-compose

Step 2. Apply executable permissions to the binary

sudo chmod +x /usr/local/bin/docker-compose

Step 3. Check Docker Compose version

docker-compose — version

docker-compose version 1.25.5, build 8a1c60f6

Install Go

The recommended version of Go is version 1.12.x.

Step 1. Download the tar file

curl -O https://storage.googleapis.com/golang/go1.12.9.linux-amd64.tar.gz

Step 2. Extract the tar file

tar -xvf go1.12.9.linux-amd64.tar.gz

Step 3. Move the go directory

sudo mv go /usr/local

Step 4. Update environment variables

We need to update environment variables i.e. PATH and GOPATH. For this, the user’s profile needs to be updated.

nano ~/.profile

Add the below in the .profile file.

export GOPATH=$HOME/go

export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin

Save the .profile file and load the updated environment variables.

source ~/.profile

Step 5. Check to GoLang version

go version

go version go1.12.9 linux/amd64

Install Node.js and NPM

If you will be developing applications for Hyperledger Fabric leveraging the Hyperledger Fabric SDK for Node.js, version 8 is supported from 8.9.4 and higher. Node.js version 10 is supported by 10.15.3 and higher.

We will be installing a 10.x version. Installing Node.js will also install NPM

Step 1. Install the Node.js v10.x repository

curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash –

Step 2. Install nodejs

sudo apt-get install -y nodejs

Step 3. Check node version

node -v


Step 4. Check NPM version

npm -v


Install Hyperledger Samples, Binaries and Docker Images

Under Fabric 1.4.x releases, v 1.4.7 is the latest release and we will install this version.

Step 1. Before downloading the Fabric binaries, create a directory for e.g. hyperledger in your home path.

mkdir hyperledger

cd hyperledger/

Step 2. Download Fabric v1.4.7

From the hyperledger directory (for e.g. /home/jay/hyperledger) run the below command. Please note, this will take quite some time based on your internet speed.

curl -sSL http://bit.ly/2ysbOFE | bash -s — 1.4.7 1.4.7 0.4.20

Step 3. Update environment variable

nano ~/.profile

Add the fabric bin path to the PATH variable. Please make sure to use the path where you have downloaded fabric binaries.

export PATH=/home/$USER/hyperledger/fabric-samples/bin:$PATH

Save the .profile file and load the updated environment variables.

source ~/.profile


A utility for generating crypto material for testing.

Command to get help

cryptogen help

cryptogen command help

cryptogen showtemplate

  • Shows the template that can be used for creating your own config file.
  • Users provide the YML file input

cryptogen generate

to generate the crypto-material. This is used for generating crypto material for testing.

Cryptogen configuration file setup

Crypto-config.yaml file has two sections

  • OrdererOrgs — A list of organizations managing orderers.

PeerOrgs — A list of member Organizations managing peers.

  • Use specs for specific peer hostname
  • Use the template for defining multiple peers
  • Creates crypto for multiple peers i.e. Peer0 and Peer1

To create the configuration folder with all the details about the different organization within the network,

cryptogen generate — config=./crypto-config.yaml

The command is used.



Hyperledger Fabric was originally published in The Capital on Medium, where people are continuing the conversation by highlighting and responding to this story.

Post fetched from this article