Write Off-Ledger Automation Using Daml¶
However, there are times when it would be nice to write your off-ledger logic in Daml. For relatively simple automations that don’t require full access to your system’s capabilities, using Daml means that you don’t have to map from your on-ledger Daml types and their representation on a separate off-ledger general purpose language (either through the codegen or by manipulating the Protobuf representation of Daml types directly).
There are two tools that allow you to use Daml as an off-ledger language:
- Daml Script allows you to write automations that can be triggered by any off-ledger condition, such as the availability of a file in a folder, a message coming from a broker or a user interacting with the system directly.
- Daml Triggers allow a similar approach but triggered by on-ledger events, such as the creation of a contract.
In their interactions with a traditional database system Daml Scripts and Daml Triggers are analogous to SQL scripts and SQL triggers.