Skip to main content
This page introduces the development stack you’ll use to build Canton applications. Understanding these components helps you see how everything fits together.

Stack Overview

Smart Contract Layer

Daml

Daml is Canton’s smart contract language—a functional language designed for multi-party workflows.
AspectDetails
ParadigmFunctional programming
Type systemStrongly typed with inference
Compiles toDaml-LF (ledger format)
Primary useDefine contracts, choices, authorization
Example:
template Token
  with
    owner : Party
    issuer : Party
    amount : Decimal
  where
    signatory issuer
    observer owner

    choice Transfer : ContractId Token
      with newOwner : Party
      controller owner
      do create this with owner = newOwner

Daml Compiler

The Daml compiler (dpm build) compiles Daml source code into DAR files (Daml Archives) that can be deployed to participant nodes.
# Compile Daml code
dpm build

# Output: .dar file containing compiled contracts

Application Layer

Backend Integration

Your backend connects to Canton via the Ledger API.
OptionProtocolBest For
gRPC APIgRPC/ProtobufHigh-performance, typed
JSON APIHTTP/JSONSimpler integration, web-friendly
Language support:
  • TypeScript/JavaScript (code generation available via dpm codegen-js)
  • Java (code generation available via dpm codegen-java)
  • Any language via gRPC or JSON API
Community-supported bindings also exist for Python, Rust, and Go.

Code Generation

Generate type-safe bindings from your Daml code:
# Generate TypeScript bindings
dpm codegen-js .dar -o generated

# Generate Java bindings
dpm codegen-java .dar -o generated
Generated code provides:
  • Type-safe contract representations
  • Command submission helpers
  • Event handling utilities

Frontend

Use any web framework. Common choices:
FrameworkNotes
ReactMost common in Canton ecosystem
VueGood alternative
AngularEnterprise preference
The frontend typically connects via your backend, which handles Ledger API communication.

Development Tools

Daml SDK

The Daml SDK bundles everything needed for Canton development:
ComponentPurpose
Daml compilerCompile smart contracts
Daml ScriptTest and interact with contracts
SandboxRun a single Canton node for testing
Canton runtimeRun local participant nodes
ConsoleInteractive administration
TemplatesProject scaffolding

dpm (Daml Package Manager)

Manage dependencies and build workflows:
# Initialize project
dpm init

# Add dependency
dpm add package-name

# Build
dpm build

VS Code Extension

The Daml VS Code extension (Daml Studio) provides:
  • Syntax highlighting
  • Type checking
  • Error diagnostics
  • Code navigation
  • Integrated terminal
The extension is installed automatically with DPM. You need VS Code 1.87 or above. To launch Daml Studio, run dpm studio from your project directory.

Infrastructure Components

LocalNet

LocalNet is a local Global Synchronizer simulation for development:
# Start LocalNet (via QuickStart)
make setup
make build
make start

# Or run a single Canton node via Daml SDK
dpm sandbox
LocalNet provides:
  • Local synchronizer
  • Local participant node(s)
  • Test Canton Coin
  • No external dependencies

Participant Node

The participant node is the portion of the validator that hosts the Canton runtime which:
  • Hosts your parties
  • Stores contract data
  • Executes Daml logic
  • Exposes the Ledger API
In production, this runs as part of your validator.

PQS (Participant Query Store)

PQS provides SQL-based querying for complex data access:
Use CaseLedger APIPQS
Simple queriesGoodGood
Complex aggregationsLimitedExcellent
ReportingDifficultEasy
Real-time updatesExcellentExcellent
PQS maintains a PostgreSQL database synchronized with ledger state.

Development Workflow

Typical Flow

Steps

  1. Write Daml contracts defining your business logic
  2. Compile with daml build
  3. Test locally with Daml Script or LocalNet
  4. Build backend integration
  5. Deploy to DevNet for integration testing
  6. Promote through TestNet to MainNet

QuickStart Project

The cn-quickstart repository provides a complete example that includes build tooling:
ComponentTechnology
ContractsDaml
BackendTypeScript
FrontendReact
InfrastructureDocker Compose LocalNet
# Clone and run
git clone https://github.com/digital-asset/cn-quickstart
cd cn-quickstart
direnv allow
cd quickstart
make install-daml-sdk
make setup
make build
make start

Tool Comparison with Other Platforms

PurposeEthereumCanton
Smart contractsSolidityDaml
Build toolHardhat/Foundrydaml build/dpm
IDERemix, VS CodeVS Code + Daml extension
TestingMocha, Foundry testsDaml Script
Local networkHardhat node, AnvilLocalNet, Canton Sandbox
APIJSON-RPCLedger API (gRPC/JSON)
IndexingThe GraphPQS

Next Steps