IBM-Blockchain-Archive / ibm-blockchain-issues

Having issues with the IBM Blockchain Bluemix service? Let us know!
13 stars 12 forks source link

Deploying chaincode from github to IBM Blockchain is NOT WORKING. #42

Closed TarantulaTechnology closed 7 years ago

TarantulaTechnology commented 8 years ago

BMX IBM Blockchain is BROKE for developers who want to deploy their own or demo code from github as IBM documentation describes.

The Demo Chaincode Example02 works only from the UI. You cannot deploy it from github. The UI is confusing, because the link to the source code being deployed goes to v0.6 code (shim.ChaincodeStubInterface).

If you copy the source code to your own github repo and try to deploy it you get an error complaining about the shim.ChaincodeStubInterface (v0.6 code).

If you change the code to v0.5 (shim.ChaincodeStub), it indicates a successful deploy, returning a chaincode ID. But upon examination of the network tab it is clear it did not deploy correctly, it never appears and cannot be found as indicated by a query that returns an error message hinting this.

So, clearly something is BROKE in IBM Blockchain on BMX.

Again, you can only deploy and operate the Demo Chaincode. You cannot deploy your own code from github, even though it is a perfect copy of the chaincode IBM indicates is being deployed.

Another point of confusion is the code level deployed and supported on IBM Blockchain.

Is it Fabric v0.5 (shim.ChaincodeStub) or Fabric v0.6 (shim.ChaincodeStubInterface)?

Because only code compiled to v0.5 (shim.ChaincodeStub) is consumed without an error indication while code compiled to v0.6 is consumed, but returns an ERROR indicating it does not like the v0.6 code (shim.ChaincodeStubInterface).

I highly suggest IBM NOT rely on canned tests baked into the UI--Demo Chaincode. Instead rely on what a developer does: compile chaincode, push it to your github repo, and deploy it using the URL to your github repo.

The inability of developers to deploy their own code makes BMX IBM Blockchain at this time USELESS to developers and only a very simple sales demo!

dshuffma-ibm commented 8 years ago

Well, the majority of your issues actually are from a documentation error. I'll try to fix this asap. The link you see for example02 chaincode is actually not the one it sends when it does the deploy. Lets look at the contents of the actual deploy the UI sends:

image

and then look at the url we have incorrectly set for the chaincode link:

https://github.com/hyperledger/fabric/blob/master/examples/chaincode/go/chaincode_example02/chaincode_example02.go

Its not the same, the hyperlink is wrong.


Your next point is that the UI cc deployment is not a good test. Well that's not true. The UI deployment is not special in anyway. You probably came to this conclusion because of the above error. If you plan to deploy chaincode with HTTP then the "baked in" UI deploy is functionally identical to any other deployment.


Your next question was about what shim version. Bluemix is still on fabric 0.5.x so use v0.5 (shim.ChaincodeStub).


on to your final issue. So your deployment was not totally successful correct? Could you post the body of your deployment call? Also take a look a the logs of the peer you sent it to. There is usually helpful info in there.

TarantulaTechnology commented 8 years ago

Why is the link pointing to: code in Dale Avery (masterDev1985)'s github repo? How are you able to compile anything referencing github.com/hyperledger/fabric/core/chaincode/shim which contains shim.ChaincodeStubInterface, not shim.ChaincodeStub?

If you want to help me you must understand what I am doing and what I am doing is what IBM docs tell you to do.

  1. Make sure you can compile your code locally, (I can),
  2. place your code in a public github repo, (I did),
  3. submit a deploy request (I did),
  4. check the response for any errors (I did no errors).

But I know better because, reading the logs it failed during the compile, copy, etc. line. IBM should not do things like combining commands, but instead keep each separate, and report failures from each instead of failing on the line with n-commands that leave no room to determine which command is failing.

I'll assume it is the compile that is failing. The error does not tell you why or what, it just says error API 500...I've been here before.

I know the process and code I am doing and using worked flawlessly on Sep 7th. Now it does not work.

I'm told v0.5 is still deployed and I believe that because, if I compile v0.6 and deploy I get an expected error submitting v0.6 to a v0.5 deployment. So, I am confident IBM is running v0.5, but I cannot understand why it is failing to compile in IBM, while it compiles successfully, locally. If there was output from the IBM compile then I would have something to work with. But API 500 leaves no insight why it is failing.

Because no one here understands what I am saying, because I am unable to clearly explain and argue my experience, I expect the IBM blockchain will not function, beyond the UI canned demos, correctly, if a developer tries to deploy code from Github, until the v0.6 release, and IBM is forced to redeploy and ensure it is functioning for developers who want to deploy code rather than deploy the working canned demos on the UI and play.

I want to code and deploy my code and this is so frustrating. I'll keep checking back, but for now, I cannot recommend BMX IBM Blockchain to clients and peers, until this is resolved, and that looks like it is not going to happen until IBM loads a fresh new version like, the soon to be released v0.6.

Maybe, that's what they are waiting for, and just do not have the bandwidth, or will, to resolve an issue with a version they know will go away soon.

Meanwhile, developers trying BMX IBM Blockchain will not receive a good impression and may seek alternative resources for their blockchain development.

Sorry, if this post leaves one fuming. Not my intention, I just want to code and deploy chaincode, and so, I am disappointed I am no longer able to do what I was doing up to Sep 8th.

IBM Blockchain probably broke between Sep16-19th, that's when the last public notice of trouble and activity was posted, ending with the v0.4.1 to v0.4.2 IBM Blockchain version update. And now code that compiles locally, does not compile in IBM Blockchain. What changed?

TarantulaTechnology commented 8 years ago

If you deploy and get no error and you go to the network tab, you will not see the chaincode at the bottom, ever!

If you deploy the canned UI demos, you will see the chaincode at the bottom of the network tab, with little delay.

This clearly indicates there is a problem with the IBM Blockchain deployment code.

Question is...is it your chaincode or IBM Blockchain code?

Well, if you can compile your chaincode then it must be the IBM Blockchain code that is at fault--simple logic.

mastersingh24 commented 8 years ago

I'll be back to post some more detailed responses to your very valid questions after I test a couple of things, but let me address one thing first:

Why is the link pointing to: code in Dale Avery (masterDev1985)'s github repo? How are you able to compile anything referencing github.com/hyperledger/fabric/core/chaincode/shim which contains shim.ChaincodeStubInterface, not shim.ChaincodeStub?

Up until mid/late July, we were running 2 nodes networks in BMX (using NOOPS of course) and we were running several different commit levels of the fabric prior to fabric cutting the v0.5-developer-preview. At that point, new blockchain service instances in Bluemix were changed to run the v0.5-developer-preview version of fabric with 4 peers running PBFT plus 1 membership services node. While this was the config for new service instances, we still kept many of the existing 2 peer versions running as well.

The chaincode shim interface actually also changed between the version of fabric in the 2 peer config and the v0.5-developer-preview version. During our testing, we had already run into the problem with trying to keep our samples working across multiple version of the fabric. This is of course caused by the fact that Go does not have any real versioning scheme. You'll see that in our marbles and cp demos we actually use a folder structure to version our chaincode but this does not protect against the fact that fabric has no versioning. And as you know, go get will always pull from the HEAD of the master branch of the repo.

So what ended up doing is that in base container image we use for fabric, we include the v0.5-developer-preview version of the fabric in our GOPATH. This way you don't need to vendor the fabric within your chaincode project and can still do remote deployment from your own Github repo (assuming you implement the v0.5 shim interface). Now that chaincode won't compile locally unless you actually have the v0.5-developer-preview version in your local GOPATH, but it will deploy and compile within BMX.

But we had one additional problem. Someone decided that we should also include the example02 chaincode within the UI / dashboard. This would have been OK except for 2 things:

1) Right before we were ready to launch the update 4 peer config, the shim interface in the master branch was changed. This also resulted in example02 being changed to use this new interface

2) Hyperledger transitioned from Github to Gerrit and during this transition for legal reasons (I think) the v0.5-developer-preview branch was not carried over. At the same time, Github became a mirror of Gerrit so we basically lost the v0.5-developer-preview branch

Luckily from past experience we already had a fork of the v0.5-developer-preview version of fabric in Dale's (masterDev1985) account so we pointed to it. The BMX blockchain UI uses the REST API to deploy from remote repos so we use Dale's for example02 and the ones in the ibm-blockchain org to deploy marbles and commerical paper (cp). But the code is the same.

mastersingh24 commented 8 years ago
IBM Blockchain probably broke between Sep16-19th, that's when the last public notice of trouble and activity was posted, ending with the v0.4.1 to v0.4.2 IBM Blockchain version update. And now code that compiles locally, does not compile in IBM Blockchain. What changed?

The v0.4.1 to v0.4.2 update was a single backend change which had nothing to do with the fabric (it was basically a small fix to prevent collisions in our backend database when resetting networks)

Now as long as you were using the v0.5 version of the interfaces, your chaincode should deploy to BMX. You should be able to find the error within the peer logs.

Now during that same period we have discovered that its taking an unusually long time to actually deploy chaincode and this even results in chaincode failing to deploy (which is why you'll never see it on the network tab of the UI).

I will say that it is currently hit or miss in terms of how long it takes to deploy chaincode and whether or not deployment will timeout (we think we have a handle on that - some routing in our network was off).

mastersingh24 commented 8 years ago

You bring up an interesting point on the stuff from the demos tab. What I think started happening is that when our internal routing got messed up, Docker wnet off to docker.io to try to find images which of course were not there which resulted in timeouts.

For the samples, we've had enough people deploy them already that the images are actually on the local machines. We are still investigating this odd behavior

svenwoldt commented 7 years ago

crazy read, was just about to give it a try then I came around this "so BMX" issue again - outta here

mrshah-at-ibm commented 7 years ago

@TarantulaTechnology we have updated the bluemix service to v0.6 of fabric on Nov 14. You can vendor the chaincode shim with the chaincode (thus not having external dependencies to pull from).

Please let us know, if you are still seeing this issue.

dhyey20 commented 7 years ago

Closing this. Please re-open if you are still having issues.

tjclifford commented 7 years ago

I'm having what seems to be the same error when I try to build and deploy Nick Gaski's version of commercial paper, https://github.com/nickgaski/cp-web. The project does build, but when it gets pushed to one of my 4 Bluemix instances, I'm getting:

2017-07-18T13:25:02.52-0400 [APP/PROC/WEB/0]OUT [ibc-js] Deploying Chaincode - Starting 2017-07-18T13:25:02.52-0400 [APP/PROC/WEB/0]OUT [ibc-js] function: init , arg: [] 2017-07-18T13:25:02.52-0400 [APP/PROC/WEB/0]OUT Waiting... 2017-07-18T13:25:02.59-0400 [APP/PROC/WEB/0]OUT [ibc-js] deploy - failure: 500 2017-07-18T13:25:02.59-0400 [APP/PROC/WEB/0]OUT ! looks like a deploy error, holding off on the starting the socket 2017-07-18T13:25:02.59-0400 [APP/PROC/WEB/0]OUT { name: 'deploy() error', 2017-07-18T13:25:02.59-0400 [APP/PROC/WEB/0]OUT code: 500, 2017-07-18T13:25:02.59-0400 [APP/PROC/WEB/0]OUT details: { [Error: socket hang up] code: 'ECONNRESET' } }

This seems to indicate the Blockchain service Bluemix lets us set up seems to be having some trouble, not allowing connections. I can only wait to see if this is true, unless I can find the Blockchain forums on DeveloperWorks. I'll let you know what I find out.