在Hyperledger Fabric中尝试调用时,出现以下错误:存在"fabcar"的链码定义,但未安装链码 [英] In Hyperledger Fabric when I try to invoke, I'm getting the following error: chaincode definition for 'fabcar' exists, but chaincode is not installed
问题描述
我遵循了2个不同的教程
I've followed 2 different tutorials
https://github.com/swetharepakula/Fabric101Workshop 和
https://hyperledger-fabric.readthedocs.io/en/版本2.0/deploy_chaincode.html .
两次查询安装都显示 fabcar已安装并且成功提交,但是在两种情况下,当我尝试调用时,都会收到以下信息:
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:
错误:调用期间认可失败.回复:状态:500消息:确保已成功定义chaincode fabcar在频道mychannel上,然后重试:"fabcar"的链码定义存在,但未安装chaincode".
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".
我尝试更改 CORE_PEER_GOSSIP_USELEADERELECTION = true
,但是这阻止了我的一个对等节点的启动.
I've tried changing CORE_PEER_GOSSIP_USELEADERELECTION=true
, but this stopped one of my peer nodes from starting up.
我正在Mac上工作,并且节点正在docker中运行,任何帮助将不胜感激.
I'm working on a Mac and the nodes are running in docker, any help would be greatly appreciated.
推荐答案
我在批准其中一个组织时使用了错误的packageID时遇到了此错误
I've had this error when I used the wrong packageID when approving on one of the organization
使用 approveformyorg
时,请检查您分别使用了 $ PACKAGE_ID_ORG1
和 $ PACKAGE_ID_ORG2
:
When using approveformyorg
, checkout that you use respective $PACKAGE_ID_ORG1
and $PACKAGE_ID_ORG2
:
在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
在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 :
在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
请注意,在控制台输出中,两个 peer生命周期链代码查询已批准
的结果都返回相同的package_id,这是不正确的
Note that in the console output the result of both peer lifecycle chaincode queryapproved
return the same package_id which is not correct
这篇关于在Hyperledger Fabric中尝试调用时,出现以下错误:存在"fabcar"的链码定义,但未安装链码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!