Demonstrating a Baseline for Building Advanced Financial Applications on Canton

Background

Canton is a distributed ledger protocol that implements the Daml smart contract language with built-in privacy and scalability. It addresses privacy and scaling limitations found in traditional blockchain platforms by partitioning state across synchronization domains and sharing data only on a need-to-know basis. Canton enables participants to execute multi-party workflows while each party sees only the transaction data relevant to them.

Canton Network is gaining significant institutional adoption, with organizations such as Goldman Sachs, DTCC, HSBC, Chainlink, and hundreds of other participants now operating on the network, with more than $6 trillion in tokenized assets on-chain. This level of adoption informed our decision to explore Canton through hands-on engineering work.

Moonsong Labs explored the technology through a practical DeFi implementation. The project serves as both a learning exercise and a technical demonstration: issuing a compliant stablecoin on Canton Network and deploying it into a yield vault protocol. This approach demonstrated how tokenized assets can be used for purposes beyond basic transfers, enabling their participation in more complex financial workflows within the Canton ecosystem.

Objective

The objective: to create a reference architecture proving that compliant, privacy-preserving DeFi is production-ready on Canton Network. The implementation covers the full lifecycle: stablecoin issuance with programmable transfer restrictions, yield-generating vault deposits, and oracle price integration.

Our approach

Before writing any smart contracts, the team established a foundation to support reproducibility and reduce setup friction to streamline development when working with Canton. The tooling included:

  • 🐳 Devcontainer: A containerized environment packaging the Canton SDK, Daml compiler, and all dependencies for one-click setup. This eliminates environment inconsistencies and lets any developer start building immediately. The container supports both stable and latest SDK versions (easily configurable), allowing teams to test smart contract compatibility with upcoming releases without disrupting their current development environment.
  • 🤖 AI Skills: Custom AI automation for generating TypeScript SDKs from Daml models and scaffolding React UI components. This gives users a functional frontend without manual boilerplate. From DAML to UI in just one prompt.

With our development infrastructure in place, we turned to the Canton SDK and Daml Finance library (v4.0.0), which provides standardized building blocks for tokenized assets: Account and Holding factories, Instrument definitions, and Fungible/Transferable interfaces.

First, we designed Lunar Dollar, a stablecoin contract extending the base Token instrument with a compliance layer. We implemented a TransferValidator interface allowing multiple validator types (blacklist checks, claims-based KYC/AML verification) to be plugged into a central ComplianceRegistry. This separation allowed compliance logic to evolve without modifying the core token logic.

Second, we built a Vault protocol that accepts Lunar Dollar deposits and issues share tokens in return. The vault references the stablecoin as its underlying instrument, demonstrating contract composition on Canton: one protocol’s output becomes another’s input. An oracle integration pattern was used to update share valuations based on external price data, enabling yield-related logic without embedding external computation directly into the contract.

Execution

The implementation was structured around two primary components: a compliant stablecoin and a yield-generating vault. Each component was built using Canton’s Daml-based programming model and the Daml Finance library, with an emphasis on composability, privacy, and separation of concerns. Here’s a technical description of how each component was built:

💵 Lunar Dollar

Daml Finance Modules used

  • daml-finance-interface-instrument-token / daml-finance-instrument-token for base Token implementation
  • daml-finance-interface-holding with Fungible and Transferable interfaces
  • daml-finance-interface-account for custody management
  • daml-finance-interface-types-common for InstrumentKey, AccountKey, Id types

Design Patterns

  • Interface Polymorphism: TransferValidator interface with pluggable implementations (BlacklistValidator, ClaimsValidator)
  • Registry Pattern: ComplianceRegistry aggregates multiple validators; transfers iterate through all active validators before execution
  • Request/Accept Workflow: Two-step transfers require receiver initiation and owner approval

Features

  • Compliant token transfers: Every transfer validated against identity claims (KYC, AML, accreditation) and blacklist checks before execution
  • Dynamic compliance rules: Add, remove, or update validators at runtime without deploying new code
  • Operator control: Issuer can freeze funds, require specific claims, and manage the compliance registry
  • Private holdings: Only the owner and relevant parties see balances and transaction history
  • Split and merge: Fungible holdings support partial transfers and consolidation

🏦 Vault

Daml Finance Modules used

  • Inherits all Lunar Dollar dependencies via data-dependency
  • daml-finance-interface-account for Account.Credit and Account.Debit operations
  • daml-finance-holding for Transferable.Transfer during deposit flow

Design Patterns

  • Contract Key Pattern: VaultState keyed by (operator, vaultId) for stable lookups
  • Oracle Pattern: UpdateSharePrice choice allows external price feeds to update NAV
  • Separation of Config and State: VaultConfig holds static parameters; VaultState tracks mutable values (totalAssets, totalShares, sharePrice)

Features

  • Automated fund management: Deposit stablecoins to mint share tokens, redeem shares to withdraw at current NAV
  • Real-time NAV tracking: Share price updatable via external oracle or manual operator input
  • Fee collection: Configurable redemption fee automatically routed to treasury account
  • Atomic settlement: Deposit and redemption workflows execute as single transactions across multiple contracts

Putting all together

Validation

This implementation is a proof-of-concept designed to demonstrate Canton’s capabilities. To deliver a functional demo, we made the following simplifications:

  • Oracle Integration: Share price updates are triggered manually via the UpdateSharePrice choice rather than automatically fetched from a decentralized oracle (e.g., Chainlink).
  • Stablecoin Reserves: Lunar Dollar operates as a simple token without on-chain proof of reserves or collateralization mechanisms. A production stablecoin would require reserve attestations and automated peg maintenance.
  • Identity Attestations: KYC, AML, and accreditation claims are added manually by the operator. In production, these would integrate with external identity verification providers.
  • Local Sandbox Environment: The demo runs on Daml’s local sandbox with a single sync domain, rather than a distributed multi-node Canton deployment.

Functional Validation

To validate the end-to-end workflows, we used the tooling mentioned in “Our Approach” section. The React frontend connected directly to the Daml Ledger running in the sandbox environment, enabling interaction across all major system components. This allows users to:

  • Issue and transfer Lunar Dollars with compliance checks
  • Manage blacklists and identity claims
  • Deposit stablecoins into the vault and receive share tokens
  • Update share prices and process redemptions
  • View real-time contract state across all parties

The generated frontend demonstrates that the smart contract logic works correctly and provides a tangible interface for exploring Canton’s privacy model in action.

Key Takeaways

This project applied Canton’s execution model to a concrete reference architecture, implementing a compliant stablecoin with programmable transfer restrictions alongside a yield-oriented vault. The implementation exercised privacy guarantees, compliance enforcement, and atomic multi-party workflows across all core interactions.

Compliance logic can be made dynamic without redeployments.

Regulated token transfers were implemented using modular validators, allowing compliance rules to be updated independently of core contract logic.

Standard DeFi primitives compose cleanly on Canton.

Deposits, redemptions, and share pricing were implemented using Daml Finance interfaces without requiring custom protocol extensions.

Privacy is enforced at the transaction level.

Contract state and transaction details were visible only to the parties involved, while workflows executed atomically across multiple participants.

Tooling materially impacts development velocity.

Reproducible environments and automated code generation reduced setup overhead and enabled faster iteration on Canton-based applications.

Conclusion

Public blockchains often require institutions to choose between transparency and adoption. Canton Network addresses this tension by enabling programmable financial workflows while preserving privacy and compliance controls. This implementation demonstrates how familiar DeFi mechanics, commonly expressed on Ethereum, can be realized on Canton within a privacy-preserving and auditable execution model.

The reference architecture establishes a baseline for building more advanced financial applications on Canton. The patterns explored, including modular compliance enforcement, oracle-driven valuation, and atomic multi-party settlement, can be extended to more complex instruments such as tokenized securities, structured products, cross-border payment flows, and multi-asset vaults.

Video Demo

For readers interested in learning more, please check out this short demo below.