Skip to content
SM Tutorials & Certification

SMART CONTRACTS TUTORIAL

BLOCKCHAIN

1. Blockchain provides a decentralized database, or “digital ledger”, of transactions that everyone on the network can see. This network is essentially a chain of computers that must all approve an exchange before it can be verified and recorded.1

2. This process of verification and recording is called ‘proof of work’. The more ‘proof of work’ a transaction generates, the more secure a chain of transaction blocks become, in other words, the longer a blockchain, the more trustworthy it is. The use of cryptography allows for this technology to be secure by rendering it immutable. Blockchain is widely used in cryptocurrency transactions due to its immutable nature, as illustrated below.

3. Please click on the link below for a technical demo of how Blockchain works, particularly for an overview of why a blockchain is considered immutable:

Blockchain Demo2
(17 mins video)

SMART CONTRACTS

4. Smart contracts are agreements that utilize the blockchain to automatically and securely execute obligations when certain conditions are met. Like other blockchain-based technologies, the smart contract is designed to function without reliance on a centralized authority.

5. A smart contract is to be self-executing and self-enforcing. Smart contracts operate on a straightforward ‘if this, then that’ Boolean logic3.

6. There is no definition (legal or an industry agreed term) of smart contracts yet. This has resulted in confusion as to what one means when one refers to smart contracts4.

7. Reflecting this confusing usage, Stark5 presents two distinct schools of smart contracts:

  1. Smart legal contracts: This school resonates most with lawyers. This is where the term ‘smart contract’ is used to refer to legal contracts, or elements of legal
    contracts, being represented and executed by software.

  2. Smart contract code: The other school relates less to contracts as a lawyer would understand them, and more to a piece of code (known as a software agent) that is designed to execute certain tasks if predefined conditions are met. Such tasks are often embedded within and performed on a distributed ledger6. For example, one well-known smart contract implementation describes software agents that create a cryptocurrency, provide an electronic voting mechanism and offer an electronic blind auction mechanism as smart contracts.

8. The above distinctions can cause difficulties when the topic of smart contracts is discussed, and there is a risk that lawyers and computer scientists simply talk at cross purposes. However, rather than viewing smart legal contracts and smart contract code as two separate domains, the reality is that there is a relationship between them. For a smart legal contract to be implemented, it will need to embed one or more pieces of code designed to execute certain tasks if pre-defined conditions are met – that is, pieces of smart contract code. Smart legal contracts, therefore, are functionally made up of pieces of smart contract code – but, crucially, under the umbrella of an overall relationship that creates legally enforceable rights. As a result, every smart legal contract can be said to contain one or more pieces of smart contract code, but not every piece of smart contract code comprises a smart legal contract7.

9. Highlighting the distinction between smart legal contracts and smart contract code is useful in ensuring clarity of usage, but it does not result in a basic definition. Recognizing there is no single universally accepted definition, it is nonetheless useful to set out a basic description that tries to present a unified view of what the term smart contract encapsulates. One such description that performs this job well is that of Clack, Bakshi, and Braine8:

“A smart contract is an automatable and enforceable agreement. Automatable by computer, although some parts may require human input and control. Enforceable either by legal enforcement of rights and obligations or via tamper-proof execution of computer code.”

The above description has the advantage that it is broad enough to cover both smart legal contracts and smart contract code. It captures the essence of smart contracts, i.e. the ability of smart contracts to self-execute and self-enforce on Boolean logic.

7‘Smart Contracts and Distributed Ledger – A Legal Perspective’ by ISDA and Linklaters (2017), https://www.isda.org/a/6EKDE/smart-contracts-and-distributed-ledger-a-legal-perspective.pdf, p.5

8‘Smart Contract Templates: Foundations, Design Landscape and Research Directions’, Clack, C., Bakshi, V. & Braine, L. (2016, revised March 2017)

SMART CONTRACTS TODAY: ETHEREUM

10. Whilst the idea for the operation of a smart contract was formulated by Nick Szabo9 in 1996, it is through the rise of cryptocurrencies and blockchain technology, particularly Ethereum, that the process of smart contracting today has been made possible.

11. Ethereum is a distributed network formed by thousands of nodes (computers running the Ethereum software) globally. Whereas Bitcoin records the creation and transfer of bitcoins in its global ledger, Ethereum, in addition to recording the creation and transfer of Ether10, stores computer scripts (so-called “smart contracts” and “decentralized applications” (“daps”)) and records their state11.

12. Anyone can create an Ethereum contract. Once deployed, that script will exist, permanently and publicly, in the Ethereum blockchain (with a copy stored on every node in the Ethereum network)12.

13. The distributed nature of Ethereum makes it very difficult, if not impossible, to prevent or otherwise interfere with (a) people creating Ethereum contracts, (b) users accessing or interacting with the data on Ethereum contracts and (c) the automatic execution of each Ethereum contract exactly in accordance with its code13.

14. Ethereum contracts can be implemented in various Turing complete14 scripting languages. To prevent contracts that loop infinitely, which would waste the resources of the Ethereum network, the Ethereum platform charges a small amount of Ether per computation15.

15. Ethereum allows for any service that is currently centralized, to be decentralized. Consider all the industries currently controlled by intermediaries: banking, payments, insurance, and

12 Ibid

13 Ibid

14 In computability theory, a system of data manipulation rules (such as a computer’s instruction set, a programming language, or a cellular automaton) is said to be Turing complete or computationally universal if it can be used to simulate any Turing machine. A Turing machine is a hypothetical machine thought of by the mathematician Alan Turing in 1936. Despite its simplicity, the machine can simulate any computer algorithm, no matter how complicated it is.

15 Ibid

real estate are obvious ones, but blockchain technology can even be used for voting systems, IoT applications, music sharing, forecasting, and supply chain management16.

16. Current applications on Ethereum include:

  1. Uport, which allows users to control who can access their data and personal information
  2. BlockApps, which provides tools to create private and public industry-specific blockchain applications
  3. Weifund, which provides an open crowdsourcing platform that enables contributions to be turned into digital assets
  4. Augur, which is an open-source prediction and forecasting market platform
  5. Provenance, which makes supply chains more transparent for consumers by tracing what raw materials go into products

17. Various industries have started using Ethereum in their blockchain applications. Microsoft’s Azure, a recently-launched blockchain-as-a-service platform, uses many distributed ledgers in its service offerings, including Ethereum17. In fact, in January 2016, eleven banks including Barclays, UBS, and HSBC used the Ethereum protocol through Azure to test out a bank-to-bank platform. This simulation allowed banks to settle transactions to each other almost instantaneously, as opposed to several days or weeks (depending on the asset class) required under current systems. Proponents claim that blockchain will be commercially used by banks to transfer real assets in the next couple of years18.

18. The following diagram illustrates some examples of use cases for smart contracts:

SMART CONTRACTS TODAY: RISE AND FALL OF ‘THE DAO’

19. Ethereum was proposed in late 2013 by Vitalik Buterin, a cryptocurrency researcher and programmer. Development was funded by an online crowdsale that took place between July and August 201419. The system went live on 30 July 2015, with 11.9 million coins “premined” for the crowdsale20. This accounts for about 13 percent of the total circulatingsupply21.

20. In 2016, as a result of the collapse of ‘The DAO’ project, Ethereum was split into two separate blockchains – the new separate version became Ethereum (ETH), and the original continued as Ethereum Classic (ETC)22.

19 https://en.wikipedia.org/wiki/Ethereum#Smart_contracts
20 Ibid
21 Ibid
22 Ibid

21. A DAO (decentralized autonomous organization), a contrast from ‘The DAO’, is a complex smart contract or set of smart contracts. ‘The DAO’ (https://daohub.org/) is the most prominent example of a DAO. It gained significant media attention after it raised the equivalent of USD168 million from individual investors in its initial creation phase, making it the world’s biggest crowdfunding project to date23.

22. However, on 17 June 2016, a weakness in ‘The DAO’s code was maliciously exploited and it became materially compromised and it is unlikely to recover24. The DAO was delisted from trading on major exchanges such as Poloniex and Kraken in late 2016.

23. The fall and rise of ‘The DAO’ raise some pertinent questions about the sustainability and reach of smart contracts: was ‘The DAO’ too much, too soon, or is the viability of a Turing complete smart contract platform now in doubt?

24. Very complex smart contracts based on Turing complete languages will inevitably contain bugs and each smart contract controlling Ether represents something of a bounty for opportunists and hackers, requiring extreme levels of diligence25.

25. Further, DAOs are not currently recognized as legal entities, creating uncertainty as to the legal rights attributable to a DAO and who bears the legal responsibilities. It is possible that in the abstract, a DAO would fall within the categories of a general partnership or joint venture agreement between the participants. In such circumstances, courts will generally infer and impose such a structure on a DAO, in the absence of any formative document or articles. While a DAO might have extensive rules governing its conduct between internal members, those rules may be of little use when interacting with an external jurisdiction’s legal system26.

26. In fact, in ‘The DAO’ whitepaper27, it was clearly set out that the legal status of a DAO is ambiguous at best:

“A word of caution, at the outset: the legal status of DAOs remains the subject of active and vigorous debate and discussion. Not everyone shares the same definition. Some have said that they are autonomous code and can operate independently of legal systems; others have said that they must be owned or operated by humans or human-created entities. There will be many uses cases, and the DAO code will develop over time. Ultimately, how a DAO functions and its legal status will depend on many factors, including how DAO code is used, where it is used, and who uses it. This paper does not speculate about the legal status of DAOs worldwide.”

27. Other legal challenges arise with respect to determining jurisdiction. The developers of ‘The DAO’ is known, but that will not always be the case – a DAO could be created by many contributors, some known, some not known, based in multiple jurisdictions, using servers

23
“The Decentralised Autonomous Organisation (the DAO)” by Allen & Overy (2016),
http://www.allenovery.com/SiteCollectionDocuments/Article%20Decentralized%20Autonomous%20Organizations.pdf, p. 2-3
24 Ibid
25 Ibid
26 Ibid at 5-6
27 http://public/dao/whitepaper.pdf

based in yet more jurisdictions. This is exacerbated by the perceived focus on decentralization. For many participants, a key feature of DAOs is unfettered and anonymous participation. Initial funding is sent from (and dividends paid to) pseudo anonymous Ethereum accounts and, in any event, DAO tokens are freely traded between accounts. The votes of participants are not attributed or attributable either28.

28. The legal uncertainties surrounding the status of a DAO and the difficulty in properly identifying individual members of a DAO at any one point in time will make it arduous to properly assign the ownership in the product of smart contracts.

29. The DAO downfall is proof that ultimately blockchain too provides a centralized platform which is hackable. Taking a step back, this reality is not too dissimilar from conventional centralized systems like banks and governments that are corruptible. The founding developer of ‘The DAO’, Christoph Jentsch, in an interview with The New York Times on 21 May 2016 stated that:

“If I would have known the size it has grown to, maybe the tester in me would say, ‘I need more testing’. This is very risky. It’s all new land.”

FORESEEABLE REACH OF SMART CONTRACTS

30. It is foreseeable that using the capabilities discussed above, smart contracts can be utilized in various transactions, reaching from simple financial agreements to complex structures such as wills.

31. With the advent of the Internet of Things, another category called smart property is on the rise, in which the rights associated with objects attached to the objects themselves, as opposed to only the persons owning the objects. Networked door locks on shared cars (through a system such as Zipcar) could automatically open (only for that individual) when someone paid the access fee29. Or access to a leased car could be shut off from a delinquent lessee and given to the bank, but only until full payment of the principal30. More broadly, with over 25 billion objects, from light switches to crop moisture monitors, expected to have internet connectivity in 2020, smart contracts would allow devices to operate autonomously, share resources, and exchange data without central management31 or human intervention. This would make systems more efficient and help save costs.

32. Allegedly, smart contracts are to eventually remove the role of courts as enforcement agents, since they are to be self-enforcing by their very nature. This means that when it comes to smart contracts coded on a public blockchain, parties will no longer have the avenue of resorting to litigation. Once the smart contract is coded, the machinery for its execution is unavoidably set in motion. The parties’ opportunity to affect the transaction ex-post will be cut off.

33. Whilst the above may be true for smart contracts on a public blockchain, the situation for smart contracts coded on a private blockchain is slightly different. In these situations, parties who dispute the outcome of a pre-coded event on the smart contract will need to bring their disputes to the owner of the private blockchain instead. This is likely to mean that the role of the judiciary in these matters will be reduced to perhaps merely interpreting if the smart clause in dispute was coded accurately, governing the intention of the parties at the time of entering into the smart contract.

34. While the potential benefits of smart contracts are substantial, the potential problems are significant as well. Werbach and Cornell32 state in their paper that, “[t]here is a Frankenstein dimension to a smart contract: An instrument that fuses something innately human (entering into and enforcing agreements) with something mechanical, derived from scientific experiments. Science fiction authors since Mary Shelley have warned of the consequences of such cyborgs. Perhaps the benefits of smart contracts will exceed the costs. Perhaps the benefits can be magnified or the costs minimized. We should, nonetheless, carefully assess both sides of the ledger.”

35. Werbach and Cornell argue that the advent of smart contracts in the least, illuminate foundational issues in the law of contract itself. They opine33 that the intent of contracting is not to merely (i) ensure the legal enforcement of the promissory commitments or moral obligations between parties or (ii) enable transactional activity, by creating a system of

29“Contracts Ex Machina” by Werbach & Cornell (Duke Law Journal, 2017), p. 336 – 337

30 Ibid

31 Ibid

32 Ibid at 364

33 Ibid at 352 – 362

voluntarily binding oneself through opting into predictable consequences for breach. The foregoing is too simplistic and does not capture the spirit of the law of contract.

36. In their view, the purpose of the law of contract is as follows: “Contract law does not exist to alter our reasons going forward—though it surely does that—but rather it exists to adjudicate the justice of a situation ex post. Its basic function is to decide whether one party has wronged another party by failing to perform a promised action. That is, contract law is a fundamentally remedial institution, not aimed at creating new reasons but aimed at resolving disputes, taking the reasons as already given. When one views contract law in this way, then it is apparent that smart contracting doesn’t even purport to do what contract law does. The two have fundamentally different objectives. Smart contracting functions to ensure action. Contract law functions to recognize and remedy grievances.”34

37. Levy highlights 3 contracting practices that are prevalent35, 2 of which are particularly relevant in understanding the limitations of the reach of smart contracts in complex contracts like construction and IP licensing contracts:

34 Ibid

35“Book-Smart, Not Street-Smart: Blockchain-Based Smart Contracts and the Social Workings of Law”, Karen E. C. Levy, Cornell University, Engaging Science, Technology, and Society 3 (2017), 1-15

36 As Gordon (1985, p.569) puts it: “In the “relational” view of Macaulay and Macneil, parties treat their contracts more like marriages than like one-night stands. Obligations grow out of the commitment that they have made to one another, and the conventions that the trading community establishes for such commitments; they are not frozen at the initial moment of commitment, but change as circumstances change; the object of contracting is not primarily to allocate risks, but to signify a commitment to cooperate.”

38. It is important to appreciate that not all clauses in contracts are susceptible to automation and self-execution. Even where a clause might technically be capable of being automated, it might not always be desirable to automate it.

39. A legal agreement can be analyzed as containing operational and non-operational clauses37:

  1.  “Operational Clauses 38 – generally embed some form of conditional logic – i.e., that upon the occurrence of a specified event, or at a specified time, a deterministic action is required. Such clauses are at the heart of any financial contract.”
  2. “Non-operational Clauses39 – clauses that do not embed such conditional logic
    but that, in some respect, relate to the wider legal relationship between the parties”.

 

40. Whilst operational clauses are readily capable of being expressed as Boolean logic, non-operational clauses are less susceptible to being expressed in pure Boolean logic. “Take the example of a standard representation from a party that it is duly organised and validly existing under the laws of the jurisdiction of its organisation or incorporation. This is not a statement of conditional logic, and so would not be susceptible to pure Boolean logic. It is a representation of a legal state. But if there were a sufficiently developed ontology for legal contracts, it would be possible to conceive of a world where a computer could understand what is meant by the terms ‘party’, ‘duly organised’, ‘validly existing’, ‘jurisdiction’ and ‘organisation and incorporation’, and could check automatically with relevant company registries whether this representation is correct at the time it is given.”40

41. It will be difficult and probably not advisable to strip a legal system of all ambiguity. The nuances of complex relationships are not always easily defined and flexibility in contracting provisions could help promote the healthy longevity of business/commercial relationships between parties.

37‘Smart Contracts and Distributed Ledger – A Legal Perspective’ by ISDA and Linklaters (2017), https://www.isda.org/a/6EKDE/smart-contracts-and-distributed-ledger-a-legal-perspective.pdf, p. 10-12

38Examples include: (i) a clause that requires an amount to be payable on a payment date equal to the product of a calculation amount, a floating rate (plus or minus a spread) and a day count fraction; (ii) a clause that requires an amount to be payable on an exercise date equal to the number of options exercised multiplied by a strike price differential; (iii) a clause that provides that one party to the contract pays the other an amount equal to the difference between the settlement price and a forward price, with the party required to make such payment being determined by whether the settlement price exceeds the forward price or vice versa; and (iv) a clause that requires a party to transfer assets on a particular date that have a value equal to the amount by which a required credit support amount is less than the value of collateral provided, subject to certain formulaic haircuts and adjustments.

39 Examples include: (i) a clause specifying what law should govern in the event of any dispute; (ii) a clause specifying what jurisdiction any disputes may be brought in; (iii) a clause providing that the written legal document represents the entire agreement between the parties; (iv) representation that a party’s obligations under the legal agreement constitute legal, valid and binding obligations; (v) clause that dictates that when making a decision or a determination, the person making the calculation shall do so in good faith and in a commercially reasonable manner; and (vi) a clause that provides that all transactions entered into under a master agreement form a single agreement between the parties.”

40 Ibid

42. Further, as stated in the ISDA and Linklaters article41, “even if the contract is self-executing in the sense that the pre-specified action happens automatically, it does not necessarily mean the relevant action will be legally final in all circumstances. For example, it may turn out that performance has become illegal, or that a payment can be set aside on insolvency grounds. It will not always be possible to make an automatic assessment as to whether an act was illegal or an entity was insolvent at the time of the relevant action. The applicable information might not yet be available or, more fundamentally, certain laws might have a retrospective effect. Admittedly, this is also the case with traditional contracts, but it is worth explicitly noting that smart legal contracts do not (and cannot) change this.” (emphasis added)

43. So, what then would contracts look like going forward with the blockchain technology? The authors of the ISDA and Linklaters article have set out a useful formulation of two different models of smart contracts going forward:

“External Model

In the external model, the legal contract would remain in its present form (ie, a natural human language document), but, external to the legal contract, certain conditional logic elements of the legal contract would be coded so the required actions happen automatically when the relevant conditions are satisfied.

The code would not be part of the legal contract; all it would do would be to provide a mechanism for the automatic performance of a contract written in a natural human language. If there were any difference between what happens when the code executes and what the legal contract requires, the legal contract would take precedence. In the external model, therefore, the code would not itself legally bind the parties and would not remove legal ambiguity. Accordingly, the parties would need to be comfortable that the code accurately reflects their obligations in the natural human language legal agreement.

In many respects, at least for lawyers, the external model is only a small step further than the operational mechanics’ derivatives counterparties already have in place. Indeed, there are areas where such automation already takes place – for example, daily collateral flows are already automated in the manner described above in certain margining arrangements. That is not to belie the potential impact widespread adoption of the external model might have operationally, but merely to note that it would likely be a fairly inconsequential step for lawyers.

In the external model, therefore, it is not the contract itself that is ‘smart’, but rather the code building blocks that would accompany it and would be used to execute it.

Internal Model

In the internal model, much of the legal contract would likely remain in its present form but, critically, with certain conditional logic elements of the legal contract rewritten in a more formal representation than the current natural human language form. A computer

41 Ibid

would then take that more formal representation and execute the conditional logic automatically.

The written contract would, as a result, look like a hotchpotch of approaches. Certain clauses would be drafted in natural human language, as is the case today. But other clauses would effectively be set down on the page in some form of code, or other formal representation. Alternatively, instead of setting down the code or formal representation within the written contract itself, the written contract could refer to an identified piece of code stored elsewhere and could state that such code is to be given legal effect between the parties.”

WILL SMART CONTRACTS REPLACE LAWYERS/JUDGES?

44. In realistically assessing the reach of blockchain technology in the future and its potential to replace lawyers/judges, one firstly must appreciate that areas of law such as crime, tort, family, medical law, human rights, conflicts of law, etc. are not governed by contracting principles and are not likely to fall into the ambit of smart contracts.

45. Even when it comes to civil law areas that are governed by contract principles, not all contracts could be rendered codeable, and even if they could, not all clauses in a particular contract could be made codeable, or that it would be desirable to do so (see Levy). Contracts are deeply social tools as well as legal ones. Smart contracts fail to take the social complexities that accompany contracting into account. In fact, they are not designed to do so and therein lies their limitation.

46. As stated succinctly by Werbach & Cornell, “[s]mart contracts are just one example of a larger trend of computerized technologies purporting to displace or replace human decision-making. In areas such as hiring, financial decisions, and copyright enforcement, algorithmic systems are touted for their speed, efficiency, and reliability, in contrast to mistake-prone and potentially biased humans. And indeed, the benefits are considerable. Yet it quickly becomes clear that the machines are prone to their own errors and biases. And the introduction of algorithmic systems creates challenges for legal and practical accountability. As a result, both legal scholars and computer scientists are developing techniques to promote fairness and transparency in these decisions. A similar dynamic can be expected for smart contracts.”42

47. Entire smart contracts are difficult to develop and therefore, what we are looking at in the foreseeable future is ordinary contracts with smart clauses for the codeable provisions, and micro-smart contracts for the digital economy and the Internet of Things.

48. The future of blockchain and smart contracts undoubtedly looks exciting, especially in light of current advances made in this area in countries like China, with Alibaba launching

42“Contracts Ex Machina” by Werbach & Cornell (Duke Law Journal, 2017), p. 381-382

a blockchain technology initiative to protect product authenticity and improve the integrity of its supply chain 43, and Tencent building its own blockchain platform44.

49. A smart contract today may not be too different from the technology which has been employed by banks for decades now to net off liabilities and to manage broker account reconciliation etc. Industry players are constantly on the lookout for greater operational efficiencies and it is undeniable that blockchain technology helps achieve that aim, especially in areas such as retail, banking, land leases, and administrative functions. Though currently blockchain and smart contracts are in their nascent stages, there is great potential for this technology to create positive waves and we should be carefully observing this promising space.

Disclaimer: The views and opinions expressed in this article are those of the author and do not necessarily reflect the official policy or position of the DIFC Dispute Resolution Authority or any of its affiliates. Assumptions made in the report are not reflective of the position of the DIFC Dispute Resolution Authority or any of its affiliates.

43 http://www.thedrum.com/news/2018/04/30/alibaba-launches-blockchain-technology-improve-supply-chain-integrityand-enhance

44 https://www.coindesk.com/internet-giant-tencent-blockchain-platform/