Smart Contracts And Their Main Shortcomings
Smart contract as a concept is an important cornerstone of blockchain technology. The popularity of smarts is mostly due to their indifference to such factors as legislation backdoors, lie, misunderstanding and other manipulations inherent in every human being. Each smart contract is a program that cannot lie (unless it was intended to), it processes data in accordance with strict rules, cannot be manipulated and is not susceptible to fatigue.
However, just as common contracts may contain hidden tricks, smart contracts may have traps in their codes. Fortunately, these traps can be avoided. Any smart contract can be tested on your own private network as its code is clear and available for everyone. At least this was the initial concept of smart contracts.
Still, this is not the only reason why smarts are so popular. A set of documents forming a code, or a rulebook are commonly too big to be implemented at once. You need someone specially taught to understand the whole interaction. But still, it will take you an enormous amount of time to analyse and implement these documents. In contradiction, smart contracts are written in programming languages and can be executed in a heartbeat. They may also call each other, transfer parameters. Such approach was called dApp, which means a distributed application. DApp is a complex software in which several programs interact with each other and produce a result.
Unfortunately, nothing is perfect, and smart contracts are not an exception. They have limitations and restrictions. In order to understand them properly, let’s figure out what position smart contracts take in the blockchain network. Nota bene: There are not only various platforms for writing smart contracts in different languages, but also numerous concepts of smarts themselves. Consider them in the context of the Ethereum blockchain.
According to Ethereum rules, each smart contract is a program written in Solidity or any other appropriate language. It contains a valid address and is placed on blockchain. Since blockchain is stored by each full node at the same time, the same smart contract can be computed by every full node participant. Thus, considering a single smart contract, the network will look like the following:
The first important restriction that must be taken into account is calculation facilities. Each transaction implements changes to the state. All transactions intended to change the state simultaneously are united in blocks. Each transaction has to be processed by a full node. Since transactions can differ, their processing is measured in special units called ‘gas’. You can consider gas as fuel. The amount of state changes and their significance are limited by the total amount of gas used per block. New blocks cannot hold transactions where a gas sum is greater than a block gas cap. Meanwhile, every single gas unit is paid in ether.
The second restriction is about a contract’s size. Not only is gas paid for transaction execution but for data storage as well. Smart contract codes must be kept somewhere within the Ethereum environment. Storing of large contracts leads to two consequences. First, you have to pay gas for data storage. Second, each time someone calls your contract, they may have to pay in proportion to the complexity of the contract.
The last restriction is probably the most significant one. You might have enough ether to pay for data storage, your contract might be good enough to be paid for as well. The only thing the contract will never do is working outside blockchain. All interactions, state changes, contracts calls and ether transfers can be executed only within blockchain, and there is no way to change this paradigm.
Apparently, smart contracts are not as smart as they’re supposed to be. Regardless of all their advantages, their flaws are significant and distressing. Although, there is a way to resolve this issue. We’re talking about an oracle, a service intended to connect blockchain with the external world. This software solution will be the topic of our next article.