Diogo Silva
Diogo Silva

Reputation: 87

Error installing chaincode on HyperLedger fabric

I'm working on this tutorial http://hyperledger-fabric.readthedocs.io/en/latest/build_network.html on a virtual machine Ubuntu 14.04 and I run the script ./byfn.sh -m up to bring up the network. When I run this to install the chaincode:

peer chaincode install -n mycc -v 1.0 -p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02

I get the following error:

Error: Error endorsing chaincode: rpc error: code = Unknown desc = chaincode error (status: 500, message: Error installing chaincode code mycc:1.0(chaincode /var/hyperledger/production/chaincodes/mycc.1.0 exists))

How can I fix this?

Note: I also run docker exec -it cli bash

Upvotes: 2

Views: 5304

Answers (1)

Artem Barger
Artem Barger

Reputation: 41222

Ok, while I'm not 100% sure, since there is not enough information provided. So based on your logs snapshot provided in the comment and based on the error you've got:

Error: Error endorsing chaincode: rpc error: code = Unknown desc = chaincode error (status: 500, message: Error installing chaincode code mycc:1.0(chaincode /var/hyperledger/production/chaincodes/mycc.1.0 exists))

You trying to install chaincode with name which overlaps name of the chaincode installed by byfn.sh script. You can see in script.sh:

Try to change chaincode name in install command, to something different, e.g.:

peer chaincode install -n myNewCC -v 1.0 -p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02

An alternative could be to disable execution of script.sh, however you will have to initialize and create the channel yourself. See here.

Upvotes: 7

Related Questions