Glossary of concepts¶
Daml is a platform for building and running sophisticated, multi-party applications. At its core, it contains a smart contract language and tooling that defines the schema, semantics, and execution of transactions between parties. Daml includes Canton, a privacy-enabled distributed ledger that is enhanced when deployed with complementary blockchains.
The Daml language is a purpose-built language for rapid development of composable multi-party applications. It is a modern, ergonomically designed functional language that carefully avoids many of the pitfalls that hinder multi-party application development in other languages.
A Daml ledger is a distributed ledger system running Daml smart contracts according to the Daml ledger model and exposes the Daml Ledger APIs. All current implementations of Daml ledgers consists of a Daml driver that utilises and underlying Synchronization Technology to either implement the Daml ledger directly, or run the Canton protocol.
A Canton ledger is a privacy-enabled Daml ledger implemented using the Canton application, nodes, and protocol.
The Canton protocol is the technology which synchronizes participant nodes across any Daml-enabled blockchain or database. The Canton protocol not only makes Daml applications portable between different underlying synchronization technologies, but also allows applications to transact with each other across them.
The syncronization technology is the database or blockchain that Daml uses for synchronization, messaging and topology. Daml runs on a range of synchronization technologies, from centralized databases to fully distributed deployments, and users can employ the technology that best suits their technical and operational needs.
Daml Language Concepts¶
Contracts are immutable: once they are created on the ledger, the information in the contract cannot be changed. The only thing that can happen to it is that the contract can be archived.
Active contract, archived contract¶
- if the signatories of the contract decide to archive it
- if a consuming choice is exercised on the contract
Once the contract is archived, it is no longer valid, and choices on the contract can no longer be exercised.
A template is a blueprint for creating a contract. This is the Daml code you write.
For full documentation on what can be in a template, see Reference: templates.
Choices give you a way to transform the data in a contract: while the contract itself is immutable, you can write a choice that archives the contract and creates a new version of it with updated data.
For full documentation on choices, see Reference: choices.
- Signatories, observers, controllers, and maintainers all must be parties, represented by the
Partydata type in Daml and determine who may see
- contract data.
Parties are hosted on participant nodes and a participant node can host more than one party. A party can be hosted on several participant nodes simultaneously.
A signatory is a party on a contract. The signatories MUST consent to the creation of the contract by authorizing it: if they don’t, contract creation will fail. Once the contract is created, signatories can see the contracts and all exercises of that contract.
For documentation on signatories, see Reference: templates.
For documentation on observers, see Reference: templates.
It’s not possible for keys to be globally unique, because there is no party that will necessarily know about every contract. However, by including a party as part of the key, this ensures that the maintainer will know about all of the contracts, and so can guarantee the uniqueness of the keys that they know about.
For documentation on contract keys, see Contract keys.
The Daml standard library is a set of Daml functions, classes and more that make developing with Daml easier.
For documentation, see The standard library.
An agreement is part of a contract. It is text that explains what the contract represents.
It can be used to clarify the legal intent of a contract, but this text isn’t evaluated programmatically.
See Reference: templates.
See Reference: updates.
See Reference: updates.
They’re useful for:
- expressing clearly the intended workflow of your contracts
- ensuring that parties can exclusively create contracts, observe contracts, and exercise choices that they are meant to
- acting as regression tests to confirm that everything keeps working correctly
In Daml Studio, Daml Script runs in an emulated ledger. You specify a linear sequence of actions that various parties take, and these are evaluated in order, according to the same consistency, authorization, and privacy rules as they would be on a Daml ledger. Daml Studio shows you the resulting transaction graph, and (if a Daml Script fails) what caused it to fail.
A contract key requires a maintainer: a simple key would be something like a tuple of text and maintainer, like
See Contract keys.
DAR file, DALF file¶
A Daml Archive file, known as a
.dar file is the result of compiling Daml code using the Assistant which can be interpreted using a Daml interpreter.
.dar files to a ledger in order to be able to create contracts from the templates in that file.
.dar contains multiple
.dalf files. A
.dalf file is the output of a compiled Daml package or library. Its underlying format is Daml-LF.
Daml Assistant is a command-line tool for many tasks related to Daml. Using it, you can create Daml projects, compile Daml projects into .dar files, launch other developer tools, and download new SDK versions.
Daml Studio is a plugin for Visual Studio Code, and is the IDE for writing Daml code.
See Daml Studio.
Application, ledger client, integration¶
There’s a lot of information available about application development, starting with the Application architecture page.
The Ledger API is an API that’s exposed by any ledger on a participant node. Users access and manipulate the ledger state through the leger API. An alternative name for the Ledger API is the gRPC Ledger API if disambiguation from other technologies is needed. See The Ledger API page. It includes the following services.
Command submission service¶
Command completion service¶
Active contract service¶
Ledger identity service¶
Ledger API libraries¶
The following libraries wrap the ledger API for more native experience applications development.
Reading from the ledger¶
Applications get information about the ledger by reading from it. You can’t query the ledger, but you can subscribe to the transaction stream to get the events, or the more sophisticated active contract service.
Submitting commands, writing to the ledger¶
Applications make changes to the ledger by submitting commands. You can’t change it directly: an application submits a command of transactions. The command gets evaluated by the runtime, and will only be accepted if it’s valid.
This is echoed in Daml script, where you can mock an application by having parties submit transactions/updates to the ledger. You can use
submitMustFail to express what should succeed and what shouldn’t.
The participant node is a server that provides users a consistent programmatic access to a ledger through the Ledger API. The participant nodes handles transaction signing and validation, such that users don’t have to deal with cryptographic primitives but can trust the participant node that the data they are observing has been properly verified to be correct.
Sub-transaction privacy is where participants to a transaction only learn about the subset of the transaction they are directly involved in, but not about any other part of the transaction. This applies to both the content of the transaction as well as other involved participants.
When you compile Daml source code into a .dar file, the underlying format is Daml-LF. Daml-LF is similar to Daml, but is stripped down to a core set of features. The relationship between the surface Daml syntax and Daml-LF is loosely similar to that between Java and JVM bytecode.
As a user, you don’t need to interact with Daml-LF directly. But internally, it’s used for:
- executing Daml code on the Sandbox or on another platform
- sending and receiving values via the Ledger API (using a protocol such as gRPC)
- generating code in other languages for interacting with Daml models (often called “codegen”)
Composability is the ability of a participant to extend an existing system with new Daml applications or new topologies unilaterally without requiring cooperation from anyone except the directly involved participants who wish to be part of the new application functionality.
A trust domain encompasses a part of the system (in particular, a Daml ledger) operated by a single real-world entity. This subsystem may consist of one or more physical nodes. A single physical machine is always assumed to be controlled by exactly one real-world entity.
The domain provides total ordered, guaranteed delivery multi-cast to the participants. This means that participant nodes communicate with each other by sending end-to-end encrypted messages through the domain.
The sequencer service of the domain orders these messages without knowing about the content and ensures that every participant receives the messages in the same order.
Private Contract Store¶
Every participant node manages its own private contract store (PCS) which contains only contracts the participant is privy to. There is no global state or global contract store.
Virtual Global Ledger¶
While every participant has their own private contract store (PCS), the Canton protocol guarantees that the contracts which are stored in the PCS are well-authorized and that any change to the store is justified, authorized and valid. The result is that every participant only possesses a small part of the virtual global ledger. All the local stores together make up that virtual global ledger and they are thus synchronized. The Canton protocol guarantees that the virtual ledger provides integrity, privacy, transparency and auditability. The ledger is logically global, even though physically, it runs on segregated and isolated domains that are not aware of each other.
The mediator is a service provided by the domain and used by the Canton protocol. The mediator acts as commit coordinator, collecting individual transaction verdicts issued by validating participants and aggregates them into a single result. The mediator does not learn about the content of the transaction, they only learn about the involved participants.
The sequencer is a service provided by the domain, used by the Canton protocol. The sequencer forwards encrypted addressed messages from participants and ensures that every member receives the messages in the same order. Think about registered and sealed mail delivered according to the postal datestamp.
Domain Identity Manager¶
The Domain Identity Manager is a service provided by the domain, used by the Canton protocol. Participants join a new domain by registering with the domain identity manager. The domain identity manager establishes a consistent identity state among all participants. The domain identity manager only forwards identity updates. It can not invent them.
The Canton protocol does not use PBFT or any similar consensus algorithm. There is no proof of work or proof of stake involved. Instead, Canton uses a variant of a stakeholder based two-phase commit protocol. As such, only stakeholders of a transaction are involved in it and need to process it, providing efficiency, privacy and horizontal scalability. Canton based ledgers are resilient to malicious participants as long as there is at least a single honest participant. A domain integration itself might be using the consensus mechanism of the underlying platform, but participant nodes will not be involved in that process.