Hyperledger Custom Chaincode部署错误

Hyperledger Custom Chaincode deployment error

我正在使用 Hyperledger 来处理 POC。我已经按照 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 所述设置了链码设置。但是,当我尝试使用以下命令通过 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

中找到这个链码

P.S。在聊天中讨论后更新。