错误一
Missing channelID, please specify it with ‘-channelID’
解决方法:
export CHANNEL_NAME=mychannel
/home/aka/go/bin/configtxgen -profile TwoOrgsOrdererGenesis -outputBlock ./channel-artifacts/genesis.block -channelID $CHANNEL_NAME
错误二
peer channel create -o orderer.example.com:7050 -c mychannel -f ./channel-artifacts/channel.tx --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/msp/tlscacerts/tlsca.example.com-cert.pem
报错
Error: failed to create deliver client for orderer: orderer client failed to connect to orderer.example.com:7050: failed to create new connection: connection error: desc = “transport: error while dialing: dial tcp 127.0.0.1:7050: connect: connection refused”
然后查看orderer容器,发现orderer容器exit
查看了docker日志,
docker logs orderer.example.com
找到做错误:
Not bootstrapping because of 2 existing channels
由于 2 个现有通道而无法引导
可能是数据卷映射的问题,然后查看了docker volume的内容
docker volume ls
将orderer本地映射的数据卷删除
docker volume rm -f fixtures_orderer.example.com
重新启动docker-compose.yaml
错误三
peer lifecycle chaincode approveformyorg --channelID mychannel --name sacc --version 1.0 --init-required --package-id sacc_1:508f132cc8ed0bd2696807a47b337371a5f96370081fb51bf53494e83fa4a617 --sequence 1 --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
Error: failed to retrieve broadcast client: orderer client failed to connect to 127.0.0.1:7050: failed to create new connection: connection error: desc = “transport: error while dialing: dial tcp 127.0.0.1:7050: connect: connection refused”
peer lifecycle chaincode approveformyorg --channelID mychannel --name sacc --version 1.0 --init-required --package-id sacc_1:508f132cc8ed0bd2696807a47b337371a5f96370081fb51bf53494e83fa4a617 --sequence 1 --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 -o orderer.example.com:7050
查询是否成功
peer lifecycle chaincode checkcommitreadiness --channelID mychannel --name sacc --version 1.0 --init-required --sequence 1 --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 -o orderer.example.com:7050 --output json