Decoding Smart Contracts: An Introduction to Self-Executing Blockchain Agreements
Written by our Micro 1 Research Team: Lead Researcher: Shivaansh Garg & Research Analysts: Cooper Duschang & Kenji Lee
First we had phones and then came the smartphone, nowadays it feels like everything is getting a smart rebrand but what does this mean for smart contracts? At the end of 2020, the global market size of smart contracts was $145 million and is set to grow at a compounded rate of over 24% Year-on-Year and reach $770 million by 2028. The facet that allows for this growth is the underlying tendency of smart contracts: the ability to store, verify, and self-enforce rules. Essentially, they are pieces of code that define business logic and have the potential to fix common inefficiencies across industries today. Smart contracts can automate business transactions and verify ownership of assets.
This article jumpstarts the discussion of smart contract technology and its industrial applications.
What are Smart Contracts?
A smart contract is a self-executing contract with the terms of the agreement between multiple parties being directly written into lines of code. The integration of multiple parties ensures the security that comes along with smart contracts and is why it is becoming a popular medium for “trustless” transactions. Every contract has three components: the parties, contract terms, and object of transaction.
Smart contracts are self-executing, which means that they do not need an external party to supervise the transaction. This self-reliant efficiency is one of the many characteristics that has led to growth and interest in this technology. The digitally pre-approved agreement of smart contracts allows for criteria to be automatically approved when requirements are met. This trusted encryption of pre-approved agreements means no supervision is required for this technology and paves the way for many industries to accelerate any processes they have, unlike traditional or physical contracts where a third party (acting as an intermediary) may also be involved. Historically, traditional contracts tend to be more costly, time-consuming, and prone to fraud.
Through the use of blockchain technology, smart contracts become self-reliant. In order to ensure certain specifics, which would be required by a decentralized contract, smart contracts are transparent, irreversible, and immutable on the blockchain. However, if the developer wants, they may update clauses in the agreement through the following methods:
- Write a new contract with new terms of agreement and import the already-existing codes (conditions, transaction data) to the new one.
- Write a medial contract that acts as a new layer of conditions between the transactor and the transactee so that all transactions can go through this medial contract and the old contract gets updated.
Smart contract deployment is growing partly due to an increase in the possible use-cases for them across various industries — as will be discussed in subsequent sections. As shown in the chart below, the number of unique smart contracts created has risen significantly. This shows the increasing use case and importance of smart contracts interacting with both blockchain and external data.
Coin Metrics data shows the sum of individual contracts on the Ethereum blockchain. The contracts are counted when they have a specific address and are able to execute code. The focus remains on the Ethereum Blockchain since they introduced the first smart contracts chain and have the largest number of deployed smart contracts compared to other blockchains. Competitors including Avalanche Blockchain and Solana Blockchain do have EVM support but have not had as much adoption as Ethereum. Ethereum’s coding language, Solidity, is also the most used in the industry, allowing developers to easily create smart contracts that can be deployed directly to the Ethereum Blockchain.
Important Concepts
Smart contracts are a very intricate technology that comes with vocabulary that may seem overwhelming to those not familiar. Below are a few key terms that are important when trying to understand smart contracts:
- Native Token: The inherent currency of a blockchain — also called a protocol token. For example, Ether is the native token for Ethereum and ADA for Cardano. Native tokens have two primary purposes:
1) to serve as reserve currencies used for transaction fees, convertibility between currencies, and 2) provide liquidity for other non-native tokens as a part of an incentive scheme.
- Gas: A fee charged to transactors to successfully conduct each transaction in a secured and decentralized fashion on the Ethereum Blockchain. The price of gas is determined by the supply and demand within the network, which is measured by calculating the bandwidth and storage that every transaction requires. The fee is paid to miners as a reward for executing the transaction.
- Decentralized Application (DApp): An application that runs on a blockchain by creating a network of interfaces and tools interacting together. The network helps eradicate single-authority control and promotes decentralization.
- Off-chain: Transactions and functions offered outside the blockchain by using a third party (also called “oracles” — ex. Chainlink). Oracles can introduce off-chain data into the blockchain in order for a smart contract to be executed. This concept is gaining popularity since it offers further scalability, cost efficiency, and privacy.
- Block Explorer: A display for the front-end of a blockchain. Through block explorers, an individual can gain access to consensus data such as transactions data and status, miners, validators, etc.
- Solidity: A language used to implement smart contracts. It is the first and the most widely used language released with Ethereum. Its syntax is based on JavaScript, while it is also influenced by C++ and Python.
- Ethereum Virtual Machine (EVM): This is essentially a virtual computer running inside each Ethereum node. It allows smart contracts to be interpreted and then executed. Even though there are more virtual machines (running on the same principles), EVM is the most widely used.
Types of Smart Contracts
- Decentralized Autonomous Organization (DAO): A type of a governance community (with no central leadership) that has precoded rules through smart contracts, and any action taken by the members gets replaced by the self-executing code. Uniswap is the biggest DAO in terms of market capitalization.
- Smart Legal Contracts: These contracts, the most common one, are enforced legally where all parties need to fulfill their contractual obligations. If the obligations are not met, it may result in legal actions that are automatically triggered against them.
- Application Logic Contracts: Application-based codes that are connected to other blockchain-based contracts, and help enable communication between the blockchain technology and the Internet of Things (IoT).
- ERC20: A contract that has gained a lot of popularity in recent years and has a digital currency associated with a smart contract. The ERC20 tokens are created to create economic security for a project through incentives.
- ERC721: A contract that is commonly used for gaming and NFTs, as it helps create non-fungible (unique & indivisible) tokens.
Disclaimer: This is not an exhaustive list. There are other types of smart contracts and this list only contains the most common ones.
Limitations of Smart Contracts
Although smart contracts have made tremendous progress in development and providing definitive solutions when implemented and rewarding users or triggering events, there still remains room for further development.
The current preference of cybersecurity firm Open Zeppelin’s ERC-721Enumerable smart contract has inefficiencies in data storage and minting. Data including ownership, individual traits about a certain Non-Fungible Token (NFT), and how many NFTs is a wallet minting currently generate lots of data for miners to confirm. Currently, some developers and NFT Collections are working towards creating more efficient smart contracts for NFT minting. They have recently focused on lowering gas fees when minting multiple NFTs at a time and removing unnecessary metadata on-chain. While smart contract improvements have allowed minters to save on gas fees, there are further optimizations possible when developing and deploying contracts.
NFTChance provides multiple coding suggestions for smart contract cost optimizations such as allowing solidity to optimize the contracts when compiling them.
Smart contracts are also limited to the rules that are encoded. Smart contracts do help mediation and can create definitive decisions when an event occurs; however, this does not completely remove the need for a possible intermediary to generate the “if X, then Y” outcomes between two parties entering into a smart contract agreement. Smart contracts cannot rely on ambiguity to generate an outcome, thus they are reliant on the proficiency of the developer of the smart contract and the definition of outcomes agreed upon by the two parties.
Smart contracts can process information that occurs on-chain as well as off-chain. When off-chain data is required, oracles are implemented, acting as an application programming interface (API) that can transfer data between the smart contract and events that occur outside the blockchain. It is important to implement secure oracles to send correct data to smart contracts to generate the correct outcomes. Smart contracts are bound by the accuracy of data provided by oracles at times. Effective oracle implementations are necessary to smart contract improvement. Smart contracts are limited to the inputs of coding development and oracles, requiring both to improve in order to improve overall smart contract specificity and efficiency.
Chainlink is currently the most used oracle provider for blockchains. Individual nodes extract data from various sources and confirm the accuracy of the data with multiple nodes, avoiding issues of centralized oracles by building decentralized confirmations. This data is relayed to oracles implemented into smart contracts that then perform actions based on the data and parameters encoded.
Industry Implementation
Since its introduction in the early 90s, smart contracts and their implementation have already seen prosperous growth in many industries today. The utilization of this technology has become a necessary tool for many industries such as finance, law, and many other prominent areas of work. While smart contracts have been able to help a multitude of industries in many ways, their fundamental capabilities of serving as a program stored on the blockchain that runs based on predetermined agreements are the core of its implementation.
In the area of finance, smart contracts have been utilized to execute financial deals without having the need of a central authority. This decentralized method of financial flow has allowed for two things: more security and less human labor. With encryption within the blockchain, the security concerns should be very minimal as the distributed nodes of blockchain make smart contracts very hard to breach. The entrusted security also reduces the need for a third party to overlook financial deals. With less single-party involvement, smart contracts alleviate security concerns and allow for smoother and more efficient deal agreements.
In the area of healthcare, smart contracts have allowed for tightened security when it comes to personal health data and being more efficient when dealing with patients. Healthcare data is confidential between patients and healthcare providers but we have seen cases where patients have had their personal information stolen when providing this data. In addition, the healthcare industry has the aspect of time constraints, as patients’ health and recovery may rely on how fast their data can be processed and transferred so they can be given the right treatment. Thus, the implementation of a fast and reliable system of smart contracts can move healthcare data from one department to another safely and efficiently.
So What?
Smart contracts have garnered the attention of many with this breakthrough technology. However, many are skeptical of the fast growth and are unsure of the legitimacy of this technology. One major barrier that hinders it to scale is the comparatively lower efficiency since most smart contracts used today are on-chain. A relevant comparison can be made to the internet: pre-internet era, there was essentially no interoperability between computers, and they were mainly used as independent systems for calculations. With further adoption of technology and the internet, computers became an integral part of our lives and were utilized to do things that were beyond our initial expectations. Like the internet growing to consist of Internet of Things (IoT) devices to connect to, smart contracts are able to connect data both on- and off-chain, creating an alternative protocol to increase functionality, storage capabilities, and thus the efficiency of the network.
The technology used in smart contracts is revolutionary as it allows safe transactions without having a third party supervising them. It is about time society’s dependence on the omnipresent middleman is removed and we build an efficient, decentralized method of transacting.
Written by our Micro 1 Research Team:
Lead Researcher: Shivaansh Garg
Research Analysts: Cooper Duschang & Kenji Lee