Skip to content

Instantly share code, notes, and snippets.

@mamun67
Created November 5, 2017 15:02
Show Gist options
  • Save mamun67/bbf3fd0da55167513e65907de6a3fc9e to your computer and use it in GitHub Desktop.
Save mamun67/bbf3fd0da55167513e65907de6a3fc9e to your computer and use it in GitHub Desktop.
Steps to Start Hypledger Fabric Network for Tuna-App
Please refer to https://gist.github.com/mamun67/955013074a4f12fa1b8b9076170cec05 for Hyperledger Setup
Now we will download the latest released Docker images for Hyperledger Fabric, and tag them with the latest tag. Execute the command from within the directory into which you will extract the platform-specific binaries:
$ curl -sSL https://goo.gl/Q3YRTi | bash
Note: Check https://hyperledger-fabric.readthedocs.io/en/latest/samples.html#binaries for the latest URL (the blue portion in the above curl command) to pull in binaries.
This command downloads binaries for cryptogen, configtxgen, configxlator, peer AND downloads the Hyperledger Fabric Docker images. These assets are placed in a bin subdirectory of the current working directory.
To confirm and see the list of Docker images you’ve just downloaded, run:
$ docker images
If the Docker images are not already tagged with the latest tag, perform the following command for each of the Docker images:
$ docker tag hyperledger/fabric-tools:x86_64-1.0.2 hyperledger/fabric-tools:latest
As an additional measure, you may want to add the bin subdirectory to your PATH environment variable, so these can be picked up without needing to qualify the PATH to each binary. You can do this by running the following:
$ export PATH=$PWD/bin:$PATH
To install the Hyperledger Fabric sample code which will be used in the tutorials, do:
$ git clone https://github.com/hyperledger/fabric-samples.git
$ cd fabric-samples/first-network
Run this command ( within the first-network folder ):
$ ./byfn.sh -m generate
A brief description will appear, along with a Y/N command line prompt. Respond with a Y <Enter> to continue.
This step generates all of the certificates and keys for all our various network entities, including the genesis block used to bootstrap the ordering service and a collection of configuration transactions required to create a channel.
Next, you can start the network with the following command:
$ ./byfn.sh -m up
Another command line will appear, reply with Y <Enter> to continue.
Logs will appear in the command line, showing containers being launched, channels being created and joined, chaincode being installed, instantiated, and invoked on all the peers, as well as various transaction logs.
Troubleshooting Note:
If you have difficulties with the two previous commands and you suspect that your Docker images may be at fault, you can start back from scratch, which will delete and untag the Docker images.
$ docker rmi -f $(docker images -q)
Once you run this command, return to the Installing Hyperledger Fabric Docker Images and Binaries section.
$ git clone https://github.com/hyperledger/education.git
$ cd education/LFS171x/fabric-material/tuna-app
Make sure you have Docker running on your machine before you run the next command. If you do not have Docker installed, return to
https://gist.github.com/mamun67/955013074a4f12fa1b8b9076170cec05 for Hyperledger & Docker Setup
Also, make sure that you have completed the Installing Hyperledger Fabric section in this chapter before moving on to this application section, as you will likely experience errors.
First, remove any pre-existing containers, as it may conflict with commands in this tutorial:
$ docker rm -f $(docker ps -aq)
Then, let’s start the Hyperledger Fabric network with the following command:
$ ./startFabric.sh
Troubleshooting: If, after running the above you are getting an error similar to the following:
ERROR: failed to register layer: rename
/var/lib/docker/image/overlay2/layerdb/tmp/write-set-091347846 /var/lib/docker/image/overlay2/layerdb/sha256/9d3227c1793b7494e598caafd0a5013900e17dcdf1d7bdd31d39c82be04fcf28: file exists
try running the following command:
$ rm -rf ~/Library/Containers/com.docker.docker/Data/*
Install the required libraries from the package.json file, register the Admin and User components of our network, and start the client application with the following commands:
$ npm install
$ node registerAdmin.js
$ node registerUser.js
$ node server.js
Troubleshooting: If you are getting an error similar to the one below while attempting to perform any of the functions on the application:
Error: [client-utils.js]: sendPeersProposal - Promise is rejected: Error: Connect Failed
error from query = { Error: Connect Failed
at /Desktop/prj/education/LFS171x/fabric-material/tuna-app/node_modules/grpc/src/node/src/client.js:554:15 code: 14, metadata: Metadata { _internal_repr: {} } }
try running the following commands:
$ cd ~
$ rm -rf .hfc-key-store/
Then, run the commands above starting with:
$ node registerAdmin.js
@thirugns
Copy link

Hi,

This "$ curl -sSL https://goo.gl/Q3YRTi | bash" is giving a 404. what do I do?

@thirugns
Copy link

here is the correct link : https://raw.githubusercontent.com/hyperledger/fabric/master/scripts/bootstrap.sh
use the command curl -sSL https://raw.githubusercontent.com/hyperledger/fabric/master/scripts/bootstrap.sh | bash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment