Lecture
Smart contract (Smart contract) — a computer algorithm designed to form, control, and provide information about the ownership of something. Most often this refers to the use of blockchain technology. In a narrower sense, a smart contract is understood as a set of functions and data (current state) located at a specific address on the blockchain .
A smart contract is a computer program or transaction protocol intended to automatically execute, control, or document legally significant events and actions in accordance with the terms of a contract or agreement. The goals of smart contracts are to reduce the need for trusted intermediaries, arbitration proceedings and enforcement costs, losses from fraud, and to reduce the number of malicious and accidental exceptions.
Smart contracts — are computer programs that formulate the rules for making entries, i.e. «transactions», in the blockchain.
The first country to legislatively establish smart contracts was Belarus.
https://etherscan.io/address/0xB8c77482e45F1F44dE1745F52C74426C631bDD52#code
The parties sign a smart contract using methods similar to signing the sending of funds in existing cryptocurrency networks. After the parties sign, the contract is stored on the blockchain and comes into effect. To ensure automated execution of the contract's obligations, an execution environment is necessarily required (nodes of the Ethereum blockchain), which allows the contract's clauses to be executed fully automatically. This means that smart contracts can exist only within an environment that provides unimpeded access of executable code to the smart contract's objects.
All the terms of the contract must have a programmatic description and clear execution logic. In this regard, the first smart contracts have the task of formalizing the simplest relationships, consisting of a small number of conditions. Having unimpeded access to the contract's objects, a smart contract tracks the achievement or violation of clauses according to the specified conditions and makes independent decisions based on the programmed conditions. Thus, the basic principle of a smart contract consists in the full automation and reliability of the execution of contractual relations.
The first ideas for smart contracts were proposed by Nick Szabo . Practical implementations became possible thanks to the appearance of blockchain technology in 2008 . Some principles of smart contracts were already laid down in the very first Bitcoin protocol; however, they were not implemented in client software, did not have Turing completeness for security reasons, and were not widely used in practice. With the advent of the technology, ideas began to be expressed that various higher-level protocols, including full-fledged smart contracts , could be built on top of the Bitcoin protocol, by analogy with how numerous application-layer protocols exist on top of TCP/IP.
Smart contracts first gained widespread use with the appearance of Ethereum. The idea for the project arose in 2013. At that moment, Bitcoin Magazine founder Vitalik Buterin came to the conclusion that blockchain technology could be used much more broadly, not only in cryptocurrencies. He put forward the idea of a universal decentralized blockchain platform in which anyone could programmatically implement various systems for storing and processing information. The main condition — actions must be described as mathematical rules .
Similar to the transfer of value on the blockchain, the deployment of a smart contract on the blockchain occurs by sending a transaction from a wallet to the blockchain. The transaction includes the compiled code for the smart contract, as well as a special recipient address. This transaction must then be included in a block, which is added to the blockchain, after which the smart contract's code will execute to establish the smart contract's initial state. [32] Byzantine fault-tolerant algorithms protect the smart contract from hacking attempts in a decentralized manner. Once a smart contract has been deployed, it cannot be updated. Smart contracts on the blockchain can store arbitrary state and perform arbitrary computations. End clients interact with a smart contract through transactions. Such transactions with a smart contract can invoke other smart contracts. These transactions can result in a change of state and the sending of coins from one smart contract to another, or from one account to another.
The most popular blockchain for running smart contracts is Ethereum. On Ethereum, smart contracts are typically written in a Turing-complete programming language called Solidity, and are compiled into low-level bytecode that is executed by the Ethereum virtual machine. [36] Because of the halting problem and other security issues, Turing completeness is considered a risk, and languages such as Vyper deliberately avoid it. Some of the other smart-contract programming languages that lack Turing completeness are Simplicity, Scilla, Ivy, and Bitcoin Script. [38] However, measurements using regular expressions showed that only % of
Ethereum smart contracts included recursion and loops — constructs associated with the halting problem.
Several languages are designed to enable formal verification: Bamboo, IELE, Simplicity, Michelson (can be verified using Coq), Liquidity (compiles to Michelson), Scilla, DAML, and Pact.
| Name | Description |
|---|---|
| Bitcoin | Provides a non-Turing-complete scripting language that allows custom smart contracts to be created on top of Bitcoin, such as multi-signature accounts, payment channels, escrow, timelocks, atomic cross-chain trading, oracles, or an operator-free multiparty lottery. |
| Cardano | A blockchain platform for smart contracts using proof of stake |
| Codius | Open-sourced by Ripple in 2014, but shelved in 2015 |
| Ethereum | Implements a Turing-complete language on its blockchain, a well-known smart contract framework |
| EOS.IO | A blockchain platform for smart contracts |
| Tezos | A blockchain platform that changes its own rule set with minimal disruption to the network's operation through an on-chain governance model. |
Processes in a blockchain are, as a rule, deterministic in order to ensure Byzantine fault tolerance. Nevertheless, the use of smart contracts in the real world, for example lotteries and casinos, requires secure randomness. [44] In fact, blockchain technology reduces the cost of running a lottery and is therefore advantageous for participants. Randomness in a blockchain can be implemented using block hashes or timestamps, oracles, commitment schemes, special smart contracts such as RANDAO and Quanta, and sequences derived from mixed-strategy Nash equilibria.
In 1998 Szabo proposed that the infrastructure for smart contracts could be implemented by replicating asset registries and executing contracts using cryptographic hash chains and Byzantine fault-tolerant replication. [47] Askemos implemented this approach in 2002, using Scheme (later adding SQLite) as the contract scripting language.
One proposal for using bitcoins to register replicated assets and execute contracts is called "colored coins." Replication of ownership rights to potentially arbitrary forms of property, together with replication of contract execution, has been implemented in various projects.
In 2015, UBS experimented with "smart" bonds that use the Bitcoin blockchain [54], in which payment streams could hypothetically be fully automated, creating a self-paying instrument.
A blockchain-based smart contract is visible to all users of the blockchain in question. However, this leads to a situation in which errors, including security holes, are visible to everyone but cannot be quickly fixed. Such an attack, difficult to fix quickly, was successfully carried out against The DAO in June 2016, draining approximately US $50 million worth of Ether at the time, while the developers tried to arrive at a solution that would achieve consensus. The DAO program had a time delay before the hacker could withdraw the funds; a hard fork of the Ethereum software was carried out to take the funds back from the attacker before the deadline expired. [58] Other high-profile attacks include attacks on the Parity multi-signature wallet and the integer overflow/underflow attack (2018), totaling more than $184 million.
Problems in Ethereum smart contracts, in particular, include ambiguity and simple but insecure constructs in the Solidity contract language, compiler bugs, bugs in the Ethereum virtual machine, attacks on the blockchain network, the immutability of bugs, and the lack of documentation from a central source of known vulnerabilities, attacks, and problematic constructs. [
Smart legal contracts differ from smart contracts. As mentioned above, a smart contract does not necessarily have legal force 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. Consequently, although every smart legal contract will contain some elements of a smart contract, not every smart contract will be a smart legal contract.
There is no formal definition of a smart legal contract in the legal industry.
A Ricardian contract is a type of smart legal contract.
In order for smart contracts to exist, certain conditions are required:
The first large and promising area of blockchain development is the financial one. This includes cryptocurrency, smart contracts, and state registries. For example, right now, selling a house takes several weeks, whereas it could take just 3 minutes.
— Vitalik Buterin, Moscow, August 30, 2017[15]
Proponents of smart contracts argue[ that many types of them can be made partially or fully self-executing and self-sufficient. Smart contracts based on cryptography are capable of providing better security than traditional contracts based on law, and of reducing other transaction costs associated with concluding agreements and possible litigation costs.
According to the British magazine The Economist, smart contracts have the prospect of becoming the most important application of blockchain technology[12].
Smart contracts can acquire legal significance if they comply with the laws of a given state. For this, it is necessary that smart contracts contain the conditions and restrictions established by the state's legislation[16].
Belarus became the first country in the world to legislatively establish smart contracts on December 21, 2017, under the Decree on the Development of the Digital Economy. [17]The developer of the legal concept of the smart contract was the Belarusian lawyer Denis Aleinikov. The country plans to allow banks to conclude smart contracts.
Observers express concern that the spread of automated contract-maintenance technologies could lead to the weakening of existing social institutions that humanity has built over many generations. In addition, such technologies could lead to the disappearance of a large number of administrative jobs, just as robotization led to the disappearance of jobs in industry[12]. This applies, in particular, to notaries, bank employees, and clerks dealing with the registration of real estate transactions.
Negligence on the part of developers can lead to malicious use of smart contracts, as shown by the story of the leak of more than three million Ether coins from The DAO project[23].
Comments