Stack Overview
Smart Contract Layer
Daml
Daml is Canton’s smart contract language—a functional language designed for multi-party workflows.| Aspect | Details |
|---|---|
| Paradigm | Functional programming |
| Type system | Strongly typed with inference |
| Compiles to | Daml-LF (ledger format) |
| Primary use | Define contracts, choices, authorization |
Daml Compiler
The Daml compiler (dpm build) compiles Daml source code into DAR files (Daml Archives) that can be deployed to participant nodes.
Application Layer
Backend Integration
Your backend connects to Canton via the Ledger API.| Option | Protocol | Best For |
|---|---|---|
| gRPC API | gRPC/Protobuf | High-performance, typed |
| JSON API | HTTP/JSON | Simpler integration, web-friendly |
- TypeScript/JavaScript (code generation available via
dpm codegen-js) - Java (code generation available via
dpm codegen-java) - Any language via gRPC or JSON API
Code Generation
Generate type-safe bindings from your Daml code:- Type-safe contract representations
- Command submission helpers
- Event handling utilities
Frontend
Use any web framework. Common choices:| Framework | Notes |
|---|---|
| React | Most common in Canton ecosystem |
| Vue | Good alternative |
| Angular | Enterprise preference |
Development Tools
Daml SDK
The Daml SDK bundles everything needed for Canton development:| Component | Purpose |
|---|---|
| Daml compiler | Compile smart contracts |
| Daml Script | Test and interact with contracts |
| Sandbox | Run a single Canton node for testing |
| Canton runtime | Run local participant nodes |
| Console | Interactive administration |
| Templates | Project scaffolding |
dpm (Daml Package Manager)
Manage dependencies and build workflows:VS Code Extension
The Daml VS Code extension (Daml Studio) provides:- Syntax highlighting
- Type checking
- Error diagnostics
- Code navigation
- Integrated terminal
dpm studio from your project directory.
Infrastructure Components
LocalNet
LocalNet is a local Global Synchronizer simulation for development:- 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
PQS (Participant Query Store)
PQS provides SQL-based querying for complex data access:| Use Case | Ledger API | PQS |
|---|---|---|
| Simple queries | Good | Good |
| Complex aggregations | Limited | Excellent |
| Reporting | Difficult | Easy |
| Real-time updates | Excellent | Excellent |
Development Workflow
Typical Flow
Steps
- Write Daml contracts defining your business logic
- Compile with
daml build - Test locally with Daml Script or LocalNet
- Build backend integration
- Deploy to DevNet for integration testing
- Promote through TestNet to MainNet
QuickStart Project
The cn-quickstart repository provides a complete example that includes build tooling:| Component | Technology |
|---|---|
| Contracts | Daml |
| Backend | TypeScript |
| Frontend | React |
| Infrastructure | Docker Compose LocalNet |
Tool Comparison with Other Platforms
| Purpose | Ethereum | Canton |
|---|---|---|
| Smart contracts | Solidity | Daml |
| Build tool | Hardhat/Foundry | daml build/dpm |
| IDE | Remix, VS Code | VS Code + Daml extension |
| Testing | Mocha, Foundry tests | Daml Script |
| Local network | Hardhat node, Anvil | LocalNet, Canton Sandbox |
| API | JSON-RPC | Ledger API (gRPC/JSON) |
| Indexing | The Graph | PQS |