备份1.3版本,重新下载1.1版本到fabric文件夹
/opt/gopath/src/github.com/hyperledger/fabric -> /opt/gopath/src/github.com/hyperledger/fabric1.3
新建/opt/gopath/src/github.com/hyperledger/fabric/sheep文件夹
$ docker images
修改1.0.0 -> 1.1.0 删除-beta
$ cd /opt/gopath/src/github.com/hyperledger/fabric/examples/e2e_cli/
$ ./download-dockerimages.sh
Error response from daemon: manifest for hyperledger/fabric-couchdb:x86_64-1.1.0 not found
$ docker pull hyperledger/fabric-couchdb:latest
$ docker pull hyperledger/fabric-ca:x86_64-1.1.0
$ docker pull hyperledger/fabric-tools:x86_64-1.1.0
$ docker pull hyperledger/fabric-javaenv:x86_64-1.1.0
$ docker pull hyperledger/fabric-ccenv:x86_64-1.1.0
$ docker pull hyperledger/fabric-baseimage:x86_64-0.4.6
$ docker pull hyperledger/fabric-baseos:x86_64-0.4.6
将sheep.zip复制到/opt/gopath/src/github.com/hyperledger/fabric/sheep解压,清空channel-artifacts和crypto-config
$ cd /opt/gopath/src/github.com/hyperledger/fabric/scripts
$ ./bootstrap.sh 下载fabric1.1的bin文件并放到sheep文件夹中
$ ./bin/cryptogen generate --config=./crypto-config.yaml
org1.example.com
org2.example.com
$ export FABRIC_CFG_PATH=$PWD
$ export CHANNEL_NAME=mychannel
$ ./bin/configtxgen -profile TwoOrgsOrdererGenesis -outputBlock ./channel-artifacts/genesis.block
$ ./bin/configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ./channel-artifacts/mychannel.tx -channelID mychannel
$ ./bin/configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate channel-artifacts/Org1MSPanchors.tx -channelID $CHANNEL_NAME -asOrg Org1MSP
$ ./bin/configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate channel-artifacts/Org2MSPanchors.tx -channelID $CHANNEL_NAME -asOrg Org2MSP
修改docker-peer.yaml文件,修改成为红色部分,/Users/shijun/Desktop/fabricWorkspace/membersheepFabric/crypto-config/peerOrganizations/org1.example.com/ca/4855be3f47ea89f3e86425d6b2bf3fbc5343d187d61887188396405c844077ca_sk
$ docker-compose -f docker-orderer.yaml up -d
$ docker-compose -f docker-peer.yaml up -d
$ docker exec -it cli bash
# peer channel create -o orderer.example.com:7050 -c mychannel -f ./channel-artifacts/mychannel.tx
# peer channel join -b mychannel.block
# peer chaincode install -n traceGoods -p github.com/hyperledger/fabric/sheep/chaincode/go/trace_goods -v 1.0 需要更改版本
初始化
# peer chaincode instantiate -o orderer.example.com:7050 -C mychannel -n traceGoods -c '{"Args":["init"]}' -P "OR ('Org1MSP.member')" -v 1.0
# peer chaincode query -C mychannel -n traceGoods -c '{"Args":["queryAllGoods"]}'
["查询成功",""]
重启电脑后启动fabric,执行以下三条命令
$ docker-compose -f docker-orderer.yaml up -d
$ docker-compose -f docker-peer.yaml up -d
$ docker exec -it cli bash