一、下载1.0版本的fabric-samples
https://github.com/hyperledger/fabric-samples.git
二、 https://nexus.hyperledger.org/content/repositories/releases/org/hyperledger/fabric/hyperledger-fabric/darwin-amd64-1.0.5/
将下载下来的bin文件夹复制到fabric-samples中.
三、 https://raw.githubusercontent.com/hyperledger/fabric/v1.0.5/scripts/bootstrap.sh
下的代码复制到新建文件init.sh中,并注释两行代码(echo "===> Downloading platform binaries" curl https://nexus.hyperledger.org/content/repositories/releases/org/hyperledger/fabric/hyperledger-fabric/${ARCH}-${VERSION}/hyperledger-fabric-${ARCH}-${VERSION}.tar.gz | tar xz)
四、 chmod 777 init.sh 修改操作权限
五、 ./init.sh 执行,这里是下载镜像
六、启动网络
yongwangdeMac-mini% cd first-network
yongwangdeMac-mini% ./byfn.sh -m generate
yongwangdeMac-mini% ./byfn.sh -m down
yongwangdeMac-mini% ./byfn.sh -m up
注意启动之前要先down掉,然后每次结束之后,也应该down掉
七、新开一个命令行窗口进入docker
yongwangdeMac-mini% docker exec -it cli bash
peer chaincode query -C mychannel -n mycc -c '{"Args":["query","a"]}'
peer chaincode invoke -o orderer.example.com:7050 --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C mychannel -n mycc -c '{"Args":["invoke","a","b","20"]}'