fabric增删改查Mac

备份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

转载于:https://my.oschina.net/duojin/blog/2989130

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值