英文:
Hyperledger Custom Chaincode deployment error
问题
我正在使用Hyperledger进行POC开发。我已经按照这里提到的设置设置了链码。我正在按照链接中提到的Option 1进行操作(使用vagrant运行CA服务器和一个VP)。在我的当前设置中,我禁用了安全性。我的VP正常运行,我可以成功启动和注册链码(如这里所述)。但是,当我尝试使用以下命令通过CLI部署我的链码时:
peer chaincode deploy -n mycc -c '{\"Function\":\"init\", \"Args\":[\"hi there\"]}'
我遇到了以下错误:
Error: Error building chaincode: rpc error: code = 2 desc = "Error getting chaincode package bytes: Cannot generate hashcode from empty chaincode path"
我尝试明确指定存储自定义链码的路径,但是我遇到了以下错误:
Error: Error building chaincode: rpc error: code = 2 desc = "Path to chaincode does not exist: /opt/gopath/src/ProductBC/ProductBC/finished/"
是否有人遇到过类似的问题,或者有什么方法可以解决这个问题?
英文:
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
得分: 5
看起来你在使用完整路径来指定你的链码“/opt/gopath/src/ProductBC/ProductBC/finished/”,但是peer
默认会在你的gopath
中查找链码。
尝试使用“ProductBC/ProductBC/finished/”来运行CLI命令。
在这种情况下,peer
将会在$GOPATH/src/ProductBC/ProductBC/finished
中查找这个链码。
P.S. 在聊天中讨论后进行了更新。
英文:
It looks like that you use full path to your chaincode “/opt/gopath/src/ProductBC/ProductBC/finished/” but peer
will try to find chaincode in you gopath by default.
Just try to run CLI command with “ProductBC/ProductBC/finished/“ instead.
peer chaincode deploy -p ProductBC/ProductBC/finished -c '{"Function":"init", "Args": `["hi there"]}'`
in this case peer will try to find this chaincode in $GOPATH/src/ProductBC/ProductBC/finished
P.S. Updated after discussion in chat.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论