我遵循结构样本/测试网络的指示,但试图在docker容器中重现控制步骤。链代码安装的所有步骤都很顺利,除了最后一个步骤-peer chaincode invoke
。
在这个步骤中,我得到了一个错误:2020-07-09 10:40:00.755 UTC [chaincodeCmd] chaincodeInvokeOrQuery -> DEBU 05a ESCC invoke result: response:<status:500 message:"make sure the chaincode fabcar has been successfully defined on channel appchannel and try again: chaincode definition for 'fabcar' exists, but chaincode is not installed" > Error: endorsement failure during invoke. response: status:500 message:"make sure the chaincode fabcar has been successfully defined on channel appchannel and try again: chaincode definition for 'fabcar' exists, but chaincode is not installed"
当我用peer lifecycle chaincode queryinstalled
检查链码时,我收到一个正常响应:Installed chaincodes on peer: Package ID: fabcar_1:644530ed4e097a65073d6e0fc8a7aaa9282945e55aa1ec7d2014746fd598f631, Label: fabcar_1
但当我用peer chaincode list --installed
检查链码时,我收到空集:Get installed chaincodes on peer:
使用测试示例中的configtx.yaml。
我的错误在哪里?
这是我的Dockerfile。其主要思想是建立一个自给自足的超级账本docker环境,满足外包需求。
命令peer chaincode ...
使用LSCC-Lifecycle System Chaincode,该代码用于1.x Fabric网络。关于这一点的2.x文档在这里
您可以尝试使用旧式命令安装链码peer chaincode install ...
,然后使用peer chaincode list --installed
查询已安装的链码。但从2.0版本开始,建议使用新的生命周期链代码。
我还在这里找到了1.4和2.0版本在实践中的链代码比较。希望这能给你一些想法。
正如@HoaiNam所提到的,由于您使用的是test-network
,因此必须使用fabricv2.x
api。您也可以通过添加v1.4.x
功能(不确定(来尝试上一个命令。要了解最新的CC生命周期过程,您可以参考此处。有关命令,请参阅test-network/scripts/deployCC.sh
。我希望这能有所帮助。
在新的生命周期中,我们必须使用:
peer lifecycle chaincode queryinstalled
在旧的生命周期中,我们使用
peer chaincode list --installed