Skip to content
CCPEDIAby Unity Nodes
Canton Network docsModule 3: Daml Smart Contracts

Interfaces

Updated 01-12-2026

In Daml, an interface defines an abstract type together with a behavior specified by its view type, method signatures, and choices. For a template to conform to an interface, there must be a corresponding interface instance definition where all the methods of the interface (including the special view method) are implemented. This lets other developers write applications in terms of the interface instead of the concrete template, so contracts built on different templates can interoperate as long as they implement the same interface. For the full syntax — interface declarations, view types, interface choices, interface instance clauses, required interfaces, and the toInterface/fromInterface family of functions — see Reference: Interfaces in the Daml Language Reference.

Define interfaces in their own package

Interface definitions can’t be upgraded. If one package defines an interface and also a template that implements it, the compiler stops with an error like this:
error type checking template Asset.SimpleAsset interface instance Asset:Asset for Asset:SimpleAsset:
  The interface Asset was defined in this package and implemented in Asset by SimpleAsset

  This may make this package and its dependents not upgradeable.

  It is recommended that interfaces are defined in their own package separate from their implementations.
  Downgrade this error to a warning with -Wupgrade-interfaces
  Disable this error entirely with -Wno-upgrade-interfaces
Don’t switch the check off with -Wupgrade-interfaces or -Wno-upgrade-interfaces. A template that shares a package with an interface can never be upgraded, so the problem only moves to your first upgrade. Split the code into two packages instead: one that holds the interfaces, and one that holds the implementing templates and imports the interface package through data-dependencies.
my-project/
├── multi-package.yaml
├── asset-interface/
│   ├── daml.yaml
│   └── daml/Asset.daml              # interface Asset, its view type
└── simple-asset/
    ├── daml.yaml
    └── daml/SimpleAsset.daml        # template SimpleAsset, interface instance Asset
multi-package.yaml lists both packages, so dpm build --all builds them in dependency order:
packages:
  - ./asset-interface
  - ./simple-asset
The template package depends on the interface package’s DAR:
sdk-version: <sdk-version>
name: simple-asset
version: 0.0.1
source: daml
dependencies:
  - daml-prim
  - daml-stdlib
data-dependencies:
  - ../asset-interface/.daml/dist/asset-interface-0.0.1.dar
For package naming conventions, see Separating Interfaces from Templates. For the upgrade rules behind this check, see Separate Interfaces/Exceptions from Templates.

Interfaces on Canton Network

Interfaces are central to interoperability across the Canton Network. CIP-0056 — Token Standard defines the standard Daml interfaces for tokens on Canton Network. If your application issues or transfers tokens, implementing these interfaces makes your assets usable by wallets and other applications in the ecosystem without custom integration with each counterparty. App developers implementing an interface: by default, use the authority your interface choices receive only on your app’s own contracts. These choices run with the authority of the parties that exercise them, and the interface view does not prove which implementation runs. In your implementation:
  • Fetch every contract ID your choices receive at the interface type, and convert it with fromInterface to one of your own templates. Abort if none matches.
  • Check that the contract’s signatories and fields match what your choice expects, for example that your registry’s admin signed it and that its owner is the sender.
  • Exercise choices only on contracts you have checked this way, never on an interface contract ID taken directly from the caller.
Validator operators rely on this property when they vet your package. See the trust model for parties.