- Make sure you have installed docker(version newer than 1.12.0).
- Pulled the latest image from docker hub:
$ docker pull hyperledger/fabric-peer
$ docker pull hyperledger/fabric-membersrvc
PS: the latest tag for fabric-baseimage has not been issued officially, therefore, it would be ok for you to download other substitute:
$ docker pull hyperledger/fabric-baseimage:x86_64-0.2.0
, then re-tag it as latest:
$ docker tag hyperledger/fabric-baseimage:x86_64-0.2.0 hyperledger/fabric-baseimage:latest
- Start the hyperledger/fabric-peer and hyperledger/fabric-membersrvc using the docker-compose file in directory docker
$ cd docker && docker-compose up
PS:
- If you want to stop the service, just type the command
`$ docker-compose down`
- If you want to look up the logs separately, you could watch it by
`$ docker logs -f <container id | container name>`
- Make sure you have installed mysql (version Ver 14.14 Distrib 5.7.14) or have access to a mysql server
- sign in mysql as root and create a new account for development
- modify the USERNAME and PASSWORD specified in the create_table script
- create tables by execute the script:
$ ./create_table.sh
Make sure you have installed Intellij IDEA 2016.2 and the plugin Go for golang programming language
mkdir $GOPATH/src/baas && cd $GOPATH/src/baas
git clone URL/to/app-wallet
- import the source code under diretory consolesrvc and vendor as a project through IDEA
- modify the configuration file
database.mysql.dsn
fabric.peer.address
- run the wallet project
- import the chaincode under directory contracts and vendor as a project through IDEA
- set the env variables:
CORE_CHAINCODE_ID_NAME=wallet;
CORE_LOGGING_CHAINCODE=DEBUG;
CORE_PEER_ADDRESS=127.0.0.1:7051;
SHIM_LOGGING_LEVEL=INFO
- run the chaincode
- register the chaincode to peer by sending the following request
{
"jsonrpc": "2.0",
"method": "deploy",
"params": {
"type": 1,
"chaincodeID":{
"name":"wallet"
},
"ctorMsg": {
"function":"init",
"args":[]
}
},
"id": 1
}
please refer to restful_api which is in the directory docs