IBM Blockchain(Hyperledger) - “部署链代码时出错”

时间:2017-01-09 12:22:17

标签: ibm-cloud blockchain hyperledger hyperledger-fabric

我遵循指示,使用IBM Bluemix仪表板上的swagger API将一些链代码部署到IBM Hyperledger Blockchain。

为了部署一些链代码,我需要提交一个JSON请求,其中包含链代码存储库的路径:

{
  "jsonrpc": "2.0",
  "method": "deploy",
  "params": {
    "type": 1,
    "chaincodeID": {
      "path": "https://github.com/series0ne/learn-chaincode/tree/master/finished"
    },
    "ctorMsg": {
      "function": "init",
      "args": [
        "Hello, world"
      ]
    },
    "secureContext": "user_type1_0"
  },
  "id": 0
}

我在尝试部署之前登录了user_type1_0,但这是我得到的结果:

{
  "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 1\"\npackage github.com/series0ne/learn-chaincode/tree/master/finished: cannot find package \"github.com/series0ne/learn-chaincode/tree/master/finished\" in any of:\n\t/opt/go/src/github.com/series0ne/learn-chaincode/tree/master/finished (from $GOROOT)\n\t/opt/gopath/_usercode_/424324290/src/github.com/series0ne/learn-chaincode/tree/master/finished (from $GOPATH)\n\t/opt/gopath/src/github.com/series0ne/learn-chaincode/tree/master/finished\n"
  },
  "id": 0
}

有什么想法吗?

P.S。目前在Bluemix上运行Hyperledger区块链的提交级别0.6.1。

3 个答案:

答案 0 :(得分:1)

尝试剥离“树/主”'部署网址的一部分。请注意,下面链接的示例不包括网址的这一部分:

https://github.com/IBM-Blockchain/learn-chaincode#deploying-the-chaincode

此url将被传递到对等体内的go get <url>命令,该命令将下载链代码以便可以编译。因此,此URL必须与此命令接受的格式匹配。

答案 1 :(得分:1)

我尝试使用基于Dale建议的Learn Chaincode示例将存储库的地址从https://github.com/GitHub_ID/learn-chaincode/tree/master/finished更改为https://github.com/GitHub_ID/learn-chaincode/finished。用于此测试的Blockchain网络在Bluemix上运行,Hyperledger Fabric版本为0.6.1。通过修改后的路径,可以使用接口内的API选项卡为区块链网络部署链代码。

以下是要检查的一些事项。

  • 来自https://github.com/IBM-Blockchain/learn-chaincode的v2.0分支应与运行Hyperledger Fabric版本0.6.1的区块链网络一起使用。即使使用https://github.com/IBM-Blockchain/learn-chaincode的v2.0分支?
  • ,您的个人分叉也是如此
  • 是否从用于注册user_type1_0用户的同一验证对等体发出了链代码部署?可以在API选项卡的顶部选择验证对等体。 Learn Chaincode说明中有一条说明,表明相同的验证对等方必须注册用户并部署链代码。

答案 2 :(得分:0)

您的go get is命令由于ACL而无法访问软件包的位置,或者根据IBM文档,其参数无效。请重新检查其格式

相关问题