This project shows an End2End demo for using Hyperledger Fabric v1.1.0-alpha.
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
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 testgovendor sync fetches all dependencies defines in vendor/vendor.json
so that there are no compile errors and the test passes.
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: rundocker-compose-certgen.ymlto generate configurations and certificates for the network into config directorymake up: start the fabric network specified indocker-compose.ymlbased on the configurations and certs generated bymake certgenmake downstop the fabric networkmake deldelete 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 upAfter 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 changedThe 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