我正在使用 Hyperledger 处理 POC。我已经按照 here 所述设置了链码设置.我遵循链接中提到的选项 1(使用 vagrant 运行 CA 服务器和一个副总裁)。在我当前的设置中,我在禁用安全性的情况下运行。我的 VP 运行良好,我能够很好地启动和注册链码(如前所述 here 。但是,当我尝试使用以下命令通过 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/"
有没有人遇到过类似的问题或关于如何克服这个问题的任何要点?
最佳答案
看起来您使用链代码的完整路径“/opt/gopath/src/ProductBC/ProductBC/finished/”,但 peer
默认会尝试在您的 gopath 中查找链代码。
只需尝试使用“ProductBC/ProductBC/finished/”运行 CLI 命令即可。
peer chaincode deploy -p ProductBC/ProductBC/finished -c '{"Function":"init", "Args": `["hi there"]}'`
在这种情况下,节点将尝试在 $GOPATH/src/ProductBC/ProductBC/finished 中找到这个链码
附言在聊天中讨论后更新。
关于go - Hyperledger Custom Chaincode部署错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38472750/