Daml Smart Contract Language and Runtime

repository·main·Indexed 21 days ago

https://github.com/digital-asset/daml

Daml is a smart contract language and runtime for building decentralized applications on distributed ledgers, featuring formal verification capabilities. This documentation covers the Daml SDK, including the damlc compiler, the Daml Studio VS Code extension, Bazel build configurations for ghc-lib and Canton integration, and cross-version compatibility testing for Sandbox classic and Daml Script.

Tokens
234.6K
Snippets
666
Records
1.2K
Agent score
75%

What's inside Daml

  1. Overview of Ledger API Services

    main

    The gRPC Ledger API is organized into functional service groups:

    Submitting Commands

    • Command Submission Service: Submit commands (create contracts or exercise choices).
    • Command Completion Service: Track the status of submitted commands.
    • Command Service: A convenience service that combines submission and completion.
    • Interactive Submission Service: Prepare and submit externally signed transactions.

    Reading from the Ledger

    • Update Service: Stream committed transactions and events, or look up transactions.
    • State Service: Bootstrap an application with currently active contracts (avoids processing the ledger from the beginning).
    • Event Query Service: Obtain a party-specific view of contract events.

    Utility Services

    • Party Management Service: Allocate and find information about parties.
    • User Management Service: Manage users and rights.
    • Identity Provider Config Service: Manage external IDP systems for Participant Node tokens.
    • Package Management Service: Upload packages to the ledger.
    • Package Service: Query deployed Daml packages.
    • Version Service: Retrieve Ledger API version info.
    • Pruning Service: Prune archived contracts/transactions at a given offset.

    Testing Services (Non-production only)

    • Time Service: Obtain the time as known by the ledger.
  2. Use the Daml Script library for testing

    main

    The Daml Script library provides the API required to implement Daml script tests. It is divided into two main modules:

    • Daml.Script: The public API intended for use in writing and executing Daml script tests.
    • Daml.Script.Internal: Internal components (not intended for direct end-user consumption).

    To implement tests, you should primarily interact with the Daml.Script module.

  3. Use the DA.Date module for date manipulation

    main

    The DA.Date module provides functions to manipulate Date values. The supported range for Date is from 0001-01-01T00:00:00.000000Z to 9999-12-31T23:59:59.999999Z.

    Key capabilities include:

    • Constructing dates from year, month, and day components.
    • Converting dates to Gregorian triplets (year, month, day).
    • Calculating the number of days between two dates.
    • Adding or subtracting days from a date.
    • Determining the day of the week and leap years.
  4. Use @daml/types for Daml primitive types and JSON API serialization

    main

    The @daml/types library provides TypeScript definitions for Daml's primitive data types (e.g., Template, ContractId, Int, Text). It includes the necessary encoders and decoders to facilitate interaction with the Daml Ledger's JSON API.

    Note: If you are building a Daml distributed application, you should generally use the openapi package instead of interacting with @daml/types directly.

  5. Use Haskell Proto Source for the Ledger API

    main

    This module provides Haskell bindings compiled from the ledger-api proto files (frozen as of 2025-09-24).

    Warning:

    • These bindings are deprecated.
    • Use these definitions only for the Ledger API. Do not use the proto definitions contained in this module for any other purpose.
    • It is assumed that the ledger API will not introduce breaking changes for the following services: package service, party management, and user management.
  6. Understand support expectations for Daml Open Source

    main

    Daml Open Source users receive support through the community and limited assistance from Digital Asset employees.

    Support Channels

    • Public Support Only: Support is provided via the Questions category on the Daml Forum. Digital Asset employees cannot answer questions via private messages or email.
    • Paid Private Support: For private support and professional consultation on building Daml applications, contact Digital Asset Support.

    Support Scope

    • What is covered: Assistance with Daml error messages and discussions regarding Daml design.
    • What is NOT covered: Extensive consultation on how to build your specific application or guidance on external languages, frameworks, libraries, and tools used in your stack.

    Response Timing

    • Community Support: Provided by community members at their own discretion.
    • Digital Asset Employee Support: Employees aim to reply to unanswered questions within two business days.
    • Note on Holidays: Response times may be affected by public holidays in Zurich (Switzerland) or New York (United States).
  7. Use the DA.Logic module for propositional calculus

    main
    The DA.Logic module provides tools for working with propositional calculus. It allows you to construct formulas using propositions of a specific type t and perform logical operations such as negation, conjunction, and disjunction. It also includes utilities for transforming formulas into normal forms (NNF, DNF), reducing them, and interpreting them based on truth assignments.
  8. Overview of the Java client library (bindings-java)

    main

    The Java client library (bindings-java) provides a Java-idiomatic abstraction layer over the gRPC Ledger API. It simplifies interactions with the Ledger API by providing toProto and fromProto methods to convert between generated gRPC classes and idiomatic Java objects.

    Key features include:

    • Data Type Mapping: Provides Java classes that represent basic Daml data types.
    • Codegen Support: These classes are used by the Daml Codegen for Java to generate Java equivalents of user-defined Daml code.

    The library is contained within the Java package com.daml.ledger.javaapi.data.