Ethereum Smart Contracts
9 min read

What are Ethereum Smart Contracts

By Editorial Team

One of the fundamental technologies that underpins the Ethereum network is the development of “Smart Contracts”. Whereas Bitcoin and other cryptocurrencies were developed for the sole purpose of being a Peer-to-Peer digital currency, Ethereum was developed as a concept for running decentralised applications.

In their simplest forms, smart contracts are pieces of computer code that have built in logic and conditions that define their outcome. They are also run in a decentralised manner by all the computers on the network (nodes) and are stored and replicated on the ledger (blockchain).

They are nothing more than relatively simple programs that will execute “if this then that” functions. Hence, unlike simple blockchains that will store data in a decentralised manner, smart contracts will be run as decentralised calculations. They were first theorised by Nick Szabo in 1994 as a way of digitizing contracts that could be run as computer code.

Examples of Smart Contracts

Although Smart Contracts may initially sound like quite a complicated discipline, taking a look at applications of smart contracts with real world examples aids the explanation. Below are some simple applications in which smart contracts could greatly improve efficiency.

Legal Contracts

We all know that lawyers are quite fastidious when it comes to the verbiage in legal documents. Smart contracts are most able to change the way in which commercial contracts of sale are drawn up. In commercial law, for example, there are a number of conditions that must be met at various stages of the agreement before money is transferred.

These conditions on the sales are also nothing more than a collection of “if this then that” conditions. For example, in the sale of a house, there are number of conditions that have to be met by the seller before payment tranches would be facilitated. If there are any disputes to terms not being met on the contract then the sale will not go through.

This is something that can easily be coded onto a smart contract. This code will execute the terms of the agreement on the decentralised network on all of the computers. Some will also say that this smart contract will also perform the functions coded better than lawyers reading the contract. Smart contracts are not subject to linguistic nuances.

Moreover, due to the fact that these smart contracts are public and widely distributed means that there is general consensus as to the terms that are coded into the contract. Both parties are aware that inbuilt code will execute the smart contract based on the conditions that they both agreed.

Smart Contracts and Bank Accounts

Bank accounts can behave very much like smart contracts. For example, nearly all of us will have regular payments that will come out of our bank accounts and are sent to chosen third parties. This could to repay a credit card or to meet a debit order etc. The terms around these payments are usually date based (first of the month).

At beginning of the month when the payment is supposed to go through, there are really simple rules that will be executed by the bank. They will check the amount that is required to be paid as well as whether the funds are available in the account. They may also check to see whether there are any other “holds” that are placed on the account because of other payments.

If there are enough funds in the account and there are no other holds that are placed on it then the payment will go through to the third party. This could also have been a really simple smart contract that would look for conditions before the payments are made between parties. However, it would not be determined by the bank in the central location but would be executed on the decentralised network.

Sample Smart Contract

It now makes sense to have a look at an actual smart contract and the underlying code in order to better understand the basics of the transaction.

Example Ethereum Smart Contract

Sample contract from

In the above contract we are creating an array of all of the wallets. Then, the creator of the gets the initial supply of the tokens. Then, the contract will check if the sender has sufficient funds to send the amount requested, will check for any overflows and then will initiate the transaction.

Arguments for Decentralised Smart Contracts

One of the most important benefits about a smart contract is that it is executed on a public blockchain and shared ledger. This means that two parties who would not ordinarily trust each other can at least agree on the current state of the public ledger. As long as the majority of the network participants are in agreement as to the current state then smart contracts executed on that network should also be fully trusted.

We can take a look at an example when a smart contract could help with something called an OTC (Over the Counter) derivative transaction. These are usually transactions that are entered into by two participants who agree to the terms of the trade. Unlike with a central clearing house that acts as a third party to a trade, OTC transactions are direct and have no clearinghouse.

These are trades that are usually done by large institutions in the financial markets. They will settle the terms of the OTC agreement subject to certain conditions being met. The OTC agreement will be on written down in a legal agreement that both parties will have access to. Hence, it should be clear from the agreement who should pay whom on particular trade outcomes.

Yet, there is still scope for misunderstanding and disagreement between the parties. For example, there could be a misinterpretation of particular clauses (that lawyers will fight for) or there will be a disagreement between whether the trade has met the external conditions required.

A Smart OTC Contract

Smart OTC Contract
With a smart contract, however, there is only one contract that has been written in code and upon deployment is immutable (cannot be changed). The smart contract will execute the code precisely as has been intended and there can be no misinterpretation of the terms. By nature of the execution of the contract, both parties are beholden to it.

Furthermore, it is not up to the parties to decide whether the factors that trigger the OTC payout have been reached. It is determined solely by whether the conditions coded into the smart contract have been met. If the price of the share has reached a certain level then the condition has been met and the smart contract will execute the IF condition.

Apart from just confirming the outcome of the trade, the Smart contract can also facilitate the movement of funds from the losing party to the winning party. The Smart contract will execute the payment on the blockchain. Hence, it would act as a decentralised quasi clearinghouse. Both parties will initialise the transaction with the required starting balance of collateral staked on the trade.

Other Benefits of Smart Contracts

  • Safety: The blockchain where the smart contracts are stored makes use of modern cryptography. This means that they are extremely secure and it would be nearly impossible for hackers to compromise the system and alter the terms of a smart contract.
  • Autonomous: Smart contracts run by themselves automatically on the network. There is no need to monitor, activate or process them. This also ties in with the trust and security aspect. Given that no central authority has control over the contracts, there is more trust that they will indeed execute as intended.
  • Mass Backups:Given that the on the blockchain, all computers on the network have a copy of the contract, there is no need for regular backups. Moreover, data loss should never be a concern for people who have their data placed on the blockchain.
  • Speed: Paperwork can be a laborious affair. There will always have to be a back and forth between the parties when the terms of the contract have been met. Sometimes contracts also have to be sent in hardcopy which means they have to physically move between parties. With smart contracts however, code is executed in fractions of seconds. There is no need to go back and forth between the parties as all of the work is being done by the contract on the blockchain.
  • Cheap: As smart contracts are entered into directly between the two parties without the help of a middleman, they are relatively inexpensive. There is no need for lawyers to intermediate a transaction. There no need for a central exchange in the case of trading. No third party to an intermediate reduces cost.
  • Fully Accurate: There is no errors when it comes to smart contract. As long as they have been coded effectively, they will be executed as intended. There is also no room for misinterpretation of what the terms or the outcome is. They are hardcoded into the contract and are run 100% efficiently.

The benefits of Smart contracts are perhaps best summed up by Jegg Garzik who owns the Bloq

Smart contracts … guarantee a very, very specific set of outcomes. There’s never any confusion and there’s never any need for litigation.

A Big Future for Smart Contracts

Although smart contracts are no doubt revolutionary, there are a few possible problems that could arise from their use. Of course, there is always the possibility that unforeseen coding errors and bugs could exist in the contract. These could lead to outcomes neither party had expected. Similarly, how would the government regulate such contracts and how could they limit abuse?

Indeed, there are other things which are inherent in traditional contracts like Force Majeure which allows for leeway in the case of an extraordinary event or circumstance not in the control of the parties. With smart contracts, the code will be executed irrespective of these events.

However, there is no reason that these potential issues could not be overcome. Researchers at Cornell Tech from numerous fields are working on solutions to make smart contracts part of our daily lives. Lawyers could work with developers to create smart contract templates for commercial use. The opportunities for collaboration towards mass adoption are no doubt endless.

Featured Image via Fotolia

Editors at large. Posting the latest news, reviews and analysis to hit the blockchain. View all posts by Editorial Team ->

Related Posts

Fractionalized NFTs
Fractionalized NFTs

Fractionalised NFTs – Making Non-Fungible Tokens Affordable

July 31, 2021 18 min read
Guide to Starting Yield Farming
Guide to Starting Yield Farming

Getting Starting with Yield Farming: The ONLY Guide you Need

July 28, 2021 22 min read
What are cross chain bridges and why they are important for Defi
What are cross chain bridges and why they are important for Defi

What Are Cross-Chain Bridges: And Their Importance for DeFi

July 26, 2021 18 min read

Crypto Staking: The Dividends Of Blockchain

July 23, 2021 17 min read
Parachains Explained
Parachains Explained

What Are Parachains? Complete Beginner’s Guide

July 4, 2021 20 min read
Crypto Trading vs Crypto Investing
Crypto Trading vs Crypto Investing

Crypto Trading vs. Crypto Investing: Complete Beginner’s Guide

July 3, 2021 18 min read
The Basics of Blockchain Investing
The Basics of Blockchain Investing

The Basics of Blockchain Investing

June 25, 2021 22 min read
ETh2 vs. ETH1
ETh2 vs. ETH1

Ethereum 1.0 to 2.0: A Complete Beginner’s Guide

March 25, 2021 19 min read
Buying Bitcoin in Aus
Buying Bitcoin in Aus

Buying CryptoCurrency in Australia: Top 4 Options

January 15, 2021 19 min read