What is a smart contract?

Smart contracts were first described in the 1990s by Nick Szabo. At that time, he defined a smart contract as an instrument that formalizes and secures computer networks by combining protocols with user interfaces. Szabo discussed the possible use of smart contracts in various areas related to contractual agreements. Within the cryptocurrency space, we can define a smart contract as an application or program running in a blockchain. Usually, they work as a digital agreement enforced by a specific set of rules. The rules are predefined by code, which is duplicated and performed by all network nodes.

Blockchain smart contracts make it possible to create reliable protocols. Meaning that two parties can make commitments via a blockchain, without knowing or trusting one another. They can rest assured that if the conditions are not met, the contract will not be performed. Furthermore, the use of smart contracts can eliminate the need for intermediaries, which can significantly reduce operational costs. Although the Bitcoin protocol has supported smart contracts for many years, they have been made accessible by Ethereum's creator and co-founder, Vitalik Buterin. It is worth noting that each blockchain can utilize a different way to make use of smart contracts. For now, we will focus on the smart contracts running on the Ethereum Virtual Machine (EVM), an essential part of the Ethereum blockchain.

How do they work?

A smart contract performs a particular task if and when certain conditions are met. A smart contract system, therefore, often follows "if condition X is met, then perform action Y" statements. However, despite the terminology, smart contracts are neither legal contracts nor smart contracts. It is coded that runs on blockchain.

On the Ethereum network, smart contracts are responsible for performing the operations that take place when users (addresses) interact with each other. An address that is not a smart contract is called an external account (EOA). In other words, smart contracts are controlled by computer codes, and EOAs are controlled by users. Ethereum smart contracts consist of a contract code and two public keys. The creator of the contract provides the first public key. The other key represents the contract itself and acts as a digital identifier unique to each smart contract.

The deployment of a smart contract is done via a transaction and can only be activated when an EOA or other smart contract calls on an EOA or other smart contracts. However, the first trigger is by an EOA (user).

Key features

An Ethereum smart contract often has the following characteristics:
  • Distributed.  Smart contracts are replicated and distributed in all nodes of the Ethereum network. This characteristic is one of the significant differences with other solutions based on centralized servers.
  • Deterministic. Smart contracts only carry out the actions for which they are designed. Moreover, the result will always be the same, no matter who performs it.
  • Autonomous. Smart contracts can automate all kinds of tasks and work as a self-executing program. But if a smart contract is not triggered, in most cases it remains "dormant" and does not take any action.
  • Unchanging. Smart contracts cannot be altered after implementation. They can only be "removed" if a specific function was implemented beforehand. For example, we can say that smart contracts can provide a fraud-proof code.
  • Adaptable. Before implementation, smart contracts can be coded in many different ways. They can, therefore, be used to create many types of decentralized applications (DApps).
  • Reliable. Two or more parties can communicate with each other via smart contracts without knowing or trusting each other. Besides, blockchain technology ensures that the data is accurate.
  • Transparent. Because smart contracts are based on a public blockchain, their source code is not only unchangeable but also visible to everyone.