Contractual transaction on a decentralized platform
This article is about contractual transactions on a decentralized platform. For smart legal contracts, seeSmart legal contract.
Asmart contract is acomputer program or atransaction protocol that is intended to automatically execute, control or document events and actions according to the terms of acontract or an agreement.[1][2][3][4] The objectives of smart contracts are the reduction of need for trusted intermediators, arbitration costs, and fraud losses, as well as the reduction of malicious and accidental exceptions.[5][2] Smart contracts are commonly associated withcryptocurrencies, and the smart contracts introduced byEthereum are generally considered a fundamental building block fordecentralized finance (DeFi) andnon-fungible token (NFT) applications.[6]
A smart contract should not be confused with asmart legal contract, which is a traditional, natural-language, legally binding agreement that has selected terms expressed and implemented in machine-readable code.[9][10][11]
Etymology
By 1996,Nick Szabo was using the term "smart contract" to refer to contracts which would be enforced by physical property (such as hardware or software) instead of by law. Szabo describedvending machines as an example of this concept.[12][13] In 1998, the term was used to describe objects inrights management service layer of the systemThe Stanford Infobus, which was a part ofStanford Digital Library Project.[1]
Asmart contract does not typically constitute a valid binding agreement at law.[14] Proposals exist to regulate smart contracts.[9][10][11]
Smart contracts are not legal agreements, but instead transactions which are executed automatically by acomputer program or atransaction protocol,[14] such as technological means for the automation of payment obligations[15] such as by transferring cryptocurrencies or other tokens. Some scholars have argued that the imperative or declarative nature of programming languages would impact the legal validity of smart contracts.[16]
In some jurisdictions, legal scholars have examined how the rigidity of smart contracts interacts with traditional doctrines such as contractual unforeseeability. For instance, Colombian legal scholarship has proposed adapting the theory of supervening onerousness (teoría de la imprevisión) to account for the high economic and systemic costs of reversing smart contract effects through judicial intervention, emphasizing the need to internalize these costs and develop new procedural mechanisms for digital environments.[17]
Since the 2015 launch of theEthereumblockchain, the term "smart contract" has been applied to general purpose computation that takes place on a blockchain. The US National Institute of Standards and Technology describes a "smart contract" as a "collection of code and data (sometimes referred to as functions and state) that is deployed using cryptographically signed transactions on the blockchain network".[18] In this interpretation a smart contract is any kind of computer program which uses a blockchain. A smart contract also can be regarded as a securedstored procedure, as its execution and codified effects (like the transfer of tokens between parties) cannot be manipulated without modifying the blockchain itself. In this interpretation, the execution of contracts is controlled and audited by the platform, not by arbitrary server-side programs connecting to the platform.[19][20]
In 2018, aUS Senate report said: "While smart contracts might sound new, the concept is rooted in basic contract law. Usually, the judicial system adjudicates contractual disputes and enforces terms, but it is also common to have another arbitration method, especially for international transactions. With smart contracts, a program enforces the contract built into the code."[21] States in the US which have passed legislation on the use of smart contracts include Arizona,[22] Iowa,[23] Nevada,[24] Tennessee,[25] and Wyoming.[26]
In April 2021, the UK Jurisdiction Taskforce (UKJT) published the Digital Dispute Resolution Rules (the Digital DR Rules), which were intended to enable the rapid resolution of blockchain and crypto legal disputes in Britain.[27]
In 2021, the Law Commission of England and Wales advised that smart legal contracts are capable of being recognized and enforced under existing English law.[1]
Workings
Similar to a transfer of value on a blockchain, deployment of a smart contract on a blockchain occurs by sending a transaction from awallet for the blockchain.[28] The transaction includes the compiled code for the smart contract as well as a special receiver address.[28] That transaction must then be included in a block that is added to the blockchain, at which point the smart contract's code will execute to establish the initial state of the smart contract.[28]Byzantine fault-tolerant algorithms secure the smart contract in a decentralized way from attempts to tamper with it. Once a smart contract is deployed, it cannot be updated.[29] Smart contracts on a blockchain can store arbitrary state and execute arbitrary computations. End clients interact with a smart contract through transactions. Such transactions with a smart contract can invoke other smart contracts. These transactions might result in changing the state and sending coins from one smart contract to another or from one account to another.[29]
The most popular blockchain for running smart contracts isEthereum.[30] On Ethereum,smart contracts are typically written in aTuring-complete programming language calledSolidity,[31] and compiled into low-levelbytecode to be executed by theEthereum Virtual Machine.[32] Due to thehalting problem and other security problems, Turing-completeness is considered to be a risk and is deliberately avoided by languages likeVyper.[33][34] Some of the other smart contract programming languages missing Turing-completeness are Simplicity, Scilla, Ivy and Bitcoin Script.[34] Some newer platforms have explored "asset-oriented" domain-specific languages (such as Scrypto) that treat digital assets as native data types within the language environment to enforce finiteness and safety rules at the compiler level.[35] However, measurements in 2020 usingregular expressions showed that only 35.3% of 53,757 Ethereum smart contracts at that time included recursions and loops — constructs connected to the halting problem.[36]
Several languages are designed to enableformal verification: Bamboo, IELE, Simplicity, Michelson (can be verified withRocq),[34] Liquidity (compiles to Michelson), Scilla, DAML and Pact.[33]
Notable examples of blockchain platforms supporting smart contracts include the following:
Provides a Turing-incomplete script language that allows the creation of custom smart contracts on top of Bitcoin likemultisignature accounts, payment channels, escrows, time locks, atomic cross-chain trading,oracles, or multi-party lottery with no operator.[38]
Processes on a blockchain are generally deterministic in order to ensureByzantine fault tolerance.[44] Nevertheless, real world application of smart contracts, such aslotteries andcasinos, require secure randomness.[45] In fact, blockchain technology reduces the costs for conducting of a lottery and is therefore beneficial for the participants. Randomness on blockchain can be implemented by using block hashes or timestamps, oracles, commitment schemes, special smart contracts like RANDAO[46][47] and Quanta, as well as sequences frommixed strategyNash equilibria.[44]
One proposal for using Bitcoin for replicated asset registration and contract execution is called "colored coins".[54] Replicated titles for potentially arbitrary forms of property, along with replicated contract execution, are implemented in different projects.
As of 2015[update],UBS was experimenting with "smart bonds" that use thebitcoinblockchain[55] in which payment streams could hypothetically be fully automated, creating a self-paying instrument.[56]
Seth Oranburg and Liya Palagashvili argue that smart contracts could also be used inemployment contracts, especially temporary employment contracts, which according to them would benefit the employer.[66][67]
Security issues
The transactions data from a blockchain-based smart contract is visible to all users in the blockchain. The data provides cryptographic view of the transactions, however, this leads to a situation where bugs, including security holes, are visible to all yet may not be quickly fixed.[68] Such an attack, difficult to fix quickly, was successfully executed onThe DAO in June 2016, draining approximatelyUS$50million worth ofEther at the time, while developers attempted to come to a solution that would gain consensus.[69] The DAO program had a time delay in place before the hacker could remove the funds; a hard fork of the Ethereum software was done to claw back the funds from the attacker before the time limit expired.[70] Other high-profile attacks include theParity multisignature wallet attacks, and an integer underflow/overflow attack (2018), totaling overUS$184million.[71]
Issues in Ethereum smart contracts, in particular, include ambiguities and easy-but-insecure constructs in its contract language Solidity, compiler bugs, Ethereum Virtual Machine bugs, attacks on the blockchain network, the immutability of bugs and that there is no central source documenting known vulnerabilities, attacks and problematic constructs.[37]
Difference from smart legal contracts
Smart legal contracts are distinct from smart contracts. As mentioned above, a smart contract is not necessarily legally enforceable as a contract. On the other hand, a smart legal contract has all the elements of a legally enforceable contract in the jurisdiction in which it can be enforced and it can be enforced by a court or tribunal. Therefore, while every smart legal contract will contain some elements of a smart contract, not every smart contract will be a smart legal contract.[72]
There is no formal definition of a smart legal contract in the legal industry.[73]
^abRöscheisen, Martin; Baldonado, Michelle; Chang, Kevin; Gravano, Luis; Ketchpel, Steven; Paepcke, Andreas (1998). "The Stanford InfoBus and its service layers: Augmenting the internet with higher-level information management protocols".Digital Libraries in Computer Science: The MeDoc Approach. Lecture Notes in Computer Science. Vol. 1392. Springer. pp. 213–230.doi:10.1007/bfb0052526.ISBN978-3-540-64493-4.
^Savelyev, Alexander (14 December 2016). "Contract Law 2.0: "Smart" Contracts As the Beginning of the End of Classic Contract Law".SSRN2885241.
^Tapscott, Don; Tapscott, Alex (May 2016).The Blockchain Revolution: How the Technology Behind Bitcoin is Changing Money, Business, and the World. Portfolio/Penguin. pp. 72, 83, 101, 127.ISBN978-0670069972.
^D J Yaga et al., Blockchain Technology Overview, National Institute of Standards and Technology Internal/Interagency Report 8202, 2018, p 54, cited in Mik, Eliza, Smart Contracts: A Requiem (December 7, 2019). Journal of Contract Law (2019) Volume 36 Part 1 at p 71
^Vo, Hoang Tam; Kundu, Ashish; Mohania, Mukesh (2018)."Research Directions in Blockchain Data Management and Analytics"(PDF).Advances in Database Technology - Extending Database Technology.21. OpenProceedings: 446.Archived(PDF) from the original on 2019-10-02. Retrieved2019-10-02.Some distributed ledger technologies support an additional capability called a smart contract, which is similar to the concept of stored procedure in classical relational databases to some extent. Smart contracts allow the shared business processes within a business network to be standardised, automated and enforced via computer programs to increase the integrity of the ledger.
^Huckle, Steve; Bhattacharya, Rituparna; White, Martin; Beloff, Natalia (2016)."Internet of Things, Blockchain and Shared Economy Applications".Procedia Computer Science.98. Elsevier B.V.: 463.doi:10.1016/j.procs.2016.09.074.Firstly, that total quantity of BTC in a transaction's inputs must cover the total number of BTC in the outputs. That rule behaves similarly to a database stored procedure, except that it is impossible to circumvent. Secondly, BTC transactions use public-private key cryptography. That makes BTC act like a database with a publicly auditable per-row permission scheme.
^Wohrer, Maximilian; Zdun, Uwe (20 March 2018). "Smart contracts: Security patterns in the ethereum ecosystem and solidity".2018 International Workshop on Blockchain Oriented Software Engineering (IWBOSE). pp. 2–8.doi:10.1109/IWBOSE.2018.8327565.ISBN978-1-5386-5986-1.S2CID4567923.
^Perez, Daniel; Livshits, Benjamin (17 October 2020). "Smart Contract Vulnerabilities: Vulnerable Does Not Imply Exploited".arXiv:1902.06710 [cs.CR].
^abHarz, Dominik; Knottenbelt, William (31 October 2018). "Towards Safer Smart Contracts: A Survey of Languages and Verification Methods".arXiv:1809.09805 [cs.CR].
^Jansen, Marc; Hdhili, Farouk; Gouiaa, Ramy; Qasem, Ziyaad (2020). "Do Smart Contract Languages Need to be Turing Complete?".Blockchain and Applications. Advances in Intelligent Systems and Computing. Vol. 1010. Springer International Publishing. pp. 19–26.doi:10.1007/978-3-030-23813-1_3.ISBN978-3-030-23812-4.S2CID195656195.
^abAtzei, Nicola; Bartoletti, Massimo; Cimoli, Tiziana (2017),"A survey of attacks on Ethereum smart contracts"(PDF),6th International Conference on Principles of Security and Trust (POST), European Joint Conferences on Theory and Practice of Software,archived(PDF) from the original on 2017-07-10, retrieved2017-06-20
^Atzei, Nicola; Bartoletti, Massimo; Cimoli, Tiziana; Lande, Stefano; Zunino, Roberto (2018),"SoK: unraveling Bitcoin smart contracts"(PDF),7th International Conference on Principles of Security and Trust (POST), European Joint Conferences on Theory and Practice of Software,archived(PDF) from the original on 2018-02-23, retrieved2018-02-22
^Hasan, Md; Mbah, Joseph (2024), "A Comprehensive Analysis of Blockchain Technology and Consensus Protocols Across Multilayered Framework",IEEE Access,12:10555–10582,doi:10.1109/ACCESS.2024.3352723 (inactive 21 January 2026){{citation}}: CS1 maint: DOI inactive as of January 2026 (link)
^Hafid, Laila; Hafid, Abdelillah (2022), "Formal verification of Tezos smart contracts in Coq",Journal of Ambient Intelligence and Humanized Computing,13 (12):6003–6021,doi:10.1007/s12652-021-03487-y (inactive 21 January 2026){{citation}}: CS1 maint: DOI inactive as of January 2026 (link)
^abChatterjee, Krishnendu; Goharshady, Amir Kafshdar; Pourdamghani, Arash (21 February 2019). "Probabilistic Smart Contracts: Secure Randomness on the Blockchain".arXiv:1902.07986 [cs.GT].
^Jia, Zhifeng; Chen, Rui; Li, Jie (2019). "DeLottery: A Novel Decentralized Lottery System Based on Blockchain Technology".Proceedings of the 2019 2nd International Conference on Blockchain Technology and Applications. pp. 20–25.doi:10.1145/3376044.3376049.ISBN9781450377430.S2CID207880557.
^"randao/randao". randao. 10 July 2020.Archived from the original on 10 August 2020. Retrieved10 July 2020.
^Jörg F. Wittenberger (2002).Askemos a distributed settlement. Proceedings of International Conference on Advances in Infrastructure for e-Business, e-Education, e-Science, and e-Medicine on the Internet (SSGRR), L’Aquila.Archived from the original on 2018-07-01. Retrieved2017-05-25.
^Oranburg, Seth; Palagashvili, Liya (22 October 2018). "The Gig Economy, Smart Contracts, and Disruption of Traditional Work Arrangements".SSRN3270867.
^Pinna, Andrea; Ibba, Simona (2019). "A blockchain-based decentralized system for proper handling of temporary employment contracts". In Kohei Arai; Supriya Kapoor; Rahul Bhatia (eds.).Intelligent Computing: Proceedings of the 2018 Computing Conference, Volume 2. Advances in Intelligent Systems and Computing. Vol. 857. pp. 1231–1243.arXiv:1711.09758.doi:10.1007/978-3-030-01177-2_88.ISBN978-3-030-01176-5.