2017-01-24 39 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

相关问题