Hyperledger: The Complete Guide Tutorial | CHECK-OUT
Hyperledger Tutorial

Hyperledger: The Complete Guide Tutorial For Free | CHECK-OUT

Last updated on 07th Jul 2020, Blog, Tutorials

About author

Gejan vikas (Blockchain Developer )

Gejan Vikas has 7+ years of experience in Web3.js, Ethereum, Truffle, Remix, Smart Contracts, Cryptography, Wallets, Blockchain Fundamentals, and Defi. His articles assist in sharing information and abilities in core fields and provide students with informative knowledge.

(5.0) | 19276 Ratings 1117


Hyperledger is an umbrella project, under the Linux Foundation. NodeJs, Alljoyn, Dronecode are some example projects that have adopted the “Linux Way”, i.e. to weave a community of developers who work on open source projects thus maintaining a cycle where a  piece of code is constantly getting modified and redistributed.


Hyperledger is an open source collaborative effort created to advance cross-industry blockchain technologies. It is a global collaboration, hosted by The Linux Foundation, including leaders in finance, banking, Internet of Things, supply chains, manufacturing, and Technology.”

Subscribe For Free Demo

Hyperledger Projects

The “umbrella strategy” of Hyperledger incubates and promotes a range of business blockchain technologies, framework, libraries, interfaces, and application. Currently, Hyperledger is the host of the following projects:

  • Hyperledger Sawtooth: This is a modular blockchain suite developed by Intel, which uses a new consensus algorithm called Proof of Elapsed Time (PoeT).
  • Hyperledger Iroha: Iroha is a project of a couple of Japanese companies to create an easy to incorporate the framework for a blockchain.
  • Hyperledger Fabric (Hyperledger IBM): This project is lead by IBM. Fabric is a plug and plays implementation of blockchain technology designed as a foundation to develop high-scaling blockchain applications with a flexible degree of permissions.
  • Hyperledger Burrow: This project develops a permissible smart contract machine along the specification of Ethereum.
  • Hyperledger Composer: A tool for building blockchain business networks.
  • Hyperledger Explorer: Hyperledger Explorer is a blockchain module and one of the Hyperledger projects hosted by The Linux Foundation. Designed to create a user-friendly Web application, Hyperledger Explorer can view, invoke, deploy or query blocks, transactions and associated data, network information (name, status, list of nodes), chain codes and transaction families, as well as any other relevant information stored in the ledger.
  • Hyperledger Indy: Hyperledger Indy is a collection of tools, libraries and further components for digital identities rooted on blockchains.
  • Hyperledger Cello: A blockchain as-a-service deployment model.
hyperledger apis, sdks,cli

Hyperledger Fabric

Fabric and it work :

 The framework is implemented in Go. It is made for enabling consortium blockchains with different degrees of permissions. Fabric heavily relies on a smart contract system called Chaincode, which every peer of the networks runs in Docker containers. An overview of Fabric’s technology can be found in the manual.

While not completely and generally permissioned, Fabric allows enterprises to make parts of the blockchain, if not all, permissioned. Participants usually need to register to get the permission to join and issue transactions on a Fabric based blockchain.  To use resources more efficiently, Fabric has fewer nodes than a public chain and computes data massively in parallel, which makes Fabric scale much better than public blockchains. Also, its basic architecture supports confidential data, giving its members more privacy as they find on a public blockchain.

What is Hyperledger Fabric? Why is it a good fit for enterprises?

Fabric has some key properties that differentiate it from other blockchains. To keep it simple, this is what you need to know:

  • It’s a permitted blockchain. It’s not designed to be open to the world but you can add as many entities as you want.
  • It supports smart contracts, the same way Ethereum does. It’s written in chaincode (Fabric’s fancy word for smart contract code). All you need to know is that Fabric’s smart contracts are written in Go.
  • There is a concept of “Channels” where parties that are part of a blockchain can create separate transactions privately and then pass the final state to the be recorded on the main blockchain. This is not unlike state channels in other blockchains, but there is an additional privacy layer.
  • All participants have known identities, maintained by what Fabric calls “Membership Service Providers” (MSP). If you’re allowing a group of 10 hospitals to participate in your blockchain, each of the 10 hospitals are known to the network. This is the key feature of Hyperledger Fabric that makes it fit well with enterprise solutions.
  • Consensus: Fabric doesn’t use typical Proof of Work or Proof of Stake mechanisms to achieve consensus. Because it’s highly permitted, it uses a sequence of verified transactions (based on MSP) instead. You can use chaincode to only accept a transaction if two parties who conduct a transaction both sign it and then peers that take in the transaction validate it as well. In short, all you need to worry about for now is that multiple verified participants need to sign transactions for them to get included to the ledger. This is a good fit for enterprise based blockchains that don’t have a huge number of participants. Because the participants are known to each other, there is a natural deterrent to malicious behavior. Read more here. This is a simple transaction flow diagram. You don’t need to understand all the details for now.
hyperledger fabric

These key properties of Fabric give you the background info you need to start working with it. Like anything, the best way to learn is to dive right in and roll up your sleeves. Let’s fire up our own network and start tinkering with Fabric!

Hyperledger work

  • On a Hyperledger based network though, it’s a completely different story! The peers directly affiliated with the deal are connected, and only their ledgers get updated about the deal. Third parties who help carry out the transaction only get to know the exact amount of information they need with the help of permission and regulations levied on the network.
  • Suppose Alice and Bob were executing their special transaction on a Hyperledger based network, she would look up Bob through an app which in returns queries a membership service. After the membership has been validated, the two peers are connected and results are generated. In this two-party agreement, both results have to be the same for them to get validated. But in other transactions with multiple parties, more rules can be applied. These generated transactions are now sent to a consensus cloud for ordering, following which they are committed to their respective ledgers.

Installing components

Step 1: Install the CLI tools

  • There are a few useful CLI tools for Composer developers. The most important one is composer-cli, which contains all the essential operations, so we’ll install that first. Next, we’ll also pick up generator-hyperledger-composer, composer-rest-server and Yeoman plus the generator-hyperledger-composer. Those last 3 are not core parts of the development environment, but they’ll be useful if you’re following the tutorials or developing applications that interact with your Business Network, so we’ll get them installed now.
  • Note that you should not use su or sudo for the following npm commands.

       Essential CLI tools:

  • npm install -g composer-cli@0.19

Utility for running a REST Server on your machine to expose your business networks as RESTful APIs:

  • npm install -g composer-rest-server@0.19

Useful utility for generating application assets:

  • npm install -g generator-hyperledger-composer@0.19

Yeoman is a tool for generating applications, which utilises generator-hyperledger-composer:

  •  npm install -g yo

Step 2: Install Playground

  • If you’ve already tried Composer online, you’ll have seen the browser app “Playground”. You can run this locally on your development machine too, giving you a UI for viewing and demonstrating your business networks.
  • Browser app for simple editing and testing Business Networks:
  • npm install -g composer-playground@0.19

Step 3: Set up your IDE

Whilst the browser app can be used to work on your Business Network code, most users will prefer to work in an IDE. Our favourite is VSCode, because a Composer extension is available.

  •        Install VSCode from this URL: https://code.visualstudio.com/download

Open VSCode, go to Extensions, then search for and install the Hyperledger Composer extension from the Marketplace.

Step 4: Install Hyperledger Fabric


  • cURL — latest version
  • Docker — version 17.06.2-ce or greater
  • Docker Compose — version 1.14.0 or greater
  • Golang — version 1.11.x
  • Nodejs — version 8.x (other versions are not in support yet)
  • NPM — version 5.x
  • Python 2.7

These prerequisites’ versions are according to the fabric v1.4 documentation.

 Linux Installation

  • Linux installation is pretty straight forward compared to windows. Few commands and Fabric is ready.
  • I have provisioned a Linux 16.04 VM from AWS for this article. All the instructions will run in the terminal. I haven’t found any system requirement information in Hyperledger documentation. Please comment if you have a reference for the system requirement.

Step 1: Create a new sudo user

It is recommended that Hyperledger Fabric shouldn’t be installed as a root user. Open the terminal.

Add the new user “fabric”

  •                                   sudo adduser fabric

Add the user “fabric” to the Sudo groups

  •                         sudo usermod -aG sudo newuser

Login to “fabric” user

  •                         su fabric

Test the sudo access

  •                          sudo ls

If you get any error then the user is not added to the sudo group. Follow this link for more information.

Course Curriculum

Learn Expert-led Hyperledger Blockchain Training By Industry Experts

  • Instructor-led Sessions
  • Real-life Case Studies
  • Assignments
Explore Curriculum

Step 2: cURL

  • Check if your Linux has curl install or not. curl –version
  • If not follow the below instructions to install:
  •                    sudo apt-get update
  •                   sudo apt-get install curl
  •                       curl –version

Step 3: Docker and Docker Compose

Install the latest version of Docker from the official Docker repository.

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

Add the Docker repository to APT sources

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

Update the package database

  •                           sudo apt-get update

Install Docker

  •                      sudo apt-get install -y docker-ce

To use docker commands it requires root privileges. Instead of using sudo for all the docker commands, add the user to docker group

  •                        sudo usermod -aG docker fabric

Logout using exit command and log in again. Check the groups’ user is part of, using id -nG command.

  •                      fabric sudo docker

Test the Installation :

Check the docker and docker-compose version

  •                 docker –version
  •              docker-compose –version

Pull the hello-world image from Docker Hub and run a container:

  •                docker run hello-world
  •               docker hello world

If you get this message then your is successfully installed.

Step 4: Golang

Install the golang package

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

Extract the package

  • tar xvf go1.11.linux-amd64.tar.gz

Check the go version

  •                          go version

Set the GOPATH

  •                    export GOPATH=$HOME/go
  •                 export PATH=$PATH:$GOPATH/bin

For more installation information follow this link and for GOPATH follow this link.

Step 4: Nodejs and npm

Download the installation script using curl

  • curl -sL https://deb.nodesource.com/setup_8.x -o nodesource_setup.sh

Run the script under sudo

  •                       sudo bash nodesource_setup.sh

Install the nodejs

  • sudo apt-get install nodejs

With nodejs, npm also get installed. Check their version

  • node -v
  • Output
  • v8.16.0
  • npm -v
  • v6.4.1

Step 5: Python 2.7

By default ubuntu 16.04 comes with Python 3.5.1 installed as python3 binary.

To install python 2.7

  • sudo apt-get install python

Check the python version:

python –version : Python 2.7.12

All the prerequisites are installed. Now, let’s install the Hyperledger Fabric v1.4.

Step 6: Install Samples, Binaries and Docker Images

Determine the directory where you want to download the fabric samples. Open the directory in terminal and run the below command.

  •         curl -sSL http://bit.ly/2ysbOFE | bash -s

It will download the latest production release.

If you want a specific release for ex. v1.4.1, follow the below command.

  • curl -sSL http://bit.ly/2ysbOFE | bash -s — <fabric_version> <fabric-ca_version> <thirdparty_version>
  • curl -sSL http://bit.ly/2ysbOFE | bash -s — 1.4.1 1.4.1 0.4.15

It’ll take some time, once it is finished you can see a new directory “fabric-samples”.“fabric-samples” come with sample examples to start with Hyperledger Fabric. There are many good examples to play within the fabric samples.

Step 7: Test the fabric network

As we have successfully completed the setting up the Fabric environment, let’s test it. To test it we’ll use first-network sample in the fabric-samples. Open the fabric-samples and go to first-network.

  •                      cd fabric-samples/first-network
  •                            first-network

To test it, run the byfn.sh . It is a test script, it first setup the network with 2 organizations org1 and org2 with 2 peers each and an orderer .

  •                        ./byfn.sh up
  •                               first-network start

On successful execution, you’ll see the below message.

  •               first-network end

If you reach till this point it means you have successfully setup the fabric network. Now, we have completed the testing of first-network, clean the network.

./byfn down

Congratulations, we have completed the Hyper ledger Fabric installation in Linux machine.

Windows Installation

  • For Windows installation, you should be prepared for some obstacles as installation on windows is not easy peasy.
  • Let’s begin the windows installation.
  • I am using Windows 10 Pro for the Fabric v1.4 installation.

Step 1: cURL

Please check if cURL is already installed in your PC.

  •                     curl –help

If you don’t get any error it means cURL is installed in your PC and you can go to the next step. For others please follow the below steps.

To install cURL, download the package according to your Windows 32/64 bit from this link. Extract the package and run the curl.exe present in the bin folder.

  • Add the curl in the environment variable.
  • Open the cmd and check the curl –help .

Step 2: Docker and Docker Compose

  • Before installing the docker, check if virtualization is Enabled in your PC or not. To check it, openTask Manager >> Performance Tab >> CPU
  • virtualization
  • From the BIOS settings, virtualization can be turned to Enabled. Instructions to enter BIOS settings vary from pc manufacturer to manufacturer. Please check this link for the instructions.
  • Once the virtualization is Enabled we can move to download the docker.
  • Please be sure which Windows you’re using before installing Docker. There are 2 versions of Docker for Windows.
    • Docker Toolbox — Windows 8, Windows 10 Home
    • Docker Desktop — Windows 10 Pro, Enterprise — 64 bit
  • You first need to have an account in DockerHub to download the docker desktop. Please signup if you don’t have one.
  • Download the docker from this link.

Note: While installing keep the settings default don’t change anything.

Test the Installation

  • Open the cmd window
  • Run docker –version and docker-compose –version

docker –version : Docker version 18.09.2, build 6247962

docker-compose –version : docker-compose version 1.23.2, build 1110ad01

Pull the hello-world image from Docker Hub and run a container:

  •          docker run hello-world
  •                      docker hello-world

If you get this message then the Docker installed successfully in your machine.

For more information on Docker check the official documentation.

Step 3: Golang

  • Download the Golang package from the official site.
  • Once it is installed open the command prompt and run

go version


go version go1.11.5 windows/amd64

Step 4: Nodejs and npm

  • Download the node v8.x from this link and install it.
  • Check if it is installed correctly.
  • node -v
  • v8.16.0
  • npm -v 
  • 6.4.1

Step 5: Python 2.7

  • Download the python 2.7 from its official site.
  • While installing add python to the system Path variable. This allows you to type ‘python’ into a command prompt without needing the full path.
  • Change Add python.exe to Path to Will be installed on the local hard drive
  • python-path
  • Check the python installed correctly or not.

python –version : Python 2.7.16

The Hyperledger Fabric prerequisites are installed. Now, it is time to install the extra windows dependencies.

Windows Extras

Step 6: Install windows-build-tools and grpc

  • Install the windows-build-tools globally using npm .
  • Open the command prompt and run the below command.
  • npm install –global windows-build-tools

It will take some time around 15 minutes or more. Once it will complete you will get the below message.

  • windows-build-tools
  • Once this is done, you should also install the NPM GRPC module with the following command:
  • npm install –global grpc

Step 7: Install git to run the bash commands

  • To run the bash commands we have to install git .
  • Git is a set of command line utility programs that are designed to execute on a Unix style command-line environment. — atlassian
  • Git Bash is an application for Microsoft Windows environments which provides an emulation layer for a Git command line experience. — atlassian
  • Hang on, for a while we are done with prerequisites and now we are on the final step to install the Hyperledger Fabric.

Step 8: Install Samples, Binaries and Docker Images

  • Go to the directory where you want to download the fabric samples.
  • Once you’re in the directory open git bash . Right-click and select Git Bash Here .
  • git bash
  • Run the below command to install Samples, Binaries and Docker Images
  • curl -sSL http://bit.ly/2ysbOFE | bash -s

It will download the latest production release. If you want a specific release for ex. v1.4.1, follow the below command.

  • url -sSL http://bit.ly/2ysbOFE | bash -s — <fabric_version> <fabric-ca_version> <thirdparty_version>
  • curl -sSL http://bit.ly/2ysbOFE | bash -s — 1.4.1 1.4.1 0.4.15

It’ll take some time, once it is finished you can see a new directory “fabric-samples”.

fabric-samples : “fabric-samples” come with sample examples to start with Hyperledger Fabric. There are many good examples to play within the fabric samples.

Step 7: Test the fabric network

  • As we have successfully completed the setting up the Fabric environment, it’s time to test it. We are going to use the first-network sample from the fabric-samples.
  • Open the fabric-samples and go to first-network.
  • cd fabric-samples/first-network
  • first-network
  • To test it, run the byfn.sh . It is a test script, it first setup the network with 2 organizations org1 and org2 with 2 peers each and an orderer .
  • ./byfn.sh up
  • first-network start
  • On successful execution, you’ll see the below message.
  • first-network end
  • If you reach till this point it means you have successfully setup the fabric network.
  • Now, we have completed the testing of first-network, clean the network.
  • ./byfn down
  • Here, we have completed the Hyperledger Fabric installation in the Windows machine.

Why is Hyperledger Fabric suitable for business?

It’s difficult to compare Hyperledger Fabric to any other blockchain network like Bitcoin or Ethereum. Unlike most other networks, Hyperledger isn’t intended for public use.

In fact, there’s no such thing as the Hyperledger mainnet. Hyperledger is a platform for developing custom networks to suit your needs.

You may want to build a custom network for your project for a number of reasons:

  • You need functionality that isn’t available in any existing network.
  • Each of your tasks or customers is unique and requires special treatment within the platform.
  • You need to secure your data or keep some of it private.
  • You want to control access to your network.

Apart from the opportunity to adjust a private blockchain to your specific needs, you can also benefit from the absence of commission and independence from external factors such as miners and price movements.

Industries and projects such as the following will benefit from Hyperledger Fabric:

  • Logistics (supply chain management)
  • Finance (audits and accounting)
  • Medical records
  • Distributed databases for managing the electrical grid
  • Educational platforms
Hyperledger Sample Resumes! Download & Edit, Get Noticed by Top Employers! Download
possible applications of Hyperledger Fabric

However, Hyperledger Fabric is designed for field-specific private networks with explicit access restrictions and data ownership, so it won’t work for use cases such as:

  • Crowdsales
  • Trading
  • Currency exchange and transfer
  • Public auctions, elections, etc.

All of these use cases require a truly decentralized network that provides all users with equal rights to ensure fair conditions – for example, to eliminate the chance of vote rigging.


While most other blockchain projects focus on cryptocurrencies and tokens, the projects around Hyperledger demonstrate a strong potential to build the backbone of non-monetary, high scaling industrial applications of blockchain technology. With interesting concepts and leaders in the technology behind, Hyperledge has not the worst chances to win this prize. Hyperledger has unique functionality compared to other popular blockchains. Its permitted nature, great access control, and scalability make Hyperledger Fabric probably the best choice for building a dedicated blockchain network. At ACTE, we use many technologies and tools, and we’re open to projects of any complexity. Our seasoned specialists are ready to develop an advanced blockchain-driven solution for your project.

Are you looking training with Right Jobs?

Contact Us
Get Training Quote for Free