Hyperledger Fabric ProcessProposal -> Failed to invoke chaincode channel= chaincode=_lifecycle - hyperledger-fabric

I am running Hyperledger Fabric and while trying to install the chaincode on peer0.org1, "peer lifecycle chaincode install basic.tar.gz", I run into some errors and can not install it -- Error: chaincode install failed with status: 500 - error in simulation: failed to execute transaction ee4a6ae0672861fa153e7fd5cd797e59b3eeebf1d2950ccd9e13e8231de484a9: error sending: timeout expired while executing transaction.
Below I will share the logs. Can anyone tell me what should I do? I have tried to reinstall it but with no success.
----logs---
2022-08-28 16:10:46.246 UTC 004a INFO [chaincode.externalbuilder.ccaas_builder] waitForExit -> ::Error: chaincode type not supported: node command=detect
2022-08-28 16:14:33.640 UTC 004b WARN [peer.blocksprovider] func1 -> Encountered an error reading from deliver stream: rpc error: code = Unavailable desc = transport is closing channel=mychannel orderer-address=orderer.example.com:7050
2022-08-28 16:14:33.640 UTC 004c WARN [peer.blocksprovider] DeliverBlocks -> Orderer hung up without sending status channel=mychannel orderer-address=orderer.example.com:7050
2022-08-28 16:15:46.750 UTC 004d INFO [endorser] callChaincode -> finished chaincode: _lifecycle duration: 300000ms channel= txID=ee4a6ae0
2022-08-28 16:15:46.778 UTC 004e ERRO [endorser] simulateProposal -> failed to invoke chaincode _lifecycle, error: timeout expired while executing transaction
github.com/hyperledger/fabric/core/chaincode.(*Handler).Execute
runtime.goexit
/usr/local/go/src/runtime/asm_amd64.s:1571 channel= txID=ee4a6ae0
2022-08-28 16:15:46.778 UTC 004f WARN [endorser] ProcessProposal -> Failed to invoke chaincode channel= chaincode=_lifecycle error="error in simulation: failed to execute transaction ee4a6ae0672861fa153e7fd5cd797e59b3eeebf1d2950ccd9e13e8231de484a9: error sending: timeout expired while executing transaction"
2022-08-28 16:15:46.778 UTC 0050 INFO [comm.grpc.server] 1 -> unary call completed grpc.service=protos.Endorser grpc.method=ProcessProposal grpc.peer_address=172.21.0.1:51150 grpc.code=OK grpc.call_duration=5m0.029919322s
2022-08-28 16:16:03.168 UTC 0051 INFO [lifecycle] InstallChaincode -> Successfully installed chaincode with package ID 'basic_1.0:9821071a953f452bda87fe89637d1e377dac825da4649ba998464a3c85d60c50'
2022-08-28 16:20:33.471 UTC 0052 WARN [peer.blocksprovider] func1 -> Encountered an error reading from deliver stream: rpc error: code = Unavailable desc = transport is closing channel=mychannel orderer-address=orderer.example.com:7050
2022-08-28 16:20:33.471 UTC 0053 WARN [peer.blocksprovider] DeliverBlocks -> Orderer hung up without sending status channel=mychannel orderer-address=orderer.example.com:7050

Related

Hyperledger Fabric 2.4 approve chaincode error

I'm setting up an hyperledger fabric network with docker compose.
All the containers are up and running but i'm having problems with the appprovemyorg command.
These are the logs of the peer after joining the channel:
2022-05-24 07:41:54.316 UTC 0023 INFO [ledgermgmt] CreateLedger -> Creating ledger [mychannel] with genesis block
2022-05-24 07:41:54.319 UTC 0024 INFO [blkstorage] newBlockfileMgr -> Getting block information from block storage
2022-05-24 07:41:54.328 UTC 0025 INFO [kvledger] commit -> [mychannel] Committed block [0] with 1 transaction(s) in 6ms (state_validation=0ms block_and_pvtdata_commit=3ms state_commit=1ms) commitHash=[]
2022-05-24 07:41:54.328 UTC 0026 INFO [kvledger] updateLedgerStatus -> Updating ledger [mychannel] status to [ACTIVE]
2022-05-24 07:41:54.329 UTC 0027 INFO [ledgermgmt] CreateLedger -> Created ledger [mychannel] with genesis block
2022-05-24 07:41:54.332 UTC 0028 INFO [gossip.gossip] JoinChan -> Joining gossip network of channel mychannel with 1 organizations
2022-05-24 07:41:54.332 UTC 0029 INFO [gossip.gossip] learnAnchorPeers -> No configured anchor peers of org1MSP for channel mychannel to learn about
2022-05-24 07:41:54.333 UTC 002a INFO [gateway] configUpdate -> Updating orderer config channel=mychannel
2022-05-24 07:41:54.333 UTC 002b INFO [gossip.state] NewGossipStateProvider -> Updating metadata information for channel mychannel, current ledger sequence is at = 0, next expected block is = 1
2022-05-24 07:41:54.333 UTC 002c INFO [endorser] callChaincode -> finished chaincode: cscc duration: 21ms channel= txID=a704dc84
2022-05-24 07:41:54.333 UTC 002d INFO [comm.grpc.server] 1 -> unary call completed grpc.service=protos.Endorser grpc.method=ProcessProposal grpc.peer_address=172.22.0.9:59204 grpc.code=OK grpc.call_duration=22.209824ms
2022-05-24 07:42:00.335 UTC 002e INFO [gossip.election] beLeader -> 49ad88f230e73d14bb6f9b8a891c0f5bc47a35cd793ff62222e489f762864a33 : Becoming a leader
2022-05-24 07:42:00.335 UTC 002f INFO [gossip.service] func1 -> Elected as a leader, starting delivery service for channel mychannel
2022-05-24 07:42:00.335 UTC 0030 INFO [deliveryClient] StartDeliverForChannel -> This peer will retrieve blocks from ordering service and disseminate to other peers in the organization for channel mychannel
2022-05-24 07:30:08.206 UTC 0031 WARN [peer.blocksprovider] DeliverBlocks -> Could not connect to ordering service: could not dial endpoint 'orderer2:8050': failed to create new connection: connection error: desc = "transport: error while dialing: dial tcp 0.0.0.0:8050: connect: connection refused" channel=mychannel
2022-05-24 07:30:08.307 UTC 0032 WARN [peer.blocksprovider] DeliverBlocks -> Could not connect to ordering service: could not dial endpoint 'orderer3:9050': failed to create new connection: connection error: desc = "transport: error while dialing: dial tcp 0.0.0.0:9050: connect: connection refused" channel=mychannel
2022-05-24 07:30:08.428 UTC 0033 WARN [peer.blocksprovider] DeliverBlocks -> Could not connect to ordering service: could not dial endpoint 'orderer1:7050': failed to create new connection: connection error: desc = "transport: error while dialing: dial tcp 0.0.0.0:7050: connect: connection refused" channel=mychannel
As you can see, i have some warnings but I can safely join the channel and I have no problems at all when i install the chaincode (the warnings disappear too).
These are the logs on the peer after installing the chaincode:
2022-05-24 07:45:17.017 UTC 0052 INFO [chaincode.externalbuilder.ccaas_builder] waitForExit -> ::Detect command=detect
2022-05-24 07:45:17.017 UTC 0053 INFO [chaincode.externalbuilder.ccaas_builder] waitForExit -> ::Error: chaincode type not supported: java command=detect
2022-05-24 07:45:17.023 UTC 0054 INFO [lifecycle] InstallChaincode -> Successfully installed chaincode with package ID 'testchaincode_1:de8cddcb2deda13a7a3c1e9f6e37764e6d2c1bb6f89bac1f0d2c6396587b35f7'
2022-05-24 07:45:17.023 UTC 0055 INFO [endorser] callChaincode -> finished chaincode: _lifecycle duration: 14ms channel= txID=694acf7b
2022-05-24 07:45:17.023 UTC 0056 INFO [comm.grpc.server] 1 -> unary call completed grpc.service=protos.Endorser grpc.method=ProcessProposal grpc.peer_address=172.22.0.9:59206 grpc.code=OK grpc.call_duration=15.8101ms
When i try to approve the chaincode with this command:
peer lifecycle chaincode approveformyorg --tls --cafile /tmp/hyperledger/org1/peer1/tls-msp/tlscacerts/tls-tls-ca-7052.pem -o orderer1:7050 --ordererTLSHostnameOverride orderer1 --channelID mychannel --name mycc --version 1 --sequence 1 --waitForEvent --init-required --package-id testchaincode_1:de8cddcb2deda13a7a3c1e9f6e37764e6d2c1bb6f89bac1f0d2c6396587b35f7
I have this error:
Error: timed out waiting for txid on all peers
With these logs on the peer:
2022-05-24 07:46:54.303 UTC 0059 INFO [lifecycle] ApproveChaincodeDefinitionForOrg -> Successfully endorsed chaincode approval with name 'mycc', package ID 'testchaincode_1:de8cddcb2deda13a7a3c1e9f6e37764e6d2c1bb6f89bac1f0d2c6396587b35f7', on channel 'mychannel' with definition {sequence: 1, endorsement info: (version: '1', plugin: 'escc', init required: true), validation info: (plugin: 'vscc', policy: '12202f4368616e6e656c2f4170706c69636174696f6e2f456e646f7273656d656e74'), collections: ()}
2022-05-24 07:46:54.303 UTC 005a INFO [endorser] callChaincode -> finished chaincode: _lifecycle duration: 0ms channel=mychannel txID=d56b21b6
2022-05-24 07:46:54.308 UTC 005b INFO [comm.grpc.server] 1 -> unary call completed grpc.service=protos.Endorser grpc.method=ProcessProposal grpc.peer_address=172.22.0.9:59210 grpc.code=OK grpc.call_duration=6.78249ms
2022-05-24 07:46:55.194 UTC 005c WARN [peer.blocksprovider] DeliverBlocks -> Could not connect to ordering service: could not dial endpoint 'orderer1:7050': failed to create new connection: connection error: desc = "transport: error while dialing: dial tcp 0.0.0.0:7050: connect: connection refused" channel=mychannel
2022-05-24 07:47:24.311 UTC 005d INFO [comm.grpc.server] 1 -> streaming call completed grpc.service=protos.Deliver grpc.method=DeliverFiltered grpc.request_deadline=2022-05-24T07:47:24.31Z grpc.peer_address=172.22.0.9:59212 error="context finished before block retrieved: context deadline exceeded" grpc.code=Unknown grpc.call_duration=30.0006887s
2022-05-24 07:47:54.260 UTC 005e WARN [peer.blocksprovider] DeliverBlocks -> Could not connect to ordering service: could not dial endpoint 'orderer2:8050': failed to create new connection: connection error: desc = "transport: error while dialing: dial tcp 0.0.0.0:8050: connect: connection refused" channel=mychannel
So i can't approve the chaincode and advance in the process.
Can anyone help me solve this problem?
Thanks

Unable to install chaincode on hyperledger fabric based peer

When I tried below command
echo -e "Installing chaincode on peer2 of org2 now....\n"
docker exec -e CORE_PEER_LOCALMSPID=Org2MSP \
-e CORE_PEER_ADDRESS=peer2.org2.example.com:7051 \
-e CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer2.org2.example.com/tls/server.crt \
-e CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer2.org2.example.com/tls/server.key \
-e CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer2.org2.example.com/tls/ca.crt \
-e CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin#org2.example.com/msp \
cli peer lifecycle chaincode install basic.tar.gz
I am getting following error. I could install chaincode on all other peers successfully.
2022-01-27 13:13:33.744 UTC [endorser] ProcessProposal -> WARN 121 Failed to invoke chaincode channel= chaincode=_lifecycle error="error in simulation: failed to execute transaction cfe6ea05af60787c665900fd685a5f037098a3adb3137f3a48db6b0e643ae440: error sending: timeout expired while executing transaction"
2022-01-27 13:13:33.744 UTC [comm.grpc.server] 1 -> INFO 122 unary call completed grpc.service=protos.Endorser grpc.method=ProcessProposal grpc.peer_address=172.18.0.7:59556 grpc.code=OK grpc.call_duration=5m0.004667347s
2022-01-27 13:23:28.627 UTC [gossip.privdata] StoreBlock -> INFO 123 Received block [9] from buffer channel=channelone
2022-01-27 13:23:28.631 UTC [committer.txvalidator] Validate -> INFO 124 [channelone] Validated block [9] in 3ms
2022-01-27 13:23:28.667 UTC [kvledger] CommitLegacy -> INFO 125 [channelone] Committed block [9] with 1 transaction(s) in 29ms (state_validation=0ms block_and_pvtdata_commit=5ms state_commit=1ms) commitHash=[ce41d01661edff937d020d18a8facadd67a94368773f1ab31db92bbd4ff54026]
2022-01-27 13:34:57.933 UTC [endorser] callChaincode -> INFO 126 finished chaincode: _lifecycle duration: 300001ms channel= txID=9d859382
2022-01-27 13:34:57.934 UTC [endorser] SimulateProposal -> ERRO 127 failed to invoke chaincode _lifecycle, error: timeout expired while executing transaction
github.com/hyperledger/fabric/core/chaincode.(*Handler).Execute
/go/src/github.com/hyperledger/fabric/core/chaincode/handler.go:1181
github.com/hyperledger/fabric/core/chaincode.(*ChaincodeSupport).execute
/go/src/github.com/hyperledger/fabric/core/chaincode/chaincode_support.go:272
github.com/hyperledger/fabric/core/chaincode.(*ChaincodeSupport).Invoke

Hyperledger Fabric: peer chaincode instantiate error: "could not assemble transaction " "msg chaincode registration failed"

We are trying to instantiate the sample chaincode github.com/chaincode/chaincode_example02/go/ in a sample network, and we get the following error message... any suggestions where to look at?
CLI logs:
Error: could not assemble transaction, err proposal response was not successful, error code 500, msg chaincode registration failed: container exited with 0
Peer Logs:
2020-10-29 15:20:31.341 UTC [gossip.comm] sendToEndpoint -> DEBU 5ed1 Exiting
2020-10-29 15:20:31.397 UTC [chaincode] Launch -> DEBU 5ed2 stopping due to error while launching: container exited with 0
github.com/hyperledger/fabric/core/chaincode.(*RuntimeLauncher).Launch.func1
/opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/runtime_launcher.go:63
runtime.goexit
/opt/go/src/runtime/asm_amd64.s:1333
chaincode registration failed
2020-10-29 15:20:31.397 UTC [container] lockContainer -> DEBU 5ed3 waiting for container(mycc-1.0) lock
2020-10-29 15:20:31.397 UTC [container] lockContainer -> DEBU 5ed4 got container (mycc-1.0) lock
2020-10-29 15:20:31.417 UTC [container] unlockContainer -> DEBU 5edb container lock deleted(mycc-1.0)
2020-10-29 15:20:31.417 UTC [chaincode] Launch -> DEBU 5edc launch complete
2020-10-29 15:20:31.417 UTC [chaincode] Deregister -> DEBU 5edd deregister handler: mycc:1.0
2020-10-29 15:20:31.417 UTC [endorser] callChaincode -> INFO 5ede [mychannel][502c46f0] Exit chaincode: name:"lscc" (35376ms)
2020-10-29 15:20:31.417 UTC [endorser] SimulateProposal -> ERRO 5edf [mychannel][502c46f0] failed to invoke chaincode name:"lscc" , error: container exited with 0
github.com/hyperledger/fabric/core/chaincode.(*RuntimeLauncher).Launch.func1
/opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/runtime_launcher.go:63
runtime.goexit
/opt/go/src/runtime/asm_amd64.s:1333
chaincode registration failed
2020-10-29 15:20:31.417 UTC [endorser] SimulateProposal -> DEBU 5ee0 [mychannel][502c46f0] Exit
2020-10-29 15:20:31.417 UTC [lockbasedtxmgr] Done -> DEBU 5ee1 Done with transaction simulation / query execution [502c46f068a775e5966ee76e646b9444410e582877e12bd2b69aa89102061299]
2020-10-29 15:20:31.417 UTC [endorser] func1 -> DEBU 5ee2 Exit: request from 192.168.0.6:50290
The problem was caused by having a docker-compose network name which was not the default name (byfn).
It was fixed by adding the environ variable CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE to the right name

Hyperledger Fabric endorsement failing: txid exists

I am currently trying to successfully invoke a chaincode on an Hyperledger Fabric network using Docker Swarm, based on this example. My network is the following:
org1 with peer0.org1.com + 1 CA org1 + CLI org1 + orderer.example.com from ordererOrg on PC1
org2 with peer0.org2.com + 1 CA org2 on PC2
It seems that my network is working, but once a chaincode is instantiated on a peer then invoked, the operation is not propagated. E.g I insert data into the ledger, the chaincode container logs show that they process the data, the peer container used to invoke the chaincode seems to have correctly endorsed and simulated the query too. All of this using commands manually from inside the CLI.
peer0.org1.com container logs
2019-07-09 08:52:08.753 UTC [endorser] EndorseWithPlugin -> DEBU 3784 Entering endorsement for {plugin: escc, channel: mychannel, tx: 50732326bbe19c9eb8de42fa327ee67fc2c8102337ef96cdf9ca49fb7a0b7703, chaincode: fabcar}
2019-07-09 08:52:08.753 UTC [msp.identity] Sign -> DEBU 3785 Sign: plaintext: 0A2040CDC0100B7F12FA1505C311EF86...455254494649434154452D2D2D2D2D0A
2019-07-09 08:52:08.753 UTC [msp.identity] Sign -> DEBU 3786 Sign: digest: 5E7E6A043E851C3316B08F5CB4A05D31840D213793C55BF14EBE64213E852F84
2019-07-09 08:52:08.756 UTC [endorser] EndorseWithPlugin -> DEBU 3787 Exiting {plugin: escc, channel: mychannel, tx: 50732326bbe19c9eb8de42fa327ee67fc2c8102337ef96cdf9ca49fb7a0b7703, chaincode: fabcar}
2019-07-09 08:52:08.756 UTC [endorser] endorseProposal -> DEBU 3788 [mychannel][50732326] Exit
2019-07-09 08:52:08.756 UTC [lockbasedtxmgr] Done -> DEBU 3789 Done with transaction simulation / query execution [50732326bbe19c9eb8de42fa327ee67fc2c8102337ef96cdf9ca49fb7a0b7703]
2019-07-09 08:52:08.756 UTC [endorser] func1 -> DEBU 378a Exit: request from 10.0.0.4:34978
2019-07-09 08:52:08.756 UTC [comm.grpc.server] 1 -> INFO 378b unary call completed grpc.service=protos.Endorser grpc.method=ProcessProposal grpc.peer_address=10.0.0.4:34978 grpc.code=OK grpc.call_duration=8.895639ms
A (successfully executed) query on the ledger then shows that the ledger state didn't change.
However, if I use the node SDK provided in the fabcar example from the official samples repo (invoke.js) to invoke the same chaincode operation I get an error:
node sdk error with node invoke.js
2019-07-09T09:22:03.277Z - warn: [DiscoveryEndorsementHandler]: _build_endorse_group_member >> G0:1 - endorsement failed - Error: failed to execute transaction a0a2570dd9a4ce0c696ab08263320927382c6f3db046843dca70a96b63a97da9: error sending: txid: a0a2570dd9a4ce0c696ab08263320927382c6f3db046843dca70a96b63a97da9(mychannel) exists
Failed to submit transaction: Error: Endorsement has failed
peer0.org1.com container logs after node invoke
2019-07-09 09:22:03.273 UTC [endorser] callChaincode -> INFO 15480 [mychannel][a0a2570d] Entry chaincode: name:"fabcar"
2019-07-09 09:22:03.273 UTC [chaincode] Execute -> DEBU 15481 Entry
2019-07-09 09:22:03.273 UTC [chaincode] Execute -> DEBU 15482 Exit
2019-07-09 09:22:03.273 UTC [endorser] callChaincode -> INFO 15483 [mychannel][a0a2570d] Exit chaincode: name:"fabcar" (0ms)
2019-07-09 09:22:03.273 UTC [chaincode] handleMessage -> DEBU 15484 [a0a2570d] Fabric side handling ChaincodeMessage of type: PUT_STATE in state ready
2019-07-09 09:22:03.273 UTC [endorser] SimulateProposal -> ERRO 15485 [mychannel][a0a2570d] failed to invoke chaincode name:"fabcar" , error: txid: a0a2570dd9a4ce0c696ab08263320927382c6f3db046843dca70a96b63a97da9(mychannel) exists
github.com/hyperledger/fabric/core/chaincode.(*TransactionContexts).Create
/opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/transaction_contexts.go:59
github.com/hyperledger/fabric/core/chaincode.(*Handler).Execute
/opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/handler.go:1207
github.com/hyperledger/fabric/core/chaincode.(*ChaincodeSupport).execute
/opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/chaincode_support.go:313
github.com/hyperledger/fabric/core/chaincode.(*ChaincodeSupport).Invoke
/opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/chaincode_support.go:302
github.com/hyperledger/fabric/core/chaincode.(*ChaincodeSupport).Execute
/opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/chaincode_support.go:239
github.com/hyperledger/fabric/core/endorser.(*SupportImpl).Execute
/opt/gopath/src/github.com/hyperledger/fabric/core/endorser/support.go:147
github.com/hyperledger/fabric/core/endorser.(*Endorser).callChaincode
/opt/gopath/src/github.com/hyperledger/fabric/core/endorser/endorser.go:146
github.com/hyperledger/fabric/core/endorser.(*Endorser).SimulateProposal
/opt/gopath/src/github.com/hyperledger/fabric/core/endorser/endorser.go:247
github.com/hyperledger/fabric/core/endorser.(*Endorser).ProcessProposal
/opt/gopath/src/github.com/hyperledger/fabric/core/endorser/endorser.go:500
github.com/hyperledger/fabric/core/handlers/auth/filter.(*expirationCheckFilter).ProcessProposal
/opt/gopath/src/github.com/hyperledger/fabric/core/handlers/auth/filter/expiration.go:61
github.com/hyperledger/fabric/core/handlers/auth/filter.(*filter).ProcessProposal
/opt/gopath/src/github.com/hyperledger/fabric/core/handlers/auth/filter/filter.go:32
github.com/hyperledger/fabric/protos/peer._Endorser_ProcessProposal_Handler.func1
/opt/gopath/src/github.com/hyperledger/fabric/protos/peer/peer.pb.go:169
github.com/hyperledger/fabric/vendor/github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1.1
/opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/grpc-ecosystem/go-grpc-middleware/chain.go:31
github.com/hyperledger/fabric/core/comm.(*Throttle).UnaryServerIntercptor
/opt/gopath/src/github.com/hyperledger/fabric/core/comm/throttle.go:54
github.com/hyperledger/fabric/core/comm.(*Throttle).UnaryServerIntercptor-fm
/opt/gopath/src/github.com/hyperledger/fabric/peer/node/start.go:224
github.com/hyperledger/fabric/vendor/github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1.1
/opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/grpc-ecosystem/go-grpc-middleware/chain.go:34
github.com/hyperledger/fabric/common/grpclogging.UnaryServerInterceptor.func1
/opt/gopath/src/github.com/hyperledger/fabric/common/grpclogging/server.go:91
github.com/hyperledger/fabric/vendor/github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1.1
/opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/grpc-ecosystem/go-grpc-middleware/chain.go:34
github.com/hyperledger/fabric/common/grpcmetrics.UnaryServerInterceptor.func1
/opt/gopath/src/github.com/hyperledger/fabric/common/grpcmetrics/interceptor.go:30
github.com/hyperledger/fabric/vendor/github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1
/opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/grpc-ecosystem/go-grpc-middleware/chain.go:39
github.com/hyperledger/fabric/protos/peer._Endorser_ProcessProposal_Handler
/opt/gopath/src/github.com/hyperledger/fabric/protos/peer/peer.pb.go:171
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*Server).processUnaryRPC
/opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/server.go:982
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*Server).handleStream
/opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/server.go:1208
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*Server).serveStreams.func1.1
/opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/server.go:686
runtime.goexit
/opt/go/src/runtime/asm_amd64.s:1333
error sending
failed to execute transaction a0a2570dd9a4ce0c696ab08263320927382c6f3db046843dca70a96b63a97da9
github.com/hyperledger/fabric/core/chaincode.processChaincodeExecutionResult
/opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/chaincode_support.go:245
github.com/hyperledger/fabric/core/chaincode.(*ChaincodeSupport).Execute
/opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/chaincode_support.go:240
github.com/hyperledger/fabric/core/endorser.(*SupportImpl).Execute
/opt/gopath/src/github.com/hyperledger/fabric/core/endorser/support.go:147
github.com/hyperledger/fabric/core/endorser.(*Endorser).callChaincode
/opt/gopath/src/github.com/hyperledger/fabric/core/endorser/endorser.go:146
github.com/hyperledger/fabric/core/endorser.(*Endorser).SimulateProposal
/opt/gopath/src/github.com/hyperledger/fabric/core/endorser/endorser.go:247
github.com/hyperledger/fabric/core/endorser.(*Endorser).ProcessProposal
/opt/gopath/src/github.com/hyperledger/fabric/core/endorser/endorser.go:500
github.com/hyperledger/fabric/core/handlers/auth/filter.(*expirationCheckFilter).ProcessProposal
/opt/gopath/src/github.com/hyperledger/fabric/core/handlers/auth/filter/expiration.go:61
github.com/hyperledger/fabric/core/handlers/auth/filter.(*filter).ProcessProposal
/opt/gopath/src/github.com/hyperledger/fabric/core/handlers/auth/filter/filter.go:32
github.com/hyperledger/fabric/protos/peer._Endorser_ProcessProposal_Handler.func1
/opt/gopath/src/github.com/hyperledger/fabric/protos/peer/peer.pb.go:169
github.com/hyperledger/fabric/vendor/github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1.1
/opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/grpc-ecosystem/go-grpc-middleware/chain.go:31
github.com/hyperledger/fabric/core/comm.(*Throttle).UnaryServerIntercptor
/opt/gopath/src/github.com/hyperledger/fabric/core/comm/throttle.go:54
github.com/hyperledger/fabric/core/comm.(*Throttle).UnaryServerIntercptor-fm
/opt/gopath/src/github.com/hyperledger/fabric/peer/node/start.go:224
github.com/hyperledger/fabric/vendor/github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1.1
/opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/grpc-ecosystem/go-grpc-middleware/chain.go:34
github.com/hyperledger/fabric/common/grpclogging.UnaryServerInterceptor.func1
/opt/gopath/src/github.com/hyperledger/fabric/common/grpclogging/server.go:91
github.com/hyperledger/fabric/vendor/github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1.1
/opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/grpc-ecosystem/go-grpc-middleware/chain.go:34
github.com/hyperledger/fabric/common/grpcmetrics.UnaryServerInterceptor.func1
/opt/gopath/src/github.com/hyperledger/fabric/common/grpcmetrics/interceptor.go:30
github.com/hyperledger/fabric/vendor/github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1
/opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/grpc-ecosystem/go-grpc-middleware/chain.go:39
github.com/hyperledger/fabric/protos/peer._Endorser_ProcessProposal_Handler
/opt/gopath/src/github.com/hyperledger/fabric/protos/peer/peer.pb.go:171
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*Server).processUnaryRPC
/opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/server.go:982
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*Server).handleStream
/opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/server.go:1208
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*Server).serveStreams.func1.1
/opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/server.go:686
runtime.goexit
/opt/go/src/runtime/asm_amd64.s:1333
2019-07-09 09:22:03.273 UTC [endorser] SimulateProposal -> DEBU 15486 [mychannel][a0a2570d] Exit
2019-07-09 09:22:03.273 UTC [lockbasedtxmgr] Done -> DEBU 15487 Done with transaction simulation / query execution [a0a2570dd9a4ce0c696ab08263320927382c6f3db046843dca70a96b63a97da9]
2019-07-09 09:22:03.273 UTC [endorser] func1 -> DEBU 15488 Exit: request from 172.18.0.1:51702
2019-07-09 09:22:03.273 UTC [chaincode] HandleTransaction -> DEBU 15489 [a0a2570d] handling PUT_STATE from chaincode
2019-07-09 09:22:03.273 UTC [comm.grpc.server] 1 -> INFO 1548a unary call completed grpc.service=protos.Endorser grpc.method=ProcessProposal grpc.peer_address=172.18.0.1:51702 grpc.code=OK grpc.call_duration=4.573006ms
2019-07-09 09:22:03.274 UTC [chaincode] HandleTransaction -> DEBU 1548b [a0a2570d] Completed PUT_STATE. Sending RESPONSE
2019-07-09 09:22:03.274 UTC [chaincode] handleMessage -> DEBU 1548c [a0a2570d] Fabric side handling ChaincodeMessage of type: PUT_STATE in state ready
2019-07-09 09:22:03.274 UTC [chaincode] HandleTransaction -> DEBU 1548d [a0a2570d] handling PUT_STATE from chaincode
2019-07-09 09:22:03.274 UTC [chaincode] HandleTransaction -> DEBU 1548e [a0a2570d] Completed PUT_STATE. Sending RESPONSE
2019-07-09 09:22:03.275 UTC [chaincode] handleMessage -> DEBU 1548f [a0a2570d] Fabric side handling ChaincodeMessage of type: COMPLETED in state ready
2019-07-09 09:22:03.275 UTC [chaincode] Notify -> DEBU 15490 [a0a2570d] notifying Txid:a0a2570dd9a4ce0c696ab08263320927382c6f3db046843dca70a96b63a97da9, channelID:mychannel
2019-07-09 09:22:03.275 UTC [chaincode] Execute -> DEBU 15491 Exit
2019-07-09 09:22:03.275 UTC [endorser] callChaincode -> INFO 15492 [mychannel][a0a2570d] Exit chaincode: name:"fabcar" (3ms)
2019-07-09 09:22:03.275 UTC [lockbasedtxmgr] GetTxSimulationResults -> DEBU 15493 Simulation completed, getting simulation results
2019-07-09 09:22:03.275 UTC [lockbasedtxmgr] Done -> DEBU 15494 Done with transaction simulation / query execution [a0a2570dd9a4ce0c696ab08263320927382c6f3db046843dca70a96b63a97da9]
2019-07-09 09:22:03.275 UTC [endorser] SimulateProposal -> DEBU 15495 [mychannel][a0a2570d] Exit
2019-07-09 09:22:03.275 UTC [endorser] endorseProposal -> DEBU 15496 [mychannel][a0a2570d] Entry chaincode: name:"fabcar"
2019-07-09 09:22:03.275 UTC [endorser] endorseProposal -> DEBU 15497 [mychannel][a0a2570d] escc for chaincode name:"fabcar" is escc
2019-07-09 09:22:03.275 UTC [endorser] EndorseWithPlugin -> DEBU 15498 Entering endorsement for {plugin: escc, channel: mychannel, tx: a0a2570dd9a4ce0c696ab08263320927382c6f3db046843dca70a96b63a97da9, chaincode: fabcar}
2019-07-09 09:22:03.275 UTC [msp.identity] Sign -> DEBU 15499 Sign: plaintext: 0A20828C242C3048295EE0453AD5EA85...455254494649434154452D2D2D2D2D0A
2019-07-09 09:22:03.275 UTC [msp.identity] Sign -> DEBU 1549a Sign: digest: F3BEDFED5C78408FD01F0A41C0714245508FD2F5AEF8A34F33E7F3C61DEFF987
2019-07-09 09:22:03.275 UTC [endorser] EndorseWithPlugin -> DEBU 1549b Exiting {plugin: escc, channel: mychannel, tx: a0a2570dd9a4ce0c696ab08263320927382c6f3db046843dca70a96b63a97da9, chaincode: fabcar}
2019-07-09 09:22:03.276 UTC [endorser] endorseProposal -> DEBU 1549c [mychannel][a0a2570d] Exit
2019-07-09 09:22:03.276 UTC [lockbasedtxmgr] Done -> DEBU 1549d Done with transaction simulation / query execution [a0a2570dd9a4ce0c696ab08263320927382c6f3db046843dca70a96b63a97da9]
2019-07-09 09:22:03.276 UTC [endorser] func1 -> DEBU 1549e Exit: request from 172.18.0.1:51702
2019-07-09 09:22:03.276 UTC [comm.grpc.server] 1 -> INFO 1549f unary call completed grpc.service=protos.Endorser grpc.method=ProcessProposal grpc.peer_address=172.18.0.1:51702 grpc.code=OK grpc.call_duration=6.750666ms
I tried some solutions found on SO such as:
having anchor peers set for each org: was already done
setting CORE_PEER_LISTENADDRESS=org1.example.com:7051 -> failed the peer containers. If I set the address to 0.0.0.0:7051 the containers starts again but the error stays the same
restarting Docker / removing volumes / redownloading images: didn't change a thing
Further points:
The orderer doesn't seem to be notified, as we can see in its logs.
When I use node invoke.js I sometimes get this error, which disappears when I launch the command again. Peer logs don't show an error.
node invoke.js inconsistent error
2019-07-09T14:13:21.232Z - error: [AbstractStrategy]: constructor: No event hubs for strategy
Failed to submit transaction: Error: No event hubs for strategy
When I query using node, I'll sometimes get the following error:
node query.js inconsistent error
2019-07-09T13:23:13.602Z - error: [SingleQueryHandler]: evaluate: message=No peers available to query. Errors: [], stack=FabricError: No peers available to query. Errors: []
at SingleQueryHandler.evaluate (/home/path_to_dir/app/javascript/node_modules/fabric-network/lib/impl/query/singlequeryhandler.js:39:17)
at Transaction.evaluate (/home/path_to_dir/app/javascript/node_modules/fabric-network/lib/transaction.js:246:29)
at Contract.evaluateTransaction (/home/path_to_dir/app/javascript/node_modules/fabric-network/lib/contract.js:172:39)
at main (/home/path_to_dir/app/javascript/query.js:47:39)
at <anonymous>, name=FabricError
Failed to evaluate transaction: FabricError: No peers available to query. Errors: []
This error usually disappears when I start a query again but will pop off from time to time. When the query comes from the CLIorg1 it never happens.
Some probably useful files:
configtx.yaml
crypto-config.yaml
docker-compose-org1.yaml
docker-compose-org2.yaml
EDIT: added insert.js file and logs after trying to node insert.js (see comments)
Configuration information
HLF 1.4.1 ; Docker 18.09.7 ; docker-compose 1.23.2 ; node v8.16.0 ; npm 6.4.1 ; Ubuntu 18.04.2 LTS
Apologies for the multitude of errors which makes the question broad, but I assume they are somehow all connected to an endorsement issue. If not, do not hesitate to edit / ping me to narrow it down.

How fix "rpc error: code = Unknown desc = access denied: channel [mychannel] creator org [Org1MSP]" error in Hyperledger Fabric

Currently I am using Hyperledger Fabric 1.4, and I am trying to modify the basic-network. I am trying to add an org2 with one peer. Whenever I try to invoke the chaincode from the peer on the second organization (Org2) I get the following error:
Error: Error endorsing chaincode: rpc error: code = Unknown desc = access denied: channel [] creator org [Org2MSP]
My current network components are:
org1, with two peers
org2, with one peer
CA1
CA2
Ordere
CLI
and a channel called "mychannel"
I am able to create the channel "mychannel" and join the 3 peers from the two organizations. Also, I am able to install the chaincode on three of the peers from both organizations. And I am instantiating the chaincode on peer0 in Org1
Part of the Ordere logs:
2019-05-13 13:17:42.384 UTC [fsblkstorage] newBlockfileMgr -> INFO 003 Getting block information from block storage
2019-05-13 13:17:42.970 UTC [orderer.commmon.multichannel] Initialize -> INFO 004 Starting system channel 'testchainid' with genesis block hash f1bcfe55588bd24faaa699bc740045455283b63950436a36d5cf473f4b3d8f81 and orderer type solo
2019-05-13 13:17:42.970 UTC [orderer.common.server] Start -> INFO 005 Starting orderer:
Version: 1.4.1
Commit SHA: 87074a7
Go version: go1.11.5
OS/Arch: linux/amd64
2019-05-13 13:17:42.970 UTC [orderer.common.server] Start -> INFO 006 Beginning to serve requests
2019-05-13 13:21:30.921 UTC [comm.grpc.server] 1 -> INFO 007 streaming call completed grpc.service=orderer.AtomicBroadcast grpc.method=Broadcast grpc.peer_address=172.20.0.6:36544 grpc.code=OK grpc.call_duration=27.428231ms
2019-05-13 13:21:30.927 UTC [fsblkstorage] newBlockfileMgr -> INFO 008 Getting block information from block storage
2019-05-13 13:21:31.038 UTC [orderer.commmon.multichannel] newChain -> INFO 009 Created and starting new chain mychannel
2019-05-13 13:21:31.044 UTC [comm.grpc.server] 1 -> INFO 00a streaming call completed grpc.service=orderer.AtomicBroadcast grpc.method=Deliver grpc.peer_address=172.20.0.6:36542 grpc.code=OK grpc.call_duration=152.538972ms
2019-05-13 13:22:11.867 UTC [common.deliver] Handle -> WARN 00b Error reading from 172.20.0.6:36578: rpc error: code = Canceled desc = context canceled
2019-05-13 13:22:11.867 UTC [comm.grpc.server] 1 -> INFO 00c streaming call completed grpc.service=orderer.AtomicBroadcast grpc.method=Deliver grpc.peer_address=172.20.0.6:36578 error="rpc error: code = Canceled desc = context canceled" grpc.code=Canceled grpc.call_duration=5.757971ms
2019-05-13 13:22:22.295 UTC [orderer.common.broadcast] Handle -> WARN 00d Error reading from 172.20.0.8:34272: rpc error: code = Canceled desc = context canceled
2019-05-13 13:22:22.295 UTC [comm.grpc.server] 1 -> INFO 00e streaming call completed grpc.service=orderer.AtomicBroadcast grpc.method=Broadcast grpc.peer_address=172.20.0.8:34272 error="rpc error: code = Canceled desc = context canceled" grpc.code=Canceled grpc.call_duration=7.238573847s
2019-05-13 13:23:46.748 UTC [orderer.common.broadcast] Handle -> WARN 00f Error reading from 172.20.0.8:34362: rpc error: code = Canceled desc = context canceled
2019-05-13 13:23:46.748 UTC [comm.grpc.server] 1 -> INFO 010 streaming call completed grpc.service=orderer.AtomicBroadcast grpc.method=Broadcast grpc.peer_address=172.20.0.8:34362 error="rpc error: code = Canceled desc = context canceled" grpc.code=Canceled grpc.call_duration=49.20235ms
In summery, I can not invoke the chaincode from the second organization (Org2) because of channel access error.
Note:
I am generating the CA and I have checked the files and it seems to be correct
If anyone can help I would appreciate it.
Thanks in advance
This can be caused by wrong MSPID name for example "orgMSP" is wrong as it starts with lowercase "o"
to solve the problem use correct MSPID
export CORE_PEER_LOCALMSPID="Org1MSP"
It would be easy to answer if you have shared the peer logs.
The error could be because of the Certificates to sign the transaction.Double check your certificate received from CA and also checked the certificates and path used inside the docker container of peer1.

Resources