A few weeks ago, in June 2021, AWS published a two-part series on its AWS Database Blog describing a smart legal contract solution built with Accord Project and Amazon technologies. This work was led by Nikolay Vlasov, a Senior Blockchain Architect with AWS Professional Services. 

The contract in the solution was a supply contract between a coffee shop and a wholesale supplier of milk. The scenario implemented by the smart legal contract involves prescheduled weekly deliveries of milk to the coffee shop. The contract states that for every 2 days that the delivery is late, the supplier must pay the customer 10.5% of the total cost, up to a maximum of 52% of the total delivery value. There is also a clause that states the contract is terminated if the supplier is late 15 days. The actions of the smart legal contract, then, are the automatic calculation of the penalty that the supplier must pay, and the automatic termination of the contract in the event a delivery is delayed for 15 days.

This demonstration highlights a couple from a range of benefits that smart legal contracts introduce. The smart instance of the delivery conditions between the seller and buyer can provide cost-efficiency through automation. Smart legal contracts can automate not only reminders about obligations but the actual performance of contractual obligations. They also provide a more efficient way to verify that conditions set out by certain key clauses have been met and properly enforced.  Smart legal contracts also increase trust among contract participants—because this trust depends on the technology used to carry out the implementation, tamper-resistant technologies like distributed ledgers can be useful. In this case, the technology that provides immutability and data integrity is a centralized ledger database called Amazon Quantum Ledger Database.

AWS’s solution here has an instructive framework for use cases that fit smart legal contracts. Given the programmatic nature of contract actions and verifications, processes between contract parties that are distinctly worked out or established are better suited for smart legal contracts. This is often the case with standardized or templatized contracts requiring little to no change to the structure of the contract as a result of negotiations. Another aspect is volume: established processes and standardized contracts tend to accompany use cases involving a high volume of contracts, transactions, or contract events to justify the cost of setting up the solution. Use cases that warrant tamper-proof databases—such as the late delivery supply one shown by AWS and supported by Amazon QLDB—should involve the potential for disputes about the results of calculations tied to contract clauses.

Besides Amazon QLDB, the Amazon technologies used are Amazon Simple Storage Service, AWS Lambda, and Amazon Simple Queuing Service.  The overall architecture and the choices made are discussed at some length in the original articles. Below is a quick overview. 

Amazon Simple Storage Service serves as a catalog for contract templates. AWS Lambda triggers the deployment of a new contract based on the contract template from the template catalog, reacts to external events (e.g. data about delivery dates and times), and triggers every subsequent call to the contract to check its state. Amazon QLDB makes it simple to see the history of all events associated with the smart legal contract; the party to the contract that owns the AWS account—in this case, the coffee shop—can check every change made to the contract by code (e.g., penalty calculations made after each delivery). Via its API, Amazon QLDB allows both parties, not just the account owner, to verify the data integrity of contract transactions and resultant data. Each party receives a digital receipt for each transaction with information from the Amazon QLDB ledger. The purpose of the Amazon Simple Queuing Service is to receive obligations emitted from the smart legal contract and send to external systems for processing, such as finance or accounting systems to generate invoices based on the penalty amount.

The benefits of Accord Project’s open source technology is showcased well by this demo solution. The late delivery contract clause rendered as a smart legal contract shows the tight coupling of a common data model and execution logic with natural language (see the Cicero template system). The execution part of the smart legal contract uses scripts that implement machine-runnable contract logic.  Another notable advantage of Accord Project technology is portability: the codebase is implemented in JavaScript, permitting smart legal contracts to be executed in a number of environments, including JavaScript virtual machines inside web browsers and with Node.js on servers.

Read Part 1 and Part 2 of the article.  You can set up this smart legal contract demo from its GitHub repo.