Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Blockchain by (4.1k points)

I'm using Hyperledger to work on a POC. I've set the chaincode setup as mentioned here . I'm following the Option 1 mentioned in the link(using vagrant to run a CA server and one VP). In my current setup, I'm running with security disabled. My VP is running fine, and I'm able to start and register the chaincode just fine (as per mentioned here. But, when I'm trying to deploy my chaincode via CLI with the following command:

peer chaincode deploy -n mycc -c '{"Function":"init", "Args": `["hi there"]}'`

I am getting the following error: 

Error: Error building chaincode: rpc error: code = 2 desc = "Error getting chaincode package bytes: Cannot generate hashcode from empty chaincode path"

I tried specifically mentioning the path where I've stored my custom chaincode, I get the following error :

Error: Error building chaincode: rpc error: code = 2 desc = "Path to chaincode does not exist: /opt/gopath/src/ProductBC/ProductBC/finished/"

Has anyone faced a similar issue or any points on what can be done to overcome this ?

1 Answer

0 votes
by (14.4k points)

You are getting the error because you are using the full path to your chain code. 

Rather you should use gopath because that is what peers will look for. 

Try to run the CLI command with 

ProductBC/ProductBC/finished/

peer chaincode deploy -p ProductBC/ProductBC/finished -c '{"Function":"init", "Args": `["hi there"]}'`

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...