Ibm cloud IBM Hyperledger Fabric Bluemix实现-部署链码时出错
在遵循“从IBMIbm cloud IBM Hyperledger Fabric Bluemix实现-部署链码时出错,ibm-cloud,blockchain,hyperledger-fabric,Ibm Cloud,Blockchain,Hyperledger Fabric,在遵循“从IBMBluemix区块链文档中部署链码的步骤时,我发现以下错误: 响应主体 { "jsonrpc": "2.0", "error": { "code": -32001, "message": "Deployment failure", "data": "Error when deploying chaincode: Error getting chaincode package bytes: Error getting code 'go get' fa
Bluemix
区块链
文档中部署链码
的步骤时,我发现以下错误:
响应主体
{
"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
}
尝试引用以下链接:
go代码构建正确,但我仍然遇到了“垫片接口”问题的失败错误。Go代码仍然有问题吗?该问题似乎与Asgn1.Go文件中的Go代码有关。该消息表示Init函数的签名是
Init(shim.ChaincodeStubInterface)([]字节,错误)
,而不是Init(shim.ChaincodeStubInterface,字符串,[]字符串)([]字节,错误)
有关与Hyperledger结构版本0.6.1一起使用的示例链码,请参阅中的“了解链码”示例链码。注意,Init函数的签名是
Init(stub shim.ChaincodeStubInterface,function string,args[]string)([]字节,错误)
Andrew Tharp,非常感谢您的链接。用这段代码,一切都很顺利。现在,我对《QuerySpec》中的第二步很感兴趣。我会再搜索一下。还有一件事我不明白的是,当我在cmd上构建Go代码时,它没有给我任何“Shim”错误,所以我认为Go代码一切都很好。但是Bluemix的“DeploySpec”只适用于您提供链接时更改的代码。