“Error getting chaincode package bytes” when deploying chaincode on hyperledger via REST

萝らか妹 提交于 2019-12-01 11:08:59

Considering that you are playing with Bluemix service, I assume you are following "Implementing your first chain code tutorial"

If your forked repository you will see instructions to use branch v1.0 for Bluemix Blockchain Services (link) IBM BMX Service is (still) using Fabric v0.5.

Once you have Registered with one of the available Enroll ID you should be able to deploy your chaincode using DeploySpec (note the path: "https://github.com/romeokienzler/learn-chaincode/tree/v1.0/finished")

{
"jsonrpc": "2.0",
  "method": "deploy",
  "params": {
    "type": 1,
    "chaincodeID": {
      "path": "https://github.com/romeokienzler/learn-chaincode/tree/v1.0/finished"
    },
    "ctorMsg": {
      "function": "init",
      "args": [
        "hi there"
      ]
    },
    "secureContext": "user_type1_0"
  },
  "id": 1
}
Sergey Balashevich

First of all deploy command should be changed to ( the value for path variable was changed):

{
    "jsonrpc": "2.0",
    "method": "deploy",
    "params": {
        "type": 1,
        "chaincodeID": {
            "path": "https://github.com/romeokienzler/learn-chaincode/finished"
        },
        "ctorMsg": {
            "function": "init",
            "args": ["hi there"]
        },
        "secureContext": "user_type1_0"
    },
    "id": 1
}

P.S. As @Mil4n correctly mentioned, IBM Bluemix still works with Fabric v0.5. Chaincode romeokienzler/learn-chaincode/finished should be adopted to this version.

For example shim.ChaincodeStubInterface is not available yet and should be replaced with *shim.ChaincodeStub.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!