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

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.

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.

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.

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

Related

cf push to IBM Cloud failed : Unable to install node: improper constraint: >=4.1.0 <5.5.0

I pushed an app to the IBM Cloud after a minor change (just some data, no code or dependencies).
cat: /VERSION: No such file or directory
-----> IBM SDK for Node.js Buildpack v4.0.1-20190930-1425
Based on Cloud Foundry Node.js Buildpack 1.6.53
-----> Installing binaries
engines.node (package.json): >=4.1.0 <5.5.0
engines.npm (package.json): unspecified (use default)
**WARNING** Dangerous semver range (>) in engines.node. See: http://docs.cloudfoundry.org/buildpacks/node/node-tips.html
**ERROR** Unable to install node: improper constraint: >=4.1.0 <5.5.0
Failed to compile droplet: Failed to run all supply scripts: exit status 14
Exit status 223
Cell 155a85d3-8d60-425c-8e39-3a1183bfec2a stopping instance 5aad9d60-87d7-4153-b1ac-c3847c9a7a83
Cell 155a85d3-8d60-425c-8e39-3a1183bfec2a destroying container for instance 5aad9d60-87d7-4153-b1ac-c3847c9a7a83
Cell 155a85d3-8d60-425c-8e39-3a1183bfec2a successfully destroyed container for instance 5aad9d60-87d7-4153-b1ac-c3847c9a7a83
FAILED
Error restarting application: BuildpackCompileFailed
An older version of the app is running on the IBM Cloud already (from May 2019, I think).
So I wonder what changed so it's not working anymore.
In IBM Cloud Foundry, the Node.js version must be specified like this
"engines": {
"node": "12.x"
}
or
"engines": {
"node": "12.10.x"
}
You can also try removing this completely on your package.json file.
"engines": {
"node": "6.15.1",
"npm": "3.10.10"
},
Here's a quick reference.

Unable to run botium for watson connector

I am trying to test Watson assistance Chatbot
{ "botium": {
"Capabilities": {
"PROJECTNAME": "IBM Watson",
"SCRIPTING_UTTEXPANSION_MODE": "all",
"SCRIPTING_FORMAT": "xlsx",
"SCRIPTING_XLSX_STARTROW": 2,
"SCRIPTING_XLSX_STARTCOL": 1,
"CONTAINERMODE": "watson",
"WATSON_APIKEY": "*********************************",
"WATSON_WORKSPACE_ID": "*********************"
} } }
but it is failing with following exception
Cannot build watson container: 'Watson workspace connection failed: { Error: Unauthorized: Access is denied due to invalid credentials.\n at Request._callback
I have provided correct credential
Skill Details Skill Name:My first skill
Skill ID:****************************
**Workspace ID:*****************************
and
API Key
Service Credentials Service Credentials Name:Service credentials-1
**Api Key:********************
Am I missing something?
Most likely, you have to adapt the Watson Service Endpoint Url using the WATSON_URL capability
And you should switch to the V2 Version of the Assistant API - https://github.com/codeforequity-at/botium-connector-watson#watson_assistant_version - using the Watson assistant ID instead of the workspace id: https://github.com/codeforequity-at/botium-connector-watson#watson_assistant_id-
"WATSON_ASSISTANT_VERSION": "V2",
"WATSON_URL": "your service endpoint",
"WATSON_APIKEY": "....",
"WATSON_ASSISTANT_ID": "....",

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

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
}
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.

“Error getting chaincode package bytes” in car-lease-demo deploy via REST-chaincodeID path

I'm trying to deploy car-lease-demo in Bluemix Services and I cant find the right path for chaincodeID in swaggerApi. I've used the github repo from IBM but it outputs this error:
{
"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/IBM-Blockchain/car-lease-demo/Chaincode/vehicle_code: cannot find package \"github.com/IBM-Blockchain/car-lease-demo/Chaincode/vehicle_code\" in any of:\n\t/opt/go/src/github.com/IBM-Blockchain/car-lease-demo/Chaincode/vehicle_code (from $GOROOT)\n\t/opt/gopath/_usercode_/798513695/src/github.com/IBM-Blockchain/car-lease-demo/Chaincode/vehicle_code (from $GOPATH)\n\t/opt/gopath/src/github.com/IBM-Blockchain/car-lease-demo/Chaincode/vehicle_code\n"
},
"id": 3
}
I've found this
source and checked the JSON tab but the package that is referred in the beginning is not working.
Any idea which is the correct path for the chaincodeID to deploy car-lease-demo chaincode in BMX?
I'm using BMX v0.6
As it says in the error message the go get <chaincode path> failed during the chaincode deploy. This is because the chaincode path in your deploy request is wrong. The correct chaincode path for this chaincode is:
github.com/IBM-Blockchain/car-lease-demo/Chaincode/src/vehicle_code
That said, before you try deploying a chaincode from the web in this manner, you can check if the go chaincode is accessible over the web by doing a:
go get <public chaincode path>

Get Azure VM status : "running , stopped" using resource manager deployment and rest api

i've deployed a vm using Resource Manager deployment model.
Using rest api as described here: https://msdn.microsoft.com/en-us/library/azure/mt163682.aspx
i'm able to get informations about my VM. But i cannot see if the VM is running or not. I want that information to start/stop the VM Automatically via code.
Does anyone have tried that and get the VM powerstate?
best regards...
i make a GET using this URI
string.Format("https://management.azure.com/subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.Compute/virtualMachines/{2}?api-version={3}", subscriptionID, resssourcegroup, vmname,apiversion);
apiversion is 2016-03-30.
The API call for this information is:
https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/Microsoft.Compute/virtualMachines/{vm-name}/InstanceView?api-version={api-version}
Needed to use the second request uri "Get information about the instance view of a virtual machine" from the following url https://msdn.microsoft.com/en-us/library/azure/mt163682.aspx to get the instance powerstate.
Thank you.
This is the link to the documentation where you can see the Status of the VM:
https://learn.microsoft.com/en-us/rest/api/compute/virtual-machines/instance-view?tabs=HTTP
This is an example of the output
"statuses": [
{
"code": "ProvisioningState/succeeded",
"level": "Info",
"displayStatus": "Provisioning succeeded",
"time": "2022-07-25T02:12:52.7726725+00:00"
},
{
"code": "PowerState/running",
"level": "Info",
"displayStatus": "VM running"
}
]