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

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>

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 deploy the application in the IBM Cloud

Unable to deploy the web application in the IBM Cloud dedicated using toolchain.
Shows the deploy failed error.
Gives the message "*App instance exited with guid **** payload: {"instance"=>"****", "index"=>0, "reason"=>"CRASHED", "exit_description"=>"APP/PROC/WEB: Exited with status 1", "crash_count"=>3, "crash_timestamp"=>****, "version"=>"****"}*"
Please suggest some remediation.
Thanks in advance..

IBM hyperlegder Fabric Bluemix implementation - errror when deploying chaincode

While following the steps in 'Deploying your chaincode from IBM Bluemix Blockchain documentation, I'm getting the following error:
Response Body
{
"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 2\"\n# github.com/VrushaliW1/BluemixApp1\n/opt/gopath/_usercode_/583850129/src/github.com/VrushaliW1/BluemixApp1/Asgn1.go:38: stub.GetFunctionAndParameters undefined (type shim.ChaincodeStubInterface has no field or method GetFunctionAndParameters)\n/opt/gopath/_usercode_/583850129/src/github.com/VrushaliW1/BluemixApp1/Asgn1.go:75: stub.GetFunctionAndParameters undefined (type shim.ChaincodeStubInterface has no field or method GetFunctionAndParameters)\n/opt/gopath/_usercode_/583850129/src/github.com/VrushaliW1/BluemixApp1/Asgn1.go:193: cannot use new(SimpleChaincode) (type *SimpleChaincode) as type shim.Chaincode in argument to shim.Start:\n\t*SimpleChaincode does not implement shim.Chaincode (wrong type for Init method)\n\t\thave Init(shim.ChaincodeStubInterface) ([]byte, error)\n\t\twant Init(shim.ChaincodeStubInterface, string, []string) ([]byte, error)\n"
},
"id": 0
}
Tried referring to the links :
IBM Blockchain (Hyperledger) - "Error when deploying chaincode"
"Error getting chaincode package bytes" when deploying chaincode on hyperledger via REST
The go code build rightly but still I'm getting this failure error with 'Shim interface' issue. Is still anything wrong in the Go code?
The issue appears to be related to the Go code in the Asgn1.go file. The message is indicating that the signature of the Init function was Init(shim.ChaincodeStubInterface) ([]byte, error) rather than Init(shim.ChaincodeStubInterface, string, []string) ([]byte, error).
For an example chaincode that works with Hyperledger Fabric version 0.6.1, refer to the “Learn Chaincode” example chaincode at https://github.com/IBM-Blockchain/learn-chaincode/blob/v2.0/finished/chaincode_finished.go. Note that the signature of the Init function is Init(stub shim.ChaincodeStubInterface, function string, args []string) ([]byte, error).

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

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.