DL Fabric Gateway™ User Guide— Section 10

This post is part of the ‘DL Fabric Gateway™ User Guide’ originally published as

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:


Step 1

Open a Command Line Interface (CLI) of your choice (Terminal, cmd, etc.)

Step 2

Install curl (if not already installed): Download links — Linux/Windows

Step 3

Copy and paste the following API Call into your CLI of choice, and tap “enter” on your keyboard

curl -X POST \
‘https://dlfabricnetwork.dltlabs.com/api/1.0/fab_upgradeChaincode' \
-H ‘Content-Type: application/json’ \
-H ‘Authorization: AUTH_TOKEN_HERE’ \
-d ‘{
“userName” : “your@email.com”,
“chaincodeName” : “YourChaincode”,
“chaincodeVersion”: “v3”,
“chaincodeType” : “golang”,
“args” : [],
“functionName” : “initLedger”,
“channelName”: “yourchannel”


Image for post
Image for post

And will return a success response:

“status”: “success”,
“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.

Image for post
Image for post

DLT Labs is a global leader in Distributed Ledger Technology and Enterprise Products. To know more, head over to: https://www.dltlabs.com/

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store