2

I got problems during my invoke.

1.) I rund following command:

peer lifecycle chaincode querycommitted \
    --channelID mychannel \
    --name basic \
    --cafile ${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem

--> till here everything worked well.

Than I wanted to invoke the chaincode:

peer chaincode invoke \
    -o localhost:7050 \
    --ordererTLSHostnameOverride orderer.example.com \
    --tls \
    --cafile ${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem \
    -C mychannel \
    -n basic \
    --peerAddresses localhost:7051 \
    --tlsRootCertFiles ${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt \
    --peerAddresses localhost:9051 \
    --tlsRootCertFiles ${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt \
    -c '{"function":"InitLedger","Args":[]}'

Afterwards I got the Error:

Error: endorsement failure during invoke. response: status:500 message:"error in simulation: failed to execute transaction 93.....: could not launch chaincode basic_1.0:465......: chaincode registration failed: container exited with 1"

I tried the whole process serveral times, to make sure, that I do not have any mistakes before. I also checked the dockers by docker ps , all are normal.

So I have no glue, what the source for the error could be.I will be happy about every help! Thank you!!!

myeongkil kim
  • 2,465
  • 4
  • 16
  • 22
Kate
  • 181
  • 1
  • 1
  • 13

1 Answers1

2

Initially after committing the chaincode, init must be performed first. To execute init, you just need to specify --isInit in the invoke parameter option. See the documentation below. fabric/peer/chaincode

peer chaincode invoke \
    -o localhost:7050 \
    --ordererTLSHostnameOverride orderer.example.com \
    --tls \
    --cafile ${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem \
    -C mychannel \
    -n basic \
    --isInit \
    --peerAddresses localhost:7051 \
    --tlsRootCertFiles ${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt \
    --peerAddresses localhost:9051 \
    --tlsRootCertFiles ${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt \
    -c '{"function":"InitLedger","Args":[]}'
myeongkil kim
  • 2,465
  • 4
  • 16
  • 22
  • 1
    thank you. In my case, I don't need to execute init. Anyway I tried yours: `Error: endorsement failure during invoke. response: status:500 message:"error in simulation: failed to execute transaction 5c8....: invalid invocation: chaincode 'basic' does not require initialization but called as init" ` – Kate Dec 31 '20 at 09:52
  • i see, It's ambiguous right now, so I'll check it again tomorrow. It's not helpful, but unfortunate :( – myeongkil kim Dec 31 '20 at 12:23
  • Yeah it's a bit strange. So I followed completly this instruction: [link] (https://hyperledger-fabric.readthedocs.io/en/release-2.2/deploy_chaincode.html). So to invoke the chaincode is still not working.....But I can go further - actually to the end- without any problems in the instruction. So does it mean invoking the chaincode is not necessary ? And @myeongkil kim Happy New Year to you!! (I still have some hours more to go) – Kate Dec 31 '20 at 18:54
  • 1
    What is the version of docker? Currently, gRPC-related issues are occurring in version >3.0.0, and it was confirmed that the fabric also has a dependency. – myeongkil kim Jan 01 '21 at 03:36
  • It's docker version: 19.03.8. So recording the fabric prerequisites it should be ok ("17.06.2-ce or later") – Kate Jan 02 '21 at 15:16
  • Docker desktop(3.0.0) has Docker Engine(20.10.0) It doesn't seem to be this problem. – myeongkil kim Jan 03 '21 at 04:53
  • 1
    If so, what are the `ccenv` and `baseos` docker image versions of chaincode? It is necessary to check whether the version of the peer and the version of the chaincode image specified in core.yaml are the same. If the chaincode image version is latest, you need to check whether the latest version is the same as the peer version value. – myeongkil kim Jan 03 '21 at 04:53
  • Thank you @myeongkil kim! It is working now :) – Kate Jan 05 '21 at 09:23