Closed SBerda closed 7 years ago
but why? why don't you guys write your modified chaincode and install/instantiate THAT chaincode. am I missing something?
Yes I sorry, I have explained badly.
We are writting our modified chaincode but it's based on the marbles chaincode, we wanted to take a working exemple and modified it.
But it's seems that the marbles project don't want to use our custom chaincode and use it's own even if we only modify juste a little .
Do you have any idea why ?
Thanks again for you help
It seems that you are not following the proper procedure for editing, installing, and instantiating a new version of the chaincode. In order to edit chaincode, you can't simply login to the container and replace the existing binary (well, maybe you could, but that is definitely not the system that's been put in place to do so, and as you can see it's causing issues).
The general procedure for editing an existing chaincode to a new version is as follows:
The exact implementation of this procedure depends on the network you have setup to run marbles. Are you running a local Fabric network, or through Bluemix? If you are running a local network, which network did you choose? Basic or byfn? If it's a custom network, please post the docker-compose.yaml file you used to setup your network,
Thanks @ajpauwels
@SBerda did the above comment solve the issue? Can we close this?
Hi, Yes, thank you @ajpauwels for your help . :)
But every time when we debug our chaincode, should we install new version of chaincode? Is there any shortcut way to edit the installed chaincode?
Yes, every time you change the chaincode you install the new version of it. As outlined in any Hyperledger Fabric doc or tutorial you may find. That is how chaincode and Hyperledger Fabric works.
I suggest writing a script which automates the commands to install and upgrade the chaincode. On a local devnet this process takes 1-2 seconds.
You can try running your peer in chaincode-dev mode. Then you can run your chaincode and connect it manually to the peer. You can keep iterating on your chaincode without the need to reinstall/instantiate.
Ref: https://hyperledger-fabric.readthedocs.io/en/release-1.4/peer-chaincode-devmode.html
Hello,
What we trying to archieve Modify the chaincode content to add our custom fields to marbles project.
To do that, as a first step, we would like to modify the output text of a blockchain function . Let's take for exemple « fmt.Println("starting init_marble FizzBuzz") » If we do our work correctly, « docker logs » of dev-peer0-marbles-v0 should output the added content.
What we have tried so far :
Install and instantiate the chaincode Then go inside the container « dev-peer0-marbles-v0 » and remplace /usr/local/bin/chaincode with our chaincode binary and launch marbles as usual.
Note : We cannot modify the chaincode between « install » and « instantiate » because the docker container is not launched yet.
We also wondered if it was related to : https://hyperledger-fabric.readthedocs.io/en/v1.0.0-beta/cc-packaging-and-signing.html# A file is generated in peer0 at the following path : /var/hyperledger/production/chaincodes/marbles.v0
If you have any idea about it ?
Thank you in advance for your help Best regards
SBerda