问题描述
我在vm中设置了一个对等设备,并且运行良好.我也通过此向同行注册了链码
I have setup a peer in a vm and its running fine. Also i have registered the chaincode with the peer through this
它没有显示错误
现在,在此之后,当我尝试使用此json从其余位置触发init方法时
Now after this when i try to hit the init method from rest using this json
{
"jsonrpc": "2.0",
"method": "deploy",
"params": {
"type": 1,
"chaincodeID":{
"name": "chaincode_example02",
"path": "github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02"
},
"ctorMsg": {
"function":"init",
"args": ["a","100","b","200"]
}
},
"id": 10
}
我收到此错误
{
"jsonrpc": "2.0"
"error": {
"code": -32700
"message": "Parse error"
"data": "Error unmarshalling chaincode request payload: illegal base64 data at input byte 0"
}-
"id": null
}
有人可以告诉我我在做什么错吗?
Can anybody tell me what am i doing wrong?
推荐答案
我遇到了同样的错误.以下是我所做的并返回了消息.请在随附的屏幕截图中找到tcpdump捕获的我的流量日志.除了控制信号
I got the same error. Following is what I've done and returned message. Please find my traffic log captured by tcpdump in the attached screenshot. Looks like nothing has been actually transferred except for controlling signals
-
我在第一个终端控制台中使用此命令启动了一个运行noops共识的对等端
I started a validating peer running noops consensus with this command in 1st terminal console
docker run --name vp0 --rm -it -e CORE_VM_ENDPOINT = unix:///var/run/docker.sock -p 7050:7050 -p 7051:7051 -p 7054:7054 -p 7053:7053 -e CORE_LOGGING_LEVEL =调试-e CORE_PEER_ID = vp0 -e CORE_PEER_ADDRESSAUTODETECT =真超级账本/fabric-peer对等节点启动
docker run --name vp0 --rm -it -e CORE_VM_ENDPOINT=unix:///var/run/docker.sock -p 7050:7050 -p 7051:7051 -p 7054:7054 -p 7053:7053 -e CORE_LOGGING_LEVEL=DEBUG -e CORE_PEER_ID=vp0 -e CORE_PEER_ADDRESSAUTODETECT=true hyperledger/fabric-peer peer node start
我在第二个终端控制台中用这些命令注册了示例链码
I register the example chaincode with these commands in 2nd terminal console
cd $ GOPATH/src/github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02
cd $GOPATH/src/github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02
开始构建
CORE_CHAINCODE_ID_NAME = mycc CORE_PEER_ADDRESS = 0.0.0.0:7051 ./chaincode_example02
CORE_CHAINCODE_ID_NAME=mycc CORE_PEER_ADDRESS=0.0.0.0:7051 ./chaincode_example02
第一个终端控制台显示我的示例链码已注册
the 1st terminal console show that my example chaincode got registered
18:32:12.070 [chaincode] HandleChaincodeStream-> DEBU 061当前上下文截止日期= 0001-01-01 00:00:00 +0000 UTC,确定=假
18:32:12.070 [chaincode] HandleChaincodeStream -> DEBU 061 Current context deadline = 0001-01-01 00:00:00 +0000 UTC, ok = false
18:32:12.071 [chaincode] processStream-> DEBU 062 []从Shim接收到消息REGISTER
18:32:12.071 [chaincode] processStream -> DEBU 062 []Received message REGISTER from shim
18:32:12.071 [chaincode] HandleMessage-> DEBU 063 []处理ChaincodeMessage类型:注册状态已创建
18:32:12.071 [chaincode] HandleMessage -> DEBU 063 []Handling ChaincodeMessage of type: REGISTER in state created
18:32:12.071 [chaincode] beforeRegisterEvent-> DEBU 064在创建状态下收到注册
18:32:12.071 [chaincode] beforeRegisterEvent -> DEBU 064 Received REGISTER in state created
18:32:12.071 [chaincode] registerHandler-> DEBU 065已完成针对链码mycc的注册处理程序
18:32:12.071 [chaincode] registerHandler -> DEBU 065 registered handler complete for chaincode mycc
18:32:12.071 [chaincode] beforeRegisterEvent-> DEBU 066已获得chaincodeID = name:"mycc"的注册,发回已注册的
18:32:12.071 [chaincode] beforeRegisterEvent -> DEBU 066 Got REGISTER for chaincodeID = name:"mycc" , sending back REGISTERED
18:32:12.071 [chaincode] notifyDuringStartup-> DEBU 067没有什么要通知的(开发模式?)
18:32:12.071 [chaincode] notifyDuringStartup -> DEBU 067 nothing to notify (dev mode ?)
第二个终端控制台显示一切正常
the 2nd terminal console says everything seems to be fine
18:32:12.069 [shim] DEBU:对等地址:0.0.0.0:7051
18:32:12.069 [shim] DEBU : Peer address: 0.0.0.0:7051
18:32:12.070 [shim] DEBU:os.Args返回:[./chaincode_example02]
18:32:12.070 [shim] DEBU : os.Args returns: [./chaincode_example02]
18:32:12.070 [shim] DEBU:正在注册.正在发送注册信息
18:32:12.070 [shim] DEBU : Registering.. sending REGISTER
18:32:12.071 [shim] DEBU:[]接收到来自shim的注册消息
18:32:12.071 [shim] DEBU : []Received message REGISTERED from shim
18:32:12.071 [shim] DEBU:[]处理ChaincodeMessage类型:已注册(状态:已创建)
18:32:12.071 [shim] DEBU : []Handling ChaincodeMessage of type: REGISTERED(state:created)
18:32:12.071 [shim] DEBU:已收到注册,可以调用
18:32:12.071 [shim] DEBU : Received REGISTERED, ready for invocations
当我将示例链代码部署到对等方时,我收到了错误消息
When I deploy the example chaincode to the peer, I got the error message
对等链代码部署-n mycc -c'{"Function":"init","Args":["a","100","b","200"]}''
peer chaincode deploy -n mycc -c '{"Function":"init", "Args": ["a","100", "b", "200"]}'
19:03:33.715 [logging] LoggingInit-> DEBU 001将命令'chaincode'的默认日志记录级别设置为DEBUG错误:Chaincode参数错误:输入字节0处的非法base64数据
19:03:33.715 [logging] LoggingInit -> DEBU 001 Setting default logging level to DEBUG for command 'chaincode'Error: Chaincode argument error: illegal base64 data at input byte 0
这篇关于HyperLedger-Fabric ChainCode部署导致解析错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!