IBM hyperlegder Fabric Bluemix实现 - 部署链代码时出错

时间:2017-01-24 09:29:23

标签: ibm-cloud blockchain hyperledger-fabric

在执行“从IBM chaincode Bluemix文档部署Blockchain”中的步骤时,我收到以下错误:

回复正文

{
  "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代码中还有什么问题吗?

1 个答案:

答案 0 :(得分: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处的“Learn Chaincode”示例链代码。请注意,Init函数的签名是Init(stub shim.ChaincodeStubInterface, function string, args []string) ([]byte, error)