Smart Legal Contracts

This is a guest post by Arity, a technology company based in New York building next-generation contract software.

What is a "smart legal contract" and how do legal contracts interact, if at all, with distributed ledgers? Some take the view that Ricardian contracts are the correct paradigm to reason about the interplay between software and legal contracts.

A Ricardian contract places the defining elements of a legal agreement in a format that can be expressed and executed in software.

There is an allure to having a contract that is both readable by attorneys and executable by software. But, it is practically very difficult to build software that parses natural legal language and code as part of the same document. At least in the short term, it is far more likely that quasi-Ricardian contracts or another model arises to connect legal contracts to smart contracts.

So, the real question becomes how do we connect natural language prose to a smart contract or series of smart contracts that takes some automated action based on the legal contract? At Arity, we believe changing the document model underlying legal documents can have a significant effect on integrating legal contracts with smart contracts. Arity's web-native editor for legal contracts uses a data-rich document model that is human-readable and can be parsed and manipulated using any programming language, including smart-contract languages.

An example of the document model underlying Arity's editor.

By changing the document model and embedding data within the model itself, we can transform our legal contracts into documents that can be processed by software, including smart-contracts, and used in interesting applications that require data typically locked in natural language prose.

With a data-rich document model underpinning legal contracts, there are many interesting applications leveraging distributed-ledger technology that can be built. In fact, many smart-contract use cases currently being explored, at base, rely heavily on legal contracts. Use cases in finance, supply chain, and global trade all currently run on "dumb" legal contracts.

The first step to building a meaningful smart-contract application using legal contracts is getting verified data from a legal contract on the ledger. As anyone who has built a smart-contract application knows, garbage data in equals garbage out. ️

To ensure data fidelity and consistency, Arity's engineering team has prototyped a peer-to-peer network for signing legal contracts that have a data-rich document model underpinning each contract. We have chosen to build the prototype using Daml, an open-source programming language for writing distributed applications quickly, concisely, and correctly. Using the provable correctness of Daml, we were able to build a prototype that allows any Daml Party - a primitive data type in Daml that uniquely represents a user in a Daml network - to receive a proposed legal contract, go through a defined Daml workflow, and execute the legal contract using that Party's cryptographic keys. The legal agreement is then persisted as a SignedContract (see lines 181-187) representing the final, signed legal contact. But, in this case, the signedAgreement (line 183) has a JSON-like data structure rich with information and data pertaining to the legal contract.

Any of the Daml Parties involved in the legal contract workflow can then utilize the SignedContract on line 181 - or just certain data within the JSON-like data structure - in other Daml smart contracts to perform interesting and in some cases automated actions. For instance, if the legal contract pertained to an insurance policy, the claims administrator could utilize other Daml contracts to receive and process insurance claims in a more automated manner using data tied directly to the underlying insurance policy, whose execution and information is recorded on the ledger.

Daml  program for peer-to-peer execution of legal contracts.

We have presented a prototype that provides a strong primitive for building further applications using any data within the legal contract itself, all of which are made possible by recording a data-rich document model - the JSONValue - within the distributed ledger itself for use in a myriad of smart contracts. A peer-to-peer legal network as envisioned could have businesses and individuals with their own unique cryptographic keys for signing data-rich legal documents that, when executed, would be recorded on a distributed ledger. The ledger would record the authoritative legal document for all parties and allow any of the parties to a contract to compose even further Daml workflows using data from the executed legal document.

Why we used Daml

Arity chose to use Daml for this use case for a number of reasons:

  1. We became productive in Daml using the Daml SDK quickly. Daml is intuitive to use, and abstracts away important but critical elements when building smart-contract applications. For instance, Daml's strong authorization abstractions are powerful to build off of. Using signatories, observers, and choices, it is effectively impossible for any Party in a Daml network to enter into a smart-contract without that Party's authorization. As a benefit, this closely tracks the legal world as well.
  2. Daml abstracts the ledger underlying a Daml program so the application developer can focus on business logic without having to pick, up front, the underlying distributed ledger.
  3. Daml is a very readable programming language, meaning even attorneys can understand the syntax and effect of a Daml program.
  4. The privacy features of Daml are critical for an application involving sensitive data, such as legal contracts. Using Daml, you can simply write your smart-contracts using Parties and Observers and data on the ledger is only disclosed to the correct Parties and Observers, by default.

As Arity continues to build out the prototype, we will continue to use Daml and explore some of its more powerful features.

About Arity

Arity is a technology company based in New York, New York building next-generation contract software. Arity's web-native editor makes composing contract templates, clauses, and workflows simple for legal teams, allowing all stakeholders in the contract process to collaborate, in a data-rich way, like never before.