1
votes

This is a follow-up question for "Chaincode for Developers Cli error terminal 3". I am doing Chaincode for Developers tutorial and I am getting the following error when I run the command peer chaincode instantiate -n mycc -v 0 -c '{"Args":["a","10"]}' -C myc on. terminal 3.

Output for command peer chaincode instantiate -n mycc -v 0 -c '{"Args":["a","10"]}' -C myc:

Error: Error getting (myc) orderer endpoint: Error endorsing GetConfigBlock: rpc error: code = Unknown desc = chaincode error (status: 500, message: "GetConfigBlock" request failed authorization check for channel [myc]: [Failed to get policy manager for channel [myc]])

Output for the command:

peer chaincode install -p chaincodedev/chaincode/sacc -n mycc -v 0

2017-08-23 15:10:21.852 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP 2017-08-23 15:10:21.852 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity 2017-08-23 15:10:21.852 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc 2017-08-23 15:10:21.852 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc 2017-08-23 15:10:21.904 UTC [golang-platform] getCodeFromFS -> DEBU 005 getCodeFromFS chaincodedev/chaincode/sacc 2017-08-23 15:10:22.080 UTC [golang-platform] func1 -> DEBU 006 Discarding GOROOT package fmt 2017-08-23 15:10:22.081 UTC [golang-platform] func1 -> DEBU 007 Discarding provided package github.com/hyperledger/fabric/core/chaincode/shim 2017-08-23 15:10:22.081 UTC [golang-platform] func1 -> DEBU 008 Discarding provided package github.com/hyperledger/fabric/protos/peer 2017-08-23 15:10:22.082 UTC [golang-platform] GetDeploymentPayload -> DEBU 009 done 2017-08-23 15:10:22.085 UTC [msp/identity] Sign -> DEBU 00a Sign: plaintext: 0AA3080A5B08031A0B08DEB5F6CC0510...DF65FC130000FFFFF65F638E00120000 2017-08-23 15:10:22.085 UTC [msp/identity] Sign -> DEBU 00b Sign: digest: 00E981BB0FC2A7D32706156C0F2E1521E5B62F58E231787D87B2CB57CD10C3FA 2017-08-23 15:10:22.089 UTC [chaincodeCmd] install -> DEBU 00c Installed remotely response: 2017-08-23 15:10:22.089 UTC [main] main -> INFO 00d Exiting.....

I had to comment out the line

command: /bin/bash -c './script.sh

in the file "docker-compose-simple.yaml in order to run the command

docker exec -it cli bash.

Can anyone tell me how to solve this?

4

4 Answers

1
votes

Well, I can see a few problems which might the root cause for the error you described. First of all please note, that during instantiate command:

peer chaincode instantiate -n mycc -v 0 -c '{"Args":["a","10"]}' -C myc

you are not pointing to the ordering service, since instantiate is an endorsement transaction eventually it has to be submitted to the ordering service and therefore it should be something like this:

peer chaincode instantiate -o ordererEndpoint:7050 -n mycc -v 0 -c '{"Args":["a","10"]}' -C myc

Note that error you received gives you a hint, since it says that wasn't able to obtain configuration block:

Error: Error getting (myc) orderer endpoint: Error endorsing GetConfigBlock: rpc error: code = Unknown desc = chaincode error (status: 500, message: "GetConfigBlock" request failed authorization check for channel [myc]: [Failed to get policy manager for channel [myc]])

Additionally please make sure that myc is existing channel and you have correctly created it beforehand. You can simply do:

peer channel list

to retrieve a list of channels peer was joined to.

0
votes

The script that you disabled had the commands for creating the channels and joining peer to the channel, which are pre-requisites for doing invokes with the chaincode.

0
votes

I think your problem is caused by the version of image. You're using 1.0.1, and you should change to 1.0.0. Check that the version code is

sudo docker images
0
votes

If you are using docker toolbox on Windows7 to run developer tutorial the end-of-line notation needs to be change to be unix compatible in the scripts.sh. You can use notepadd++ -> edit -> EOL Conversion -> select unix.