The Sandbox is a single-participant Canton node that runs locally on your machine. Start it withDocumentation Index
Fetch the complete documentation index at: https://docs.canton.network/llms.txt
Use this file to discover all available pages before exploring further.
dpm sandbox for quick development cycles without the overhead of Docker or a full network.
Starting the Sandbox
localhost:6865 by default. The process runs in the foreground — press Ctrl+C to stop it.
The Sandbox uses the SDK version from your project’s daml.yaml, so make sure you have run dpm install first.
What the Sandbox Provides
- A single Canton node
- Ledger API (gRPC) endpoint for command submission and transaction streaming
- JSON API endpoint for HTTP-based access
- Admin API for party allocation and DAR uploads
- In-memory storage (state is lost when the Sandbox stops)
Common Development Workflows
Upload and Test Contracts
After compiling your Daml code, upload the DAR to the running Sandbox and interact with it:Connect a Backend
Point your Java or TypeScript backend at the Sandbox’s Ledger API endpoint. The Sandbox supports the same gRPC and JSON API interfaces as production validators, so your backend code does not need to change.Allocate Parties
Use the Admin API or Canton Console to create test parties:When to Use Sandbox vs LocalNet
| Scenario | Sandbox | LocalNet |
|---|---|---|
| Testing contract logic with Ledger API | Yes | Yes |
| Testing codegen serialization | Yes | Yes |
| Multi-validator workflows | No | Yes |
| Canton Coin and payments | No | Yes |
| Wallet integration | No | Yes |
| Splice API interactions | No | Yes |
| Quick iteration, no Docker | Yes | No |
When to Use Sandbox vs Daml Script
Daml Script (dpm test) and the Sandbox serve different testing needs:
- Daml Script runs test scenarios in-process without a ledger. It is the fastest way to test contract logic, authorization rules, and multi-party workflows. Use it for unit testing your Daml model.
- The Sandbox runs a real Canton node. Use it when you need to test your application’s integration with the Ledger API — verifying that codegen-generated types serialize correctly, that your backend connects and authenticates properly, and that JSON API requests produce expected results.
Stopping the Sandbox
Press Ctrl+C in the terminal where the Sandbox is running. Since the Sandbox uses in-memory storage, all data is lost on shutdown. This is by design — each test run starts with a clean ledger.Related Pages
- dpm command reference —
dpm sandboxoptions - LocalNet — Full multi-validator environment for integration testing
- Daml Script — In-process testing without a running node
- Testing Daml Contracts — Complete testing guide
Sandbox
Sandbox is a program for running a Canton ledger with your Daml code. The ledger uses the simplest topology possible: a single Participant Node connected to a Synchronizer Node. Use the sandbox when you need access to a Canton ledger running your Daml code and matching the target Participant Node topology is not required.Install
Install the Sandbox by installing dpm.Configure
To configure the Sandbox, use the command line.Command line configuration
To view all available command line configuration options for Sandbox, rundpm sandbox --help in your terminal:
dpm sandbox --canton-help in your terminal.
Canton configuration
Behind the scenes, Sandbox runs an underlying Canton ledger with a default configuration file to initialize a participant namedsandbox, a sequencer named sequencer1, and a mediator named mediator1.
Configure the underlying Canton ledger further in one of two ways:
-
Specify additional configuration file(s) to apply on top of the default configuration using
--config filepath. If several configuration files assign to the same key, the last value is taken. -
Set the value of a specific key with
-C key=value. For example, to override the ledger-api port of the sandbox participant, the command would be:
Canton Declarative API
The declarative API allows specifying DARs, Parties and Users desired to be present on the Canton ledger. The ledger will automatically take care of uploading the DARs, and creating the parties and users.- upload local DARs
Operate
Start Canton with a single participant:Interacting with Sandbox’s ledger
Once the sandbox is running, you may interact with it the same way you would for any Canton instance. For example, you may upload dars to it, or run scripts against it:dpm sandbox is a Canton instance, all documentation for using Canton applies.
Connecting to Sandbox’s console
Once you have a Sandbox running locally (i.e. after runningdpm sandbox) you may connect to Sandbox remotely by running the dpm canton-console command in a separate terminal:
exit command.
Built-in documentation
The Canton console comes with built-in documentation. You can use thehelp command to get online documentation for top-level commands. Many objects in the console also have built-in help that you can access by invoking the help method on them.
For example, you can ask for help on the health object by typing:
Interact with the Sandbox
One of the objects available in the Canton console represents the Sandbox itself. The object is calledsandbox and you can use it to interact with the Sandbox. For example, you can list the DARs loaded on the Sandbox by running the following command:
How it works
Canton offers a console where you can run administrative or debugging commands. When you run the Sandbox usingdpm sandbox, you are effectively starting an in-memory instance of Canton with a single sync domain and a single participant.
As such, you can interact with the running Sandbox using the console, just like you would in a production environment.
For an in-depth guide on how to use this tool against a production, staging or testing environment, consult the main documentation for the Canton console.
Testing your Daml contracts
Sandbox is primarily used as the first step in testing your Daml contracts in isolationRun with authorization
By default, Sandbox accepts all valid Ledger API requests without performing any request authorization. To start Sandbox with authorization using JWT-based access tokens as described in the Authorization documentation, create a config file that specifies the type of authorization service and the path to the certificate, then supply that config file to Sandbox withdpm sandbox --config auth.conf.
auth-services are described in detail in API configuration documentation
Generate JSON web tokens (JWT)
To generate access tokens for testing purposes, use the jwt.io web site.Generate RSA keys
To generate RSA keys for testing purposes, use the following commandsandbox.key: the private key in PEM/DER/PKCS#1 formatsandbox.crt: a self-signed certificate containing the public key, in PEM/DER/X.509 Certificate format
Generate EC keys
To generate keys to be used with ES256 for testing purposes, use the following commandecdsa256.key: the private key in PEM/DER/PKCS#1 formatecdsa256.crt: a self-signed certificate containing the public key, in PEM/DER/X.509 Certificate format
Run with TLS
To enable TLS, you need to specify the private key for your server and the certificate chain. This enables TLS for both the gRPC Ledger API and the Canton Admin API. When enabling client authentication, you also need to specify client certificates which can be used by Canton’s internal processes. Note that the identity of the application will not be proven by using this method, i.e. theapplication_id field in the request is not necessarily correlated with the CN (Common Name) in the certificate. Below, you can see an example config. For more details on TLS, refer to Canton’s documentation on TLS configuration.
Dev Protocol
To enable the canton dev protocol:Troubleshoot
Failed to bind to address
By default, Sandbox reserves five ports for its Canton services:6865for the participant’s Ledger API6866for the participant’s Admin API6867for the sequencer’s public API6868for the sequencer’s admin API6869for the mediator’s admin API
--json-api-port, if any.
When one of these ports is already used by an existing process, Sandbox will emit an error that contains the following text:
lsof -n -i command lists what processes are already listening to a port. For example, if an existing Java program is already listening to 6865, lsof would look as follows:
- Use —port= to override binding to
6865 - Use —admin-api-port= to override binding to
6866 - Use —sequencer-public-port= to override binding to
6867 - Use —sequencer-admin-port= to override binding to
6868 - Use —mediator-admin-port= to override binding to
6869 - Use
--json-api-portto change the port to which the JSON API binds.
SDK not installed
If thedaml.yaml file of the project you are currently in specifies a version of the dpm SDK that is not installed, you may get the following error message:
- Install the SDK as instructed to by the error, or
- Change the SDK version in the project’s
daml.yamlfile, or - Change directories to be outside of the project, where the default Daml version that is already installed on your system will be used.