Domain expert defined legal smart contracts using a declarative language
This research investigates the potential of declarative languages to advance what can be achieved by domain experts programming their own automation. We illustrate this potential by exploring the issue of implementing legal contracts and other legal/normative documents as both human and machine readable smart contracts deployable on a blockchain. The risk, communication, understandability, flexibility, agility and cost problems encountered with current compiled procedural language approaches, creates an opportunity for a solution that enables domain experts to write, test and deploy their own smart contracts. The study began with a description of an ideal solution and a literature review, which helped to identify the open questions around how to build the ideal solution. The investigation involved experimenting with a proof-of-concept system starting from assumptions which were refined at each iteration. The result is a proof-of-concept editor that enables domain experts to first guide the system to acquire an understanding of the closed world of a legal document, then model and test the embedded logic, before adding the assertional data and performing program testing. This results in an exhaustively tested logic program that is both human and machine readable and can be deployed as a smart contract. Fronting the domain expert user with a smart user interface that communicates visually and verbally in domain familiar concepts while concurrently encoding the ontology and legal logic in an declarative language, was made possible by a number of formal correspondences between graphics, text and declarative representations that were identified. We also found that model validation and verification could be highly automated and that it is possible for exhaustive testing to be conducted by a domain expert via a user mediated simulation. The editor is a novel integration of a number of techniques and technologies that solves a real world problem of significance, and likely is applicable to other domains.