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 chaincode installation on DL Fabric Gateway™.
Installing Chaincode on DL Fabric Gateway™
Installing chaincode allows you to upload your code to the Fabric network, which can then be deployed (instantiated) onto channels of your choosing.
Install chaincode on DL Fabric Gateway™ using the fab_installChaincodeAPI:
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” : “YourChaincodeName”,
“code”: “BASE64_ENCODED_CHAINCODE (will be very long)”,
“chaincodeType” : “golang”,
In the command line, BASE64_ENCODED_CHAINCODE will be the long string that we generated in Step 7 of “Converting Chaincode to Base64”.
Which will return a success response:
“message”: “Successfully installed chaincode.”
Notice that we have set chaincodeType to: “golang”, since we are using Golang and not Node.js, and that our chaincodeVersion is set to: “v1”. We will go over the chaincode upgrade process in a future section, where chaincodeVersion becomes important.
Additional Details: Chaincode Prerequisites
>> IMPORTANT — In order to deploy any Chaincode, the user must have joined at least 1 channel.
Chaincode is typically coded using Golang or Node.js. Using DL Fabric Gateway™, the user can create and execute chaincode by instantiating it on a channel.
Although the Hyperledger Fabric network offers support to Node.js as well as Golang, our preferred choice is the latter. The reasons why we prefer Golang as our chaincode execution language is as follows:
- The execution time is at least 3 times faster than Node.js.
- Interprets errors in chaincode before compilation.
In order to demonstrate, we have elected to use the Fab Car chaincode (written in Golang), for which the code is available at the link below:
Once we have obtained the Fab Car chaincode, we must convert it to Base64 format in order to use it with DL Fabric Gateway™.
To access the conversion steps, please follow the link: https://medium.com/@dltlabs/dl-fabric-gateway-overview-section-4-69d2b0a79657
Base64 conversion can be done using any conversion tool. The link to one of the most used online Base64 converters is: https://www.base64encode.org/