Prerequisites
Ensure that your Canton Participant Node opens a JSON Ledger API HTTP port. To learn about how to do it, read the tutorial: Get started with Canton and the JSON Ledger API. Ensure that you have access to Daml tools such as the Assistant (daml) and the Compiler (damlc).
Install curl or other similar tool that facilitates interactions over the HTTP protocol.
If you want to be able to format and filter JSON output from curl command responses, install jq or a similar tool.
Before any ledger interaction, ensure to build the model into a .dar file.
How to upload a DAR archive file
Assume you are working on a Daml model calledMyModel, and you want to start on-ledger interactions based on this model. The first step is to upload its containing package and to make sure it is vetted on all the interacting Participant Nodes.
The JSON Ledger API provides endpoints that enable you to upload the package and get it vetted on the Participant Node as an intrinsic part of the upload process.
As most of the interactions are based on a package ID, use the damlc compiler to inspect the resulting DAR archive file and extract the package ID of your project’s main package.
v2/packages endpoint:
How to query for existing packages
To list all packages known to the Participant Node, issue a GET request towards thev2/packages endpoint.
jq to filter the output and determine if the expected package ID is among the results.