Hyperledger Fabric自定义链代码调用失败

问题描述 投票:0回答:2

我正在尝试运行自定义链代码。我能够成功部署它,但是当我使用以下命令运行invoke命令时:

peer chaincode invoke -n mycc -c '{"Args":["write","hello_world", "200"]}'

面对此错误消息:

错误:错误支持链代码:rpc错误:代码= 2 desc =部署链代码时出错:无法启动链代码规范(无法从LCCC获取mycc的部署事务 - 错误部署链代码:返回失败的事务或查询:未找到事务缺省值/ mycc)

在对等体上成功部署链码后记录(在DEV模式下运行对等体):

13:48:06.320 [shim] INFO : Chaincode log level not provided; defaulting to: DEBUG
13:48:06.320 [shim] DEBU : Peer address: 0.0.0.0:7051
13:48:06.321 [shim] DEBU : os.Args returns: [./chaincode_start]
13:48:06.323 [shim] DEBU : Registering.. sending REGISTER
13:48:06.324 [shim] DEBU : []Received message REGISTERED from shim
13:48:06.325 [shim] DEBU : []Handling ChaincodeMessage of type: REGISTERED(state:created)
13:48:06.325 [shim] DEBU : Received REGISTERED, ready for invocations
13:54:16.458 [shim] DEBU : [lccc]Received message INIT from shim
13:54:16.458 [shim] DEBU : [lccc]Handling ChaincodeMessage of type: INIT(state:established)
13:54:16.458 [shim] DEBU : Entered state init
13:54:16.458 [shim] DEBU : [lccc]Received INIT, initializing chaincode
13:54:16.461 [shim] DEBU : [lccc]Inside putstate
13:54:16.461 [shim] DEBU : [lccc]Sending PUT_STATE
13:54:16.462 [shim] DEBU : [lccc]Received message RESPONSE from shim
13:54:16.462 [shim] DEBU : [lccc]Handling ChaincodeMessage of type: RESPONSE(state:init)
13:54:16.462 [shim] DEBU : [lccc]before send
13:54:16.462 [shim] DEBU : [lccc]after send
13:54:16.464 [shim] DEBU : [lccc]Received RESPONSE, communicated (state:init)
13:54:16.464 [shim] DEBU : [lccc]Received RESPONSE. Successfully updated state
13:54:16.464 [shim] DEBU : [lccc]Init succeeded. Sending COMPLETED
13:54:16.464 [shim] DEBU : [lccc]Move state message COMPLETED
13:54:16.464 [shim] DEBU : [lccc]Handling ChaincodeMessage of type: COMPLETED(state:init)
13:54:16.465 [shim] DEBU : [lccc]send state message COMPLETED

任何关于我出错的指针都会很棒。提前致谢。

blockchain hyperledger hyperledger-fabric
2个回答
0
投票

对调用语法的一些修改可能会有所帮助。

  • 如果启用了安全性,则应使用-u参数指定已注册的用户。
  • 对于-n参数,可以尝试链代码ID而不是链代码名称。

调用的示例语法包含在https://hub.docker.com/r/ibmblockchain/fabric-peer/的“测试和验证本地网络”标题下。


0
投票

您是否确保在运行此命令之前设置了环境变量,一旦您重新进入对等容器,您需要这样做。此外,在调用chaincode时,您需要传递一些标志及其选项。

尝试这样的命令:

***peer chaincode invoke -o <orderer-string>:<port> --tls --cafile <permissions-path-which-is-.pem-file> -C $CHANNEL_NAME -n mycc -c '{"Args":["write","hello_world", "200"]}'***
© www.soinside.com 2019 - 2024. All rights reserved.