What is a smart contract
Blockchain technology, which we first learned about in connection with bitcoin, has changed significantly since its inception. But what makes blockchain so valuable for various commercial enterprises, the technical community, and even the average consumer?
Some may argue that the blockchain is notable for its applications that implement the recording of various data and events. Others believe that the greatest value of a blockchain is in its ability to process transactions. All these functions of the blockchain, like many others, can be combined to create an extremely useful application – smart contracts.
Smart contracts have been designed to securely and transparently exchange assets without the need for an intermediary. Smart contacts (sometimes called crypto contracts) are programs that are written specifically for the automated management of asset transfers between two or more parties as soon as certain conditions are met. Nick Szabo first formulated this concept in 1994, almost two decades before the technology was implemented.
Now for a deeper definition: the term “smart contract” is often used by crypto enthusiasts to describe several different concepts. Most noteworthy are concepts such as a smart contract code and a smart legal contract.
Smart Contract Code
At first, platforms using this technology were designed primarily to simplify cryptocurrency transactions. A smart contract code is, in fact, any code on the blockchain that can manage assets (cryptocurrency) within one blockchain. To be considered a smart contract, the code must be executed automatically, be traceable, unchanged and irreversible.
Below are examples of two smart contract code usage scenarios.
Jill rents an apartment with Jack through a blockchain-based rental platform. A smart contract can be used to automatically transfer a predetermined number of cryptocurrency tokens from Jill to Jack after Jill has lived in the apartment for one month. In this case, the parameter for the contract to be executed is to rent a Jill apartment for a month, and the assets that are transferred after completion are cryptocurrency tokens.
A retailer implements a smart contract program that is designed to prevent several members of the same household from buying too many apples using a promotional code for discounts. It might look like a code that automatically removes Jack’s ability to buy apples using a promotional code if Jill already bought an apple at this discount.
Smart Legal Contracts
A smart legal contract uses a smart contract code to upgrade traditional legal contracts. These enhancements may take the form of more stable or predictable agreements or simplify complex operations.
But there is one serious problem: smart contracts are not yet supported by the legislative framework of most societies. Thus, they do not yet have legal force.
How do smart contracts work
Here’s how a basic smart contract works:
- Assets are encoded;
- Contract terms are coded;
- Both assets and conditions are entered into the blockchain as part of the block;
- As soon as the contractual terms are met by both parties, the contract is executed;
- Any asset transfers are made based on the terms of the contract.
Benefits of Using Smart Contracts
March contracts can optimize and automate a wide variety of transactions that occur in any professional sector.
They can help businesses build trust with their customers and maximize transaction transparency. And, most importantly, they are unchanged, that is, they eliminate the risk that someone will change the contract in order to take advantage of others. These features can be very valuable, especially in industries such as the financial sector or government.
Although smart contracts are a simple concept, the nuances associated with their use in reality can complicate the situation. One of the most attractive features of smart contracts – their ability to manage and automate procedures in a decentralized database – is at the same time one of the main limiting factors for their mass recognition.
The decentralized nature of smart contracts suggests that maintaining the confidentiality of information is virtually impossible. It also means that contracts cannot communicate directly with the real world without compromising the security and integrity of data on the blockchain. Accordingly, they need trusted parties to enter data into the chain.
One solution to this problem is the so-called blockchain oracles. Oracles, as a rule, trust third-party data channels that monitor real-world events and provide information to the blockchain. Thus, the smart contracts included in this blockchain can effectively make judgments based on information that is usually not available on the network.
Although the main feature of blockchains is their decentralized nature, it is very important to note that oracles are usually organized by a central institution that is considered trustworthy.
Popular smart contract platforms
Many organizations strive to use smart contracts, and blockchain technology quickly adapts to growing demand in several ways. Currently, the following three platforms occupy leading positions in this niche.
Ethereum Virtual Machine (EVM)
Ethereum is currently the leading platform for creating smart contracts. The Ethereum Virtual Machine (EVM) is the isolated runtime environment in which these contracts are hosted. Ethereum’s network infrastructure uses a cryptocurrency called ether to facilitate transactions.
Ethereum users have two main types of account available. Firstly, these are external (regular) accounts. They are managed by people and are used to store ether, send it to other accounts, create contracts and call (use) the functions of existing contracts. Secondly, these are the contracts themselves. Contract accounts are controlled by a built-in code. The code cannot be modified by the user, although the values existing in the contract can be changed by related transactions. Any changes made to the contract are automatically recorded on the blockchain.
All accounts have access to their own air balance, which can be changed through transactions.
To use each contract, users need to spend some ether as the so-called gas. (It is most convenient to consider gas as a transaction fee used to create or execute smart contracts.) The amount of gas that needs to be spent is determined based on the amount of work that the ethereum platform must produce to fulfill the contract.
When a contract requires some computing work, the network calculates how much gas is needed for these calculations. If the gas ends before the transaction is completed, the transaction will not be completed, and the gas will still be spent. If the amount of gas exceeds the required, the remaining gas is returned to the account, which calls the function. All gas spent on such contracts is paid to Ethereum miners as compensation for checking transactions on the network.
EVM is a reliable platform that offers a wide range of smart contract functions that are arranged in such a way that programmers can form contracts according to their own needs. That’s why companies in many industries, from e-commerce to financial services, have already developed their own ethereum-based smart contract applications.
Virtual machine NEO (NeoVM)
NEO is a growing Chinese platform that can be used to create smart contracts and develop cryptocurrencies. Contracts are very similar to those used in ethereum. It is believed that under optimal conditions, NEO’s performance is higher.
The platform is also more flexible and expandable than Ethereum. Unlike Ethereum, which only supports its own Solidity language, NEO allows developers to create contracts using many well-known programming languages, including C #, VB.Net, F #, Java, Kotlin and Python.
Despite the fact that NEO is still at an early stage of its development, it is expected that the platform will be able to become a leader in the smart contract market as it grows. Now it is considered the most scalable smart contract platform, and it is well deserved (the network can process 1000 transactions per second). However, it is important to note that creating smart contracts and decentralized applications on this network can be more expensive than using ethereum.
EOS is another platform that is under development and focuses on the functionality of smart contracts. It uses web assembly (WASM) to execute smart contract code, and C ++ is expected to become the core language for developing contracts on this network.
The contract functions generally work the same as they do on the ethereum network, but there are some notable differences. For example, EOS uses the Proof-of-Stake (PoS) consensus mechanism for transaction management, while Ethereum uses the Proof-of-Work (PoW) mechanism.
In the case of Proof-of-Work, users need to do some work to request a service from the network, while Proof-of-Stake means that the user can access these services by owning a certain number of tokens. PoW networks usually force users to spend money on fees (gas), while PoS requires users to own network tokens to access services.
One of the main advantages of the PoS protocol is that it completely eliminates transaction fees. It also provides users with bandwidth and network storage, which directly correlate with the number of tokens they have.
This protocol difference also allows you to freeze and edit EOS applications (without breaking other contracts), while Ethereum-based applications do not have this functionality.
EOS uses Graphene technology, capable of processing between 10,000 and 100,000 transactions per second. She also plans to use parallelization for network growth, so throughput can reach millions of transactions per second.
With all of this in mind, EOS should become a highly scalable and commercially viable smart contract platform and Ethereum’s main competitor.
Having figured out how smart contracts work and which platforms are used to create them, let’s move on to the options for using this technology. As an example, here are five industries that can benefit from the use of smart contracts.
Using smart contracts in real estate
A serious problem for real estate market participants is the need for direct interaction with agents, landlords, inspectors and third-party service providers to verify and confirm each step in the rental or purchase process.
Smart contracts that automate leases can simplify many of these processes, reducing the need for personal contacts and arrangements. They can also streamline processes such as real estate search and leasing or cash flow management for real estate companies.
Rentberry, a decentralized housing rental platform, is one example of a business that facilitates automation of rental payments, managing safe deposits, and even placing homes for sale using smart contracts. With Rentberry, a lease is concluded and verified exclusively with the participation of the landlord and tenant. The agreement takes the form of a smart contract, which is entered into the blockchain and, therefore, is unchanged.
In the smart contract code, rental payments are set automatically in accordance with a predefined schedule. These conditions can be discussed before entering the code. Terms of term deposits are established at the beginning of the contract, and at the end of the lease any debt will be deducted, and the remaining deposit will be automatically returned to the lessee.
This is a great example of how smart contracts can be used to create a completely transparent record of a lease, preventing fraud by any party throughout the process.
Using smart contracts in supply chain management
Supply chain logistics is an industry that includes the storage and delivery of physical goods by land, sea and air. This is one of the most difficult industries in the world, as each element must be monitored to ensure that the product reaches the final point. To implement the supply chain, you need a large number of different transactions.
Despite the fact that most organizations already have specialized tools for managing digital packages and assets, they are often too expensive and require a lot of actions from staff, such as scanning packages, maintaining ledgers, and paying bills.
These benefits include:
- Tracking goods in transit;
- Low costs;
- Self-government (automation);
- Clarity of the terms of the contract (direct contracts);
- Fraud protection;
At the same time, the company noted that the introduction of this technology throughout the industry may be difficult, since effective standards and protocols should first be established to ensure confidentiality and security when using smart contracts, and legislation should be fully responsive to innovation.
ShipChain and VeChain are two blockchain projects that work to implement smart contract functionality for supply chains. ShipChain aims to improve product tracking and maximize the efficiency of transport routes using blockchain technology, while VeChain improves supply chain security by using smart contracts and other blockchain infrastructures to prevent fraud.
Using smart contracts in the financial sector
A recent article entitled “Smart Contracts and the Future of the Banking System” prepared by Nasdaq noted that the main problem that impedes the widespread adoption of smart contracts is the lack of smart interfaces between the blockchains in which smart contracts work and the rest of the world.
With this in mind, industry groups such as FinTechNetwork and Zerado still believe that smart contracts can offer many useful applications for banks if they decide how to effectively coordinate legal contracts in smart contract format. This will probably require banks to apply smart contracts, which will be correlated with the development of the blockchain infrastructure and the infrastructure of outdated financial services (banking, insurance networks, etc.).
Such a system can eliminate delays that are usually caused by centralized institutions like clearing houses and allow smart contracts to initiate automatic payments of fixed currencies from bank accounts after the conditions of the contract are met. Similarly, these same contracts can guarantee compliance with the requirements of the tax authorities and the automatic sending of relevant reports.
Regulators will also be able to access and read records of all transactions, verifying that all applicable rules are followed. When implemented correctly, this type of system will provide a secure, private, and scalable platform for all transaction participants.
However, in practice, everything is not so simple; There are problems due to which smart contracts are not used by most financial companies.
First, regulators who manage financial institutions in their countries will need to develop smart contractual provisions that can effectively protect the public. Such rules are essential for smart contracts to be enforceable and secure. This technology should also be secure enough for widespread use in the industry, as transaction records will potentially be visible to all users. This raises questions about what data should be available to all participants and how users can verify the authenticity of data that is transferred to the blockchain through oracle services.
After the answers to these questions are received and the obstacles to management are removed, we will see real cases of the use of smart contracts in the financial services industry.
For a deeper understanding of this complex topic, you can read white paper Cap-Gemini.
The use of smart-contracts in state institutions
Smart contracts will be able to solve such tasks of government institutions as contract management, identity verification or voting.
One example is the idea of using blockchains to record promises made by public persons, and then using this data to guarantee their observance.
For example, the legislator may agree to allocate a certain amount to solve a particular problem. As soon as it is sent, the contract will be concluded, and all members of the community are informed about the status of the transaction. If the amount is not sent by the indicated date, the smart contract will act differently, informing the founders that the promise has not been kept.
Another example: the US government is currently exploring smart contracts that can be used to improve the system used to participate in government procurement. It is also believed that smart contracts can be used to facilitate access to an anonymous voting register, which citizens can easily access.
Of course, such a system should be completely secure and be able to verify a person’s identity without disclosing confidential information on the public blockchain.
Using smart contracts in healthcare
Healthcare is a massive industry. Medicine accounts for a significant part of the economy in many countries (in the USA – about 20%).
With so many transactions taking place all over the world, healthcare organizations are obviously transmitting enormous amounts of data to each other. These data can vary from publicly available to extremely confidential, therefore their safe storage is a priority for medical institutions. However, accuracy is just as important as confidentiality, since an inaccurate patient record can lead to improper treatment, which can worsen his condition.
Blockchains can be used to store various health data in such a way that they are accurate, fully encrypted and digitally signed. Patients should be able to choose who is allowed to access their health information by providing an access key directly to trusted healthcare providers.
This minimizes the risk of fraud and simplifies the communication of patients, insurers and healthcare organizations with each other. Patientory, a blockchain project that raised more than $ 7 million in the first three days of its ICO, aims to achieve this goal – improving the storage and processing of patient data.
This will allow healthcare institutions to create smart contracts that instantly transmit reliably accurate health data to insurers or other medical facilities, making it easier to process payments between organizations. Ideally, such transfers will be sent automatically using a smart contract.
Difficulties in using smart contracts
The introduction of smart contracts in our world can make a big difference. However, the smart contracts that exist today are not perfect. Here are three problems that the creators of smart contracts have to deal with before the technology gains widespread acceptance.
Building trust in the use of smart contracts
Achieving widespread use of technology will require building public confidence by ensuring the security of personal data, assets and rights. In this regard, the most urgent problem for smart contracts is the need to bridge the gap between traditional legal contracts and legal smart contracts.
Smart contract developers need to figure out how to develop completely error-free, secure applications. These contracts must be flexible as they will need to be adapted to ensure compliance with constantly changing laws and regulations. At the same time, the blockchain should be able to offer users a reasonable level of confidentiality, since the exchange of too voluminous information about certain transactions can put users at risk.
The problem of the so-called oracles is an obstacle to the widespread adoption of smart contracts. It lies in the fact that the execution of smart contracts cannot be initiated in real time based on the occurrence of events in the physical world. To overcome this limitation, as we already wrote, blockchain needs oracles.
Oracles can provide smart contracts with the necessary data, but things get complicated when physical elements are involved. Unlike sending a simple data stream from a financial institution or software service to the blockchain, physical elements may require much more channels to track data, process it and send it.
All this data must be analyzed and verified before it is entered into the blockchain, in order to prevent costly mistakes. Checking and downloading large amounts of information can be expensive. In combination with the fact that oracles are essentially centralized, this inspires less confidence in the advisability of using oracles at this stage of technology development.
The fact that oracles are usually not decentralized means that they introduce the human factor into the blockchain. If the data provided by the oracle is not accurate, this may lead to the failure of smart contracts.
Platform specific limitations
Finally, a serious problem may be related to the construction of the blockchain platform used to create smart contracts. If the network is not scalable and is not built to support a large volume of transactions, smart contracts hosted on this platform will not be performed optimally.
The costs associated with using the platform can also increase, especially in the case of PoW-based platforms such as Ethereum. If the network does not have security features, smart contracts on this platform may be compromised by cybercriminals or technical errors.
The Future of Smart Contracts: Revolutionary Potential
A large number of studies are underway to reduce the impact of these restrictions.
Here are two possible solutions to the oracle problem:
- Fines for oracles that provide erroneous data;
- Using the services of several oracles as sources of information on the blockchain to ensure a reasonable level of consensus on the data before they are entered.
As best minds seek to deal with this problem, over time we will come closer to its optimal solution.
At the same time, smart contract platforms are becoming more autonomous, accurate and transparent. Protection technologies are also evolving every day.
The benefits of doing business in the digital field using smart contracts are undoubtedly huge. The implementation of smart contracts in almost all sectors of production and services is only a matter of time. It is safe to say that smart contracts will become the pillar of the future global economy and part of the everyday life of every consumer.