I've followed 2 different tutorials
https://github.com/swetharepakula/Fabric101Workshop and
https://hyperledger-fabric.readthedocs.io/en/release-2.0/deploy_chaincode.html.
Both times when I query installed it shows fabcar is installed and it commits successfully, but in both when I try to invoke I receive the following:
Error: endorsement failure during invoke. response: status:500 message:"make sure the chaincode fabcar has been successfully defined on channel mychannel and try again: chaincode definition for 'fabcar' exists, but chaincode is not installed".
I've tried changing CORE_PEER_GOSSIP_USELEADERELECTION=true
, but this stopped one of my peer nodes from starting up.
I'm working on a Mac and the nodes are running in docker, any help would be greatly appreciated.
a chaincode is installed onto the file system of every peer that joins a channel, the chaincode must then be instantiated on the channel so that peers can interact with the ledger via the chaincode container. The instantiation performs any necessary initialization of the chaincode.
I've had this error when I used the wrong packageID when approving on one of the organization
When using approveformyorg
, checkout that you use respective $PACKAGE_ID_ORG1
and $PACKAGE_ID_ORG2
:
On org1 :
peer lifecycle chaincode approveformyorg \
--channelID $CHANNEL_NAME \
--name $CHAINCODE_NAME --version $CC_VERSION \
--package-id $PACKAGE_ID_ORG1 \
--sequence $CC_SEQ -o orderer:7050 --tls --cafile $ORDERER_TLS_CA
On org2 :
peer lifecycle chaincode approveformyorg \
--channelID $CHANNEL_NAME \
--name $CHAINCODE_NAME --version $CC_VERSION \
--package-id $PACKAGE_ID_ORG2 \
--sequence $CC_SEQ -o orderer:7050 --tls --cafile
Otherwise it would give me the following info :
On org1:
bash-5.0# peer lifecycle chaincode queryapproved -C bankscochannel -n fabcar
Approved chaincode definition for chaincode 'fabcar' on channel 'bankscochannel':
sequence: 1, version: 1.0, init-required: false, package-id: fabcar-v1:002d3fc291572c3e8bc52fea3b228cbd1877ab87669978759fc75f51f893a0dd, endorsement plugin: escc, validation plugin: vscc
bash-5.0# peer lifecycle chaincode querycommitted -C bankscochannel
Committed chaincode definitions on channel 'bankscochannel':
Name: fabcar, Version: 1.0, Sequence: 1, Endorsement Plugin: escc, Validation Plugin: vscc
bash-5.0# peer lifecycle chaincode queryinstalled
Installed chaincodes on peer:
Package ID: fabcar-v1:002d3fc291572c3e8bc52fea3b228cbd1877ab87669978759fc75f51f893a0dd, Label: fabcar-v1
0n org2:
bash-5.0# peer lifecycle chaincode queryapproved -C bankscochannel -n fabcar
Approved chaincode definition for chaincode 'fabcar' on channel 'bankscochannel':
sequence: 1, version: 1.0, init-required: false, package-id: fabcar-v1:002d3fc291572c3e8bc52fea3b228cbd1877ab87669978759fc75f51f893a0dd, endorsement plugin: escc, validation plugin: vscc
bash-5.0# peer lifecycle chaincode querycommitted -C bankscochannel
Committed chaincode definitions on channel 'bankscochannel':
Name: fabcar, Version: 1.0, Sequence: 1, Endorsement Plugin: escc, Validation Plugin: vscc
bash-5.0# peer lifecycle chaincode queryinstalled
Installed chaincodes on peer:
Package ID: fabcar-v1:c4430b8d45ee5bca03233272da19aafab73d41c973861adfab8d349c70d950e3, Label: fabcar-v1
Note that in the console output the result of both peer lifecycle chaincode queryapproved
return the same package_id which is not correct
You may not have set the correct --package-id
when you approved your chaincode definition
I encountered the same problem as you,that is because I have set uncorrect --package-id
1ec5f659f7b95978829202e4201cd969ccb0952a9c87a1bb51c9588b518923a1,but correct --package-id
value should be sacc_1.0:1ec5f659f7b95978829202e4201cd969ccb0952a9c87a1bb51c9588b518923a1
reference https://hyperledger-fabric.readthedocs.io/en/release-2.2/deploy_chaincode.html#invoke-failure
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With