2017-01-24 38 views
0

時,雖然按照「中的步驟部署你的chaincode從IBM BluemixBlockchain文檔,我發現了以下錯誤:IBM hyperlegder面料Bluemix實現 - errror部署chaincode

響應體

{ 
    "jsonrpc": "2.0", 
    "error": { 
    "code": -32001, 
    "message": "Deployment failure", 
    "data": "Error when deploying chaincode: Error getting chaincode package bytes: Error getting code 'go get' failed with error: \"exit status 2\"\n# github.com/VrushaliW1/BluemixApp1\n/opt/gopath/_usercode_/583850129/src/github.com/VrushaliW1/BluemixApp1/Asgn1.go:38: stub.GetFunctionAndParameters undefined (type shim.ChaincodeStubInterface has no field or method GetFunctionAndParameters)\n/opt/gopath/_usercode_/583850129/src/github.com/VrushaliW1/BluemixApp1/Asgn1.go:75: stub.GetFunctionAndParameters undefined (type shim.ChaincodeStubInterface has no field or method GetFunctionAndParameters)\n/opt/gopath/_usercode_/583850129/src/github.com/VrushaliW1/BluemixApp1/Asgn1.go:193: cannot use new(SimpleChaincode) (type *SimpleChaincode) as type shim.Chaincode in argument to shim.Start:\n\t*SimpleChaincode does not implement shim.Chaincode (wrong type for Init method)\n\t\thave Init(shim.ChaincodeStubInterface) ([]byte, error)\n\t\twant Init(shim.ChaincodeStubInterface, string, []string) ([]byte, error)\n" 
    }, 
    "id": 0 
} 

參考以下鏈接: IBM Blockchain (Hyperledger) - "Error when deploying chaincode"

"Error getting chaincode package bytes" when deploying chaincode on hyperledger via REST

go代碼正確地構建,但仍然出現'Shim interface'問題的失敗錯誤。 Go代碼仍然有問題嗎?

回答

0

此問題似乎與Asgn1.go文件中的Go代碼有關。該消息表明Init函數的簽名是Init(shim.ChaincodeStubInterface) ([]byte, error)而不是Init(shim.ChaincodeStubInterface, string, []string) ([]byte, error)

有關適用於Hyperledger Fabric版本0.6.1的鏈式代碼示例,請參閱https://github.com/IBM-Blockchain/learn-chaincode/blob/v2.0/finished/chaincode_finished.go上的「瞭解Chaincode」示例鏈接代碼。請注意,Init函數的簽名是Init(stub shim.ChaincodeStubInterface, function string, args []string) ([]byte, error)

+0

Andrew Tharp,非常感謝你的鏈接。事情確實解決了這個問題。現在我正在堅持'QuerySpec'的第二步。我會再搜索一下。還有一件事我不明白的是,當我在cmd上構建它時,Go代碼並沒有給我任何'Shim'的錯誤,所以我認爲Go代碼中的一切都是goo。但是Bluemix的'DeploySpec'只能在您提供鏈接時更改代碼。 – VrushaliMphatek

相關問題