Canton applications evolve. Templates gain new fields, choices change behavior, and entirely new workflows get introduced. Smart Contract Upgrade (SCU) is the mechanism that makes this possible without breaking existing contracts or requiring coordinated downtime across organizations. NOTE: SCU has rules that need to be followed.Documentation Index
Fetch the complete documentation index at: https://docs.canton.network/llms.txt
Use this file to discover all available pages before exploring further.
Why Upgrades Are Different on Canton
On a traditional database, you run a migration script and the schema changes. On Canton, contracts are immutable and distributed across multiple organizations’ validators. Changing a template’s structure means every validator hosting parties that use that template needs to be aware of the change. This creates a challenge: you can’t force all organizations to upgrade simultaneously. SCU solves this by allowing multiple versions of a package to coexist on the ledger, with controlled rules for cross-version interaction.The Upgrade Model
The recommended approach combines an asynchronous rollout with a synchronous switch-over: Asynchronous rollout:- The app provider implements and tests v2 app components.
- The app provider makes the v2 components available to app users.
- The app provider and users asynchronously roll out upgraded backends, frontends, audit the upgraded DAR packages, and then vet the packages.
- The app provider publishes a target date for app users to complete the upgrade and decommission v1.
- Shortly before the target upgrade date, the app provider and users coordinate to upload the v2 package (DAR) files to their validators.
- At the predetermined time, they all vet the newly uploaded package(s) to make that version active.
Package Versioning
Every Daml package has a name and version, defined indaml.yaml. When you upload a new version of a package (same name, higher version number), both versions exist on the ledger simultaneously. Existing contracts remain associated with the version that created them, but the ledger can resolve them against newer versions under SCU’s compatibility rules.
This multi-version coexistence is the foundation of zero-downtime upgrades. Old contracts don’t need to be migrated before the new version becomes active — they can be read and exercised through the newer version’s code when compatibility permits.
When to Use Upgrades vs. New Templates
Not every change requires the upgrade mechanism. Consider the trade-offs: Use SCU when:- You’re adding optional fields to existing templates
- You’re adding new choices to existing templates
- You need existing contracts to work with new code without migration
- You want zero-downtime deployment
- The change is fundamentally incompatible (removing fields, changing types)
- The new workflow is logically distinct from the old one
- You want a clean separation between old and new behavior
Key Challenges
- Asynchronous rollouts — App providers and app users often cannot upgrade simultaneously. Upgrades must allow independent deployment schedules.
- Mixed-version deployments — Due to asynchronous rollouts, the application must temporarily support mixed-version deployments across organizations. Backends and frontends must remain compatible with both v1 and v2 DAR workflows.
- Zero-downtime upgrades — Certain workflows may need to progress 24/7 without interruption. SCU and the asynchronous rollout approach enable workflows to continue uninterrupted during the upgrade process.
Module Structure
This module walks you through the upgrade process step by step:Upgrade Compatibility
What changes are allowed and what breaks compatibility.
Writing Your First Upgrade
Step-by-step tutorial for creating a v2 package.
Package Selection
How the ledger resolves which package version to use.
Testing Upgrades
Verifying upgrade paths before deployment.
Deploying Upgrades
Rolling out upgrades across environments and organizations.