Skip to content

dawnwords/fabric-demo

Repository files navigation

Hyperledger Fabric End2End Demo

This project shows an End2End demo for using Hyperledger Fabric v1.1.0-alpha.

Environments

The environments for this project are shown below should be set up, no limited to the given versions, in advance.

  • JDK Version: 1.8.0
  • Go Version: 1.9.3
  • Govendor Version: 1.0.9
  • Docker Version: 17.12.0-ce
  • Docker-compose Version: 1.18.0

Set up chaincode-demo

chaincode-demo gives an example for Golang Chaincode to depends on some other third party libraries as vendors.

Since chaincode-demo might not be located in the $GOPATH or $GOROOT directory, to enable go test and govendor, create a symbolic link for chaincode-demo in $GOPATH together with fabric

cd ${GOPATH}/src/github.com/hyperledger
ln -s ${fabric-demo-root}/chaincode-demo .
cd chaincode-demo
govendor sync
go test

govendor sync fetches all dependencies defines in vendor/vendor.json so that there are no compile errors and the test passes.

Set up sample fabric network

docker-compose-certgen.yml is the docker-compose file to generate configurations and certificates for the network.

docker-compose.yml is the docker-compose file that defines the docker containers in the fabric network, namely one peer container, one orderer container, on CA container and one command line setting-up container.

Makefile defines the following commands:

  • make certgen: run docker-compose-certgen.yml to generate configurations and certificates for the network into config directory
  • make up: start the fabric network specified in docker-compose.yml based on the configurations and certs generated by make certgen
  • make down stop the fabric network
  • make del delete config directory to clear original configurations and certificates

In order to start the fabric network, using the following commands:

cd fabric-demo
make certgen
make up

After make up, the following contents will be output:

Creating Channel
Installing Chaincode
Instantiating Chaincode
Query Chaincode
Query Result: 300
Done

Then press ctrl+C and docker logs -f cli will be interrupted.

To stop the network:

make down
make del  # if *.yaml config file changed

Run client-sdk-demo

The project is based on Gradle and client-sdk-demo is a submodule for the root project. To run the main method and get the output in org.hyperledger.fabric.sdk.demo.DemoClient:

cd fabric-demo
./gradlew :client-sdk-demo:run

About

Hyperledger Fabric End2End Demo

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published