当我从cli查询链码时,出现以下错误:
Error: endorsement failure during query. response: status:500 message:"make sure the chaincode SimpleChaincode has been successfully instantiated and try again: chaincode SimpleChaincode not found"
尽管如此,我看到链码已实例化。如果我检查docker ps,我可以看到chaincode的docker正在运行,并且其日志向我显示了chaincode的init函数消息正确显示。
cli在实例化链码的同级中运行。我不知道这是否有问题。
这是无法执行的query.sh:
ORDERER_CA=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/motogp.com/orderers/orderer.motogp.com/msp/tlscacerts/tlsca.motogp.com-cert.pem
CORE_PEER_LOCALMSPID="hondaMSP"
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/honda.motogp.com/peers/peer0.honda.motogp.com/tls/ca.crt
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/honda.motogp.com/users/Admin@honda.motogp.com/msp
CORE_PEER_ADDRESS=peer0.honda.motogp.com:7051
CHANNEL_NAME=motogpchannel
CORE_PEER_TLS_ENABLED=true
queryChaincode () {
peer chaincode query -C $CHANNEL_NAME -n SimpleChaincode -c '{"Args":["query","a"]}' >&log.txt
res=$?
cat log.txt
}
queryChaincode