Chapter 6: Smart contract
The term "smart contract" refers to a computer program or a transaction protocol that is designed to automatically execute, control, or document events and acts in accordance with the conditions of a contract or an agreement. A reduction in the need for trusted intermediaries, costs associated with arbitration, and losses incurred due to fraud are some of the goals of smart contracts. Additionally, smart contracts aim to reduce the number of exceptions that are both intentional and inadvertent. There is a widespread association between smart contracts and cryptocurrencies. The smart contracts that were introduced by Ethereum are usually believed to be an essential building block for applications that involve decentralized finance (DeFi) and non-fungible tokens (NFT).
The Bitcoin protocol is described as a poor form of the smart contract concept as it was initially defined by Nick Szabo in the Ethereum white paper that was written by Vitalik Buterin in 2014. However, Buterin presented a stronger version of the smart contract concept that was built on the Solidity language, which is designed to be Turing complete. Since then, a number of different cryptocurrencies have begun to enable programming languages that make it possible for more sophisticated smart contracts to be created between parties that cannot be trusted.
A smart contract should not be confused with a smart legal contract, which is a traditional, legally enforceable agreement that is written in natural language and has selected terms that are stated and implemented in code that is readable by machines.
Nick Szabo began using the term "smart contract" in 1996 to refer to contracts that would be enforced by physical property (such as hardware or software) rather than by the law. As of that year, the term has become widely used. A good illustration of this idea was provided by Szabo in the form of vending machines. The word was first used in 1998 to refer to objects that were located in the rights management service layer of the system known as The Stanford Infobus, which was a component of the Stanford Digital Library Project as well.
In most cases, a smart contract does not establish a legally enforceable agreement that is acceptable under the law. There have been suggestions made to govern smart contracts.
Rather than being legal agreements, smart contracts are transactions that are carried out automatically by a computer program or a transaction protocol. This includes technological means for the automation of payment responsibilities, such as the transfer of cryptocurrencies or other tokens. Smart contracts are not legally binding. It has been proposed by a few academics that the imperative or declarative nature of programming languages might have an effect on the legal legitimacy of smart contracts.
Since the debut of the Ethereum blockchain in 2015, the phrase "smart contract" has been used to refer to computations that are performed on a blockchain for general purposes. According to the National Institute of Standards and Technology in the United States, a "smart contract" is defined 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." The term "smart contract" refers to any type of computer program that makes use of a blockchain, according to this view. Because its execution and defined effects (such as the transfer of tokens between parties) cannot be manipulated without amending the blockchain itself, a smart contract can also be considered a secured stored procedure. This is because their execution and effects cannot be altered. According to this understanding, the platform itself is responsible for controlling and auditing the execution of contracts; random server-side programs that connect to the platform are not responsible for this.
"While smart contracts might sound new, the concept is rooted in basic contract law," stated a report that was published by the United States Senate in the year 2018. It is usual practice to have another arbitration option, particularly for foreign transactions, in addition to the legal system, which is often responsible for adjudicating commercial disputes and enforcing conditions. When using smart contracts, a program is responsible for enforcing the contract contained within the code. In the United States of America, the states of Arizona, Iowa, Nevada, Tennessee, and Wyoming are among those that have enacted legislation regarding the utilization of smart contracts.
According to the United Kingdom Jurisdiction Taskforce (UKJT), the Digital Dispute Resolution Rules (also known as the Digital DR Rules) were issued in April 2021. The purpose of these rules was to facilitate the speedy resolution of blockchain and cryptocurrency legal issues in the United Kingdom.
A smart contract can be deployed on a blockchain in a manner that is analogous to the transfer of value on a blockchain. This is accomplished by sending a transaction from a wallet that is associated with the blockchain. In addition to a unique receiver address, the transaction contains the code that has been compiled for the smart contract. Following this, the transaction in question must be incorporated into a block that is put to the blockchain. At this point, the code of the smart contract will be executed in order to establish the initial state of the smart contract. Smart contracts are protected from any efforts to manipulate them in a decentralized manner using fault-tolerant algorithms that are based on the Byzantine algorithm. There is no way to make changes to a smart contract after it has been deployed. Smart contracts that are stored on a blockchain have the ability to run any calculations and store arbitrary states. Through the use of transactions, end clients engage in interaction with a smart contract. Similar transactions using a smart contract have the potential to invoke further smart contracts. The state of the smart contract might be altered as a result of these transactions, and coins could be transferred from one smart contract to another or from one account to another.
The Ethereum blockchain is the most widely used blockchain for the operation of smart contracts. On Ethereum, smart contracts are often written in a programming language known as Solidity, which is a Turing-complete language. These contracts are then compiled into low-level bytecode, which enable the Ethereum Virtual Machine to carry out its purposes. Turing-completeness is a risk that is intentionally avoided by languages such as Vyper since it is believed to be a risk due to the halting problem as well as other security considerations. Simplicity, Scilla, Ivy, and Bitcoin Script are a few examples of additional programming languages for smart contracts that do not possess Turing-completeness. Recursions and loops are structures that are tied to the halting problem. However, measurements taken in the year 2020 using regular expressions revealed that only 35.3% of the 53,757 Ethereum smart contracts that were in existence at that time featured these constructs.
Bamboo, IELE, Simplicity, Michelson (which can be proved using Coq), Liquidity (which compiles to Michelson), Scilla, DAML, and Pact are some of the languages that have been intended to support formal verification.
In order to fulfill the requirements of Byzantine fault tolerance, the processes that run on a blockchain are often deterministic. On the other hand, the implementation of smart contracts in the real world, such as casinos and lotteries, necessitates the application of secure randomness. In point of fact, blockchain technology minimizes the expenses associated with the operation of a lottery, which is advantageous for the individuals who take part in the lottery. The implementation of randomness on blockchain can be accomplished by the utilization of block hashes or timestamps, oracles, commitment schemes, special smart contracts such as RANDAO and Quanta, and sequences derived from mixed strategy Nash equilibria.
Using cryptographic hash chains and Byzantine fault-tolerant replication, Szabo postulated in 1998 that smart contract infrastructure might be achieved through replicated asset registries and contract execution. This strategy would allow for the execution of contracts. In 2002, Askemos carried out the implementation of this strategy by employing Scheme as the contract script language, with SQLite being added subsequently.
The term "colored coins" refers to a plan that includes the utilization of Bitcoin for the purpose of replicating asset registration and contract execution. The implementation of duplicated titles for potentially arbitrary types of property, in addition to replicated contract execution, appears in a variety of projects.
UBS was conducting experiments with "smart bonds" in the year 2015, which are based on the blockchain technology of bitcoin. These bonds have the potential to fully automate payment streams, so establishing a self-paying instrument on the blockchain.
Through the utilization of smart contracts, it is conceivable that the wishes regarding inheritance could be automatically carried out subsequent to the registration of a death certificate. Additionally, birth certificates are able to include smart contracts into their use.
Moreover, Chris Snook of Inc.com indicates that smart contracts might be utilized in the field of title records and in the public register. Additionally, smart contracts could be utilized to handle transactions involving...