Documentation Index
Fetch the complete documentation index at: https://docs.canton.network/llms.txt
Use this file to discover all available pages before exploring further.
How to upload and query Daml packages
Canton Participant Node exposes a package management service that allows uploading and discovery of the Daml packages. This guide explains how to programmatically manipulate the packages using the JSON Ledger API, which is described using OpenAPI specifications. To learn about the Daml packages, see :brokenref:‘DAR files and Daml packages’ in the key concepts section. Refer to the package management section in the operational guide to learn how to upload packages and inspected them using the Canton console.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.