2016-07-20 42 views
3

我正在使用Hyperledger來處理POC。我已經設置鏈碼設置爲here。我遵循鏈接中提到的選項1(使用vagrant運行CA服務器和一個VP)。在我目前的設置中,我在禁用安全的情況下運行。我的VP被罰款運行,並且我能夠啓動並註冊chaincode就好了(按照提到here但是,當我試圖通過CLI使用以下命令來部署我chaincode:Hyperledger自定義Chaincode部署錯誤

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" 

我試着特別提到了在那裏我已經存儲在我的自定義chaincode的路徑,我得到以下錯誤:

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

有沒有人遇到類似的問題,或者有什麼可以解決這個問題的方法?

回答

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"]}'` 
在這種情況下,對

將設法找到這個chaincode在$ GOPATH/src目錄/ ProductBC/ProductBC /成品

附:在聊天中討論後更新。

+0

所以,我的GOPATH是'/ opt/gopath /',我的chaincode駐留在'/ src'目錄中。所以,我試着用下面的命令: 「peer chaincode deploy -p/src/ProductBC/ProductBC/finished -n mycc -c'{」Function「:」init「,」Args「:'[」hi there「] }''「,它現在不會拋出任何錯誤,但似乎卡住了。用新狀態更新問題。 – tortuga

+0

'src'沒有必要。你能不能嘗試運行這個命令? (剛剛更新了答案中的示例) –

+0

通過重新啓動對等點,您意味着通過'make peer'再次構建對等點,或者僅通過'peer node start'命令重新啓動對等點? – tortuga

相關問題