我试图运行自定义链码。我能够成功部署它,但是当我使用:
运行invoke命令时peer chaincode invoke -n mycc -c '{"Args":["write","hello_world", "200"]}'
面对此错误消息:
错误:错误支持链代码:rpc错误:代码= 2 desc =错误 部署链代码:无法启动链代码规范(无法 从LCCC获取mycc的部署事务 - 错误部署 chaincode:返回失败的事务或查询:事务不是 发现默认/ 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
任何关于我出错的指针都会很棒。提前谢谢。
答案 0 :(得分:0)
对调用语法的一些修改可能有所帮助。
调用的示例语法包含在https://hub.docker.com/r/ibmblockchain/fabric-peer/的“测试和验证本地网络”标题下。
答案 1 :(得分: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"]}'***