Analyses
11
May
what is smart contract

This website has affiliate links. We may receive compensation if you visit partners we recommend. Read more about our advertising principles from the About Us page.

Smart contracts explained

Smart contracts are self-executing programs that run on a blockchain. Smart contracts are written in a programming language specific to the blockchain they are deployed on. Smart contracts cannot access external data and real-world information by default.

The key features of smart contracts are immutability, transparency, and self-execution. Smart contracts and decentralized applications (Dapps) are different concepts, although they are often used interchangeably.

Smart contracts have the potential to revolutionize various industries by increasing efficiency, reducing costs, and mitigating risk. While smart contracts offer numerous benefits, they also face specific challenges and limitations that must be acknowledged.

Smart contracts have already showcased their potential to revolutionize industries.

What are smart contracts?

Smart contracts are self-executing programs that run on a blockchain. Smart contracts allow the automated execution of transactions and agreements between parties without intermediaries. However, while smart contracts are described as “smart” and “contracts,” these terms can be misleading.

Firstly, the term “smart” in smart contracts does not imply inherent intelligence or decision-making capabilities. Smart contracts are only as smart as the code that defines them and the rules they are programmed to follow. The execution of a smart contract does not involve subjective judgment.

Secondly, while smart contracts are often referred to as contracts, they may not always resemble legal contracts. Smart contracts are essentially pieces of code that automate the execution of predefined actions.

Computer scientist Nick Szabo first introduced the concept of smart contracts in the 1990s. But, it wasn’t until the development of blockchain technology that smart contracts became a practical reality.

The Ethereum blockchain, launched in 2015, was the first platform to introduce smart contracts as a core feature. Since then, many other blockchain platforms have followed suit.

Below is a list of the five most popular smart contract platforms sorted by total liquidity (TVL).

PlatformNative tokenTVLMarket share
Ethereum ETH $50.3 billion 57.0%
Tron TRX $9.5 billion 10.7%
BNB Chain BNB $5.7 billion 6.3%
Solana SOL $4.6 billion 5.2%
Arbitrum ARB $3.2 billion 3.6%
Blast BLAST $1.3 billion 1.5%
Avalanche AVAX 1.2 billion 1.4%
Base - 1.2 billion 1.3%

While Bitcoin also utilizes a blockchain, it does not support the level of programmability of Ethereum and other smart contract platforms. Bitcoin’s scripting language is limited in its capabilities and wasn’t designed with smart contracts in mind.

How are smart contracts created?

Smart contracts are written in a programming language specific to the blockchain they are deployed on. Next, we’ll explain the creation and implementation of smart contracts on the Ethereum blockchain. The process is similar to other smart contract platforms.

On Ethereum, smart contracts are written in a programming language called Solidity. Solidity is a high-level, statically typed language explicitly designed for creating smart contracts.

Below is an example of a function written in Solidity.

smart contract solidity code

Once the Solidity code is written, it needs to be compiled into bytecode that can be executed by the Ethereum Virtual Machine (EVM). The EVM is a runtime environment within the Ethereum network that runs smart contracts. Every node of the Ethereum network runs an identical copy of the EVM.

Next, the smart contract is deployed on the Ethereum blockchain. This deployment process involves creating a transaction that includes the bytecode of the smart contract. The transaction is then broadcast to the Ethereum network.

Validators on the Ethereum network include the broadcasted transaction into a new blockchain block.  This is when the smart contract becomes accessible to all participants on the network. The smart contract also becomes immutable, which means its code cannot be changed.

What if a bug in a smart contract or a new version of the code is launched? This requires creating a new smart contract. If there are funds stored in the old smart contract, they must also be moved to the new one.

Smart contracts need oracles

Smart contracts cannot access external data and real-world information by default. This is where oracles come into play.

Oracles serve as bridges between smart contracts and the external world. Without oracles, smart contracts would be limited to using the blockchain data they are deployed on. There would be strict boundaries to what kind of applications could be built.

Here are five examples of data feeds smart contracts are using.

  • Cryptocurrency price data
  • Weather data
  • Sports and gaming data
  • IoT data
  • VRF (Verifiable Random Function)

It must be understood that using an oracle comes with risks because an oracle can jeopardize the integrity of a smart contract. This can happen if the data comes from a single, trusted source.

Chainlink has solved the data integrity issue. Chainlink has built a decentralized network of oracles to source data from multiple independent sources. By aggregating data from various providers, Chainlink ensures data accuracy and minimizes the risk of corruption.

chainlink oracles

Chainlink has emerged as the leading oracle provider. More than a thousand decentralized applications use Chainlink’s decentralized oracle networks. It has become a crucial piece of the DeFi infrastructure. Read more about oracles from our Chainlink guide.

Key features of smart contracts

The key features of smart contracts are immutability, transparency, and self-execution. These features set smart contracts apart from traditional contracts. Let’s explore these features next.

One of the defining characteristics of smart contracts is their immutability. Once a smart contract is deployed on a blockchain, its code and logic cannot be altered. This immutability ensures that the terms and conditions defined within the contract cannot be tampered with.

Immutability is an essential feature of DeFi (decentralized finance) applications. Below is a picture of Aave, a popular DeFi loan application. Without the immutability of smart contracts, Aave and other DeFi apps couldn’t exist.

aave app

Transparency of smart contracts means that the program code and transaction history are visible to anyone on the blockchain. All participants can verify and audit the execution of a smart contract. This eliminates the need for intermediaries or third-party verifications.

You might have heard of smart contracts audits, though. These refer to the audits of the program code of the smart contract before it is deployed on the blockchain. The purpose of the audits is to find critical bugs and logical flaws.

Smart contracts are designed to be self-executing programs that commit predefined conditions and actions. Once the specified conditions are met, the smart contract automatically executes the agreed-upon actions. This eliminates the need for manual intervention.

Self-execution reduces human error, streamlines processes, and enhances efficiency. DeFi apps are great examples of these benefits. They are fully automated applications that require no human intervention at any stage.

Smart contracts vs. Dapps

Smart contracts and decentralized applications (Dapps) are different concepts, although they are often used interchangeably.

The main difference between smart contracts and Dapps is that smart contracts are self-contained pieces of code that execute predefined functions. DApps, on the other hand, are more complex applications that utilize smart contracts for their functionality. Smart contracts can be thought of as the building blocks of Dapps.

The picture below shows popular Dapps listed on dappradar.com.

smart contract dapps

Dapps typically have a user interface or front-end that interacts with smart contracts. Several front-ends could also be built to interact with the same smart contracts.

Examples of smart contract applications

Smart contracts have the potential to revolutionize various industries by increasing efficiency, reducing costs, and mitigating risk. This chapter will explore four real-world examples of how smart contracts can be used.

  1. Finance
  2. NFTs
  3. Real Estate
  4. Supply chain management

Smart contracts can be used in finance to automate various processes, such as loan disbursement, asset management, and insurance. For example, a smart contract can automatically disburse a loan to a borrower once predefined conditions are met, such as a specified credit score or collateral. This automation can increase efficiency and reduce manual verification and processing costs.

Decentralized Finance (DeFi) is already a 50-billion-dollar industry built entirely on using smart contracts. There are hundreds of decentralized finance services that are used by millions of investors. Read more about this industry from our article What is DeFi?

Below is a list of the five most popular DeFi categories sorted by total liquidity.

CategoryTVL
Liquid staking $17.8 billion
Dexes $17.5 billion
Lending $14.3 billion
Bridge $12.4 billion
CDP $10.1 billion

Smart contracts are also used to create and manage NFTs, providing a secure and transparent way to track ownership and transfer of these assets. When an NFT is made, a smart contract is deployed on the blockchain that defines the ownership, transfer, and other relevant information about the asset.

The NFT industry has use cases such as digital art, gaming, tokenized real-world assets, and even tickets.

In real estate, smart contracts can automate the sale and purchase of properties. A smart contract can automatically transfer property ownership to the buyer once the purchase price is paid, eliminating the need for intermediaries such as lawyers and escrow agents. This automation can reduce costs and increase the speed of the transaction.

Smart contracts can be used in supply chain management to improve transparency and traceability. A smart contract can track the movement of goods from the point of origin to the destination, ensuring that all parties involved in the supply chain have access to the same information. This can reduce the risk of fraud and errors and increase efficiency.

Challenges and limitations of smart contracts

While smart contracts offer numerous benefits, they also face specific challenges and limitations that must be acknowledged. Here are four examples of the challenges and constraints of smart contracts.

  1. Scalability
  2. Vulnerabilities
  3. Regulation
  4. Interoperability

Once blockchains grow in popularity and usage, scalability becomes a significant challenge. Many smart contract platforms have faced scalability issues regarding transaction processing speed and network capacity.

Since human developers code smart contracts, they will always contain bugs. In 2022, smart contract exploits cost 2.8 billion dollars to investors. The security practices of the industry must be improved in the future.

The regulatory frameworks surrounding decentralized apps are still evolving in many jurisdictions. Determining the enforceability of smart contracts and resolving disputes present challenges within existing legal systems.

Interoperability refers to the ability of different blockchains to work together. Currently, there is a lack of standardization and interoperability protocols. This has led to the building of smart contract bridges, which have proven vulnerable to exploits. The interoperability between smart contract platforms must improve before larger-scale adoption is possible.

The future of smart contracts

Smart contracts have already showcased their potential to revolutionize industries. However, some use cases can become even more popular in the future. Next, we will explore four potential future applications of smart contracts.

  1. Internet of Things (IoT)
  2. Tokenization of real-world assets
  3. NFTs
  4. DeFi

Smart contracts can be utilized in IoT to automate and streamline interactions between connected devices. Smart devices can autonomously execute actions based on predefined conditions. The IoT industry has almost endless use cases for blockchain-based applications.

The tokenization of real-world assets has gained traction, but its full potential is yet to be realized. Smart contracts enable the fractional ownership of assets such as real estate, artworks, or intellectual property rights. In theory, every single asset in the world could be tokenized.

The growth of the non-fungible token sector is expected to continue. NFTs have gained attention in art, collectibles, and gaming. NFTs can extend to more domains, including music, virtual worlds, and licensing rights. Smart contracts are used to create NFTs and facilitate their transactions.

DeFi has already seen significant growth, but it has the potential to bring financial services to billions of unbanked people. These innovations can increase financial inclusivity, reduce reliance on intermediaries, and provide more efficient and transparent economic systems. Smart contracts are the building blocks of every single DeFi application.

Antti Hyppänen

Antti Hyppänen is the founder and editor-in-chief of AboutBitcoin.io. Antti has written articles about cryptos since 2017. He follows the crypto market every day of the year and is responsible for the daily operations of AboutBitcoin. Antti is not a maximalist regarding any cryptocurrency but looks at the industry objectively. Antti’s investment profile is “buy & hold,” i.e., he does not trade or use leverage. His crypto portfolio consists of mainly Bitcoin and Ethereum. Antti also follows macroeconomic events. In addition to cryptos, his interests include gold, silver, and the US stock market.