Search code examples
ibm-cloudblockchainhyperledgerhyperledger-fabric

IBM Blockchain (Hyperledger) - "Error when deploying chaincode"


I'm following the instructions to deploy some chaincode to the IBM Hyperledger Blockchain, using the swagger API on the IBM Bluemix dashboard.

In order to deploy some chaincode, I need to submit a JSON request, which contains the path to the chaincode repository:

{
  "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
}

I have logged in user_type1_0 before attempting to deploy, but this is the result I get:

{
  "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
}

Any ideas?

P.S. Currently running commit level 0.6.1 of the Hyperledger blockchain on Bluemix.


Solution

  • Try stripping out the 'tree/master' portion of your deployment url. Notice that the example linked below does not include this portion of the url:

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

    This url is going to be passed into a go get <url> command inside the peer, which will download the chaincode so that it can be compiled. So, this url must match the format accepted by this command.