What is a Smart Contract? Here are Practical Examples

Smart contracts

Even though there are very few newcomers to the crypto market now, I will provide some useful information on smart contracts even for those who have been investing in digital assets for a long time. After all, we all have knowledge gaps, and many definitions are very vague – especially as it pertains to blockchain and smart contracts.

What is a Smart Contract, Anyway?

A smart contract is a program that starts the execution of a specified result only when pre-specified conditions are met. In other words:

  1. The parties have determined the conditions and the result of their execution.
  2. When requirements are met, the smart contract will be automatically executed. This can be either the transfer of assets from one side to the other or the launching of a chain of any operations sequence.

The principle and most apparent advantages of this technology are the elimination of intermediaries and the resolution of the issue of trust which is an achievement of technological trust.

The first and most straightforward application of such a contract is multi-signature contract (i.e., multisig, escrow). Those parties who do not trust one another can freeze a certain amount of assets in the blockchain in such a way that, in order to spend them, a contract would require signatures of more than 50% of stakeholders.

Example 1

The contract execution mechanism is visible in the following example:

Suppose there is a contract for saving money initiated by parents for their children to use when they reach adulthood. Contributions can be made to the account, where funds can be returned strictly after 18 years. This contract accepts transactions, transfers money from the parent’s account and checks the timeline for a specified date (like 18 years). If it does, it transfers money to the child’s account. Miners, seeing the code of this contract, will execute it. If you do not need to do anything, then the state of the account will not change, and no transactions need to be performed. However, as soon as 18 years have passed, the miner will execute the contract code and receive a transaction returning the money to the child’s account – and write it in the blockchain. To avoid contracts that take money from accounts or DoS clients in endless cycles, each instruction of the contract costs a bit of a different currency (i.e., gas), which has a price in the currency of the network. Therefore, the execution of a contract requires money that goes to those who execute them and close the blocks (i.e., to miners themselves).

Example 2

The second example:

Another type of contract could be one that accepts bets on the bitcoin price on a specific date and then transfers the money to the winning party based on the result. How does a contract know a bitcoin rate when the time comes? After all, can’t the data be changed and faked?

Such problems can be solved with Oracles. An oracle is a conductor program that transfers information from external data sources to the blockchain, providing the necessary data to execute smart contracts. For example, an oracle can tracks stock quotes on the external web and transfer these data to the blockchain.

Oracles in smart contracts are a full-fledged industry in which many startups try to offer their solutions. Hacked covered this industry in the following article: Are Oracles the Ticket to Ethereum’s Next Bull Market?

Now smart contracts are widely used in the field of fundraising, such as in initial coin offerings (ICOs). As many investors know, ICOs have made their presence felt on many industries, such as financial markets (banking services, insurance, derivatives trading), supply chain management and logistics, accounting and auditing, registration of property rights, all sorts of voting, smart transport, digital identity identification and many, many others.

Unconditional advantages of smart contract technology are, of course, savings (due to the absence of intermediaries); immutability (since the prescribed terms of the contract are stored in a distributed registry, and no one can change them) and speed (when conditions are met, the process starts instantly).

The most apparent shortcomings are the susceptibility to bugs and the complexity of writing. Besides, the exchange of confidential data through transparent distributed registries is not suitable for many banks and large corporations. Also, problems of scaling and speed of transaction processing are still relevant.

However, overall, a smart contract is a significant breakthrough and a foundation of broader applications of blockchain technology. Smart contracts have proliferated the market via ICOs but their applicability extends far beyond that. Only time will tell if smart contracts disrupt other core areas of the economy.

Disclaimer: The author owns bitcoin, Ethereum and other cryptocurrencies. He holds investment positions in the coins, but does not engage in short-term or day-trading.

Featured image courtesy of Shutterstock.

Author:
Vladislav Semjonov has a legal and financial background. He has been involved in crypto space since early 2017 in both ICO advising positions in several ICO consultancy firms, and as an ICO analyst for VC. He began contributing for Hacked.com in April 2017.