Skip to main content
Moving from Solidity to Daml requires a significant mental shift. This page explains the paradigm differences and how to adapt your thinking.

Programming Model Comparison

AspectSolidityDaml
ParadigmImperative, object-orientedFunctional, declarative
StateMutable storageImmutable contracts
ExecutionSequential operationsTransaction trees
TypesStatic with dynamic callsStrongly typed, ADTs
Side effectsUnlimitedControlled via monads

State Model: Mutable vs. Immutable

Solidity: Mutable State

In Solidity, contracts have mutable storage that you modify directly:
Mental model: The contract is a persistent object with state you modify.

Daml: Immutable Contracts

In Daml, contracts are immutable data. State changes create new contracts or archive existing contracts:
Mental model: Contracts are facts. Exercise archives the fact and creates new facts.

UTXO vs. Account Model

Ethereum: Account Model

  • State is a global mapping of accounts to balances
  • Transfers modify account entries
  • Easy to query total balance
  • Contention on popular accounts

Canton: Extended UTXO Model

  • State is a set of contracts (like unspent outputs)
  • Transfers archive existing contracts, create new ones
  • Balance is sum of owned contracts
  • Better parallelism, explicit data flow

Language Comparison

Type System

FeatureSolidityDaml
Type safetyModerateStrong
Null handlingImplicit (0/empty)Explicit (Optional)
Custom typesStructs, enumsADTs, records
GenericsLimitedFull parametric polymorphism

Solidity Types

Daml Types

Solidity Control Flow

Daml Control Flow

Authorization Model

Solidity: Runtime Authorization

Issues:
  • Authorization checked at runtime
  • Easy to forget checks
  • Anyone can attempt the call
  • Authorization mixed with logic

Daml: Declarative Authorization

Benefits:
  • Authorization declared, not coded
  • Impossible to forget (compiler enforces)
  • Only authorized parties can attempt
  • Clear separation of concerns

Multi-Party Coordination

Solidity: Manual Multi-Sig

Daml: Native Multi-Party

Common Patterns Translated

Solidity PatternDaml Equivalent
OwnableSignatory declaration
PausableContract archival + recreation
ERC-20Token Standard (CIP-0056)
Proxy/UpgradeableSmart Contract Upgrade (SCU)
Pull paymentPropose/accept pattern
FactoryTemplate + create
RegistryContract keys (when available)

What to Unlearn

Solidity HabitDaml Reality
Mutate state in placeArchive + create new contracts
Runtime msg.sender checksCompile-time controller declarations
Public functions anyone can callOnly controllers can exercise
Global contract addressContract IDs change on every update
Loops for iterationUse forA, mapA, fold patterns
Try/catch everywhereAssertions for validation; exceptions are deprecated

Next Steps

Network Architecture

Compare network architecture and topology.

Module 3: Daml

Start writing Daml smart contracts.