Fabric Environment Setup




Hyperledger Fabric

  • Hyperledger Fabric is a permissioned distributed ledger technology. 
  • Meaning that only invited people can participate and view the blockchain.
  • Do not need cryptocurrency for the mining of blocks
  • Multi-programming language support, smart contracts (Chaincode) can be written in some popular programming languages, such as Java, Go, and NodeJS/Javascript.
  • Modular framework, based on the organization, it can be configured. 
  • Different entities like, number of peers, accesscontrol, the consensus protocol,                database service , ordering service can all be configured.

Environment Setup

sudo apt-get install curl

sudo apt-get install golang-go
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin

sudo apt-get install nodejs
sudo apt-get install npm
sudo apt-get install python
sudo apt-get install docker

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

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

sudo apt-get update

apt-cache policy docker-ce
sudo apt-get install -y docker-ce
sudo apt-get install docker-compose

sudo apt-get upgrade

Install Fabric

You can follow this link to finish the installation,
https://hyperledger-fabric.readthedocs.io/en/latest/install.html

I have listed out the steps/issues i have faced,
As in the link above, run this CURL command,

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

This will do the following,
  • Install the Hyperledger Fabric platform-specific binaries and config files for the version specified into the root of the fabric-samples repository
  • Download the Hyperledger Fabric docker images for the version specified
When I run the curl and when it reached the area to download and install docker, got an error.

===> List out hyperledger docker images
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.38/images/json: dial unix /var/run/docker.sock: connect: permission denied

Followed the steps shown below to fix the issue.
Docker image download and install successfully finished.
$ sudo usermod -aG docker $USER
needs to have $USER defined in your shell. This is often there by default, but you may need to set the value to your login id in some shells.

To avoid performing a login again, you can simply run:

$ newgrp docker
to get access to that group in your current shell.

Once you have done this, the user effectively has root access on the server, so only do this for users that are trusted with that level of access.
The script will finish by listing docker images that installed,


The command above downloads and executes a bash script that will download and extract all of the platform-specific binaries you will need to set up your network and place them into the cloned repo you created above. It retrieves the following platform-specific binaries:
  • cryptogen,
  • configtxgen,
  • configtxlator,
  • peer,
  • orderer,
  • idemixgen, and
  • fabric-ca-client
and places them in the bin sub-directory of the current working directory.
You may want to add that to your PATH environment variable so that these can be picked up without fully qualifying the path to each binary. e.g.:
export PATH=<path to download location>/bin:$PATH 


On my system that location was, /home/abcbuddy/fabric-samples/bin
export PATH=/home/abcbuddy/fabric-samples/bin:$PATH 
Check and see how the bin directory look like,



Next Check the installation.

Run the following commands to bring up the network.
  • cd fabric-samples/first-network
    ./byfn.sh generate
    This first step generates all of the certificates and keys for our various network entities, the genesis used to bootstrap the ordering service, and a collection of configuration transactions required to configure a channel.

  • ./byfn.sh up - this command will bring up the network.
  • ./byfn.sh down - this will bring down the network, kill your docker containers, remove the crypto material and four artifacts, and delete the chaincode images from your Docker Registry
  • 1 comment:

    1. Nice Blog,
      I had a look at the details that you mentioned in the blog about the problems that you face while working with hyperledger fabrics and I must say that this is a very helpful blog. I was looking to hire blockchain development company in India and got to know about this blog. Thanks for sharing such a great blog.
      Hire dedicated blockchain development company
      Hire dedicated blockchain developers

      ReplyDelete