This post is part of the ‘DL Fabric Gateway™ User Guide’ originally published as
DL Fabric Gateway™ — User Guide
DL Fabric Gateway™ is a platform intended to facilitate the deployment and execution of chaincode on Hyperledger Fabric…
This post continues our ongoing discussion regarding upgrading chaincode on DL Fabric Gateway™.
Upgrade Chaincode on DL Fabric Gateway™
Upgrading chaincode enables revisions to be made on older chaincode. This ensures that your chaincode can always be modified or improved.
Upgrade chaincode on DL Fabric Gateway™ using the fab_upgradeChaincode API:
Open a Command Line Interface (CLI) of your choice (Terminal, cmd, etc.)
Copy and paste the following API Call into your CLI of choice, and tap “enter” on your keyboard
curl -X POST \
-H ‘Content-Type: application/json’ \
-H ‘Authorization: AUTH_TOKEN_HERE’ \
“userName” : “firstname.lastname@example.org”,
“chaincodeName” : “YourChaincode”,
“chaincodeType” : “golang”,
“args” : ,
“functionName” : “initLedger”,
And will return a success response:
“message”: “Successfully upgraded chaincode.”
Background Information: Upgrading Chaincode
If we wish to make changes to the chaincode after instantiating it, we can accomplish this by upgrading the chaincode.
The chaincodeVersion component (see Note in “Installing Chaincode on DL Fabric Gateway™”) keeps an index of all compiled versions of the chaincode so that they are unique and can be distinguished from one another.
This property doesn’t change the channel name or code name — it just adds a version each time a chaincode is re-compiled or upgraded. Upgrade requires the repetition of Section 6, with updated chaincode and chaincodeVersion. The upgrade acts as the new instance for the chaincode, so instantiation (Section 7) is not required.