dpm is the command-line interface for Canton development. It manages SDK installation, project scaffolding, compilation, testing, code generation, and local development environments. Most Canton development workflows start with a dpm command.
Pre-requisites
Dpm runs on Windows, macOS and Linux. For full functionality, you must have installed:- VS Code download
- JDK 17 or greater, installed and part of your
JAVA_HOME. If you do not already have a JDK installed, try OpenJDK or Eclipse Adoptium. - If you are on a Mac with Apple Silicon, you may need to install Rosetta 2 to run x86 binaries. You can do this by running the following command in a terminal:
Installation
Installingdpm usually involves downloading a single binary and adding it to your PATH.
When installing dpm (any edition, on any platform), you can set the DPM_HOME environment variable to change the location where the SDK and any future updates are installed. The default is:
${HOME}/.dpm/on Mac and Linux%APPDATA%/.dpm/on Windows
${HOME}/.dpm/bin to your PATH:
Mac/Linux Installation
Windows Installation
Download and run the windows installer, which will install the dpm sdk and set up the PATH variable for you.Manual Installation
If you prefer a more manual installation process, see Manual Installation Instructions.Installing dpm without an SDK
You can obtain the baredpm binary — which does not have any SDK bundled with it — in two ways.
Download it from the releases page.
Or pull it directly from the public OCI repository using oras (or a similar tool):
--platform value for your machine: linux/amd64, linux/arm64, darwin/amd64, darwin/arm64, or windows/amd64.
Once you have the bare binary, you can run dpm install as described in Project Management: with no arguments it is an alias for dpm install package, installing the current project’s dependencies; with a version argument (dpm install <version>) it installs that SDK version. Because the bare binary is not bundled with an SDK, you must set the registry manually — see Registry and Edition.
Upgrading the SDK
You can upgrade to the latest version of an SDK by running:Verifying the Installation
Once installed, verify the installation:Configuration Files
daml.yaml
Every Daml project has adaml.yaml file at its root. If a daml.yaml file doesn’t exist in your project, you can create one with:
sdk-version— The Daml SDK version to use.dpm installdownloads this version.name— The package name, used in the output DAR filenamesource— Directory containing Daml source files (typicallydaml)dependencies— List of Daml library dependenciesbuild-options— Compiler flags (e.g., target LF version)
multi-package.yaml
For projects with multiple Daml packages, amulti-package.yaml at the project root lists all sub-packages:
dpm build --all from the root builds all listed packages in dependency order.
dpm-config.yaml
Thedpm-config.yaml file stores global dpm configuration such as SDK installation paths and registry settings. It is stored at ${DPM_HOME}/dpm-config.yaml (where ${DPM_HOME} is usually ~/.dpm), is optional, and rarely needs manual editing.
dpm can be configured through this config file and through environment variables simultaneously. Environment variables take precedence over the corresponding fields in dpm-config.yaml, so they can be used to override configured values.
Typical uses include:
- Registry URL — Override the default OCI registry for SDK components.
- Authentication — Point to registry credentials.
- Insecure registry — Allow HTTP connections to a registry.
Registry and Edition
For many of its built-in commands,dpm needs to know which OCI registry is in effect. If dpm was obtained as part of an SDK, the registry is set automatically in ${DPM_HOME}/dpm-config.yaml (where ${DPM_HOME} is usually ~/.dpm).
However, if you are using the bare binary obtained directly from its OCI repository, this configuration might not be known. You can set it manually in ${DPM_HOME}/dpm-config.yaml:
DPM_REGISTRY environment variable.
Authentication
Authentication for pulling from and pushing to OCI registries is based on a file similar to~/.docker/config.json, though a Docker installation on the system isn’t necessary.
dpm defaults to using Docker’s auth. You can configure Docker to authenticate to the OCI registry (Google Artifact Registry), and dpm will use that:
Variable interpolation
Bothdaml.yaml and dpm-config.yaml support variable interpolation, which lets you avoid hardcoded values (such as registry URLs or credentials paths) and reference environment variables or other dynamic values.
Command Reference
Project Management
dpm init — Initialize a new Daml project in the current directory. Creates a daml.yaml configuration file and a basic project structure.
You can manage SDK versions manually by using dpm install. To install the SDK version specified in the daml.yaml, run:
3.5.2, run:
*):
dpm new — Create a new project from a template. Templates provide working examples that you can modify.
Building and Testing
dpm build — Compile Daml source files into a DAR (Daml Archive) file. The output goes to .daml/dist/.
dpm test — Run all Daml Script tests in the current package. Produces a summary with pass/fail status and coverage report.
dpm install — Download and install the Daml SDK version specified in daml.yaml.
Code Generation
dpm codegen-js — Generate TypeScript/JavaScript bindings from a compiled DAR file.
dpm codegen-java — Generate Java bindings from a compiled DAR file.
Development Environment
dpm sandbox — Start a local Canton sandbox node. This runs a single-participant Canton instance with an in-memory ledger for testing.
dpm studio — Open Daml Studio (the VS Code extension) for the current project. This launches VS Code with the Daml extension activated.
Exploration
Use--help on any command to see available options:
Summary of dpm Commands
-
dpm build: Build a Daml package or project This builds the Daml project according to the project config filedaml.yaml(see configuration files). In particular, it will use the dpm SDK (specified in thesdk-versionfield indaml.yaml) to resolve dependencies and compile the Daml project. Given adaml.yamland.damlsource files, thedpm buildcommand will generate a .dar for this package. See How to build Daml Archives for how to define a package and build it to a DAR. -
dpm test: Test the current Daml project or the given files by running all test declarations. This runs all daml scripts defined within a package. Daml Scripts are top level values of typeScript (), from thedaml-scriptpackage. This package mimics a Canton Ledger Client for quick iterative testing, and direct support within Daml Studio. The command runs these scripts against a reference Ledger called the IDE Ledger, which implements the core functionality of the Canton Ledger without the complexity of multi-participant setups. It is most useful for verifying the fundamentals of your ledger model, before moving onto integration testing via the Ledger API directly, or the Daml Codegen.dpm testalso provides code coverage information for templates and choices used. -
dpm clean: Clean a Daml package or project This removes any Daml artifact files created in your package during a daml build, including DARs.
Note: after installing a specific SDK version with
dpm install <version>, update your project config file to use the new version.
Components
Components are artifacts thatdpm (being primarily a launcher) wraps. Examples of components are sandbox and scribe. A component defines the commands it wants dpm to expose, as well as the binaries that back those commands.
A component is a directory that contains:
- a
component.yamlfile at its root. Its main purpose is to telldpmhow to import the component’s commands andexecthem. - the binary or binaries (or JARs) that back the commands defined in
component.yaml. - optionally, additional arbitrary files and directories (if needed for the operation of the component, for example
libdirectories). When the component is published,dpmincludes these in the artifact (see Publishing Components to an OCI Repository).
component.yaml defining two commands (foo and bar) backed by the same native binary:
dpm --help, you’ll see the following in the help message:
exec-args on the bar command tells dpm to supply additional args when running the binary backing the command, so it is executed as ./foo-binary --should-bar-instead-of-foo.
Dependency on other components
You can optionally declare dependencies of your component on other components:foo to be present when running dpm. dpm injects an environment variable named CUSTOM_FOO_PATH into this component’s environment, pointing to the path of foo on the filesystem.
The dependency components must be present either as part of the installed SDK, or declared in daml.yaml or multi-package.yaml.
component.yaml schema
See the JSON schema.Working with Components
Initializing a component
Usedpm component init to scaffold a new component in the current directory:
component.yaml (and a daml.yaml) in the current directory. Pass --force to overwrite existing component.yaml and daml.yaml files:
Running a remote component
Once a component has been published, you can pull it down and test-run it withdpm component run:
DPM_REGISTRY environment variable or ${DPM_HOME}/dpm-config.yaml. This is handy for quickly sanity-checking a published component:
dpm pulls the component into ~/.dpm/cache/components/, and then runs the specified command of your component.
Adding components and DARs to a project
Usedpm add component to add a published component to your project:
Use
dpm add dar to add or update a DAR in your project. You must specify whether the DAR is a dependency or a data-dependency:
Publishing
Publishing Components to an OCI Repository
This functionality is available in DPM version 1.0.14 or later (or bundled with SDK 3.5 or later).
dpm fully handles packaging and publishing components. Components are published as OCI artifacts to an OCI registry.
As a component developer, you can use the dpm publish component command to publish a component. Publishing is platform-aware, and the command requires the target platform(s) to be specified with -p/--platform:
--platform flags. For JAR components, you can use --platform generic=<path to dir>.
Here’s a sample component foo laid out with one directory per platform:
component.yaml file is required, and must be present at the root of each platform directory.
Publish it like this:
latest tag.
The published artifact for a given platform includes everything present in the given directory for that platform — all files and subdirectories (for example lib). You don’t have to pre-bundle or zip up anything; just provide the raw directory. When pulling a component, dpm restores the artifact exactly as it was at publish time.
The component can now be imported (pulled) and run by dpm. See Running a remote component for how to pull components.
Options
When publishing build artifacts you can also apply annotations to the entire image. The
-a/--annotations flag can be used with a key/value pair multiple times to add annotations to the image being published. This is useful for attaching metadata such as the branch the build artifacts were built from, or the commit SHA related to the artifacts.
Publishing DARs to an OCI Repository
This functionality is available in DPM version 1.0.20 or later (or bundled with SDK 3.5.2 or later).
dpm tags; see Listing available tags and versions below.
See the Remote Dars docs section to learn how to install oci:// DARs in your project.
Options
Listing available tags and versions in an OCI repository
You can use thedpm tags command to view published versions and tags for a specific component or DAR:
Typical Workflow
A common development cycle withdpm:
daml assistant to dpm migration steps
This section provides a step-by-step guide for projects originally built with the Daml assistant.
Migration steps
- Install Dpm Follow the installation instructions above.
- Verify Dpm is in your PATH
-
Remove
~/.daml/binfrom your PATH Edit your shell configuration file (e.g.,~/.bashrc,~/.zshrc,~/.profile) and remove any line that adds~/.daml/binto yourPATH - Remove the Daml assistant
-
Create a project configuration if needed
If a
daml.yamlfile doesn’t already exist in your project, generate one:
-
Replace
damlcommands withdpmMost commands map directly. See the command migration table below. Sixdamlcommands have been removed and replaced with Declarative API, Canton Console, JSON API, and/or gRPC API calls. See removed command replacements for full details. -
Review project configuration
Review your
daml.yamlto ensure it is compatible with dpm. Audit parent directories for staledaml.yamlfiles. Delete orphan or invalid files. -
Review global configuration (optional)
Review or create
${DPM_HOME}/dpm-config.yamlif you need to customize registry, authentication, or other global settings. - Set up variable interpolation (optional) Use variable interpolation in your configuration files to avoid hardcoded values.
-
Update CI/CD pipelines (if applicable)
Update any CI/CD pipeline scripts that reference
damlcommands to use the correspondingdpmcommands instead.
Command migration table
Removed command replacements
The followingdaml commands have no direct dpm equivalent. Use the Declarative API, Canton Console, JSON API, or gRPC API instead.
daml ledger allocate-parties
daml ledger list-parties
daml ledger upload-dar
daml ledger fetch-dar
daml packages
daml start
Replace with dpm sandbox combined with dpm build. Use the Declarative API or JSON/gRPC API to upload DARs and allocate parties as needed.
See dpm sandbox for details on running a local Canton installation.
Related Pages
- Daml SDK — What the SDK includes and how versions work
- Sandbox — Local testing environment started by
dpm sandbox - Daml Studio — VS Code extension launched by
dpm studio - Daml Script — Writing and running tests with
dpm test
Manual Installation Instructions
Mac/Linux Installation
If you cannot / wish not to use the shell script to install for Linux or OSX, you can alternatively install dpm manually by running this set of commands in your terminal: The latest stable release version can be found by hitting the following URL:Windows Installation
Download and unpack the windows dpm-sdk archive (.zip), then:Unstable Version Manual Installation
Preview / unstable versions are also available for experimentation, though it is always recommended to use the stable versions listed above instead.Unstable Mac / Linux
Follow thedpm-manual-installation-mac-linux instructions to install an unstable version, but note the differences in VERSION and TARBALL_URL.
The latest unstable release version can be found by hitting the following URL:
Unstable Windows
Download and unpack the latest windows unstable dpm-sdk archive (.zip), then followdpm-manual-installation-windows instructions.