Canton Network docsProtocol Deep Dive › Ledger Model
Structure
Updated 26-11-2026
Canton enables multi-party workflows by providing parties with a virtual global ledger (VGL).
The VGL records interactions between actors, called parties, resulting in shared facts that are stored as contracts.
At a high level, the interactions are visualized below:
Three parties Alice, Bob, and Charlie connect independently to a virtual global ledger, depicted as a large box.
They hold different views of that ledger in their local databases shown as blue icons.
The global ledger is virtual in the sense that no single entity typically sees this global ledger in its entirety;
it is an imaginary database that represents the union of all parties’ databases.
The Ledger Model defines:
An atomic swap, also known as delivery versus payment (DvP), combines two asset transfers between the parties in a single transaction.
The
To create a DvP contract instance, the parties go through the usual propose-accept workflow pattern shown next.
Party
Acceptance and settlement can happen either in a single step via the
Or in two separate steps with
Exercising the
A non-consuming Exercise shows up in the combined
A node n1 is said to be an ancestor of node n2, and n2 is a descendant of n1 if the action rooted at n2 is a proper subaction of the action rooted at n1.
For another example, the consequences of an Exercise action are a list of actions and therefore form a transaction
In the example of the
Formally, every subtransaction of a transaction is identified by its frontier,
namely the set of positions in the original transaction whose nodes are still retained as roots of the subtransaction.
The above diagram shows these frontiers as the yellow boxes above each subtransaction.
A frontier is a subset of the positions in a transactions such that no two positions in a frontier are a prefix of one another,
i.e. a frontier is an anti-chain in the prefix order of the positions .
This absence of prefixes in the frontier ensures that no action can appear in a subtransaction alongside its own ancestor or descendant (vertical exclusion).
The privacy model uses the concept of subtransactions to define the visibility rules.
Using this general structure, we can formally define the Ledger.
A Canton Ledger thus represents the full history of all actions taken by parties.
Visually, a ledger can be represented as a sequence growing from left to right as time progresses.
Below, dashed vertical lines in purple mark the boundaries of commits,
and each commit is annotated with its requester(s) and the update ID.
Blue arrows link each Exercise and Fetch action to the Create action of the input contract.
These arrows highlight that the ledger forms a transaction graph in the sense of a UTXO blockchain.
For example, the following Daml Script encodes the whole workflow of the running DvP example.
This workflow gives rise to the ledger shown below with four commits:
At this stage, the edges in the Ledger are arbitrary.
Any arrangement of commits that satisfies the acyclic property of a DAG constitutes a valid mathematical ledger.
However, for a ledger to be useful in practice, these edges must follow the logic of the smart contracts they record.
The integrity conditions on a ledger require that the happens-before order respects the lifecycle of contracts.
For example, the commit that creates a contract must happen before the commit that spends the contract unless they are the same.
For the next few sections, we will consider only ledgers that meet these conditions.
As the graph is acyclic, the happens-before relationship forms a strict partial order on the commits.
It is transitive (if c1 happens before c2 and c2 happens before c3, then c1 also happens before c3) and irreflexive (a commit cannot happen before itself).
Yet the integrity constraints do not impose an order between independent commits.
In the above example, there need not be edges among the first three commits
For a total happens-before order, the execution order on the ledger is also total: the entire ledger can be viewed as a single, chronological timeline of actions.
- What the changes and the ledgers look like - the structure of the Canton Ledger
- Who sees which changes and data - the privacy model for the Canton Ledger
- What changes to the ledger are allowed and who can request them - the integrity model for the Canton Ledger
Introduction
This section looks at the structure of a ledger that records the interactions between the parties as ledger changes. The definitions presented here address the first question: “What do changes and ledgers look like?”. The basic building blocks of the recorded interactions are actions, which get grouped into transactions, updates, commits, and the Ledger. Parties are the entities that authorize actions, sign transactions, and hold specific viewing rights. They can represent the people, organizations, or automated systems participating in a workflow. When parties interact and agree on a set of facts or obligations, this agreement is recorded on the ledger as a contract. A contract holds the actual data or state of the ledger at any given point in time. Every contract is assigned a unique, system-generated contract ID so the ledger can track its lifecycle. A contract is instantiated from a blueprint known as a Daml template, which defines the rules of engagement with it. A template specifies what data the contract must contain, who is required to authorize it, and what subsequent actions (called choices) parties can take on it. A contract can also optionally be assigned a contract key, which is a human-readable identifier tied to real-world data that allows parties to easily look up and interact with the contract over time.Running example
This section introduces the templates and the workflow that will be used throughout the Ledger Model.Templates
The running example for the Ledger Model is a simple multi-party interaction of two parties atomically swapping their digital assets. A digital asset is modeled as aSimpleAsset with an issuer, an owner, and the asset description.
The owner can transfer such an asset to a new owner with the Transfer choice.
These Daml templates are for illustration purposes only.
They are not meant for real-world usage as they are heavily simplified.
template SimpleAsset with
issuer : Party
owner : Party
asset : Text
where
signatory issuer
observer owner
choice Transfer : ContractId SimpleAsset
with
newOwner : Party
controller owner
do
create this with owner = newOwner
SimpleDvP template below captures the agreement between two parties partyA and partyB to swap ownership of the two allocated assets.
Either party to the DvP can execute the swap by exercising the Settle choice.
template SimpleDvP with
party1 : Party
party2 : Party
asset1 : ContractId SimpleAsset
asset2 : ContractId SimpleAsset
where
signatory party1
signatory party2
choice Settle : (ContractId SimpleAsset, ContractId SimpleAsset)
with
actor : Party
controller actor
do
assert $ actor == party1 || actor == party2
new1 <- exercise asset1 Transfer with newOwner = party2
new2 <- exercise asset2 Transfer with newOwner = party1
pure (new1, new2)
proposer creates a proposal for the party counterparty with their allocated asset and the description of the asset they expect to swap with.
The counterparty can accept the proposal with the Accept choice to create a SimpleDvP contract, or can accept and immediately settle the swap with the AcceptAndSettle choice.
template ProposeSimpleDvP with
proposer : Party
counterparty : Party
allocated : ContractId SimpleAsset
expected : SimpleAsset
where
signatory proposer
observer counterparty
choice Accept : ContractId SimpleDvP
with
toBeAllocated : ContractId SimpleAsset
controller counterparty
do
fetchedAsset <- fetch toBeAllocated
assert $ fetchedAsset == expected
create $ SimpleDvP with
party1 = proposer
party2 = counterparty
asset1 = allocated
asset2 = toBeAllocated
nonconsuming choice AcceptAndSettle : (ContractId SimpleAsset, ContractId SimpleAsset)
with
toBeAllocated: ContractId SimpleAsset
controller counterparty
do
dvp <- exercise self $ Accept with ..
exercise dvp $ Settle with actor = counterparty
Workflow
Most of the examples in this section look at the following Daml Script scenarios based on the above templates. Two banks first each issue one asset to either Alice or Bob and then Alice proposes a DvP to Bob. Bob accepts the proposal and settles the DvP. let eurAsset = SimpleAsset with
issuer = bank1
owner = alice
asset = "1 EUR"
eur <- submit bank1 do createCmd eurAsset
let usdAsset = SimpleAsset with
issuer = bank2
owner = bob
asset = "1 USD"
usd <- submit bank2 do createCmd usdAsset
proposeDvP <- submit alice $ do
createCmd ProposeSimpleDvP with
proposer = alice
counterparty = bob
allocated = eur
expected = usdAsset
disclosedEur <- fromSome <$> queryDisclosure alice eur
AcceptAndSettle choice:
(newUsd, newEur) <- submit (actAs bob <> disclose disclosedEur) $ do
exerciseCmd proposeDvP $ AcceptAndSettle with toBeAllocated = usd
Accept followed by Settle:
dvp <- submit bob $
do exerciseCmd proposeDvp $ Accept with toBeAllocated = usd
(newUsd, newEur) <- submit (actAs bob <> disclose disclosedEur) $ do
exerciseCmd dvp $ Settle with actor = bob
Actions
Hierarchical structure
One of the main features of the Ledger Model is a hierarchical action structure. This structure is illustrated using Bob settling the DvP by exercising theSettle choice in the above scenario.
Alice and Bob have allocated their assets (contracts #1 and #2) on the ledger to a SimpleDvp contract (#4).
These contracts appears as inputs (dashed boxes on the left) in the diagram below.
Settle choice yields an Exercise action,
which is the tree of nodes shown in blue.
The input contracts on the left are not part of the action.
The root node describes the parameters of the choice and references the SimpleDvp input contract #4.
It has two subtrees, which perform the asset transfers automatically as part of the Settle choice.
-
The left subtree represents Alice exercising the
Transferchoice on herSimpleAssetcontract #1. It consists of two nodes: The root node describes the parameters of the choice and the input contract #1. The child node, which is a one-node subtree of its own, encodes the creation of Bob’s newSimpleAssetcontract #5. -
The right subtree is analogous:
The root node of the subtree describes Bob exercising the
Transferchoice on hisSimpleAssetcontract #2, and its child encodes the creation of Alice’s newSimpleAssetcontract #6.
Transfer choice on their SimpleAsset input contracts #1 and #2, respectively.
And each of the two subtrees contains another subtree,
namely the creation of Bob’s and Alice’s new SimpleAsset contracts #5 and #6.
Each of these subtrees is an action in its own right.
This hierarchical structure induces a subaction relationship explained below
and forms the basis for the privacy model.
Definition
Overall, the settlement in the above example contains two types of actions:- Creating contracts
- Exercising choices on contracts.
-
A Create node records the creation of the contract.
It contains the following pieces of information:
- The contract ID is a unique identifier of the contract. It is equivalent to the transaction output (TxO) in ledgers based on unspent transaction outputs (UTxO).
- The template ID identifies the Daml code associated with the contract, and its arguments define the contract instance, which is the immutable data associated with the contract ID.
- The signatories are the non-empty set of parties that must authorize the creation and archival of the contract.
- The contract observers, or just observers for short, are the set of parties that will be informed about the contract creation and archival, in addition to the signatories.
signatoryandobserverclauses defined by the template. Create nodes are depicted as shown below. Diagrams often omit fields with empty values and observers that are also signatories. -
An Exercise node records the parameters of a choice that one or more parties have exercised on a contract.
It contains the following pieces of information:
- An exercise kind, which is either consuming or non-consuming. Once consumed, a contract cannot be used again (i.e. fetched or exercised a choice on); for example, Alice must not be able to transfer her asset twice, as this would be double spending. In contrast, contracts exercised in a non-consuming fashion can be reused, for example for expressing a delegation from one party to another.
- The contract ID on which the choice is exercised. This contract is called the input contract.
- The interface ID if this choice was exercised through a Daml interface.
- The template ID that defines the smart contract code for the choice with the given choice name, and the choice arguments that are passed to the smart contract code.
-
An associated set of parties called actors.
These are the parties who perform the action.
They are specified in the
controllerclause in the Daml template. - An associated set of choice observers. These parties will be informed about the choice being exercised.
- The exercise result as the Daml value returned by evaluating the choice body.
-
A Fetch node acting on a contract, which demonstrates that the contract exists and is active at the time of fetching.
A Fetch behaves like a non-consuming Exercise with no consequences, and can be repeated.
The fetch node contains the following pieces of information, analogous to Exercise nodes:
contract ID, interface ID, template ID, and the actors, namely the parties who fetch the contract.
Fetch nodes are depicted as shown below.
- A Create action has a Create node as the root. The consequences are empty.
- An Exercise action has an Exercise node as the root and the consequences are the subactions triggered immediately by evaluating the choice body. The Exercise action is the parent action of its consequences.
- A Fetch action has a Fetch node as the root. The consequences are empty.
Examples
An example of a Fetch action appears in theAccept choice on a DvP proposal contract from the template ProposeSimpleDvP.
The choice body fetches the SimpleAsset that Bob allocates to the DvP,
which checks that the asset contract is active and brings the contract instance into the computation,
so that the choice implementation can assert that this asset meets the expectation expressed in the proposal contract.
The next diagram shows this Exercise action with the Fetch action as its first consequence.
AcceptAndSettle choice on the ProposeSimpleDvP contract:
This choice is non-consuming so that the Accept choice exercised in the choice body can consume the proposal contract.
As the next diagram shows, non-consuming Exercises yield multiple references to the same input contract #3.
The diagram also shows that fetches have the same effect: input contract #2 is used twice.
Subactions
This example again highlights the hierarchical structure of actions: TheAcceptAndSettle action contains the corresponding actions for Accept and Settle as its consequences.
More generally, since actions trigger consequences recursively, every action generates a tree of subsequent events.
For an action act, its subactions are the action itself together with its proper subactions,
which are defined recursively as the subactions of its immediate consequences.
Create and Fetch actions have no consequences and are thus leaf nodes.
So they are their sole own subaction, meaning they have no proper subactions.
The proper subactions of an Exercise action are the events triggered while evaluating the choice body.
The subaction relation is visualized below for Bob’s Settle Exercise.
Each borderless box contains an action (via its tree of nodes) and the nesting of these boxes encodes the subaction relation.
In detail, both the blue and purple boxes are proper subactions of Bob’s Settle action shown in grey.
The green box is a proper subaction of the blue and the grey boxes, and the yellow box is a proper subaction of the purple and the grey boxes.
Action Execution Order
This hierarchical structure establishes a local Action Execution Order. Since the root node of an action triggers its consequences, the root node is said to execute before its consequences. Within the list of consequences, actions execute according to their order in the list (left-to-right). Mathematically, an action’s tree structure assigns a unique position to each node, represented as a sequence of integers:- The root node has the empty position ε.
- If a node has position c, the root node of its i-th consequence has the coordinate c.i.
Transactions
A transaction is a list of actions that are executed atomically. Those actions are called the root actions of the transaction. That is, for a transaction tx = act1, …, actn, every acti is a root action. For example, if Alice and Charlie have made one DvP proposal each for Bob, then Bob may want to both accept simulataneously. To that end, Bob exercises bothAccept choices in a single transaction with two root actions (blue and purple), as shown next.
Visually, transactions are delimited by the dashed lines on both sides, to distinguish them from actions.
Like for actions, the input contracts on the left are not part of the transaction.
Settle action on Alice’s and Bob’s SimpleDvP,
the consequences of the Settle action form the following transaction,
where actions are ordered left-to-right as before.
The transaction consists of two root actions (blue and purple), namely the two Transfer actions of the two legs of the DvP.
Transaction Execution Order
The list of actions extends the position system and establishes a Transaction Execution Order: Nodes in an earlier action acti execute before nodes in later actions actj in the transaction, i.e., when i is less that j. Mathematically, the position of a node in the transaction is obtained by prefixing the list index i of its action actacti to the node’s position within acti. For example, the root node of act1 has position 1, and its first consequence has position 1.1. The root node of act2 has position 2. Just as with individual actions, the execution order within the transaction is simply the lexicographical order of the nodes’ positions.Subtransaction
The hierarchical structure of actions extends to transactions and yields the notion of subtransactions. Conceptually, a subtransaction is a version of the original transaction that has been iteratively “unrolled” to varying depths across its branches: In each step, any one root action is chosen and replaced by its consequences, if any. This yields another transaction, to which the same unrolling can be applied again. A proper subtransaction is obtained by performing at least one iteration starting from the initial transaction. For example, the next diagram shows this unrolling step-by-step for the transaction that consists of theSettle action shown above.
Each step indicated by a green arrow makes exactly one Replace choice, where the node at the given position is replaced by the consequences.
Step by step, this enumerates all possible subtransactions of the initial transaction.
When the only root action at position 1 is replaced first, its two consequences become the new roots of the first subtransaction.
Next, one of the roots of this first subtransaction is replaced, which makes its only consequence a new root (a Create node).
When this Create node without consequences is replaced, only the other root action remains (third level at the outsides).
And so on, until all actions have been eliminated in the empty transaction at the bottom.
Inputs and outputs
The Ledger Model falls into the category of (extended) UTxO-style ledgers where the set of unspent transaction outputs (UTxOs) constitutes the current state of a ledger. Here, the transaction outputs are the contract IDs of the contracts created in a transaction. When a contract is consumed, its contract ID is spent and thus removed from the UTxO set. The data associated with each UTxO is immutable; modifications happen by consuming a contract ID and recreating a new contract with a different contract ID. This Ledger Model extends the UTxO model in two aspects:- A transaction may use a contract without consuming it, namely, by exercising a non-consuming choice or fetching it. In such a case, the contract ID remains in the set of UTxOs even though it appears as an input to a transaction.
-
Transactions are structured hierarchically and contract IDs created in the transaction may be consumed within the same transaction.
For example, inside the
AcceptAndSettleaction, the createdSimpleDvPin the first consequence is consumed by the second consequence. Such contracts are called transient.
Ledger
The transaction structure records the contents of a party interaction. The ledger records two more aspects of an interaction:- An identifier to uniquely refer a particular party interaction.
- The parties who requested a particular party interaction.
TX i for some number i, similar to the transaction view in Daml Studio.
On the Ledger API, update IDs are arbitrary strings whose lexicographic order is independent from their order on the ledger.
A commit records the information on who requested a party interaction.
It bundles an update (the transaction and its unique ID) with the one or more parties that requested it.
These parties are called the requesters of the commit.
In Daml Script, the requesters correspond to the actAs parties given to the submit commands.
Up to this point, we have focused on the constituents of a single interaction.
To build a ledger, it must also be defined how multiple interactions are arranged relative to one another.
When commits are recorded, they are linked together in a graph structure, with the commits represented as vertices and the links between them represented as directed edges.
This structure is forms Directed Acyclic Graph (DAG).
A Directed Acyclic Graph (DAG) G = (V, E) consists of a set of vertices (nodes) V and a set of directed edges E, i.e., pairs of vertices.
The graph is acyclic, meaning that for no vertex v in V there is a non-empty path that starts and ends at v.
Definition: LedgerA Ledger is a directed acyclic graph (DAG) where the vertices are commit and every commit has a unique update IDs.
Definition: top-level actionFor a commit, the root actions of its transaction are called the top-level actions.
A top-level action of any ledger commit is also a top-level action of the ledger.
let eurAsset = SimpleAsset with
issuer = bank1
owner = alice
asset = "1 EUR"
eur <- submit bank1 do createCmd eurAsset
let usdAsset = SimpleAsset with
issuer = bank2
owner = bob
asset = "1 USD"
usd <- submit bank2 do createCmd usdAsset
proposeDvP <- submit alice $ do
createCmd ProposeSimpleDvP with
proposer = alice
counterparty = bob
allocated = eur
expected = usdAsset
disclosedEur <- fromSome <$> queryDisclosure alice eur
(newUsd, newEur) <- submit (actAs bob <> disclose disclosedEur) $ do
exerciseCmd proposeDvP $ AcceptAndSettle with toBeAllocated = usd
-
In the first commit, Bank 1 requests the creation of the
SimpleAssetof1 EURissued to Alice (contract #1). -
In the second commit, Bank 2 requests the creation of the
SimpleAssetof1 USDissued to Bob (contract #2). -
In the third commit, Alice requests the creation of the
ProposeSimpleDvP(contract #3). -
In the fourth commit, Bob requests to exercise the
AcceptAndSettlechoice on the DvP proposal.
Happens-before order
The edges of the ledger’s graph structure naturally induces a happens-before order on the commits in the ledger.Definition: happens-before orderWe say that commit c1 happens before c2 if and only if the ledger contains a non-empty path from c1 to c2,
or equivalently, the transitive closure of the graph contains an edge from c1 to c2.
TX 0, TX 1, and TX 2,
so they could be presented in any order.
Therefore, happens-before is only a partial order, where not all commits can be compared.
For example, TX 0 need not happen before TX 1 nor vice versa.
It is a well-known property that any partial order can be extended into a total order (a linear sequence), or equivalently, the vertices of any finite Directed Acyclic Graph can be arranged into a linear sequence by topological sorting.
For the next sections on Integrity and Privacy, we assume that the Ledger is totally ordered (unless otherwise specified).
We will return to the more general partial order in the causality section.
By combining the happens-before order of commits with the execution order within transactions,
we establish a Global Execution Order for all action nodes on the ledger.
Definition: Ledger Execution OrderA node n1 executes before n2 on the ledger if all of the following holds:
- If both nodes are in the same commit, then n1 precedes n2 in the transaction execution order.
- If the two nodes are in different commits c1 and c2, then c1 happens before c2 on the ledger.