One of the fundamental technologies that underpins the Ethereum network is the development of Ethereum 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.
Page Contents 👉
- 1 What is a smart contract?
- 2 Examples of Smart Contracts
- 3 Arguments for Decentralised Smart Contracts
- 4 A Big Future for Smart Contracts
- 5 Ethereum Smart Contract FAQ
What is a smart contract?
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 Ethereum 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.
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.
Sample contract from https://www.ethereum.org/token
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.
Vyper coding language is also used but is an experimental contract-based language program that was inspired by Python.
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
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 Ethereum 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.
Ethereum Smart Contract FAQ
What is an Ethereum Smart Contract?
An Ethereum “smart contract” is simply a program that runs on the Ethereum blockchain. It is compiled of code and data that resides at a specific address on the Ethereum blockchain. They are a type of Ethereum account, have a balance and they can send transactions over the network. They are not controlled by a user, instead, they are deployed to the network and run as a program.
The smart contract can perform functions when certain criteria are met, define rules like contracts, and automatically enforce them via the code. They cannot be deleted and interactions are irreversible.
Why Ethereum Smart Contracts?
The world’s first cryptocurrency, Bitcoin, was the first to support a very basic form of smart contract. These were very limited in comparison to what Ethereum smart contracts can do. The creators of Ethereum designed the network to be able to handle more robust transactions and support capabilities not possible on the Bitcoin network.
Ethereum is the most secure, decentralized, safe, and robust smart contract network in the world, and has been battle-tested and withstood the test of time. This is a claim that cannot be made by any other smart contract network to date. Developers look to leverage the power of Ethereum and its reliability when looking to create new applications and smart contracts.
What can Smart Contracts be Used For?
Smart contracts can be used for nearly anything! Any contract between two people can be automatically executed, removing the trust and lack of transparency that often exists between two parties when entering into an agreement. They can be used to automatically execute functions, perform tasks and more. Here are some of the common use cases:
Digital Identities– Provide an identity for digital assets, remove counterfeits, and make KYC seamless.
Trade Finance- Can be used for cross-border payments, swaps, trading between any asset on the network, and peer-to-peer payments. Can be used for liability management, automatic payments, stock splits and dividend payments.
Financial Data Recording- Improves data recording by executing it automatically, removing exposure to human error.
Supply Chain Management- Automate supply chain with visibility and transparency. Leads to less fraud, loss, and wastage. Significantly reduce costs by cutting out intermediaries. Vechain is a network similar to Ethereum that specializes in this.
Error Free Financial Services- Humans are prone to mistakes and errors, mathematical code and calculations are not. Similar to how a calculator can perform math better than a human, smart contracts can perform complex financial transactions without error.
Government- Smart contracts can help automate operations, and improve transparency and efficiency.
Insurance- Automate claims and resolves disputes.
Mortgages- Automate the mortgage approval process, making it significantly faster, and for fractions of the cost by cutting out middlemen.
What is a Smart Contract Blockchain
The cryptocurrency industry loves synonyms. The term “blockchain,” is often interwoven with crypto, network, protocol, layer-1 and more. You will often see terms like Ethereum blockchain, Ethereum network, Ethereum protocol etc., it is all referring to the same thing. A smart contract blockchain is any blockchain/network that has smart contract functionality such as Ethereum, Cardano, Solana, Avalanche, Near, and many others.
Featured Image via Fotolia