How do smart contracts work and why are they better than ordinary ones
A new cadastre registration system will start working in Sweden in 2019. Real estate transactions will become transparent and fast, as the process will be automated. All of it is possible thanks to smart contracts, a means of the conclusion of deals of the future.
How does it work?
What is a smart contract?
A smart contract is an algorithm programmed to create a two-way deal. Roughly speaking, it relies on the following operational principle: two participants conclude a deal specifying partnership conditions that are encoded. If they are fulfilled fairly and timely, both participants obtain the required result.
A smart contract sample, written on Ethereum platform. Source: ethereum.org
Thanks to smart contracts, users can exchange money, property, and securities without intermediary services.
What is the benefit?
You have probably made online purchases and faced situations when sellers asked for a prepayment. They worry that a customer can return the purchase and they would have to pay twice for the transmission of goods, suffering losses. On the other side, the customer is also bearing a risk, as the parcel may be miscarried. Sellers and buyers are forced to play Russian roulette instead of enjoying the ease of making online purchases.
The problem is that such deals are not documented. Both parties are not sure that they are making an arrangement with a fair individual, and it is not reasonable to pay for legal services taking into account the low cost of online services.
Smart contracts are a way out. They are processed within just several hours, are low budget, and the algorithm cannot be cheated.
The main advantage of smart contracts is the absence of the human factor. The script will not understand a task ambivalently, change its mind, or add backdated changes.
Transaction speed is also attractive. As all data is stored in the system, the contract will require the minimum amount of time to process information.
“Finance is the first large and promising area of blockchain development. It involves cryptocurrencies, smart contracts, and state registries. For instance, now it takes you several weeks to sell the house, and it may require just 3 minutes in the future.”
Vitalik Buterin in the interview for Rusbase, August 30, 2017
Why are smart contracts better than ordinary ones?
- Function independently
- Minimum expenses
- Conditions are clearly specified, cannot be changed
- The code cannot be bribed
- Intermediaries are required (notaries, brokers, banks)
- Intermediary services should be paid (which is expensive)
- Conditions may be interpreted for someone’s benefit and the other party may be assured that this is exactly how things should go
- People can be bribed
Why aren’t they popular then? Moreover, smart contracts reduce the work with documents moving all data to the network.
In fact, people actively use smart contracts but in small communities. The thing is that settlements for smart contracts are made only in cryptocurrencies that are beyond the law in most countries.
According to the data of the Library of Congress, only 15 out of 197 countries want to legalize digital currencies in 2018. However, only five countries ban them: Bangladesh, Bolivia, Vietnam, Kirghizia, China, and Ecuador.
Residents of other countries can use smart contracts, as they are not mentioned in the legislation. However, users should not forget that upon the emergence of problems, the law would not protect anyone.
Nevertheless, there are insecurities in the operation of smart contracts. In February of 2018, assistant professor of the University College of London Ilya Sergey and his colleagues found more than 34 thousand vulnerabilities that theoretically could help malefactors to withdraw around $6 million in Ethereum. Although researchers promise that developers will manage to correct mistakes before they are found, currency holders are still concerned.
ОК, how does the smart contract system work?
A smart contract is realized as a function recorded in the program container – a block. It unites all data flows that relate to a specific smart contract.
The code of smart contracts is written in blockchain and cannot function beyond it. However, to operate correctly, smart contracts should communicate with the external world, for instance, to receive data on changes in the exchange rate, price formation, or status of payment.
Oracles were designed for this purpose – intermediaries that establish communication between the determined blockchain environment and the chaotic external world. They function as true oracles: structure information from the external environment making it readable for blockchain, and translate code flows in the ‘human language’.
Ethereum smart contracts usually use Oraclize. ChainLink and Blocksense are less popular programs, but function well anyways.
Favorable environment is important for a contract, but to operate correctly, it should be drafted properly.
To draft a smart contract, the following attributes are required:
- availability of electronic signatures of at least two parties;
- private decentralized environment (for instance, Ethereum);
- the subject matter of the contract and tools for its execution (electronic wallets, oracles, etc.);
- correctly stated terms of an obligation, confirmed by signatures of participants.
In the end, a deal is closed. There are two options:
- Smart contracts are activated with transactions sent from the user’s electronic wallet.
- A message is sent directly from the other smart contract.
Are smart contracts available within Ethereum only?
Not really. Of course, Vitalik Buterin was a pioneer of smart contracts, but currently, other platforms use the algorithm as well:
- Bitcoin. Theoretically, smart contracts can be used here as well. However, as users often complained about failures in operation, now hardly anybody builds smart contracts on Bitcoin.
- Side Chains is an alternative project from creators of Bitcoin that offers to work with smart contracts.
- NXT is a cryptocurrency platform with restricted functions of smart contracts.
Which areas are smart contracts applied in?
Smart contracts can be used anywhere you need to close a deal between parties: both in everyday life (online shopping, purchase, and sale of property, marital agreements) and large-scale business areas (public circulation, registry, regulation of logistics, etc.).
Smart contracts can truly solve many problems of public institutions. An auction is the simplest example. If a smart contract is taught to compare state procurement proposals and choose the winner, the chances for fair victory increase massively.
Furthermore, they can be deployed in insurance. For instance, a French service Fizzy insures air flights against delays using smart contracts. Airlines cannot avoid making payouts: if all insurance contracts are recorded in blockchain, it is impossible to fabricate conditions.
Sweden is not lagging behind. Back in 2016, the country started to work with smart contracts to register land ownership. The National land cadastre service Lantmäteriet together with the blockchain startup ChromaWay, advisory company Kairos Future, and telecom supplier Telia use blockchain in the cadastre system to avoid mistakes when handling documents for real estate.
Although smart contracts require some improvement, they have good prospects. As for 2018, Canada, Sweden, France, Georgia, and a number of other countries are actively adopting blockchain at the state level.
In places where blockchain is adopted, smart contracts may appear soon.