DAML- The open-source language for smart contracts originated by Digital Asset

0

As the blockchain technology evolves, there is need for improved systems through which users operate and interact. Already, there are a lot of improvements happening especially as the enterprise blockchain continues to become popular. Among the latest developments in the fast changing blockchain environment is DAML.

What is DAML?

The popularity of blockchain, more generically called Distributed Ledger Technology (DLT), derives from a number of things, one of them being the fact that information stored on the public ledger is future proof and that it is immutable. Since the dawn of the internet, data immutability is a property that eluded many developers. As such, bad actors within the online ecosystem took advantage of the ability to alter data to commit various crimes. However, blockchain proved more important when developers demonstrated the capability of carrying out transactions in an environment without a central player like it happens in the legacy financial world.

In addition to these public ledgers, a large market for private, permissioned ledgers has also take off. Whether controlled by a legally-authorize central party or a consortium of mutually distrusting actors who have a common goal, private ledgers provide the same future-proofing and immutability as public ledgers with the added ability to maintain data privacy.

free webinar post

Whether a given ledger is public or private, underpinning the ability for peers in a blockchain ecosystem to interact with privacy guarantees is the class of application usually referred to as smart contracts. This article will discuss later in detail what smart contracts are and their importance in the context of DAML. Essentially, DAML is a smart contract language that enables developers to accurately code multi-party agreements for a variety of blockchain, DLT, or even standard database architectures.

DAML –The open-source language for smart contracts originated by Digital Asset breathes a new life into this application genre (smart contracts) which enables peers to transact in an environment of trust. Basically, this is a programming language that draws inspiration from Haskell and which facilitates creation of smart contracts for distributed business workflows. Notably, the language enables developers to cut down the amount of time spent dealing with the nuts and bolts of encryption and blockchain. Instead, the developers focus their time on developing programming solutions for business processes.

DAML – Language for Smart Contracts Simply Explained 

daml

Properties of DAML

  • Provides a means for writing contracts

Like other languages which programmers use to write smart contracts, DAML enables peers to make and honor agreements. Notably, the language describes the process of formation of a contract, the key parties in the agreement, and the parties with delegated rights to the contract. Besides defining the formation process of a contract, the language takes care of encoding of ideas like contracts, rights, parties, authorization and obligations in that the developer only has to deal with the logic of their business; any heavy lifting relating to things like hashing, cryptography, and consensus protocols are abstracted away and handled by the runtime.  This direct expression of contract elements as native language features implies that the DAML architecture can ably check the system code for problems automatically and earlier in the development cycle. Further, the system has the capability to reason on its own about the business logic.

  • It is open source

DAML is fairly new, having first. On April 4 2019, Digital Asset, the firm behind DAML announced that the source code for the program would be freely available to all developers. This open sourcing of the project meant that financial institutions, healthcare providers, retailers, and other users of the language, would be able to use DAML to model and execute contracts through blockchain technology without fear of vendor lock-in. According to the announcement, developers and other interested parties will be able to access the DAML language, source code, Software Development Kit (SDK), and runtime under the very permissive Apache 2.0 license.

  • Usable in a private execution environment

One shortcoming of publicly distributed ledgers is that every node on the platform can view the data that is present in the smart contracts. As such, peers that need to keep the details of their deal private find it impossible to transact over a public blockchain network. In particular, this is one major stumbling blocks which is preventing a complete adoption of enterprise blockchain. This is why, as mentioned earlier, private DLTs have soared in popularity.

The combination of DAML and a private DLT platform provides a remedy for this case. Notably, the team behind this expressive language optimized DAML in that it works perfectly in a private execution environment. This is to say that information carried in the contracts stays private such that only authorized parties can access it.

  • Readable by humans and machines

DAML is revolutionary is more than just one sense. Notably, the design of the system is in a way that machines and humans can understand the information included in the contract. The implication of this capability is huge. The professionals involved in the formation of a contract will have an easy time to get their way around the details because DAML is very human-friendly. For instance, a lawyer can easily understand the meaning of a contract by reading and assessing the DAML encoding of that contract. At the same time, DAML provides the right degree of specificity for developers to compute important aspects of a contract like cash flow, profiles of customers and risk exposure.

How it works

DAML works pretty much like all the other smart contract writing languages. In particular, the language works in two major levels where there is the language itself and the runtime. The language is like the main part of the technology. This is what enables developers to do all the work they need to do in terms of writing agreements and facilitating transactions.

Because there are very clean and abstracted APIs between the language and runtime, the runtime can be adapted to execute on a variety of blockchain, DLT, and other platforms. This provides the flexibility for DAML applications to be ported across platforms that deliver support for DAML. This is analogous to a JVM allowing Java applications to run unchanged on any platform that supports the JVM.

After installation of the Software Development Kit (SDK), developers only need to run a few specific files so that the device can be in a position to support the operations.

  • Data modeling

One of the main and most important tasks one needs to perform when writing a smart contract is the modeling of data to be used with that contract. Normally, the data modeling function is complicated and can lead to very complex data structures depending on how complicated the contracts are and how many parties are involved.

Unlike other smart contract languages, DAML enables developers to specify their data schema on the fly, directly embedding it within the contract’s execution language. This greatly simplifies the task of data modeling and reduces the chance of errors being introduced due to mis-matches between the data schema and application logic.

  • Template outline structure

The DAML developer specifies a contract through a simple and well-defined structure called a “template”, which contains both the data model and parameters of the contract.

The parameters include, for example, the signatories to a given contract (those participants that must authorize actions on the contract), and the observers (those participants within the agreement who are just there to see the contract and what it does but are not authorized to take actions). Another aspect of the template structure includes the agreement, which is basically the detail of the agreement and a representation of what the contract is about.

Templates can specify one or more preconditions which ensure that the contract is created only if a certain threshold is achieved by the creator of the contract. The last element of the template outline structure is “choices”. This defines the range of choices which the executor of the contract can exercise.

  • Choice structure

A major structure within the template is the choice structure, which details the choices which the contract parties can choose in terms of the nature of the template. The choice structure identifies the controller, or the party which is responsible for exercising the choice. Other elements of this structure include consumability, a name, a return type, choice arguments and a choice body.

Comparing DAML and Smart Contracts

  • Understanding smart contracts

Like earlier explained, smart contracts is a vital component of the distributed ledger technology (DLT). In public blockchains, two anonymous parties can create a smart contract to facilitate a certain transaction but the data remains stored on the public ledger. This is to say that all participants in the network can view the details of the deal to ascertain its authenticity. As such, enforcement of trust is possible.

In private, or permissioned DLTs, all parties are known but only those parties involved in a given transaction have access to that transaction’s data. Trust is still maintained through mechanisms that allow participants to validate all transactions to which they have access.

Smart contracts have distinguishing characteristics which also make them revolutionary. For instance, smart contracts can have a self-executing mechanism which kicks in motion on cue from set deadlines (also called triggering events). In public networks, any interested party can analyze the activity of the smart contracts such that any anomaly can be identified. Also, traders can use smart contracts to get the pulse of the market. This includes the ability to predict trends and uncertainties in the market.

Smart contracts have a number of benefits which include immutability of data. In the basic terms, immutability refers to the impossibility of data alteration from its original state. This is to say that the data cannot be erased or altered in any manner conceivable. The immutability of the data makes the smart contracts always accurate. Third, in some cases smart contracts enable peers to transact directly without the need for an intermediary. Therefore, such transactions are very cheap, sometimes they do not cost a dime.

Properties of  smart contracts

  • Proof of obligations and rights

One critical feature that smart contracts must possess is that one does not have to transact without being comfortable with the whole process. In essence, agreeing to enter a contract is completely voluntary but the consequences are compulsory. Therefore, the user must reliably and ably consider the future implications of the contract that one signs on to. The smart contract must guarantee that this is always the case, something that can be very difficult to get right.

  • Verification of transaction validity

Like earlier discussed, information concerning the details of the contract is easily traceable from the ledger. Therefore, this fulfils the requirement for contracts whereby one can verify their authenticity and validity.

  • Comparison with DAML

Essentially, it is obvious from the foregoing that DAML produces a subset of smart contracts in that one is able to correct the deficiencies of existing languages. Like earlier discussed, the fact that smart contracts on public networks store their data on public ledgers make smart contracts unattractive for confidential transactions. However, DAML, when used in conjunction with private networks, ensures that only those parties which authorize the contract, alongside those with delegated permission to view the details, can have access to the contract information. This is one reason why knowledgeable observers believe this language is the killer function for financial institutions and others that require transaction confidentiality.

Nonetheless, DAML as a language for smart contracts differs from traditional smart contracts when it comes to sharing of the written agreements. Smart contracts languages like Solidity share the information publicly, hence the whole network has access to the details. On the contrary, agreements written in DAML are only available on a need to know basis. This is to say that undesirable third parties do not have access to the details. In particular, the language utilizes an extra layer of security whereby the data is not even available to undesirable parties.

Benefits of DAML

  • Open source

The blockchain platform might be just 10 years old but it is growing rapidly. Today, the technology is revolutionizing industries at unprecedented rates. The reason for this fast growth is the fact that blockchain is open source and any developer can tinker with it to come with the best solution for a certain problem. Interestingly, DAML is also open source since April 4 2019. This is to say that developers have the latitude to modify the DAML code to create the most innovative solutions when it comes to the smart contracts and the blockchain ecosystem in general.

  • Enables private transactions

Traditional smart contracts languages do not contain native features with robust restrictions where agreements can be made private. In essence, the information in the agreements is accessible to all participants, including undesirable third parties. However, as discussed earlier, DAML incorporates an extra layer of security where such information is only accessible to authorized parties.

  • Accelerates enterprise blockchain adoption

As blockchain transitions to enterprise use cases, one of the issues holding the technology back is the distributed nature of information. Notably, as discussed earlier, there are already efforts like creation of private blockchain platforms where all participants have to acquire permission before entry. However, enterprises still face the threat of competitors getting a sight of their strategy. However, the entry of DAML is a potential solution to that problem. In particular, the language restricts agreement data to only those nodes authorized to access it, and information regarding agreements is not available to other users. As such, enterprises have no excuse but to jump on board and exploit the enterprise blockchain potential.

  • In-built support to validate model correctness

Given the inchoate nature of blockchain, most of the operations and models are experimental and novel. Therefore, there is need for constant validation of the correctness of the models. Luckily, DAML comes with in-built support where validation of the correctness of models is automatic.

  • Storage abstraction

The DAML runtime is robust and performs vital operations to make the language superior to the existing alternatives. For instance, the runtime abstracts the details of the ledger in that the developer can focus on the logic of the contract.

Comparing DAML with other alternative smart contract languages

The blockchain ecosystem is still growing and that implies that there is no standard systems of operations. This also means that there is no single language that dominates in writing of smart contracts. As such, there are numerous other alternatives apart from DAML. This article will discuss a few of these alternatives.

  • Solidity

Solidity is one of the very first languages for writing smart contracts that gained popularity. This popularity was as a result of the Ethereum blockchain platform being a preferred network for smart contracts. As a programming language, Solidity dominates the Ethereum platform. This language utilizes high level syntax and script that is similar to JavaScript. In particular, the language is vital in the enhancement of Ethereum Virtual Machine. Several other private blockchains like Hyperledger Burrow and Monax use the language for primary development.

Further, the Ethereum developers used Solidity to write version 0.4.0 of the software. The beauty with this language is that it does not break the functionality of the blockchain network. In addition, the language is vital in the creation of smart contracts that run on the Ethereum virtual machine (EVM). The language enhances the ability of applications to self-reinforce the business logic which is inherent in the smart contracts. As a result, transacting parties in the Ethereum ecosystem leave an authoritative record of their transactions to facilitate verifiability.

Unlike DAML whose language is similar to that of Haskell, Solidity utilizes a syntax that is close to ECMAScript. However, Solidity has extra capabilities like variadic return types and the ability for static typing. Also, contracts written in Solidity support multiple inheritance which is facilitated with C3 linearization.

  • Actulus Modelling Language

Since blockchain began to take the enterprise direction, various financial domain-specific languages came up to solve some problems identified in the initial languages. In addition to DAML and Solidity, Actulus Modelling Language (AML) came up to help solve computational issues in the pension and insurance sectors. In particular, AML is a multiparty venture that incorporates Edlund A/S and the IT University of Copenhagen.

Unlike languages like Java, and C/C++ among others which are generally applicable in various settings, AML is domain specific. This is to say that the language is useful for a specific purpose or can create applications which run on a specific platform. As such, the language cannot create stand-alone programs, interfaces and applications.

  • BOScoin Trust Contracts

This is another alternative solution that uses Web Ontology Language (WOL) to create smart contracts. BOScoin always employs Timed Automata Language (TAL) to enhance the trust and robustness of the contracts. In particular, the language creates Trust Contracts which facilitate the creation of Decentralized Applications (DApps). Essentially, the smart contract emboldens the trusted nature of DApps.

Similar to DAML, BOScoin is not Turing-Complete. Instead, the languages are decidable which differentiates them from the Turing-Complete nature of Ethereum Smart Contracts. Unlike Ethereum smart contracts, BOScoin Trust Contracts use a comprehensive and more contained ontology language. In particular, this is due to the need for the team to create a platform where developers can come up with reliable contracts.

What does the future hold for DAML?

As things stand, the blockchain environment is awash with smart contract languages. The many languages make it difficult for blockchain applications to interoperate and hence delaying the mass adoption of blockchain. Interestingly, the Hyperledger platform alone uses over six languages including DAML which creates smart contracts in Hyperledger Sawtooth.

However, the abstraction capability of the DAML runtime helps to solve a host of bug problems in smart contracts created across the board. It also makes DAML applications portable to other platforms. In addition to Digital Asset’s platform, DAML support has been announced for VMware Blockchain and Sawtooth, which indicates that other platforms might adopt it. Therefore, it is likely that the DAML language could become the universal smart contracts language in the coming decades.

Summary/Closing Remarks

Blockchain technology is clearly on the way to maturity. However, this will rely on the effectiveness through which the technology delivers solutions that match its potential. Especially at this period when the technology transitions from hype to reality, developments such as DAML are critical.

Interestingly, DAML takes the writing of smart contracts to the next level. In particular, the language defines a novel way of writing contracts where only the authorized parties and those with delegated rights can view the details of a contract. Also, the language is open source and one should expect its development and popularity to be rapid. Further, the language works in an excellent manner in private execution environment. Lastly, the language is readable by humans and machines which implies that professionals and developers will work together to develop great solutions in various industries.

What is DAML?

  • A domain-specific Smart Contracts language which draws inspiration from Haskell

Properties

  • Provides means for writing contracts – automates some functions so that developers can dwell of business logic
  • It is open source – developers can easily modify the language and the SDK is available at no charge
  • Usable in a private execution environment – information carried by contracts written in DAML is accessible only to authorized parties
  • Readable by humans and machines – provides an opportunity for novel solutions

Data modelling using DAML

  • The system is made of the language and runtime
  • Modelling follows the following structures
    • Template outline structure – it defines the signatories, observers, agreement, preconditions, and choices.
    • Choice structure – identifies the controller, consumability, a name, a return type, choice arguments, and a choice body.

Benefits of DAML

  • It is open source
  • Enables private transactions
  • Restricts viewership of agreements to authorized parties hence encouraging enterprise blockchain adoption
  • In-built support to validate model correctness
  • DAML runtime enables storage abstraction

DAML vs Solidity vs AML vs BOScoin

DAML Solidity AML BOScoin
Nature of language Domain specific Domain specific Domain specific Domain specific
Influence Haskell C++, Python, PowerShell Python JavaScript and C++
License Open source Licensed Licensed Licensed
Contract type Private Public Public Public
Network Private Ethereum Private BOScoin

The DAML language faces a promising future given the potential it holds in terms of revolutionizing the process of creation of smart contracts. Considering the increasing number of languages used in writing contracts, the industry will need a unified approach and, in this case, only the most robust language will carry the day. In particular, DAML is superior when it comes to satisfying the need for enterprises to keep their deals private. Further, the abstraction capability saves time for developers in that they will spend most of their time improving on the business logic of the contracts. Also, it is clear that many more platforms will trial DAML after VMware Blockchain and Hyperledger Sawtooth announced its incorporation in their operations. Therefore, it is highly likely that DAML might become the primary language for writing contracts if its development keeps on the current trajectory.


About Author

Swati Goyal has an extensive work experience of more than 6 years, in the field of Finance in diverse roles ranging from accounts, financial research to and Cryptocurreny. She follows the Finance market and enjoys writing on it, Swati's hobby is reading, watching movies and television shows.

Leave A Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.