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 invoking chaincode on DL Fabric Gateway™.
Invoking Chaincode on DL Fabric Gateway™
Invocation is the primary method of interaction with chaincode — invocation being another way of saying “call a function from the chaincode”.
IMPORTANT — In order to invoke chaincode, it must be installed on a given channel. This was done in the previous section.
Invoke chaincode on DL Fabric Gateway™ using the fab_invokeChaincodeAPI:
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”,
“args” : [“CAR1”, “Acura”, “MDX”, “Black”, “Jovan”],
“functionName” : “createCar”,
a) functionName is the function to be called when invoking chaincode (in this case, createCar, as specified in fabcar.go), and args are the arguments to be passed into the function specified in functionName.
Which will return a success response:
“message”: “Successfully invoked the chaincode.”
b) The transactionId specified in the response is very important, as this is where you will be able to reference a permanent record of the chaincode invocation. When building applications, it is suggested that you store transactionIds (i.e. in a DB) so that they can be referenced in the future.