<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE article PUBLIC "-//NLM//DTD Journal Publishing DTD v2.3 20070202//EN" "journalpublishing.dtd">
<article xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" article-type="brief-report">
<front>
<journal-meta>
<journal-id journal-id-type="publisher-id">Front. Blockchain</journal-id>
<journal-title>Frontiers in Blockchain</journal-title>
<abbrev-journal-title abbrev-type="pubmed">Front. Blockchain</abbrev-journal-title>
<issn pub-type="epub">2624-7852</issn>
<publisher>
<publisher-name>Frontiers Media S.A.</publisher-name>
</publisher>
</journal-meta>
<article-meta>
<article-id pub-id-type="doi">10.3389/fbloc.2020.00027</article-id>
<article-categories>
<subj-group subj-group-type="heading">
<subject>Blockchain</subject>
<subj-group>
<subject>Perspective</subject>
</subj-group>
</subj-group>
</article-categories>
<title-group>
<article-title>Smart Contracts Contracts</article-title>
</title-group>
<contrib-group>
<contrib contrib-type="author" corresp="yes">
<name><surname>Bartoletti</surname> <given-names>Massimo</given-names></name>
<xref ref-type="corresp" rid="c001"><sup>&#x0002A;</sup></xref>
<uri xlink:href="http://loop.frontiersin.org/people/570157/overview"/>
</contrib>
</contrib-group>
<aff><institution>Dipartimento di Matematica e Informatica, Universit&#x000E0; di Cagliari</institution>, <addr-line>Cagliari</addr-line>, <country>Italy</country></aff>
<author-notes>
<fn fn-type="edited-by"><p>Edited by: Christopher Clack, University College London, United Kingdom</p></fn>
<fn fn-type="edited-by"><p>Reviewed by: Reshma Kamath, Blockchain Research Institute, Canada; Kristin B. Cornelius, UCLA Department of Information Studies, United States</p></fn>
<corresp id="c001">&#x0002A;Correspondence: Massimo Bartoletti <email>bart&#x00040;unica.it</email></corresp>
<fn fn-type="other" id="fn001"><p>This article was submitted to Smart Contracts, a section of the journal Frontiers in Blockchain</p></fn></author-notes>
<pub-date pub-type="epub">
<day>04</day>
<month>06</month>
<year>2020</year>
</pub-date>
<pub-date pub-type="collection">
<year>2020</year>
</pub-date>
<volume>3</volume>
<elocation-id>27</elocation-id>
<history>
<date date-type="received">
<day>05</day>
<month>01</month>
<year>2020</year>
</date>
<date date-type="accepted">
<day>05</day>
<month>05</month>
<year>2020</year>
</date>
</history>
<permissions>
<copyright-statement>Copyright &#x000A9; 2020 Bartoletti.</copyright-statement>
<copyright-year>2020</copyright-year>
<copyright-holder>Bartoletti</copyright-holder>
<license xlink:href="http://creativecommons.org/licenses/by/4.0/"><p>This is an open-access article distributed under the terms of the Creative Commons Attribution License (CC BY). The use, distribution or reproduction in other forums is permitted, provided the original author(s) and the copyright owner(s) are credited and that the original publication in this journal is cited, in accordance with accepted academic practice. No use, distribution or reproduction is permitted which does not comply with these terms.</p></license>
</permissions>
<abstract><p>This paper explores the connection between software contracts and smart contracts. Despite the assonance, these two terms denote quite different concepts: software contracts are logical properties of software components, while smart contracts are programs executed on blockchains. What is the relation between them? We answer this question by discussing how to integrate software contracts in the design of programming languages for smart contracts.</p></abstract>
<kwd-group>
<kwd>blockchain</kwd>
<kwd>smart contracts</kwd>
<kwd>design by contract</kwd>
<kwd>formal models</kwd>
<kwd>verification</kwd>
</kwd-group>
<counts>
<fig-count count="0"/>
<table-count count="0"/>
<equation-count count="1"/>
<ref-count count="28"/>
<page-count count="5"/>
<word-count count="4299"/>
</counts>
</article-meta>
</front>
<body>
<sec sec-type="intro" id="s1">
<title>1. Introduction</title>
<p>Smart contracts (Szabo, <xref ref-type="bibr" rid="B27">1997</xref>) are pieces of software which regulate the exchange of resources (assets&#x02014;including money&#x02014;and services) between participants. The execution of smart contracts can take advantage of blockchain technologies, which allow mutually untrusted participants to agree on a global state, without the intermediation of a trusted authority. Smart contracts have been redefined and popularized by Ethereum, a public permissionless blockchain through which users can exchange a cryptocurrency, and tokens representing a multitude of other crypto-assets. Ethereum features a Turing-equivalent programming language for writing code that is stored on the blockchain, and which is called smart contract in Ethereum&#x00027;s terminology. Once a smart contract is published, its code cannot be changed, and anyone can interact with it. Hence, adversaries may try to exploit security vulnerabilities in the contract to steal crypto-assets, or cause other harm. The history of Ethereum is studded with attacks to its smart contracts, which overall have caused money losses in the order of hundreds of millions of dollars.</p>
<p>Could these attacks have been avoided? To answer this question, we must consider the vulnerabilities that have made them possible. These vulnerabilities are mainly attributable to design issues in the programming language used to write smart contracts (Luu et al., <xref ref-type="bibr" rid="B21">2016</xref>; Atzei et al., <xref ref-type="bibr" rid="B1">2017</xref>). One of the tools that have been used by software engineers to address similar issues is that of <italic>software contracts</italic>. Intuitively, a software contract is a formal specification of the behavior of a software component, which describes the duties that must be fulfilled by the users of the component, as well as the obligations of the component to its callers.</p>
<p>The main similarity between software contracts and smart contracts is that both are a form of commitment between a piece of software and its callers. For software contracts, the commitment is that the piece of software respects some properties, provided that the caller feeds it with correct inputs. For smart contracts, the commitment is somehow weaker: it just requires that all the executions of the piece of software are coherent with its semantics (i.e., code cannot be changed).</p>
<p>This difference is due to the diverse assumptions on the execution environment. In software contracts, the caller is typically assumed to control the environment where the piece of software is run: so, coherence with the semantics can be taken for granted. Instead, in smart contracts, the piece of software is concurrently executed by a network of mutually untrusted nodes, which may have economic incentives to cheat. In this setting, guaranteeing coherence with the semantics is not trivial: complex network protocols are in order to ensure that the only rational behavior for a node is not to cheat. The most significant outcome of the Bitcoin protocol was indeed to show that trusted executions in trustless environments were possible.</p>
<p>Other remarkable differences between software contracts and smart contracts emerge. While software contracts may describe arbitrary properties of a software component, smart contracts typically define the rules through which participants exchange resources (crypto-currencies or other crypto-assets). This is why the participants of a smart contract can be considered as adversaries, as they may try to steal or freeze the resources controlled by the contract. Instead, in most incarnations of software contracts (with the exceptions discussed below), participants are assumed to behave honestly.</p>
<p>Given the above differences, which ideas from software contracts can be applied to make smart contracts more reliable? In this paper, we discuss some possible research directions to answer this question. We start by providing a brief overview of software contracts, and then we discuss a few research perspectives.</p></sec>
<sec id="s2">
<title>2. Software Contracts</title>
<p>The idea of software contract dates back at least to Hoare&#x00027;s seminal paper (Hoare, <xref ref-type="bibr" rid="B15">1969</xref>), that introduced the axiomatic approach to computer programming. Since then, software contracts have been developed over the past three decades both in the academy and in the industry. In Hoare&#x00027;s approach, the semantics of a programming language is formalized as a set of axioms, and the behavior of a program is given in terms of a precondition and a postcondition. These are logical assertions which describe, respectively, the properties that must hold before and after executing the program. Assertions can be interpreted as contracts: the precondition establishes the obligations that the caller must fulfill before running the program, while the postcondition dictates the obligations of the program. For instance, for a program which merges two arrays, the precondition requires that the values of two input arrays are sorted, while the postcondition is that the output array contains, sorted, the elements of the two arrays in input.</p>
<p>Although the original goal of the axiomatic approach was to prove the correctness of programs, in software development practice the use of assertions as contracts has become widespread for a weaker goal, that is to make program testing more rigorous. Assertions are spread over large programs, dynamically checked in massive tests, and possibly removed before the actual deployment. In particular, the <italic>design by contract</italic> principle fostered by Meyer since the late eighties (Meyer, <xref ref-type="bibr" rid="B22">1986</xref>, <xref ref-type="bibr" rid="B24">1992</xref>) requires that the interfaces between modules of safety-critical software systems should be governed by contracts. These contracts are decoupled from the rest of the program logic, so that they can be easily discharged after the testing phase. Another landmark feature of contracts is that they enable to assign <italic>blame</italic> in case of contract violations. Assume that a program module has a precondition <italic>P</italic> and a postcondition <italic>Q</italic>. During the execution of the program, if <italic>P</italic> is violated then the blame is assigned to the caller; instead, if <italic>P</italic> is respected but <italic>Q</italic> is violated, then the blame is assigned to the callee. The first programming language with native support for design by contract was Eiffel, in the object-oriented paradigm (Meyer, <xref ref-type="bibr" rid="B23">1991</xref>). Since then, almost all mainstream programming languages offer some support for contracts, either natively (e.g., Scala and Clojure), or through external libraries (e.g., JML for Java, Code contracts for C&#x00023;).</p>
<p>In the functional paradigm, where program modules can be higher-order functions, contract checking and blame assignment are more complex than in the procedural and object-oriented paradigms. For instance, assume that a function <italic>g</italic> takes as input a function <italic>f</italic> from integers to integers, and produces an integer as output. While the postcondition of <italic>g</italic> can be a first-order predicate <italic>R</italic> on integers, its precondition cannot: rather, it should consist of a predicate <italic>P</italic> restricting the acceptable arguments passed to <italic>f</italic>, and a predicate <italic>Q</italic> restricting its possible outputs. So, the contract of <italic>f</italic> can be rendered as a function <italic>P</italic> &#x02192; <italic>Q</italic>, and that of <italic>g</italic> as a higher-order function (<italic>P</italic> &#x02192; <italic>Q</italic>) &#x02192; <italic>R</italic>. By decidability issues it is not possible, in general, to determine whether <italic>f</italic> respects its contract or not when <italic>g</italic> is applied. A possible way to tackle this problem, first explored in Findler and Felleisen (<xref ref-type="bibr" rid="B11">2002</xref>), is to check <italic>f</italic>&#x00027;s contract when <italic>f</italic> is applied. At that moment it is possible to know if the argument passed to <italic>f</italic> respects <italic>P</italic>, and if the value produced by the application of <italic>f</italic> respects <italic>Q</italic>, and to assign the blame accordingly. Findler and Felleisen&#x00027;s seminal work has given rise to a proliferation of studies on higher-order contracts, leading to a wide variety of languages and analysis techniques. The most notable functional language supporting the design by contract approach is Racket (Flatt and PLT, <xref ref-type="bibr" rid="B12">2010</xref>), a dialect of Scheme with higher-order assertions.</p>
<p>Going beyond the incarnation of contracts as pre- and post-conditions on program modules, Beugnard et al. (<xref ref-type="bibr" rid="B7">1999</xref>) proposed a taxonomy of software contracts consisting of four kinds of contracts:</p>
<list list-type="bullet">
<list-item><p><italic>basic contracts</italic>, which describe the syntactic constraints that must be respected to use a program module (e.g., the basic contract of a function that takes as input an integer and produces as output a string is a type int &#x02192; string);</p></list-item>
<list-item><p><italic>behavioral contracts</italic>, which impose semantic constraints on program modules, in the form of pre- and post-conditions as discussed so far;</p></list-item>
<list-item><p><italic>sequencing contracts</italic>, which impose constraints on how the different modules offered by a software component can be used (e.g., the <monospace>withdraw</monospace> method of a <monospace>BankAccount</monospace> object cannot be executed concurrently with the <monospace>deposit</monospace> method);</p></list-item>
<list-item><p><italic>quality of service contracts</italic>, which impose time, space, and precision constraints on the execution of a program module (e.g., any call to the <monospace>openAirbag</monospace> procedure must terminate within 10 ms).</p></list-item>
</list>
<p>In the setting of concurrent programming models, contracts are used to describe the possible sequences of messages that can be processed by concurrent components (H&#x000FC;ttel et al., <xref ref-type="bibr" rid="B19">2016</xref>). For instance, the contract of a payment service may require that the service first receives a <monospace>cardDetails</monospace> message, then either a <monospace>proceed</monospace> or an <monospace>abort</monospace> message; in case of <monospace>proceed</monospace>, the service sends back to the client either a message <monospace>paymentOk</monospace> or a message <monospace>paymentError</monospace>. Using a syntax inspired to that of Web Service contracts (Castagna et al., <xref ref-type="bibr" rid="B10">2009</xref>), we can express this contract as follows:</p>
<disp-formula id="E1"><mml:math id="M1"><mml:mtable columnalign="left"><mml:mtr><mml:mtd><mml:mtext class="textup" mathvariant="normal">?</mml:mtext><mml:mtext>cardDetails</mml:mtext><mml:mo>.</mml:mo><mml:mstyle mathsize="1.19em"><mml:mrow><mml:mo>(</mml:mo></mml:mrow></mml:mstyle><mml:mtext class="textup" mathvariant="normal">?abort</mml:mtext><mml:mo>&#x0002B;</mml:mo><mml:mtext class="textup" mathvariant="normal">?pay</mml:mtext></mml:mtd></mml:mtr><mml:mtr><mml:mtd><mml:mo>.</mml:mo><mml:mrow><mml:mo stretchy="false">(</mml:mo><mml:mrow><mml:mo>!</mml:mo><mml:mtext>paymentOk</mml:mtext><mml:mo>&#x02295;</mml:mo><mml:mo>!</mml:mo><mml:mtext>paymentError</mml:mtext></mml:mrow><mml:mo stretchy="false">)</mml:mo></mml:mrow><mml:mstyle mathsize="1.19em"><mml:mrow><mml:mo>)</mml:mo></mml:mrow></mml:mstyle></mml:mtd></mml:mtr></mml:mtable></mml:math></disp-formula>
<p>where <monospace>?</monospace> denotes a received message, <monospace>!</monospace> a sent message, <monospace>.</monospace> sequencing, <monospace>&#x0002B;</monospace> a choice made by the client, and &#x02295; a choice made by the service. In this setting, a typical goal is to determine if two contracts are <italic>compliant</italic>: intuitively, compliance between contracts guarantees the absence of certain kinds of communication errors in any execution of services which respect their contracts. Many different notions of compliance can be used for this purpose, based e.g., on deadlock-freedom, on may- and must-testing relations, etc. (Bordeaux et al., <xref ref-type="bibr" rid="B9">2004</xref>; Bartoletti et al., <xref ref-type="bibr" rid="B4">2015b</xref>).</p>
<p>Starting from Honda&#x00027;s seminal paper on dyadic session types (Honda, <xref ref-type="bibr" rid="B17">1993</xref>), many works address the problem of statically verifying if a service (formally specified in some calculus for concurrency) respects its contract. The overall result is that if two services are statically verified to respect their contracts, and these contracts are compliant, then no communication errors can happen at runtime. Extensions of this kind of results to the multi-party setting have been studied by Honda et al. (<xref ref-type="bibr" rid="B18">2008</xref>) and many subsequent works.</p>
<p>The work (Bocchi et al., <xref ref-type="bibr" rid="B8">2010</xref>) nicely integrates assertion-based contracts with concurrency contracts. The idea is to project a service choreography decorated with assertions to a set of local assertions: services abiding these local assertions are guaranteed to have correct interactions at run time. A dual approach is to start from an arbitrary set of services, and to dynamically compose those with compliant contracts (Bartoletti et al., <xref ref-type="bibr" rid="B5">2012</xref>). A remarkable difference between this approach and the other approaches to concurrency contracts discussed before is that the latter assume that all services are <italic>trusted</italic>, in that they will not change their code after deployment (as this would invalidate their static verification). Instead, in Bartoletti et al. (<xref ref-type="bibr" rid="B5">2012</xref>) this assumption can be limited to a subset of services, while all the others are considered as <italic>adversaries</italic>. Under this weaker hypotheses it is no longer possible to ensure the absence of contract breaches, as an adversary could diverge from the declared contract, or just stop cooperating at any time. Rather, the goal of the static analysis is to guarantee that the trusted services always respect their contracts, whatever the behavior of the adversaries. This property, called <italic>honesty</italic>, becomes relevant when services interact through communication middlewares which sanction those not abiding to their contracts (Bartoletti et al., <xref ref-type="bibr" rid="B3">2015a</xref>). In this setting, honest services are guaranteed to never be sanctioned.</p></sec>
<sec id="s3">
<title>3. Contracts for Smart Contracts</title>
<p>We now discuss some possible research directions on connecting software contracts with smart contracts.</p>
<sec>
<title> Route &#x00023;1: Embedding Assertions Into Existing Smart Contract Languages</title>
<p>A straightforward idea would be to add assertions to existing smart contract languages, in the spirit of the design by contract methodology.</p>
<p>A first step towards this direction has been taken by Solidity, the mainstream high-level language for writing smart contracts for the Ethereum platform. Starting from version 0.4.10<xref ref-type="fn" rid="fn0001"><sup>1</sup></xref>, Solidity features two functions (called <monospace>assert</monospace> and <monospace>require</monospace>), which throw a state-reverting exception if the given conditions are not respected. The two functions slightly differ on the handling of <italic>gas</italic> (i.e., the fee paid by participants for the execution of contract calls). When the condition of <monospace>assert</monospace> is violated, all the gas provided by the caller is consumed; instead, a failing <monospace>require</monospace> refunds any remaining gas. Although these functions provide useful syntactic sugar for the if-throw pattern, they do not really capture the essence of assertions in the design by contract methodology. For instance, they do not separate the duties between the caller and the smart contract: in design by contract, preconditions and postconditions represent, respectively, duties of the caller and of the callee; instead, both <monospace>assert</monospace> and <monospace>require</monospace> punish the caller in case of violations, by consuming the gas he provided to perform the call.</p>
<p>Design by contract extensions of Solidity have been proposed by external tools, like e.g., <sc>solc-verify</sc> (Hajdu and Jovanovic, <xref ref-type="bibr" rid="B13">2020</xref>). This tool allows developers to annotate Solidity code with contract invariants, loop invariants, pre- and post-conditions. These conditions can be arbitrary Solidity expressions without side effects. A static analysis of the annotated code, based on SMT solving techniques, discharges the conditions which are found to be always satisfied.</p>
<p>A limitation of working with general-purpose languages like Solidity is that they make it difficult to specify and verify properties which capture high-level properties of smart contracts (for instance, that a participant loses at most a certain amount of money in every maximal interaction with the contract). One of the reasons of this difficulty is that the interaction between the participants and the contract is not rigidly structured, since participants can call any contract method, at any time. Using more structured smart contract languages would allow to increase the level of abstraction of contract properties.</p></sec>
<sec>
<title> Route &#x00023;2: Designing Domain-Specific Languages for Smart Contracts and Assertions</title>
<p>Going beyond Ethereum and Solidity, a more radical research direction is the study of new domain-specific languages for smart contracts, with native support for design by contract. When following this direction, two crucial choices are the primitives of the smart contract language, and the formalism for describing assertions and contract properties.</p>
<p>The choice of the smart contract language may be dictated by the choice of the underlying blockchain platform: for instance, it would be inappropriate to design a Turing-equivalent language for Bitcoin contracts, since the current restrictions on Bitcoin scripts and transactions make the expressiveness of Bitcoin contracts quite limited (Atzei et al., <xref ref-type="bibr" rid="B2">2019</xref>). Even when the underlying blockchain supports Turing-equivalent contracts, like e.g., in Ethereum and Cardano, it could still be useful to restrict the expressiveness of high-level contract languages, since this would improve their verification capabilities, besides making it simpler for humans to understand programs. Several contract languages have been proposed along these lines, with different expressiveness degrees: see e.g., Harz and Knottenbelt (<xref ref-type="bibr" rid="B14">2018</xref>), Tikhomirov (<xref ref-type="bibr" rid="B28">2020</xref>), and Miller et al. (<xref ref-type="bibr" rid="B25">2018</xref>) for some references.</p>
<p>To clarify how design by contract may take advantage of restricted domain-specific languages, consider a financial contract involving three participants: an investor, a bank and an insurance company. The contract behaves like a zero-coupon bond: the investor pays (say) EUR 1000 upfront to the bank, and the bank returns EUR 2000 to the investor after a maturity date (say, 10 years). To mitigate the risk that the bank fails to repay the investor, the insurance company guarantees to cover the full amount of EUR 2000 for an annual premium of EUR 100 paid by the bank. Focussing on the investor, the desired high-level behavior is that, in any possible interaction with the contract, the investor will gain EUR 1000 within 10 years. In restricted smart contract languages like those proposed by Atzei et al. (<xref ref-type="bibr" rid="B2">2019</xref>) and Seijas et al. (<xref ref-type="bibr" rid="B26">2020</xref>) it is possible to craft a contract that is statically verified to respect this high-level property. The actual contract actually depends on the assumptions on the other participants (e.g., if the bank, or the insurance company, or none of them is considered honest), and on the amounts initially deposited in the contract.</p></sec>
<sec>
<title>Route &#x00023;3: Taking Into Account Participants&#x00027; Strategies</title>
<p>Most current analysis tools for smart contracts assume that, at any time, any participant can do any action. While this assumption perfectly makes sense when one wants to detect certain vulnerabilities of smart contracts (e.g., re-entrancy bugs in Ethereum), taking into account the <italic>strategies</italic> followed by participants may substantially improve the precision of the analysis.</p>
<p>For instance, consider a two-players gambling game with the following rules. First, each player puts a bet and commits to a move. Within 1 week, each player must reveal his move, or otherwise lose the bet. Once both moves have been revealed, the game determines the winner, according to some logics. A desirable property of this game is <italic>fairness</italic>, i.e., each player has a strategy that guarantees him to have at least the same winning probability of the other player. From the point of view of a player, it would be irrational to follow a strategy where he waits more than 1 week before revealing, since doing so would make him loses the bet. Rather, he would like to verify that the game is fair, assuming that his strategy is to reveal within the deadline, while not making any assumptions on the strategy of the other player (who should be considered as an adversary).</p>
<p>This kind of properties can be verified on Bitcoin contracts expressed in BitML, by exploiting the property-preserving reduction of contracts to finite state systems proposed in Bartoletti and Zunino (<xref ref-type="bibr" rid="B6">2019</xref>). Since considering all the possible strategies of the adversaries may lead to an exponential number of states, alternative analysis techniques to pure model checking are a possible goal for future research.</p>
<p>Another research direction is that on formal models for participant&#x00027;s strategies. For instance, Laneve et al. (<xref ref-type="bibr" rid="B20">2019</xref>) specify both smart contracts and participants in a unified process calculus. Given a system containing a smart contract and all the involved participants, they devise a static analysis which evaluates the maximum profit of each participant.</p></sec>
<sec>
<title>Route &#x00023;4: Projecting Global Contracts to Participants&#x00027; Strategies</title>
<p>Another inspiration for further research comes from the literature on concurrency multi-party contracts. There, the idea is that there is a global type which describes the overall behavior of a set of components, and we want to guarantee that, at run-time, the point-to-point interactions between these components respect the global type. One way to achieve this goal is to project the global type into a set of local types, and then verify that each component respects its local type (Honda et al., <xref ref-type="bibr" rid="B18">2008</xref>).</p>
<p>We can transpose this approach to the realm of smart contracts, by imagining that the global type is a contract among a set of participants, and that the components are participant strategies. A crucial difference with the setting of concurrency contracts is that, in that of smart contracts, one can no longer assume participants to be honest, i.e., their run-time behavior may diverge from the local types against which they have been verified. One way to tackle this problem, inspired by earlier works on concurrency contracts (Bartoletti et al., <xref ref-type="bibr" rid="B5">2012</xref>), is to make the projection construct only the strategies of the participants we are considering honest, guaranteeing that some desirable properties hold (e.g., that the honest participants never lose money), whatever the behavior of the other participants.</p></sec></sec>
<sec sec-type="conclusions" id="s4">
<title>4. Conclusions</title>
<p>Current designs of smart contract languages seem to have been influenced more by marketing principles like &#x0201C;time-to-market,&#x0201D; than by technical principles like reliability and security. This paper discusses some research directions to incorporate design by contract principles in the development of smart contracts.</p>
<p>To conclude, I would like to quote C.A.R. Hoare from his Turing Award Lecture (Hoare, <xref ref-type="bibr" rid="B16">1981</xref>). In this lecture, Hoare was criticizing the design of the programming language PL/I, but I believe that his warning against a poor software design is always appropriate, also in the setting of smart contracts:</p>
<disp-quote><p>&#x0201C;At first I hoped that such a technically unsound project would collapse but I soon realized it was doomed to success. Almost anything in software can be implemented, sold, and even used given enough determination. There is nothing a mere scientist can say that will stand against the flood of a hundred million dollars. But there is one quality that cannot be purchased in this way&#x02013;and that is reliability. The price of reliability is the pursuit of the utmost simplicity. It is a price which the very rich find most hard to pay.&#x0201D;</p></disp-quote>
</sec>
<sec id="s5">
<title>Author Contributions</title>
<p>The author confirms being the sole contributor of this work and has approved it for publication.</p>
</sec>
<sec id="s6">
<title>Conflict of Interest</title>
<p>The author declares that the research was conducted in the absence of any commercial or financial relationships that could be construed as a potential conflict of interest.</p>
</sec>
</body>
<back>
<ref-list>
<title>References</title>
<ref id="B1">
<citation citation-type="book"><person-group person-group-type="author"><name><surname>Atzei</surname> <given-names>N.</given-names></name> <name><surname>Bartoletti</surname> <given-names>M.</given-names></name> <name><surname>Cimoli</surname> <given-names>T.</given-names></name></person-group> (<year>2017</year>). <article-title>&#x0201C;A survey of attacks on Ethereum smart contracts (SoK),&#x0201D;</article-title> in <source>Proc. POST, Vol. 10204 of LNCS</source> (<publisher-loc>Uppsala</publisher-loc>: <publisher-name>Springer</publisher-name>), <fpage>164</fpage>&#x02013;<lpage>186</lpage>.</citation></ref>
<ref id="B2">
<citation citation-type="book"><person-group person-group-type="author"><name><surname>Atzei</surname> <given-names>N.</given-names></name> <name><surname>Bartoletti</surname> <given-names>M.</given-names></name> <name><surname>Lande</surname> <given-names>S.</given-names></name> <name><surname>Yoshida</surname> <given-names>N.</given-names></name> <name><surname>Zunino</surname> <given-names>R.</given-names></name></person-group> (<year>2019</year>). <article-title>&#x0201C;Developing secure Bitcoin contracts with BitML,&#x0201D;</article-title> in <source>ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering, ESEC/SIGSOFT FSE</source> (<publisher-loc>Tallinn</publisher-loc>), <fpage>1124</fpage>&#x02013;<lpage>1128</lpage>.</citation></ref>
<ref id="B3">
<citation citation-type="book"><person-group person-group-type="author"><name><surname>Bartoletti</surname> <given-names>M.</given-names></name> <name><surname>Cimoli</surname> <given-names>T.</given-names></name> <name><surname>Murgia</surname> <given-names>M.</given-names></name> <name><surname>Podda</surname> <given-names>A. S.</given-names></name> <name><surname>Pompianu</surname> <given-names>L.</given-names></name></person-group> (<year>2015a</year>). <article-title>&#x0201C;A contract-oriented middleware,&#x0201D;</article-title> in <source>Proc. Formal Aspects of Component Software, Vol. 9539 of LNCS</source> (<publisher-loc>Niter&#x000F3;i</publisher-loc>: <publisher-name>Springer</publisher-name>), <fpage>86</fpage>&#x02013;<lpage>104</lpage>.</citation></ref>
<ref id="B4">
<citation citation-type="book"><person-group person-group-type="author"><name><surname>Bartoletti</surname> <given-names>M.</given-names></name> <name><surname>Cimoli</surname> <given-names>T.</given-names></name> <name><surname>Zunino</surname> <given-names>R.</given-names></name></person-group> (<year>2015b</year>). <article-title>&#x0201C;Compliance in behavioural contracts: a brief survey,&#x0201D;</article-title> in <source>Programming Languages With Applications to Biology and Security, Vol. 9465 of LNCS</source> (<publisher-loc>Pisa</publisher-loc>: <publisher-name>Springer</publisher-name>), <fpage>103</fpage>&#x02013;<lpage>121</lpage>.</citation></ref>
<ref id="B5">
<citation citation-type="book"><person-group person-group-type="author"><name><surname>Bartoletti</surname> <given-names>M.</given-names></name> <name><surname>Tuosto</surname> <given-names>E.</given-names></name> <name><surname>Zunino</surname> <given-names>R.</given-names></name></person-group> (<year>2012</year>). <article-title>&#x0201C;On the realizability of contracts in dishonest systems,&#x0201D;</article-title> in <source>Proc. COORDINATION</source> (<publisher-loc>Stockholm</publisher-loc>), <fpage>245</fpage>&#x02013;<lpage>260</lpage>.</citation></ref>
<ref id="B6">
<citation citation-type="book"><person-group person-group-type="author"><name><surname>Bartoletti</surname> <given-names>M.</given-names></name> <name><surname>Zunino</surname> <given-names>R.</given-names></name></person-group> (<year>2019</year>). <article-title>&#x0201C;Verifying liquidity of Bitcoin contracts,&#x0201D;</article-title> in <source>Proc. POST, Vol. 11426 of LNCS</source> (<publisher-loc>Prague</publisher-loc>: <publisher-name>Springer</publisher-name>), <fpage>222</fpage>&#x02013;<lpage>247</lpage>.</citation></ref>
<ref id="B7">
<citation citation-type="journal"><person-group person-group-type="author"><name><surname>Beugnard</surname> <given-names>A.</given-names></name> <name><surname>J&#x000E9;z&#x000E9;quel</surname> <given-names>J.</given-names></name> <name><surname>Plouzeau</surname> <given-names>N.</given-names></name></person-group> (<year>1999</year>). <article-title>Making components contract aware</article-title>. <source>IEEE Comput.</source> <volume>32</volume>, <fpage>38</fpage>&#x02013;<lpage>45</lpage>.</citation></ref>
<ref id="B8">
<citation citation-type="book"><person-group person-group-type="author"><name><surname>Bocchi</surname> <given-names>L.</given-names></name> <name><surname>Honda</surname> <given-names>K.</given-names></name> <name><surname>Tuosto</surname> <given-names>E.</given-names></name> <name><surname>Yoshida</surname> <given-names>N.</given-names></name></person-group> (<year>2010</year>). <article-title>&#x0201C;A theory of design-by-contract for distributed multiparty interactions,&#x0201D;</article-title> in <source>Proc. CONCUR, Vol. 6269 of LNCS</source> (<publisher-loc>Paris</publisher-loc>), <fpage>162</fpage>&#x02013;<lpage>176</lpage>.</citation></ref>
<ref id="B9">
<citation citation-type="book"><person-group person-group-type="author"><name><surname>Bordeaux</surname> <given-names>L.</given-names></name> <name><surname>Sala&#x000FC;n</surname> <given-names>G.</given-names></name> <name><surname>Berardi</surname> <given-names>D.</given-names></name> <name><surname>Mecella</surname> <given-names>M.</given-names></name></person-group> (<year>2004</year>). <article-title>&#x0201C;When are two Web services compatible?,&#x0201D;</article-title> in <source>Proc. TES</source> (<publisher-loc>Toronto, ON</publisher-loc>), <fpage>15</fpage>&#x02013;<lpage>28</lpage>.</citation></ref>
<ref id="B10">
<citation citation-type="journal"><person-group person-group-type="author"><name><surname>Castagna</surname> <given-names>G.</given-names></name> <name><surname>Gesbert</surname> <given-names>N.</given-names></name> <name><surname>Padovani</surname> <given-names>L.</given-names></name></person-group> (<year>2009</year>). <article-title>A theory of contracts for Web services</article-title>. <source>ACM Trans. Progr. Lang. Syst.</source> 31, <volume>19</volume>:<fpage>1</fpage>&#x02013;<lpage>19:61</lpage>. <pub-id pub-id-type="doi">10.1145/1538917.1538920</pub-id></citation></ref>
<ref id="B11">
<citation citation-type="book"><person-group person-group-type="author"><name><surname>Findler</surname> <given-names>R. B.</given-names></name> <name><surname>Felleisen</surname> <given-names>M.</given-names></name></person-group> (<year>2002</year>). <article-title>&#x0201C;Contracts for higher-order functions,&#x0201D;</article-title> in <source>ACM SIGPLAN International Conference on Functional Programming</source> (<publisher-loc>Pittsburgh, PA</publisher-loc>), <fpage>48</fpage>&#x02013;<lpage>59</lpage>.</citation></ref>
<ref id="B12">
<citation citation-type="journal"><person-group person-group-type="author"><name><surname>Flatt</surname> <given-names>M.</given-names></name> <collab>PLT</collab></person-group> (<year>2010</year>). <source>Racket.</source> Technical Report Technical Report PLT-TR-2010-1, PLT Design Inc.</citation></ref>
<ref id="B13">
<citation citation-type="book"><person-group person-group-type="author"><collab>Hajdu &#x000C1; Jovanovic D</collab></person-group>. (<year>2020</year>). <article-title>&#x0201C;Solc-verify: a modular verifier for solidity smart contracts,&#x0201D;</article-title> in <source>Verified Software. Theories, Tools, and Experiments. VSTTE 2019. Lecture Notes in Computer Science</source>, Vol. 12031, eds S. Chakraborty and J. Navas (<publisher-loc>Cham</publisher-loc>: <publisher-name>Springer</publisher-name>), <fpage>161</fpage>&#x02013;<lpage>179</lpage>. <pub-id pub-id-type="doi">10.1007/978-3-030-41600-3_11</pub-id></citation></ref>
<ref id="B14">
<citation citation-type="journal"><person-group person-group-type="author"><name><surname>Harz</surname> <given-names>D.</given-names></name> <name><surname>Knottenbelt</surname> <given-names>W. J.</given-names></name></person-group> (<year>2018</year>). <article-title>Towards safer smart contracts: a survey of languages and verification methods</article-title>. <source>CoRR</source> abs/1809.09805.</citation></ref>
<ref id="B15">
<citation citation-type="journal"><person-group person-group-type="author"><name><surname>Hoare</surname> <given-names>C. A. R.</given-names></name></person-group> (<year>1969</year>). <article-title>An axiomatic basis for computer programming</article-title>. <source>Commun. ACM</source> <volume>12</volume>, <fpage>576</fpage>&#x02013;<lpage>580</lpage>.</citation></ref>
<ref id="B16">
<citation citation-type="journal"><person-group person-group-type="author"><name><surname>Hoare</surname> <given-names>C. A. R.</given-names></name></person-group> (<year>1981</year>). <article-title>The emperor&#x00027;s old clothes</article-title>. <source>Commun. ACM</source> <volume>24</volume>, <fpage>75</fpage>&#x02013;<lpage>83</lpage>.</citation></ref>
<ref id="B17">
<citation citation-type="book"><person-group person-group-type="author"><name><surname>Honda</surname> <given-names>K.</given-names></name></person-group> (<year>1993</year>). <article-title>&#x0201C;Types for dyadic interaction,&#x0201D;</article-title> in <source>Proc. CONCUR</source> (<publisher-loc>Hildesheim</publisher-loc>), <fpage>509</fpage>&#x02013;<lpage>523</lpage>.</citation></ref>
<ref id="B18">
<citation citation-type="book"><person-group person-group-type="author"><name><surname>Honda</surname> <given-names>K.</given-names></name> <name><surname>Yoshida</surname> <given-names>N.</given-names></name> <name><surname>Carbone</surname> <given-names>M.</given-names></name></person-group> (<year>2008</year>). <article-title>&#x0201C;Multiparty asynchronous session types,&#x0201D;</article-title> in <source>POPL</source> (<publisher-loc>San Francisco, CA</publisher-loc>).</citation></ref>
<ref id="B19">
<citation citation-type="journal"><person-group person-group-type="author"><name><surname>H&#x000FC;ttel</surname> <given-names>H.</given-names></name> <name><surname>Lanese</surname> <given-names>I.</given-names></name> <name><surname>Vasconcelos</surname> <given-names>V. T.</given-names></name> <name><surname>Caires</surname> <given-names>L.</given-names></name> <name><surname>Carbone</surname> <given-names>M.</given-names></name> <name><surname>Deni&#x000E9;lou</surname> <given-names>P.</given-names></name> <etal/></person-group>. (<year>2016</year>). <article-title>Foundations of session types and behavioural contracts</article-title>. <source>ACM Comput. Surv.</source> 49, <volume>3</volume>:<fpage>1</fpage>&#x02013;<lpage>3:36</lpage>. <pub-id pub-id-type="doi">10.1145/2873052</pub-id></citation></ref>
<ref id="B20">
<citation citation-type="book"><person-group person-group-type="author"><name><surname>Laneve</surname> <given-names>C.</given-names></name> <name><surname>Coen</surname> <given-names>C. S.</given-names></name> <name><surname>Veschetti</surname> <given-names>A.</given-names></name></person-group> (<year>2019</year>). <article-title>&#x0201C;On the prediction of smart contracts&#x00027; behaviours,&#x0201D;</article-title> in <source>From Software Engineering to Formal Methods and Tools, and Back, Vol. 11865 of LNCS</source>, eds M. H. ter Beek, A. Fantechi, and L. Semini (<publisher-loc>Springer</publisher-loc>), <fpage>397</fpage>&#x02013;<lpage>415</lpage>.</citation></ref>
<ref id="B21">
<citation citation-type="book"><person-group person-group-type="author"><name><surname>Luu</surname> <given-names>L.</given-names></name> <name><surname>Chu</surname> <given-names>D.-H.</given-names></name> <name><surname>Olickel</surname> <given-names>H.</given-names></name> <name><surname>Saxena</surname> <given-names>P.</given-names></name> <name><surname>Hobor</surname> <given-names>A.</given-names></name></person-group> (<year>2016</year>). <article-title>&#x0201C;Making smart contracts smarter,&#x0201D;</article-title> in <source>ACM CCS</source> (<publisher-loc>Vienna</publisher-loc>), <fpage>254</fpage>&#x02013;<lpage>269</lpage>.</citation></ref>
<ref id="B22">
<citation citation-type="book"><person-group person-group-type="author"><name><surname>Meyer</surname> <given-names>B.</given-names></name></person-group> (<year>1986</year>). <source>Design by Contract.</source> <publisher-loc>Technical Report Technical Report TR-EI-12/CO, Interactive Software Engineering Inc</publisher-loc>.</citation></ref>
<ref id="B23">
<citation citation-type="journal"><person-group person-group-type="author"><name><surname>Meyer</surname> <given-names>B.</given-names></name></person-group> (<year>1991</year>). <source>Eiffel: The Language. Prentice-Hall</source>.</citation></ref>
<ref id="B24">
<citation citation-type="journal"><person-group person-group-type="author"><name><surname>Meyer</surname> <given-names>B.</given-names></name></person-group> (<year>1992</year>). <article-title>Applying &#x0201C;design by contract&#x0201D;</article-title>. <source>IEEE Comput.</source> <volume>25</volume>, <fpage>40</fpage>&#x02013;<lpage>51</lpage>.</citation></ref>
<ref id="B25">
<citation citation-type="book"><person-group person-group-type="author"><name><surname>Miller</surname> <given-names>A.</given-names></name> <name><surname>Cai</surname> <given-names>Z.</given-names></name> <name><surname>Jha</surname> <given-names>S.</given-names></name></person-group> (<year>2018</year>). <article-title>&#x0201C;Smart contracts and opportunities for formal methods,&#x0201D;</article-title> in <source>Int. Symp. on Leveraging Applications of Formal Methods, Verification and Validation Vol. 11247 of LNCS</source> (<publisher-loc>Limassol</publisher-loc>: <publisher-name>Springer</publisher-name>), <fpage>280</fpage>&#x02013;<lpage>299</lpage>.</citation></ref>
<ref id="B26">
<citation citation-type="book"><person-group person-group-type="author"><name><surname>Seijas</surname> <given-names>P. L.</given-names></name> <name><surname>Nemish</surname> <given-names>A.</given-names></name> <name><surname>Smith</surname> <given-names>D.</given-names></name> <name><surname>Thompson</surname> <given-names>S. J.</given-names></name></person-group> (<year>2020</year>). <article-title>&#x0201C;Marlowe: implementing and analysing financial contracts on blockchain,&#x0201D;</article-title> in <source>Financial Cryptography Workshops</source> (<publisher-loc>Kota Kinabalu</publisher-loc>).</citation></ref>
<ref id="B27">
<citation citation-type="journal"><person-group person-group-type="author"><name><surname>Szabo</surname> <given-names>N.</given-names></name></person-group> (<year>1997</year>). <article-title>Formalizing and securing relationships on public networks</article-title>. <source>First Monday</source> 2. <pub-id pub-id-type="doi">10.5210/fm.v2i9.548</pub-id></citation></ref>
<ref id="B28">
<citation citation-type="web"><person-group person-group-type="author"><name><surname>Tikhomirov</surname> <given-names>S.</given-names></name></person-group> (<year>2020</year>). <source>A Curated Collection of Resources on Smart Contract Programming Languages</source>. Available online at: <ext-link ext-link-type="uri" xlink:href="https://github.com/s-tikhomirov/smart-contract-languages">https://github.com/s-tikhomirov/smart-contract-languages</ext-link></citation></ref>
</ref-list>
<fn-group>
<fn id="fn0001"><p><sup>1</sup><ext-link ext-link-type="uri" xlink:href="https://solidity.readthedocs.io/en/develop/control-structures.html&#x00023;error-handling-assert-require-revert-and-exceptions">https://solidity.readthedocs.io/en/develop/control-structures.html&#x00023;error-handling-assert-require-revert-and-exceptions</ext-link></p></fn>
</fn-group>
</back>
</article>