What is a smart contract

Introduction

Nick Szabo first described intelligent contracts in the 1990s. Then he defined a smart contract as a tool that formalizes and protects computer networks by combining protocols with user interfaces.

Szabo discussed the potential use of smart contracts in various areas that include contractual agreements, such as credit systems, payment processing, and content rights management.

In the world of cryptocurrencies, we can define a smart contract as an application or program that runs on the blockchain. As a rule, they work as a digital agreement, which is ensured by a particular set of rules. These rules are predetermined by computer code copied and executed by all network nodes.

Smart contracts on the blockchain allow you to create protocols that do not require trust.

This means that two parties can make commitments through the blockchain without knowing each other and not trusting each other. They can be sure that the contract will not be fulfilled if the conditions are not fulfilled. In addition, the use of smart contracts can eliminate the need for intermediaries, which will significantly reduce operating costs.

Although the Bitcoin protocol has supported smart contracts for many years, they were made famous by the creator and co-founder of Ethereum Vitalik Buterin. However, it is worth noting that each blockchain can represent its method of implementing smart contracts.

This article will focus on smart contracts that run on the Ethereum Virtual Machine (EVM), an integral part of the Ethereum blockchain.

How do they work?

Simply put, a smart contract works like a deterministic program. It performs a specific task under certain conditions. Thus, the smart contract system often follows "if... then...". But despite popular terminology, smart contracts are neither legal nor intelligent. This is just a piece of code running in a distributed system (blockchain).

In the Ethereum network, smart contracts are responsible for executing and managing blockchain operations when users (addresses) interact with each other. Any address that is not a smart contract is called an external account (EOA). Thus, computer code controls intelligent contracts, and users own EOA.

Ethereum smart contracts consist of a contract code and two public keys. The first public key is the one provided by the contract creator. The other key is the contract itself, acting as a digital identifier unique to each smart contract.

The deployment of any intelligent contract is carried out through a blockchain transaction, and it can only be activated when calling EOA (or other smart contracts). However, EOA (the user) always calls the first trigger.

Key Features

The Ethereum smart contract often has the following characteristics.

Can I change or delete a smart contract?

After deploying the Ethereum smart contract, it is impossible to add new features. However, if its creator includes the SELF-DESTRUCT function in the code, he will "delete" the smart contract in the future - and replace it with a new one. On the contrary, if the function is not included in the code beforehand, they will not remove it.

It is noteworthy that the so-called updatable intelligent contracts allow developers to have more flexibility regarding the immutability of contracts. There are many ways to create updatable smart contracts of varying degrees of complexity.

Consider a simplified example. Imagine that a smart contract is divided into several more minor agreements. Some are designed to be immutable, while others have the delete feature enabled. This means that part of the code (smart contracts) can be deleted and replaced while other functions remain intact.

Advantages and use cases

As a programmable code, smart contracts are easily configurable and can be developed in various ways, offering many types of services and solutions.

Being decentralized and self-executing programs, smart contracts can provide increased transparency and lower operating costs. Depending on the implementation, they can also increase efficiency and reduce bureaucratic costs.

Intelligent contracts are beneficial in transferring or exchanging funds between two or more parties.

In other words, smart contracts can be developed for various use cases. Some examples include the creation of linguistic assets, voting systems, cryptographic wallets, decentralized exchanges, games, and mobile applications. They can also be deployed alongside other blockchain solutions that cover the areas of healthcare, philanthropy, supply chain, governance, and decentralized finance (Defi).

ERC-20

Tokens issued on the Ethereum blockchain comply with a standard known as ERC-20. The standard describes the essential functions of all Ethereum-based tickets. Thus, these digital assets are often referred to as ERC-20 tokens, representing a significant portion of existing cryptocurrencies.

Many blockchain companies and startups have deployed intelligent contracts to issue their digital tokens on the Ethereum network. After the release, most of these companies distributed their ERC-20 tokens through Initial Coin Offering (ICO) events. In most cases, intelligent contracts made it possible to exchange funds and distribute tickets reliably and efficiently.

Limitations

Smart contracts consist of computer code written by people. This involves numerous risks since the code is vulnerable to vulnerabilities and errors. Ideally, they should be written and implemented by experienced programmers, especially if we talk about confidential information or large amounts of money.

In addition, some argue that centralized systems can provide most of the solutions and functions offered by smart contracts. The main difference is that smart contracts work in a distributed P2P network, not on a centralized server. And because they are based on a blockchain system, they are usually either immutable or complicated to change.

In some situations, being immutable can be great, but it isn't good in others. For example, when a decentralized autonomous organization (DAO) was hacked in 2016, millions of ethers (ETH) were stolen due to flaws in their smart contract code.

Since their smart contract was immutable, the developers could not fix the code. This eventually led to a hard fork that spawned the second Ethereum chain. Simply put, one chain "canceled" the hacking and returned the funds to the rightful owners (this is part of the current Ethereum blockchain). Another chain decided not to interfere in the hacking, stating that things in the blockchain should never change (this chain is now called Ethereum Classic).

It is important to note that the problem did not arise because of the Ethereum blockchain. This was caused by the incorrect implementation of the smart contract.

Another limitation of smart contracts is related to their uncertain legal status. In most countries, it is in a gray area because intelligent agreements do not comply with the current legal framework.

For example, many contracts require both parties to be correctly identified and be over the age of 18. The pseudonymity provided by blockchain technology, combined with the absence of intermediaries, can jeopardize these requirements. While there are potential solutions to this, the legal enforcement of smart contracts is a real challenge, especially when it comes to distributed networks without borders.

Criticism

Some blockchain enthusiasts see smart contracts as a solution that will soon replace and automate most commercial and bureaucratic systems. While this is a possible reality, it is probably far from the norm.

Smart contracts are certainly an exciting technology. But being distributed, deterministic, transparent, and immutable, can make them less attractive in some situations.

The criticism is based on the fact that smart contracts are not a suitable solution for many real problems. Some organizations are better off using conventional server alternatives.

Compared to smart contracts, centralized servers are simpler and cheaper to maintain and, as a rule, provide higher efficiency in terms of speed and inter-network communication (interaction).

Conclusion

There is no doubt that smart contracts have significantly impacted the world of cryptocurrencies and have revolutionized the blockchain space. Although end users may not interact directly with smart contracts, they are likely to use a wide range of applications in the future, from financial services to supply chain management.

Together, smart contracts and blockchain can radically change the face of almost all spheres of modern society. But only time will tell whether these revolutionary technologies will be able to overcome many obstacles to their large-scale implementation.