Hyperledger Custom Chaincode部署错误

hty*_*agi 3 go blockchain hyperledger

我正在使用Hyperledger来处理POC.我已经设置了这里提到的链代码设置.我正在关注链接中提到的选项1(使用vagrant来运行CA服务器和一个VP).在我目前的设置中,我正在运行禁用安全性.我的VP被罚款运行,并且我能够启动并注册chaincode就好了(按照提到这里但是,当我试图通过CLI使用以下命令来部署我chaincode:

peer chaincode deploy -n mycc -c '{"Function":"init", "Args": `["hi there"]}'`
Run Code Online (Sandbox Code Playgroud)

我收到以下错误

Error: Error building chaincode: rpc error: code = 2 desc = "Error getting chaincode package bytes: Cannot generate hashcode from empty chaincode path"
Run Code Online (Sandbox Code Playgroud)

我特意提到我存储自定义链码的路径,我收到以下错误:

Error: Error building chaincode: rpc error: code = 2 desc = "Path to chaincode does not exist: /opt/gopath/src/ProductBC/ProductBC/finished/"
Run Code Online (Sandbox Code Playgroud)

有没有人遇到过类似的问题或者有什么方法可以解决这个问题呢?

Ser*_*ich 5

看起来您使用完整路径到您的链码"/ 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"]}'`
Run Code Online (Sandbox Code Playgroud)

在这种情况下,peer将尝试在$ GOPATH/src/ProductBC/ProductBC/finished中找到此链代码

PS在聊天讨论后更新.