Intermediate Series

What Are Smart Contracts?

Much like a contract written by a lawyer, a smart contract establishes the terms of an agreement. However, instead of a document written in English and enforced by a legal system, a smart contract is written as computer code and executed on a blockchain like Ethereum. 

What makes it smart? Smart contracts can perform many of the same functions that intermediaries like lawyers, accountants and bankers do. For example, a smart contract can create an agreement between two parties, verify their funds, and process a loan. 

In the same way that bitcoin removes the need for trusted intermediaries like banks, smart contracts remove intermediaries for a whole range of functions. Once a smart contract is written once, it can be used thousands of times. 

A vending machine is a smart contract

To get a more intuitive feel for smart contracts, let’s borrow a metaphor from the original creator of smart contracts, Nick Szabo, who said, “The humble vending machine is the original form of a smart contract.”

When you put money into a vending machine, your product will be dispensed based on the ticketed price of the product with anything left over returned to you. In this way, we can see that a smart contract is a machine that does what we want. The key difference is that a vending machine is built from metal and plastic atoms, while a smart contract is built from bits and bytes of information. A vending machine is physical, while a smart contract is virtual. 

Now we can see why the part of the Ethereum blockchain that processes smart contracts is named the Ethereum Virtual Machine. 

Why do smart contracts matter?

Bitcoin lets us send money over the internet, smart contracts let us do everything else. Moreover, smart contracts don’t only replace the traditional finance system, they empower us to create a new and improved system that is completely free from the constraints of the old system. 

As such, we’ll see some completely new innovations that weren’t possible without them, such as:

  • They let us make loans and trade derivatives with decentralised finance (DeFi).
  • Trade digital art and sell in-game assets with non-fungible tokens (NFTs).
  • Store and share encrypted data over the decentralised internet infrastructure (web3). 

Smart contracts can also improve our lives beyond the internet. Here are three ways that smart contracts empower individuals in the real world:

  • Combining a smart contract and the Internet of Things; users can track a product through every step of the supply chain — from paddock to plate. 
  • Home mortgages managed on smart contracts can automate the confusing and manual processing of mortgage contracts, improving transparency, reducing errors and creating a smoother process. 
  • Smart contracts can help improve cancer treatments by maintaining patient privacy while sharing clinical data with researchers.

We can see that smart contracts are a superior version of the contracts that came before them. As Nick Szabo summarised, “As much as smart phones are more functional than traditional phones, which in turn are in many ways more functional than messages written on paper, smart contracts can be more functional than their inanimate paper-based ancestors.” 

How smart contracts work in five simple steps

Ethereum is currently the most popular blockchain for smart contracts. The Ethereum Virtual Machine works like a computer, running the code whenever ETH is sent to it. This allows people from all over the world to transact with each other using smart contracts. Here’s how it works in five simple steps:

1. Write the smart contract. A developer writes a smart contract. Ethereum developers write their smart contracts in a programming language called Solidity. These contracts can be used for anything, from minting NFTs to trading synthetic derivatives. 

2. Store the smart contract. The contract is then stored on the Ethereum network, with every node storing a copy of the contract. Anyone can inspect the contract to see how it works and whether they can trust it. 

3. Execute the smart contract. A user can run the smart contract by sending some ETH funds to it. The code in the contract is then executed by all of the nodes in the network so that they all agree on the output of the contract.

4. Pay a gas fee to the network. Users must pay a ‘gas’ fee to the Ethereum network, to pay for the nodes running the smart contract. 

5. Continue using the smart contract. The smart contract will continue to exist on the Ethereum network and can be used by other users whenever they like. 

The future of smart contracts

While Nick Szabo invented the idea of smart contracts in 1990, it wasn’t until 2008 when Satoshi Nakamoto invented the blockchain that the foundation was laid for incredibly powerful blockchains. In 2015, Vitalik Buterin launched Ethereum and gave way to the incredible innovation from smart contracts. 

While Ethereum has been the most prominent player when it comes to smart contracts, it’s not the only layer-1 blockchain set to power the next decade of smart contract innovation. Here are five technologies, including Ethereum, fueling the smart contract industry’s growth:

These blockchains not only represent an exciting investment opportunity for many investors, but equally an exciting platform for developers and creatives to build on. Through DeFi and NFTs built on smart contracts, everyone from artists to farmers in third-world countries can benefit, everyone will have open access to the best smart contracts. Naturally, Nick Szabo is delighted to be “Part of a community… working for a common social good.”

Ready to invest?

Get $10 worth of BTC free, when you make your first trade. T&Cs apply.