Installing Hyperledger Fabric v1.3 on Ubuntu 18.04 — Part II (Updated on 2018–11–15)

This entire tutorial is the second part of the installation of Hyperledger Fabric v1.3. In the previous article, we installed all the dependencies required for us to make the Fabric environment run. In this part of the tutorial, we aim to launch our own example network and learn to fire some transactions and query the Blockchain network to retrieve the values.

So, at first, Hyperledger Fabric Project has provided a lot of detailed examples and documentation on its site. But the one we’ll be following is the e2e_cli code example in examples directory.

To get started, we first need to clone the Fabric Project on your machine. So, go ahead and fire the command below:

git clone

After cloning the project to a safe location, migrate to the branch by using the command:

git checkout release-1.3

And make sure the directory structure is similar to one described below:

<work directory>/src/

Please refer to the below image for further explanation:

I already have the project cloned. But, at the end, you should have fabric project in your current directory. Now, that we have the project cloned into our work directory, we need some functions to be build to ensure our smooth journey towards the execution environment. So, we need to build functions, like:


This list is not an exhaustive list, but these are the most important ones. “configtxgen” takes in `configtx.yaml` file and builds your genesis block for the channel which contains metadata associated with the channel, which is broadcast to the Orderer. So, this is like the Block 0 of the network, which is needed to make sure that our chaincode is deployed on top of it. “cryptogen” is used to generate the certificates according to the organizational structure of the organizations participating in the blockchain.

To enable the building of the tools, we need to set the GOPATH variable in the ~/.bashrc or ~/.bash_profile file of the user logged into. This is to enable fabric to locate the source code to enable building of the commands. For that, we add the following line to the ~/.bashrc or ~/.bash_profile file:

export GOPATH=~/Documents/blockchain

GOPATH will always be your work directory. So, if you have a different Work Directory, then please state that as your GOPATH. Now, we are ready to build the tool. To build the tool, we write (from the root directory of the fabric project):

make release

So, if all goes well, we will have the following output:

If there is some error regarding a library, ‘ltdl.h’, fire the following command and it should probably be fixed:

sudo apt install libtool libltdl-dev

If still the problem pertains, maybe you want to check out the stackoverflow and jira for the Hyperledger Project, link (

So, considering all goes well, we now have our tools, configtxgen and cryptogen, in release/linux-amd64/bin directory, relative to Fabric’s root directory.

Now, we move to the examples/e2e_cli directory, for some real blockchain deployment and transactions stuff. So, to use the configtxgen tool and generate the genesis block and configurations for the channel, we use the following script, which by-default creates the files.

This is the output one should receive after a successful execution of the command:


Now, that we have the genesis block, we need containers to run our blockchain network. Hyperledger Fabric suggests that one should use Docker containers for these kinds of work, so that it is isolated from the host tasks and enables customization and tweaking. So, to download all the required images, run the command from the fabric root directory:

make docker

This will download all the required images and when you check the installed images using:

docker images

You should see a similar output as below:

Now, that we have the images with us, we will now start our network and run the all-in-one script to test everything is working fine or not. In our ecosystem, we have 1 Orderer, 2 Peers from 2 Organisations each and 1 CLI to access the logs and fire custom transactions.

./ up

If you provide a channel-id argument, it will create the channel with the specific channel-id or else keep “mychannel” as the default channel-id name.

If everything goes well, then, upon a successful execution, you should see the following output:

Now, that we have run the automated tests, we know that now we can create our own network and fire transactions from that too. Stay tuned for the next article, depicting, how to manually do the steps, we just did with the file.

To bring down the network, fire the command:

./ down

The above command deletes all the extra images that were created to ensure the channel and chaincode data access.

Last Updated: 2018–11–15

All about Distributed Systems and Information Security. #golang #Cybersecurity #distributedsystems