The Language

  • Data Model

    DAML's powerful type system makes it easy to model complex data schemas for your application following domain-driven design.

  • Fine-grained Permissions

    Specify who needs to sign a given contract,who can see it and who is allowed to perform actions on it.

  • Business Logic

    Describe the actions available on a contract, together with their parameters, assertions, and precise consequences.

  • Scenario-based Testing

    Test your business logic and workflows with an expressive scenario language. Interact with the ledger using multiple parties and verify the effects of your transactions instantly.

illus-two
template Cash
  with
    issuer : Party
    owner : Party
    amount : Decimal
  where
    signatory issuer
    controller owner can
      Transfer : ContractId Cash
        with
          newOwner: Party
        do create this with owner = newOwner
template TicketAgreement
  with
    organizer : Party
    owner : Party
  where
    signatory organizer, owner
template TicketOffer
  with
    organizer : Party
    buyer : Party
    price : Decimal
  where
    signatory organizer
    observer buyer
    controller buyer can
      Accept : ContractId TicketAgreement
        with
          cashId : ContractId Cash
        do
          cash <- fetch cashId
          assert (cash.amount == price)
          exercise cashId Transfer with
            newOwner = organizer
          create TicketAgreement with
            organizer; owner = buyer

validateTicketPurchase = scenario do
  issuer <- getParty "Issuer"
  organizer <- getParty "Organizer"
  buyer <- getParty "Buyer"
  cash <- submit issuer do
    create Cash with
      issuer; owner = buyer; amount = 20.0
  offer <- submit organizer do
    create TicketOffer with
      organizer; buyer; price = 20.0
  submit buyer do
    exercise offer Accept with
      cashId = cash

The runtime abstracts away the persistence layer so DAML programs can be written in a storage-agnostic way.

Contract data in the IDE is presented in an easily digestible format:

Ticket:Cash
BuyerIssuerOrganizerIdStatusIssuerOwnerAmount
#0.0archivedIssuerBuyer200.0
#0.0archivedIssuerBuyer200.0
Ticket:TicketOffer
BuyerOrganizerIdStatusOrganizerOwnerticket.eventticket.categoryticket.price
#1:0archived‘Organise’‘Buyer’‘Conference’Ticket:Category
VIP
200.0
Ticket:TicketAgreement
BuyerOrganizerIdStatusOrganizerOwnerticket.eventticket.categoryticket.price
#1:0archived‘Organise’‘Buyer’‘Conference’Ticket:Category
VIP
200.0

The SDK

DAML SDK Tooling

Building applications takes more than just a language, you need a complete toolchain.

IDE

The Visual Studio Code extension provides rich language support out of the box. Code highlighting, navigation, autocomplete, and type checking. A built in linter helps you write idiomatic DAML, and points out opportunities for refactoring.

Testing

An integrated simulation tool lets you spin up an in-memory ledger and run through scenarios in milliseconds. Nicely formatted transcripts let you inspect a trace of the interactions.

APIs

gRPC and HTTP-JSON APIs automatically generated from the DAML models give you multiple options for connecting to and interacting with the ledger. Example clients libraries are availble for Java, Python, and JavaScript.

Check out the full documentation →