DL Fabric Gateway™ User Guide— Section 7

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

This post continues our ongoing discussion regarding instantiating chaincode on DL Fabric Gateway™.

Instantiating Chaincode on DL Fabric Gateway™

Instantiating chaincode is another way of saying “deploy”. This will allow anyone on the channel to invoke (call functions from) your chaincode.

IMPORTANT — In order to instantiate chaincode, a channel and installed chaincode is required. If you are following this guide in sequence, you should have already done both.


Instantiate chaincode on DL Fabric Gateway™ using the fab_instantiateChaincode 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_instantiateChaincode' \
-H ‘Content-Type: application/json’ \
-H ‘Authorization: AUTH_TOKEN_HERE’ \
-d ‘{
“userName” : “your@email.com”,
“chaincodeName” : “YourChaincodeName”,
“chaincodeVersion”: “v1”,
“chaincodeType” : “golang”,
“args” : [],
“functionName” : “”,
“channelName”: “yourchannel”

YourChaincodeName is the name of a previously installed chaincode, args are the arguments for the Init function in the chaincode (in the Fab Car example, no arguments are required), the functionName defaults to the Init function, but can be overridden to accept a different function, and the channelName represents the channel on which the chaincode will be instantiated.


Image for post
Image for post

Which will return a success response:

“status” : “success”,
“message” : “Successfully instantiated chaincode.”
Image for post
Image for post

Written by

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