HyperLedger-Fabric: "Error unmarshalling chaincode request payload: illegal base64 data at input byte 0"

+1 vote

I try to deploy chaincode, it always throws back the error in the JSON input as shown below.

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

response:

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'

Please help

Oct 30, 2018 in Blockchain by slayer
• 29,050 points
137 views

1 answer to this question.

0 votes

The function name should be in Args and all parameters should be base64 encoded.
Instead of:

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

The arguments for deploy command will look like:

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

answered Oct 30, 2018 by Sumanth

Related Questions In Blockchain

+1 vote
2 answers

Where is custom chaincode path Hyperledger Fabric 1.0?

You have to have your chaincode at ...READ MORE

answered Jul 10, 2018 in Blockchain by slayer
• 29,050 points
920 views
0 votes
0 answers
0 votes
1 answer
0 votes
1 answer
+16 votes
4 answers