Skip to main content

Scripts

canton-deploy can execute Daml Scripts through dpm script.

Run a Script​

dpm canton-deploy run My.Module:setup --network localnet

You can provide a DAR and input file:

dpm canton-deploy run Setup:seed   --network devnet   --dar .daml/dist/my-app-0.1.0.dar   --input-file seed.json

deploy --script accepts the same --input-file flag, so you can upload and seed in one step.

Parties listed in the config are already allocated when the script runs. Look them up rather than calling allocatePartyByHint for the same name.

Script User​

The configured scriptUserId controls the user ID passed to dpm script. If it is not configured, the JWT sub is used.

The CANTON_DEPLOY_SCRIPT_USER_ID environment variable can also be used.

gRPC Authority​

dpm script uses --ledger-host for both TCP and gRPC :authority.

If grpcAuthority differs from host, that authority name must resolve and accept connections on ledgerPort.

For example, when a proxy routes by hostname, configure:

{
host: 'validator.example.com',
ledgerPort: 5011,
grpcAuthority: 'ledger.example.com',
}