Welcome to the Linux Foundation Forum!

Lab 4 Invoke Command Failing ("Chaincode registration failed")("Exited with 254")



I am trying to conduct Lab 4 but am stuck on the chaincode invocation step
From googling I've tried the following :
Restart network
Ensure package is installed correctly
Change name paramter in invoke command to PACKAGE_ID
Give absolute path to package command

Install commands used :

peer lifecycle chaincode package simple_chaincode --path /home/$USER/go/src/github.com/hyperledger/fabric-samples/lfd272/chaincodes/simple_chaincode --lang node --label simple_chaincode

peer lifecycle chaincode install simple_chaincode 

export PACKAGE_ID=simple_chaincode:5e11633859d9976c872a38b13521279adf32d14ba8bffa6e29da4b43adcde680 (textbook hash but in my env it corresponds to the correct ID generated by "chaincode install"

peer lifecycle chaincode approveformyorg -o localhost:7050--ordererTLSHostnameOverride orderer.example.com --channelIDmychannel--name simple_chaincode --version 1.0 --package-id$PACKAGE_ID --sequence 1--tls --cafile${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem 

peer lifecycle chaincode commit -o localhost:7050--ordererTLSHostnameOverride orderer.example.com --channelIDmychannel--name simple_chaincode --version 1.0 --sequence 1--tls --cafile${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem--peerAddresseslocalhost: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

peer lifecycle chaincode querycommitted --channelIDmychannel --namesimple_chaincode --cafile${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem

(This invoke command fails)

peer chaincode invoke -o localhost:7050 --ordererTLSHostnameOverrideorderer.example.com --tls --cafile${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem-C mychannel -nsimple_chaincode --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":"put","Args":["k","v"]}'

(Error Message) 

Error: endorsement failure during invoke. response: status:500 message:"error in simulation: failed to execute transaction ($HASH omitted for clarity): could not launch chaincode simple_chaincode:($HASH omitted for clarity): chaincode registration failed: container exited with 254"

Any guidance or insight would be appreciated =]

Thank you


  • Bobbijn
    Bobbijn Posts: 192

    Hello, Let's see if we can resolve this issue. The most probable causes are:

    You have specified an incorrect path to the chaincode when packaging it.
    You have specified an incorrect language flag when packaging the chaincode.
    You haven't installed the chaincode on one of the peers.

    Please determine if any of the above issues can be causing the error.

    Also support can be found on the Discord channel Here is an invite link: https://discord.gg/hyperledger

    Let me know if this helped or if we need to investigate the issue more. Bobbi

  • bpmalik
    bpmalik Posts: 2

    Thank you for the Discord invite!

    I've tried these steps but I think I need more understanding of the process so will try capturing some logs to determine the error =]

    Thank you for the help!

  • dhamadkd

    Hi @bpmalik
    The issue is with the source code of example chaincode. Make sure the fabcar chaincode is copied from the following location.
    https://github.com/hyperledger/fabric-samples/tree/main/chaincode/fabcar .

    In certain lab collections the source code is of fabcar application apis rather than the chaincode

  • Bobbijn
    Bobbijn Posts: 192



Upcoming Training