Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to invoke in Fabric v1.2 tutorial:build your first network

When I followed the tutorial for fabric(v1.2) (link here) to execute the invoke the following command

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"]

I get an error.

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" > 

Also the orderer container print the log message as below:

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
like image 724
haha liu Avatar asked Jul 24 '18 04:07

haha liu


2 Answers

I had a similar problem (using Invoke in fabric v1.2) while using this "build your first network tutorial".
Installing the mycc chain-code on org2 aswell before running the query and invoke commands fixed the problem for me.
So you can try changing the environment variables to org2 and then run the peer chaincode install command again (this time it will be for org2). Afterwards, you should be able to run the query and invoke commands.

In short, try to use this one-liner and go again:
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/[email protected]/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/

like image 113
Matan Danos Avatar answered Sep 25 '22 16:09

Matan Danos


It is written in the fabric documents but they have not mention it in the flow. We need to install chaincode on org2 too by setting up environment variables first. That was a great catch Danos.

Fabric Documents: If you want additional peers to interact with ledger, then you will need to join them to the channel, and install the same name, version and language of the chaincode source onto the appropriate peer’s filesystem. A chaincode container will be launched for each peer as soon as they try to interact with that specific chaincode. Again, be cognizant of the fact that the Node.js images will be slower to compile.

like image 26
Ajinkya Avatar answered Sep 23 '22 16:09

Ajinkya