undefined: shim.ChaincodeStubInterface deploying chaincode #29
Comments
Related to this? hyperledger-archives/fabric-test-resources-gerrit#1 |
Also note that the Demo Chaincode in the web GUI is using a mixture of imports and shim definitions:
|
I am getting the same errors from the IBM Bluemix tutorial. One doesn't compile and the other doesn't deploy. Any help? |
@dselman - unfortunately, we find ourselves in a tricky situation where the interface definitions for chaincode are different between the version deployed in Bluemix (v0.5-developer-preview) and the master branch currently mirrored in Github from Gerrit. So if you try to compile locally using the current version from Github you won't be able to deploy that to Bluemix and vice versa. If you want to deploy to Bluemix, you can clone the archive repo (https://github.com/hyperledger-archives/fabric) into your local $GOPATH/src/github.com/hyperledger/fabric and checkout the v0.5-developer-preview branch |
oh - and we actually do use the same shim in all the samples - it is just not 100% obvious which versions of the samples we are using:
|
Thanks @mastersingh24 -- that worked. |
Will the examples be updated? The out-of-box experience is broken for all new users. https://github.com/IBM-Blockchain/learn-chaincode/issues/22 |
we have a dilemma. if we accept the change it will break deploying to a bluemix network since those use an older hyperledger version. if we don't accept the change then it will break when deploying to a network using the latest hyperledger version. we have a few options.
we are open to community feedback and any other ideas. |
Trying this advice:
Forked the above and checked out the branch. github.com/hyperledger-archives/fabric/core/chaincode/shim..\src\github.com\hyperledger-archives\fabric\core\chaincode\shim\chaincode.go:107: cannot use clientConn (type *"github.com/hyperledger-archives/fabric/vendor/google.golang.org/grpc".ClientConn) as type *"github.com/hyperledger/fabric/vendor/google.golang.org/grpc".ClientConn in argument to protos.NewChaincodeSupportClient The go build also fails with: /C/Users/porteto/Documents/GoProjects/learn-chaincode/start.\chaincode_start.go:34: cannot use new(SimpleChaincode) (type _SimpleChaincode) as type shim.Chaincode in argument to shim.Start: |
yeah, I gotta say, spending 3 hours digging around looking for a way to understand just what the difference was, I'm dismayed that there isn't some way to change this with some kind of dependency management. If this bites us, now, here with a simple example (trying to show us how easy it is to develop chaincode and deploy it) - well, what will it be like when a real world app (which are usually significantly more complex than these examples) runs afoul of these types of version mismatches? shouldn't there be a "version": "1.1" line someplace?? |
package managers for golang do exist and it's absolutely the correct long term solution. I agree with you that this is a real world problem that we need to resolve sooner rather than later. the real challenge is to coordinate and align on a single solution. we need the changes to occur in the Hyperledger fabric. |
@portegys I had the same issue before. You have to use "$GOPATH/src/github.com/hyperledger/fabric" directory, instead of "hyperledger-archives". |
@dyancl I did the same thing, replaced "hyperledger-archives" with "hyperledger" but ended up with this error: If you have solved this issue kindly tell me how to do it. |
Did the same as you did MHamza81 and got the same errors .\chaincode_start.go:41: undefined: shim.ChaincodeStubInterface and if you use the shim from hyperledger-archives you get The chaincode.go file are different in hyperledger and hyperledger-archives |
@bouoth you are correct. There are differences between the various releases of the fabric. See these instructions for installing the correct version of the fabric on your machine: |
Thanks Dale Avery ! From: Dale Avery notifications@github.com @bouothhttps://github.com/bouoth you are correct. There are differences between the various releases of the fabric. See these instructions for installing the correct version of the fabric on your machine: You are receiving this because you were mentioned. |
Happy to help! |
I was using 0.5 release (git clone -b v0.5-developer-preview https://github.com/hyperledger-archives/fabric.git) and I had also got below error: I used 0.6 release (git clone -b v0.6 http://gerrit.hyperledger.org/r/fabric) and now am able to compile chaincode successfully. |
Thank you ! Ill try v6.0 Envoy? de mon iPhone Le 3 nov. 2016 ? 14:32, subhahari <notifications@github.commailto:notifications@github.com> a ?crit : I was using 0.5 release (git clone -b v0.5-developer-preview https://github.com/hyperledger-archives/fabric.git) and I had also got below error: I used 0.6 release (git clone -b v0.6 http://gerrit.hyperledger.org/r/fabric) and now am able to compile chaincode successfully. You are receiving this because you were mentioned. |
git clone -b v0.6 http://gerrit.hyperledger.org/r/fabric ,Not Found What should I do? |
@hcc0311 try again. I was able to clone that branch:
If that doesn't work for you, post the error you are seeing. |
Following the "How to Write Chaincode" tutorial I am getting local Go compile errors. When these errors are fixed by replacing references to 'stub *shim.ChaincodeStub' with 'stub shim.ChaincodeStubInterface' the chaincode fails to deploy on the server.
curl -X POST --header "Content-Type: application/json" --header "Accept: application/json" -d " {
"jsonrpc": "2.0",
"method": "deploy",
"params": {
"type": 1,
"chaincodeID": {
"path": "https://github.com/dselman/chaincode/start\"
},
"ctorMsg": {
"function": "init",
"args": [
"a",
"10",
"b",
"5"
]
},
"secureContext": "user_type1_620a5fb1bf"
},
"id": 2
}" "https://70ef4b7e-f88e-49f3-89aa-dc6f176d7f7b_vp1.us.blockchain.ibm.com:443/chaincode"
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/dselman/chaincode/start\n/go/usercode/509999092/src/github.com/dselman/chaincode/start/chaincode_start.go:37: undefined: shim.ChaincodeStubInterface\n/go/usercode/509999092/src/github.com/dselman/chaincode/start/chaincode_start.go:74: undefined: shim.ChaincodeStubInterface\n/go/usercode/509999092/src/github.com/dselman/chaincode/start/chaincode_start.go:133: undefined: shim.ChaincodeStubInterface\n/go/usercode/509999092/src/github.com/dselman/chaincode/start/chaincode_start.go:150: undefined: shim.ChaincodeStubInterface\n"
},
"id": 2
}
The text was updated successfully, but these errors were encountered: