繁体   English   中英

HyperLedger-Fabric ChainCode部署-Base64错误

[英]HyperLedger-Fabric ChainCode Deployment - Base64 error

我试图按照Windows设置在笔记本电脑上设置Hyperledger blocchain,能够启动并运行docker映像,但是当我尝试部署提供的示例时,它总是在JSON输入中抛出错误,如图所示下面。

peer chaincode deploy -p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02 -c '{"Function":"init", "Args": ["a","100", "b", "200"]}'

响应:

sug@sri-ub:~/go/$ docker exec -it aa413f4c4289 bash
root@aa413f4c4289:/opt/gopath/src/github.com/hyperledger/fabric# peer chaincode deploy -p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02 -c '{"Function":"init", "Args": ["a","100", "b", "200"]}'

04:30:55.822 [logging] LoggingInit -> DEBU 001 Setting default logging level to DEBUG for command 'chaincode' Error: Non-empty JSON chaincode parameters must contain exactly 1 key: 'Args'

我在HOST机器的POSTMAN中尝试过:

{"jsonrpc":"2.0","method":"deploy","params":{"type":1,"chaincodeID":{"path":"github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02"},"ctorMsg":{"function":"init","args":["a", "1000", "b", "2000"]}},"id":1}

得到的答复是

{"jsonrpc":"2.0","error":{"code":-32700,"message":"Parse error","data":"Error unmarshalling chaincode request payload: illegal base64 data at input byte 0"},"

这类似于错误消息,我仍然无法解决此问题,根据建议创建了新帖子,请帮助我解决此问题。

报告了类似的问题,但也无法解决

在最新的结构版本中,请求的格式已更改。 函数名称应为Args,所有参数均应为base64编码。
代替:

{"function":"init","args":["a", "1000", "b", "2000"]}}

deploy命令的参数如下所示:

{"args":['aW5pdA==', 'YQ==', 'MTAwMA==', 'Yg==', 'MjAwMA==']}

更新 :格式再次更改。 不再需要Base64编码。 最新的Fabric中正确的有效负载是:

{“args”:['init', 'a', '100', 'b', '100']}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM