IBM hyperlegder Fabric Bluemix implementation - errror when deploying chaincode - ibm-cloud

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

Related

'crypto' module: error in Realm function when using verifyAccessToken

We have created a function in Realm Service of MongoDB atlas.
We are passing an okta generated access token to this function to get it verified.
We are using below code in the function
const claims = oktaJwtVfr.verifyAccessToken(’$oktaaccesstoken’,‘api://default’);
But we are getting below error when we call this function.
{
"error": "'crypto' module: error verifying message",
"error_code": "FunctionExecutionError",
"link": "https://realm.mongodb.com/groups/6074931f0ea7xxxx1776f78d/apps/620543aa14c4be86edc27c06/logs?co_id=6210d675xx891e8aa7xx95"
}
We have added ‘#okta/jwt-verifier’ dependency in the code.
Any suggestion please ?

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.

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

"Unable to run test .. null object" on Business Rules service on Bluemix

When testing my rules on the Business Rules service on Bluemix, I get the following error:
"Unable to run test
Error when executing the ruleset /MyRuleApp/1.0/myrules/1.0
An error occurred while the rule session was called:
com.ibm.rules.res.xu.internal.XUException:
An error occurred during
the ruleset execution. ilog.rules.engine.IlrUserRuntimeException:
null object when invoking public void myMethod()"
I had misconstructed the input parameter (it was missing the opening brace):
"foo": {
"name": "foo",
"id": "bar"
}
}
Once I added the opening brace I could run the test successfully.