Hyperledger on Bluemix: Failed to launch chaincode spec(Could not get deployment transaction

231 views Asked by At

I'm running a simple Hyperledger network on Bluemix. I can deploy, and invoke, but not query. The chaincode function, Init sets up a value for var, "abc" ... stub.PutState("abc", []byte(strconv.Itoa(Aval)))

I should be able to query "abc" as validation the code is ready to use. Instead, I'm seeing this error:

"... Error:Failed to launch chaincode spec(Could not get deployment transaction for - LedgerError - ResourceNotFound: ledger: resource not found)"

The query json is:

{
  "jsonrpc": "2.0",
  "method": "query",
  "params": {
    "type": 1,
    "chaincodeID": {
      "name": "my chaincode id"
    },
    "ctorMsg": {
      "function": "read",
      "args": [
        "abc"
      ]
    },
    "secureContext": "user_type1_3"
  },
  "id": 0
}
1

There are 1 answers

2
Clyde D'Cruz On

The following is the list of probable causes of the error

Could not get deployment transaction for - LedgerError - ResourceNotFound: ledger: resource not found

1. Chaincode did not get deployed correctly. To check if the chaincode was deployed correctly, you need to check the peer logs to see if there were any errors when the deploy transaction was sent.

2. Chaincode got deployed correctly, but the consensus mechanism hasnt yet completed. You should ideally wait for a few minutes after deploying a chaincode before you try to query it.

3. The Chaincode got deployed, but the chaincode ID/name specified while trying to send a query is incorrect. You need to make sure you use the same chaincode ID that comes in the response when you deploy a chaincode.