【问题标题】:Not able to use IBM Blockchain services after Bluemix 1.0 update (Hyperledger 0.6)Bluemix 1.0 更新后无法使用 IBM Blockchain 服务 (Hyperledger 0.6)
【发布时间】:2016-11-16 12:32:45
【问题描述】:

我和我的团队正在使用 Bluemix Blockchain 服务开发一个应用程序,并且在 1.0 更新之前我们一直在使用该应用程序。我们认为这可能是与 ibm-blockchain.js 库相关的错误,但是我们尝试通过 REST 部署它,但仍然出现错误:

{
 "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/ibm-blockchain/learn-chaincode/finished\n/go/_usercode_/493306176/src/github.com/ibm-blockchain/learn-chaincode/finished/chaincode_finished.go:38: undefined: shim.ChaincodeStubInterface\n/go/_usercode_/493306176/src/github.com/ibm-blockchain/learn-chaincode/finished/chaincode_finished.go:52: undefined: shim.ChaincodeStubInterface\n/go/_usercode_/493306176/src/github.com/ibm-blockchain/learn-chaincode/finished/chaincode_finished.go:67: undefined: shim.ChaincodeStubInterface\n/go/_usercode_/493306176/src/github.com/ibm-blockchain/learn-chaincode/finished/chaincode_finished.go:80: undefined: shim.ChaincodeStubInterface\n/go/_usercode_/493306176/src/github.com/ibm-blockchain/learn-chaincode/finished/chaincode_finished.go:99: undefined: shim.ChaincodeStubInterface\n"
     },
 "id": 1
}

我们的服务仍在使用 0.5 版本。 我们也把本地版本更新到了1.0,也试过了,看看报错是不是一样,好像是这样:

12:16:55.666 [devops] getChaincodeBytes -> ERRO 034 Error getting chaincode package bytes: Error getting code 'go get' failed with error: "exit status 1"
package github.com/VitorSousaCode/chaincodes/tree/master/final: cannot find package "github.com/VitorSousaCode/chaincodes/tree/master/final" in any of:
    /opt/go/src/github.com/VitorSousaCode/chaincodes/tree/master/final (from $GOROOT)
    /opt/gopath/_usercode_/796234422/src/github.com/VitorSousaCode/chaincodes/tree/master/final (from $GOPATH)
    /opt/gopath/src/github.com/VitorSousaCode/chaincodes/tree/master/final
12:16:55.671 [devops] Deploy -> ERRO 035 Error deploying chaincode spec: type:GOLANG chaincodeID:<path:"https://github.com/VitorSousaCode/chaincodes/tree/master/final" > ctorMsg:<args:"init" > secureContext:"user_type1_xxxxxxxxx"

有没有人经历过类似的事情?有谁知道我们是否有任何方法可以继续使用我们之前开发的 Go 链代码而不进行重大更改?

【问题讨论】:

  • Bluemix 和本地环境中的错误不同。第一个issue可以和github.com/IBM-Blockchain/ibm-blockchain-issues/issues/29有关,但是在本地环境下Fabric找不到包,你用什么命令在本地部署chaincode?​​span>
  • 我们在本地用 Postman 使用 REST 命令:{ "jsonrpc": "2.0", "method": "deploy", "params": { "type": 1, "chaincodeID": { "path": "https://github.com/VitorSousaCode/chaincodes/final" }, "ctorMsg": { "function": "init", "args": [ "99" ] }, "secureContext": "user_type1_xxxxxxxxx" }, "id": 1 } 至于第一个问题,我们来看看。

标签: ibm-cloud blockchain hyperledger hyperledger-fabric


【解决方案1】:

bluemix 服务在 2016 年 11 月 10 日之前使用旧版本 v0.5 的 Hyperledger Fabric。此版本使用旧语法,即 shim.ChaincodeStub

bluemix service status page 表明,在 2016 年 10 月 11 日,bluemix 上的 Fabric 版本已更新到 v0.6.1。这个较新的版本应该使用新的语法,即shim.ChaincodeStubInterface

您的部署事务失败,因为您在链码中的语法与结构版本不一致。

注意

  • 如果您正在使用带有 v0.5 版本 Fabric 的 bluemix 服务,请确保使用 shim.ChaincodeStub 语法成功构建您的链代码

  • 如果您使用带有 v0.6 版本的 fabric 的 buemix 服务,请确保使用 shim.ChaincodeStubInterface 构建链代码。有关使用 v0.6 的示例链代码,请参阅 chaincode_example02 v0.6 chaincode

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多