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

730 views Asked by At

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.

3

There are 3 answers

5
Dale Avery On BEST ANSWER

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.

2
Andrew Tharp On

I tried using the Learn Chaincode example based on the advice from Dale to change the address of the repository from https://github.com/GitHub_ID/learn-chaincode/tree/master/finished to https://github.com/GitHub_ID/learn-chaincode/finished. The Blockchain network used for this test was running on Bluemix with version 0.6.1 of the Hyperledger Fabric. With the modified path, it was possible to use the APIs tab within the interface for the Blockchain network to deploy the chaincode.

Following are some things to check.

  • The v2.0 branch from https://github.com/IBM-Blockchain/learn-chaincode should be used with a Blockchain network running Hyperledger Fabric version 0.6.1. Is your personal fork even with the v2.0 branch from https://github.com/IBM-Blockchain/learn-chaincode?
  • Was the chaincode deployment issued from the same validating peer used to register the user_type1_0 user? The validating peer can be selected at the top of the APIs tab. There is a note in the Learn Chaincode instructions indicating that the same validating peer must register the user and deploy the chaincode.
1
Saurabh M On

Your go get is command either not able to access Location of your package due to ACL or its parameters are invalid as per IBM doc. Please recheck its format