无法在Fabric v1.2教程中调用:建立第一个网络

时间:2018-07-24 04:00:30

标签: docker hyperledger-fabric

当我按照fabric(v1.2)(link here)教程执行调用以下命令时

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 --peerAddresses peer0.org1.example.com:7051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt --peerAddresses peer0.org2.example.com:7051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt -c '{"Args":["invoke","a","b","10"]

我得到一个错误。

root@3e241e56114d:/opt/gopath/src/github.com/hyperledger/fabric/peer# 
Error: could not assemble transaction: ProposalResponsePayloads do not match - proposal response: version:1 response:<status:200 > payload:"\n \310\335\t\270\014\205Ie\022\0334R\237\025{\0107\230\317c\247\250\206&\242\306n\326\340\263\214\365\022Y\nE\022\024\n\004lscc\022\014\n\n\n\004mycc\022\002\010\003\022-\n\004mycc\022%\n\007\n\001a\022\002\010\003\n\007\n\001b\022\002\010\003\032\007\n\001a\032\00290\032\010\n\001b\032\003210\032\003\010\310\001\"\013\022\004mycc\032\0031.0" endorsement:<endorser:"\n\007Org1MSP\022\252\006-----BEGIN CERTIFICATE-----\nMIICKDCCAc6gAwIBAgIQBRhp5NBFLjyIpZGuVWWRyjAKBggqhkjOPQQDAjBzMQsw\nCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy\nYW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEcMBoGA1UEAxMTY2Eu\nb3JnMS5leGFtcGxlLmNvbTAeFw0xODA3MjQwMjU1MTJaFw0yODA3MjEwMjU1MTJa\nMGoxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1T\nYW4gRnJhbmNpc2NvMQ0wCwYDVQQLEwRwZWVyMR8wHQYDVQQDExZwZWVyMC5vcmcx\nLmV4YW1wbGUuY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEBuEO2QW6RHxg\nX7t6yFWz+P+7+oGlo29oqeJ5FElI2UiSrXFIOZPlZva/XmVZRlEs1ApIRG5/6C6a\n/yej1AEFEaNNMEswDgYDVR0PAQH/BAQDAgeAMAwGA1UdEwEB/wQCMAAwKwYDVR0j\nBCQwIoAgiTLQaCWgadDTWC+Hg5sK2dgqyLfssOp3ICw6Nc+JedIwCgYIKoZIzj0E\nAwIDSAAwRQIhAJYGk42WKfaJ9PeGlynVs58EAykvo/ct7JKGXBbCpqYAAiBj68QP\nHmrLnqRDUMaRoBxPHDaJwIi3wO+LuKBAa2kDSw==\n-----END CERTIFICATE-----\n" signature:"0D\002 \036\031lf\322l\331\0018c)\263a\334V\204\210\366\006\320NU\265\326\205)\306\210\2757\231\022\002 U\"\022&e</)\036\254qC\353H\377\377\322R\215\334I\003\362\301\277R\310p'\rn\303" > 

订购者容器还如下打印日志消息:

2018-07-24 03:26:59.429 UTC [orderer/common/broadcast] Handle -> WARN 020 Error reading from 172.18.0.7:35366: rpc error: code = Canceled desc = context cancele

2 个答案:

答案 0 :(得分:15)

使用此“构建您的第一个网络教程”时,我遇到了类似的问题(在Fabric v1.2中使用Invoke)。
在运行查询和调用命令之前,还要在org2上安装mycc链代码,从而解决了我的问题。
因此,您可以尝试将环境变量更改为org2,然后再次运行peer chaincode install命令(这次将用于org2)。之后,您应该能够运行查询并调用命令。

简而言之,请尝试使用这种单线并再次使用:
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp CORE_PEER_ADDRESS=peer0.org2.example.com:7051 CORE_PEER_LOCALMSPID="Org2MSP" CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt peer chaincode install -n mycc -v 1.0 -p github.com/chaincode/chaincode_example02/go/

答案 1 :(得分:1)

它写在结构文档中,但是他们没有在流程中提及它。我们还需要通过先设置环境变量在org2上安装chaincode。那是Danos的好收获。

面料文件: 如果您希望其他对等方与分类帐进行交互,则需要将它们加入频道,并将链码源的相同名称,版本和语言安装到适当的对等方的文件系统上。一旦每个对等方尝试与该特定链式代码进行交互,就会为每个对等者启动一个链式代码容器。同样,请注意Node.js图像的编译速度较慢。