Smart contracts or Smart contracts on the blockchain, what is it and where are they used
A smart contract or Smart contract (Smart contact) is a digital algorithm designed to generate and provide data on ownership of certain objects, as well as to exercise control over this data. Most often, this refers to the use of blockchain technology. In a narrow sense, a smart contract is a collection of functions and information located at a specific address in the blockchain.
In other words, a smart contract is a self-enforcing agreement based on a transaction that is activated when a certain condition occurs. Anything can act as a condition - any event or other transaction.
A smart contract exists as a computer code. Its functioning and regulation is carried out by a computer network. It was designed to enable the exchange of funds, property or other valuables without intermediaries. The code initially contains all possible scenarios according to which further events can occur, therefore all transactions are carried out honestly and without deception. Thus, there is no need to contact third parties to secure or formalize a transaction, and also eliminates litigation in case of failure to comply with the terms of the agreement.
Smart contract history
For the first time, the idea of a smart contract was announced in 1994 by an American researcher in the field of computer science, cryptography and law, Nick Szabo. He described a smart contract in the form of a program code that independently implements and fully controls transactions based on mathematical algorithms.
After blockchain technology was developed in 2008, it became possible to put into practice the idea of Nick Szabo. A number of smart contract principles were used in the development of the Bitcoin protocol, but were not applied in practice for security reasons.
In 2013, Vitaly Buterin , a Russian-Canadian programmer and one of the founders of the Ethereum Internet platform, decided to write a new basic protocol for smart contracts, since, in his opinion, Bitcoin is not suitable for this.
In 2016, news appeared about the end of testing by large credit and financial structures from Wall Street of blockchain technology, which is used to carry out transactions after the conclusion of transactions to sell shares until the conditions for them are fulfilled. This technology, according to the developers, contributes to significant savings for financial companies that are parties to the agreement.
A number of major banks, including JP Morgan, Credit Suisse and Citibank, took part in testing the application of blockchain technology and smart contracts in post-trading operations .
Testing began in June 2016 and by the beginning of September more than a hundred operations had been performed.
Experts predict that the use of blockchain technology and smart contracts will open up the opportunity for banks to save about $ 16 billion on registration of agreements. At the same time, the requirements for the adequacy of their capital will decrease by $ 120 billion.
In 2018, Assistant to the President of the Russian Federation, Chairman of the Supervisory Board of ANO Digital Economy, Andrey Belousov, said that by the end of 2018 or at the beginning of 2019, the State Duma of the Russian Federation would consider a draft law on crowdfunding. According to experts, this law will allow introducing and developing a new mechanism for attracting investments in the Russian Federation - through crowdfunding platforms. Crowdfunding sites are online platforms for raising funds for the implementation of certain projects by attracting investments from external, often non-professional, investors. Legal regulation will ensure the safety of such transactions and facilitate their transparency.
Regarding the law on electronic notaries, it will significantly save time on certification of documentation and certification of agreements for participants in electronic office work. This will make it possible to use e-mails in the process of registration of agreements, instead of the traditional paper workflow.
After the legalization of smart contracts in the Russian Federation, it will be possible to make transactions, the implementation of the terms of which will be controlled by special software, which will allow many operations to be carried out automatically.
In May 2018, the Russian mobile operator MTS, the corporate investment project of Sberbank of Russia Sberbank CIB and the non-bank credit organization JSC National Settlement Depository jointly placed the first ruble bonds in Russia based on blockchain technology. The functioning of a security occurs in the form of a set of smart contracts - from placement to the final fulfillment of obligations by the issuer to the depositor. Sberbank CIB acted as the organizer of the issue and the main purchaser of MTS bonds.
What is the subject of a smart contract
The objects of a smart contract are:
- The parties to the agreement who give their consent or refuse the terms using a digital signature. The direct analogue is the signature of the sender of funds in the Bitcoin network , which certifies the record of the transaction in the blockchain.
- The subject of the agreement, in the form of which only the object located directly inside the functioning of the smart contract can act. A smart contract must have direct access to the subject of the agreement without any human involvement.
- The terms of the agreement, which are fully described mathematically and fit in the form of a program code into the operating environment of a smart contract. The conditions describe the complete algorithm for implementing the clauses of the subject of the agreement.
- Decentralized platform - required for recording and storing a smart contract in the blockchain of this platform.
The essence of the smart contract
As mentioned above, smart contracts operate on the basis of blockchain technology. They are a distributed ledger, which is a decentralized structure that exists within a single network of a large number of computers. Thanks to blockchain technology, users can conduct transactions, transfer data and material values without the help of financial institutions and other intermediaries.
By its very nature, a smart contract is a computer program written in the form of software code based on mathematical logic. Due to this, it is impossible to change the terms of the agreement by one of the parties after its conclusion. The computer code ensures the strict fulfillment of all the prescribed terms of the transaction.
In a simplified form, the work of a smart contract looks like this:
- asset coding is carried out;
- the coding of the terms of the agreement is carried out;
- conditions together with assets are recorded in the blockchain as part of a block;
- after the fulfillment of obligations by each party to the agreement, a smart contract is implemented;
- all transfers of encoded assets are made based on the terms of the agreement.
In other words, when a user intends to complete a transaction, it is sent to a peer-to-peer computer network. This network certifies the execution of the transaction and the status of the user who performs it. A transaction means a transfer of funds, data transfer, etc. After a transaction is verified, it is combined with other transactions and creates a new block of the electronic register. This block has a unique position in the blockchain and cannot be changed. After that, the transaction is considered complete.
Thus, the execution of the smart contract program code occurs when a transaction is carried out . The user can do this from a personal account or through another smart contract from which the notification came. The network where the code is located is not connected to the Internet. Access between smart contracts is also limited.
Smart contracts only respond to transactions. According to the creators of the Ethereum platform, the functioning of a smart contract can be compared to any vending machine, for the purchase of goods, through which it is enough to deposit money into it and receive the goods without the participation of third parties. The same is with smart contracts - the buyer receives the goods, and the seller receives money after the program makes sure that the obligations of both parties to the agreement are fulfilled.
Benefits of smart contracts
Smart contracts allow you to automate and improve the efficiency of any transactions that are carried out in a wide variety of areas of professional activity.
The use of smart contracts can help establish more trusting relationships between entrepreneurs and their clients, making any agreements as transparent and reliable as possible. The terms of the smart contract cannot be converted to your advantage after the agreement is concluded. These specific properties of smart contracts provide ample opportunities for their application in public administration or in the financial industry.
One of the main advantages of smart contracts is that they automate and regulate processes in a decentralized ledger. However, this property at the same time prevents their widespread approval. The thing is that the decentralization of the database practically excludes the preservation of data confidentiality. At the same time, smart contracts do not have a direct communication with the outside world, which is due to considerations of protecting information in the blockchain. This means that special subjects are needed to record information in the blockchain.
One of the ways to resolve this issue is blockchain oracles. Oracles generally rely on third-party channels of information that monitor events in the real world and transmit information to the blockchain. A smart contract included in this chain can make an optimal decision based on information that the network does not have access to. Despite the fact that blockchain technology is based on the principle of decentralization, it must be said that, as a rule, oracles are created by some centralized entity that has a reputation for being reliable.
The use of smart contracts in a wide variety of areas of life has many positive aspects. Among the main ones are the following:
- Independence. The use of a smart contract eliminates the need to contact third parties (brokers, notaries, intermediaries, lawyers) for assistance in conducting a transaction. The possibility of errors or malicious deviations in the process of fulfilling the obligations under the agreement is excluded, since everything is carried out automatically, and the implementation is controlled by a computer program.
- All generated documentation is stored in coded form in a single database, which excludes the possibility of their loss or modification. Changing the address of a publicly available smart contract cannot be changed either.
- In the course of applying smart contracts, cryptographic means and coding of Internet pages are used to ensure the security of information. Such protection has high reliability rates against hacking and theft of funds.
- The smart contract system uses backups. Multiple blockchain duplication occurs, eliminating problems associated with lost invoices or recorded contract terms.
- Speed. The use of a smart contract allows you to significantly save time, which under normal conditions is needed to collect and prepare the documentation required for a transaction.
- Saving financial resources that are required to pay for the participation of intermediaries, financial institutions and other persons in the implementation of the transaction. In addition, the parties to the agreement save on the fact that the exchange of assets occurs automatically as soon as the terms of the agreement are fulfilled, and does not require additional costs.
- The use of a smart contract, in addition to speed and cost savings, makes it possible to eliminate errors in the process of entering information, which may occur when filling out forms in manual mode.
Disadvantages (vulnerability) of smart smart contracts
At the present stage of their development, smart contracts still have a number of disadvantages. The process of collecting taxes from ongoing agreements is not well thought out; the algorithm for checking and correcting errors when writing program code needs to be improved.
It is not yet clear what can be done if the contract was created with errors. In normal cases, when using the traditional paper form of the transaction, its terms can be challenged in court. However, this mechanism does not work with blockchain technology, since a transaction executed through a smart contract will be executed or not executed only on the basis of the conditions that have already been entered and cannot be changed.
Some of the most obvious challenges that need to be addressed in order for smart contracts to gain widespread acceptance include:
- Uncertain legal status and legislative regulation. In transactions with smart contracts, cryptocurrencies are used, which are not yet recognized in the legislation of most states as a permitted means for performing financial transactions.
- When drawing up a smart contract, it is necessary to provide for all possible scenarios for the development of further events, which requires very careful and scrupulous work, in the process of which errors are inevitable.
- Lack of literacy of most people in the field of smart contracts.
In addition, it must be said that smart contracts created on one of the most popular platforms, Ethereum, for some reason have significant vulnerability to hacker attacks. Among these reasons are:
- Errors in the programming language:
- Smart contracts in Ethereum are developed in the Solidity language and are a collection of functions. At the same time, the bytecode of the Ethereum virtual machine cannot process functions, for this reason, all contracts are compiled before being sent to the blockchain. This means that one error in the contract code is enough for the entire contract to work incorrectly.
- Incorrect order of exceptions. An exception may be necessary for the implementation of a smart contract - the interruption of the functioning of its method. In the event that this happens during the execution of the call command, then the implementation of contracts will not stop until the gas runs out (the unit of calculation used to calculate and pay commission for a specific operation or transaction).
- Re-introduction of the same instructions may occur, which will result in a loop in the call to the call method, which will waste all the gas.
- Errors in the functioning of the virtual machine:
- A smart contract written in a block cannot be changed. This means that it is also impossible to correct a mistake, if such was made in the contract.
- In order to send ether (Ethereum value token), you need to specify the recipients address. This address is a sequence of 160 bits. In the event that the specified address is incorrect and does not relate to a specific contract or user, there will be a loss of air that cannot be restored.
- Blockchain errors
- Transactions that fall into the short branch chain are not executed. This leads to the fact that for some time the smart contract has an indefinite status, as a result of which one of the counterparties may think that the contract has been completed, even if it is not.
- In connection with the previous point, clarifying the status of the contract may take a certain amount of time, which negatively affects its security in relation to attacks.
Types of smart contracts
At the moment, there are three types of smart contracts:
- Fully automated - when writing the code of such a contract, all stages of its implementation are envisaged, which allows you to perform the entire process in automatic mode.
- Partially automated - the main part of the agreement is drawn up in traditional paper form, and individual components are spelled out in the blockchain system. As a rule, they automate the settlement part of the agreement.
- Duplicated - agreements that exist in paper form and are fully automated. This is due to the fact that the practice of using digital contracts based on blockchain technology has a rather short history and there is not enough experience in this area. The technology has yet to gain massive acceptance, so very complex smart contracts are not being applied at this time. The most commonly used smart contracts are partially automated.
Examples of smart contracts
For a better understanding of the essence of smart contracts, it is necessary to give an example of their use. The simplest example is multisignature. In the event that counterparties want to protect themselves when concluding a deal, they can freeze certain funds on the blockchain. In the future, to receive this money, it will be necessary to obtain the approval of most of the participants. For example, there is an investor who is going to place capital in the form of a cryptocurrency to participate in an ICO (ICO (Initial Coin Offering) is the issue of its own tokens by a project, with which it will be possible to carry out certain calculations in the future). This investor transfers funds to the project wallet. The smart contract allows you to ensure that if the project is not successful, the depositors funds will automatically return to him. In the event that the project is successful, its organizers will receive investment only after a set number of multisignature participants certify the transparency of the project and activate their keys.
Currently, there is a development project based on Ethereum for a decentralized network, similar to social networks, whose users will have full unlimited control over their account. This, for example, will allow you to generate your own advertising income.
In addition, smart contract technology allows the creation of an independent securities market that does not require a stock exchange or other intermediaries to function.
Creation (development) of Smart contracts
Most of the smart contracts these days are created on decentralized platforms such as Ethereum and the like. For most users, it is more convenient to resort to the services of companies that have been present in this market for many years and have a positive reputation than to delve into the intricacies of a technology they are unfamiliar with on their own.
Many companies are adopting the practice of using smart contracts, and blockchain technology is quickly adapting to the increasing demand. At the current stage of technology development, key positions in the development of smart contracts belong to the following platforms:
Ethereum is the leader in smart contract creation. The Ethereum virtual machine is a closed environment in which smart contracts are created. The Ethereum network infrastructure uses a cryptocurrency called ether to facilitate transactions. Platform users have two main types of accounts. The first is external. Its management is carried out by people. This account is necessary for storing ether, transferring it to other accounts, forming contracts and using options for already created contracts. The second record is the contract accounts, which are managed by the program code integrated into them. The user cannot make changes to the code, but the values written in the contract can be transformed by linked transactions. All changes made are registered in the blockchain. Each account has an available ether balance. Balance may change due to transactions.
In the process of implementing a contract, users spend ether in the form of gas - the cost of a transaction through which a smart contract is created or implemented. The amount of gas depends on the amount of work that the platform needs to carry out in order for the smart contract to be executed.
Ethereum is a robust platform that provides access to a huge number of smart contract options. At the same time, there is the possibility of developing a contract according to individual parameters. A number of companies in various fields are developing their own platforms for creating smart contracts based on Ethereum.
- NEO is an actively developing Chinese platform used to develop smart contracts similar to those being developed by Ethereum. At the same time, there is an opinion that NEO has better performance.
NEO, unlike Ethereum, supports many popular programming languages such as C #, VB.Net, F #, Java, Kotlin, and Python, and is working to provide support for many others. This allows developers of lower qualifications to work on this platform than on Ethereum.
Although NEO is still a fairly young platform, there are prerequisites that it will eventually take the first place in the development of smart contracts.
- EOS is a platform that is still under development. Its priority is to improve the functionality of smart contracts. It is assumed that C ++ will be the main language for developing smart contracts on this platform.
Contract options function in much the same way as in Ethereum, however there are a number of differences. In particular, EOS uses a Proof-of-Stake (PoS) consensus mechanism to manage transactions, while Ethereum uses a Proof-of-Work (PoW) mechanism.
When using Proof-of-Work, users must perform a number of actions to request a service, while Proof-of-Stake provides access to the service, provided that the user has a set amount of cryptocurrency.
One of the main advantages of Proof-of-Stake is that it eliminates transaction fees. In addition, the amount of storage and network bandwidth available for a particular user directly depends on the amount of cryptocurrency that he has.
Unlike Ethereum, EOS provides its users with the ability to make changes to the application without affecting other contracts.
Taking into account its many advantages, EOS could seriously compete with Ethereum in the future.
Applying smart contracts
In the modern world, the use of smart contracts has become quite widespread. At the same time, the prospects for their development are even larger. There are a number of areas in which the use of smart contracts has gained particular popularity. In addition, there are some areas where the implementation of this practice can bring many benefits. Among those it should be noted:
- The sphere of sale and lease of real estate.
One of the most problematic aspects of the real estate industry is the need for constant direct interaction between participants. Personal meetings are inevitable for examining real estate, negotiating the terms of an agreement and on other occasions.
Smart contracts can automate and streamline many processes, minimizing the need for face-to-face meetings and thus saving a lot of time. Through smart contracts, you can automate the processes of real estate search, rental management, and financial flows for companies providing services in this market.
A smart contract regarding the rental of real estate can be concluded without the participation of intermediaries and third parties and requires the participation of only two parties - the tenant and the landlord. The concluded contract is recorded in the blockchain and cannot be changed. Rent payments are automatically determined in the contract code, according to the prescribed conditions, which are discussed before the code is written to the blockchain. At the same time, the clauses of the contract may stipulate any conditions important for the parties, in addition to those indicated.
- Supply chain management.
Supply chain management is a professional field that provides storage and delivery of goods using any type of transport. The implementation of a full cycle of cargo delivery involves a huge number of transactions.
Most of the organizations involved in this area have their own tools for asset management. However, as a rule, they are quite expensive to maintain and involve many operations that require time and resources. The advantages of using smart contracts in the field of logistics provides a lot of advantages, such as:
- control of cargo in transit;
- low costs;
- process automation;
- transparency of the terms of the agreement;
- security against fraudulent activities;
- providing communication.
However, there are a number of factors that make it difficult to use smart contract technology throughout the industry. It is necessary to work on ensuring confidentiality and high-quality protection of information in the process of applying smart contracts, as well as to regulate these issues at the legislative level.
- Financial sector.
According to a number of experts, the widespread implementation of smart contracts is significantly hampered by the lack of intelligent interfaces between the blockchains in which they operate and the real world. Taking this into account, it should be said that the use of smart contracts in the banking sector can bring many benefits if banks find effective methods of negotiating smart contracts and agreements drawn up on paper.
The use of this technology will eliminate delays associated with the activities of centralized institutions and will enable smart contracts to automate the processes of making fixed payments from bank accounts, subject to the fulfillment of obligations by the parties to the agreement. Also, this technology can be used to ensure compliance with the requirements of regulatory authorities and send reports in an automatic mode.
The management bodies of the company can have access and receive information on all transactions carried out to conduct checks on compliance with all requirements. If properly organized, smart contract technology will create a reliable and secure platform for all participants in transactions.
Of course, there are a number of problematic aspects that hinder the implementation of the smart contract system in many financial structures.
Above all, it requires the creation of intelligent contractual clauses that can be used to ensure security. Security requirements are of great importance for the use of smart contracts in the financial sector, since every user of the network will have access to the records of the transactions performed.
- Application of smart contracts in public administration.
Smart contracts can optimize many government functions and tasks, such as managing agreements, verifying identity, and holding elections.
One example of the use of smart contracts in the public sphere can be their use in order to ensure the protection of the voting system from any external influence. For this, the expression of the will of citizens is registered in a decentralized database, for decryption of which computing equipment of exceptional power is required, which will protect the voting system from hacking.
In addition, the US government is actively exploring blockchain technologies that can be used to optimize the public procurement system.
Of course, the use of this technology requires complete security and data confidentiality.
Healthcare sector.
The healthcare sector is huge and takes up a huge share of the economy in many countries around the world. Given the large number of transactions that take place around the world, healthcare organizations exchange incredible amounts of information of a different nature, both public and highly confidential. Therefore, securing data storage is extremely important for healthcare organizations. In addition, the accuracy of registration is equally important, since an incorrect display of a diagnosis can lead to incorrect treatment, which will lead to unpredictable consequences.
Blockchain technology allows storing patient health information in perfect accuracy, encrypted and digitally signed. Patients can decide who is given access to their health information by giving the access key to the appropriate healthcare provider.
In addition, the use of blockchain technology reduces the risks of illegal actions and optimizes the process of interaction between patients with medical institutions, insurance organizations, etc.
The use of smart contracts in medicine will allow you to instantly transfer information about patients to insurance companies or another healthcare institution, as well as to process payments between transaction participants at a faster rate. The use of smart contracts makes it possible to automatically send such financial transfers.
Trade sphere.
First of all, I mean buying goods on the Internet. The modern worldwide network is replete with all kinds of trading platforms, online stores and auctions. The popularity of online trading is increasing every day. This type of commercial activity can significantly save time, physical strength, and sometimes financial resources. Most often, cash on delivery is used to pay for goods. In this regard, the buyer is forced to pay when paying for the purchase an amount that is slightly more than the declared price of the goods. The use of smart contracts will allow you to avoid unnecessary spending when making online purchases.
It looks like this. When purchasing a product, the required amount is transferred from the buyers account to the blockchain. There it is frozen and stored until the purchased goods are delivered to the buyer. After that, the funds are transferred from the blockchain to the sellers account.
In addition, any conditions and possible situations can be spelled out in a smart contract. This can be a condition for the return of the cost of the goods to the buyer in the event of a significant delay in the delivery of the goods, or the collection of funds from the buyer for late receipt of the goods at the delivery point.
Gambling and sports betting.
Smart contract technology can be used to provide betting on sports events. For example, a player places a bet on a certain outcome of a sports match. The bet amount and the amount of potential winnings are debited from the accounts and transferred to the blockchain, where they are stored until the end of the sports game. After completion, the entire amount, depending on the result, is transferred to the appropriate account of the winning party.
Such a scheme makes it possible to do without the services of intermediaries and provides security against possible fraudulent actions of bookmakers and other persons.
Property inheritance issues.
As a rule, lawyers deal with all issues of inheritance, drawing up a will and obtaining inheritance property. There is always a possibility that such a lawyer may not be completely conscientious and the inheritance will not be properly distributed.
The use of blockchain technology and a smart contract allows us to ensure that the inheritance process goes without violations and the will will be executed exactly as its creator wanted. Blockchain technology allows you to automatically check the database in which deceased people are registered, and in case of confirmation of the death of the testator, transfer the bequest property to the ownership of the heirs.
Securing Your Network
Cybersecurity has been one of the key challenges since the advent of the Internet. Taking into account that the amount of information stored on the network is constantly growing, high-quality data protection from malicious use is an urgent need.
Blockchain technology and smart contracts can be great help in solving this problem. First of all, their use allows you to ensure reliable protection of transmitted information from any influence, interception, transformation or destruction.
In addition, cloud storage technology can be improved through smart contracts. The use of blockchain technology will significantly reduce storage maintenance costs and significantly increase the level of data protection.
Protection of intellectual property rights
The use of smart contract technology in the process of registration of copyrights or registration of patents for inventions minimizes the possibility of their violation or falsification of documents certifying the rights of the author or patent owner.
The future of Smart Contract
Smart contract technology provides incredible opportunities that can radically change the way of life of humanity and the structure of the surrounding world. Most importantly, this technology is applicable in almost any area of human life. The versatility and enormous development prospects force both individual individuals and entire states and large corporations to pay close attention to the technology of smart contracts.
However, at the present stage of development, the technology requires significant improvement. In particular, this concerns its safety, as well as reducing the level of complexity so that it does not require special knowledge in the field of computer programming to use it. In addition, there is a need for high-quality legislative regulation of blockchain-based transactions.
Universal acceptance of smart contracts requires increased trust from potential users, which can be earned by ensuring strong protection of personal data and assets. With this in mind, the issue of coordination between smart contracts and traditional, paper-based legal agreements remains an important issue.
Developers of smart contracts should make efforts to ensure not only their security, but also flexibility, as inevitably there will be a need to achieve compliance with requirements and laws that are constantly changing and supplemented. At the same time, blockchain technology should provide its users with a reasonable degree of privacy protection, since the transfer of too large amounts of data may entail a threat to the security of specific transactions.