What Are Smart Contracts in Blockchain? | Chainlink (2024)

What Is a Smart Contract?

Smart contracts are computer programs that are hosted and executed on a blockchain network. Each smart contract consists of code specifying predetermined conditions that, when met, trigger outcomes. By running on a decentralized blockchain instead of a centralized server, smart contracts allow multiple parties to come to a shared result in an accurate, timely, and tamper-proof manner.

Smart contracts are a powerful infrastructure for automation because they are not controlled by a central administrator and are not vulnerable to single points of attack by malicious entities. When applied to multi-party digital agreements, smart contract applications can reduce counterparty risk, increase efficiency, lower costs, and provide new levels of transparency into processes.

Blockchains and Smart Contracts

Smart contract-enabled blockchains unlock the ability for developers to write arbitrary application logic on top of the decentralized consensus that blockchains natively provide. That’s why blockchains, smart contracts, and applications can be thought of in terms of a hierarchical relationship: Applications (including tokens) are created by the code from a smart contract (or multiple connected smart contracts). The actions defined in a smart contract are, in turn, executed and stored by the underlying blockchain network.

How Smart Contracts Work

Smart contracts are tamper-proof programs on blockchains with the following logic: “if/when x event happens, then execute y action.” One smart contract can have multiple different conditions and one application can have multiple different smart contracts to support an interconnected set of processes. There are also multiple smart contract languages for programming, with Ethereum’s Solidity being the most popular.

Any developer can create a smart contract and deploy it on a public blockchain for their own purposes, e.g., a personal yield aggregator that automatically shifts their funds to the highest-earning application. However, many smart contracts involve multiple independent parties that may or may not know one another and don’t necessarily trust one another. The smart contract defines exactly how users can interact with it, involving who can interact with the smart contract, at what times, and what inputs result in what outputs. The result is multi-party digital agreements that evolve from today’s probabilistic state, where they will probably execute as desired, to a new deterministic state where they are guaranteed to execute according to their code.

Do All Blockchains Have Smart Contracts?

Not all blockchains can run smart contracts. While blockchains and layer-2 networks including Arbitrum, Avalanche, Base, BNB Chain, and Ethereum are examples of smart-contract-compatible blockchains, blockchains like the base Bitcoin blockchain do not have native smart contract capability. The key difference between these blockchains is the ability of an underlying blockchain to execute and store arbitrary logic.

History of Smart Contracts

Smart contracts were first coined by American computer scientist Nick Szabo in 1994. In his seminal writing, he gave a broad smart contract definition as follows: “a computerized transaction protocol that executes the terms of a contract,” with general objectives to “satisfy common contractual conditions, minimize exceptions both malicious and accidental, and minimize the need for trusted intermediaries.

While a general notion of smart contracts could be seen in systems like vending machines (e.g., a specific code leads to an expected snack), blockchains formed the foundation of smart contracts that were digital, tamper-proof, and permissionless. The introduction of the Bitcoin blockchain in 2009 supported arguably the first protocol smart contract—establishing a set of conditions that had to be satisfied to transfer Bitcoins between users on the network. These conditions include the user signing the transaction with the correct private key that matches their public address (akin to a password linked to a specific account) and the user owning enough funds to cover the transaction.

The Bitcoin blockchain then evolved to offer another major type of smart contract in 2012 called a multi-signature transaction. A multisig transaction requires a defined number of people (public keys) to sign a transaction with their private keys before it’s considered valid. This increases the security of user funds by mitigating single point of failures like a stolen or lost private key.

What Are Smart Contracts in Blockchain? | Chainlink (1)

Blockchains began to experiment over the next few years by adding new programmatic conditions (called operation codes or opcodes). However, the next major leap in smart contracts came upon the publishing of the Ethereum whitepaper by Vitalik Buterin in 2013. In 2015, Ethereum launched as a new type of blockchain for programmable smart contracts. Instead of the blockchain acting effectively as a single smart contract application or offering a few limited opcodes, the Ethereum smart contract blockchain offered a “world computer” that could run many independent smart contracts at the same time.

Smart Contract Examples

One purpose of a smart contract is to automate a specific business process between a distinct group of entities. These entities collectively come to an agreement on all the smart contract’s terms like payouts, process flow, and dispute resolutions. A simple smart contract example for global trade may have terms like:

  • Term 1: If the goods arrive on time, then execute a payment from the retailer to the supplier in full amount.
  • Term 2: If the goods arrive one day late, then execute a payment from the retailer to the supplier for 98% of the full amount.

Other smart contracts support public decentralized applications (dApps) that anyone can interact with without needing any permissions. Public dApps are often open-source so anyone in the world can inspect exactly how they function before deciding whether or not to interact with them. One example of a public dApp is a decentralized lending/borrowing market, which may have the following terms:

  • Term 1: If the user deposits collateral into the specific smart contract, they can receive a loan that’s up to 50% of the value of their collateral (i.e., $100 deposit can borrow up to a $50 loan).
  • Term 2: If the user’s collateralization ratio (collateral/outstanding loan value) drops below 200%, then the user’s collateral is automatically liquidated and transferred to the lenders to ensure they don’t lose money.
  • Term 3: Lenders can deposit funds into a specific contract that other users can borrow from at predefined collateralization ratios, while the lender receives a claim to a portion of the interest rate payments.

Enforceability of Smart Contracts

Because they run on top of blockchains, smart contracts are automatically and deterministically executed exactly as programmed. In the context of enforcement, this hypothetically means that no party involved in a smart contract transaction can change its outcome or renege on terms outlined in a smart contract.

Effectively, it’s possible for smart contracts—with the right design—to eliminate counterparty risk, often defined as the percentage risk that a counterparty will not fulfill its obligations. However, smart contracts introduce smart contract risk, or the risk that a smart contract’s code has an exploit or flaw that results in undesirable outcomes. Smart contracts always run as programmed, so if the program is faulty, then the smart contract will run the faulty code as expected.

Another key consideration for smart contract enforceability is that some contracts are simply unenforceable through code. A key example is lending—DeFi protocols almost exclusively offer overcollateralized loans, where a borrower must put in >$100 to borrow $100, because there is no way to guarantee that a lender will pay back a loan unless the full amount is already in a smart contract. In these cases, the combination of smart contracts and offchain systems such as credit scores, proof of funds, and legal contracts can provide a defense-in-depth approach to mitigating counterparty risk.

Smart Contract Benefits and Limitations

Smart contracts undoubtedly offer the world a safer, more verifiable way of creating societal agreements that involve the transfer of value and data. However, the landscape of blockchains and smart contracts is still nascent, and developers must face a variety of limitations as they look to build out the vision of the verifiable web.

Smart Contract Benefits

Most traditional digital agreements involve two parties that don’t know each other, introducing risk that either participant won’t uphold their commitments. To resolve counterparty risk, digital agreements are often hosted and executed by larger, centralized institutions like a bank that can enforce the contract’s terms. These digital contracts can be directly between a user and a large company or involve a large company acting as a trusted intermediary between two users. While this dynamic allows many contracts to exist that otherwise wouldn’t take on such risk, it also creates a situation where the larger, centralized institutions exert asymmetrical influence over the contracts.

What Are Smart Contracts in Blockchain? | Chainlink (2)

Smart contracts improve upon digital agreements by offering several advantages.

  • Security – Running the contract on decentralized blockchain infrastructure ensures there is no central point of failure to attack, no centralized intermediary to bribe, and no mechanism for either party or a central admin to use to tamper with the outcome.
  • Reliability – Having the contract logic redundantly processed and verified by a decentralized network of nodes provides strong tamper-proof, uptime, and correctness guarantees that the contract will execute on time according to its terms.
  • Equitable – Using a decentralized network to host and enforce the terms of the agreement reduces the ability of a for-profit middleman to use their position of privilege to rent-seek and siphon off value.
  • Efficiency – Automating the backend processes of the agreement—escrow, maintenance, execution, and/or settlement—means neither party has to wait for manual data to be entered, the counterparty to fulfill their obligations, or a middleman to process the transaction.

Smart Contract Limitations

A hallmark limitation of smart contract development is their immutable nature: Once created, smart contract code cannot be changed. This can be viewed as both a powerful feature and a fundamental limitation: Immutable applications operate automatically for as long as the blockchain it runs on is live, but they cannot be upgraded for new features, functionality, bug fixes, or expansions. This highlights another limitation and risk for smart contracts—a smart contract that’s deployed with an undiscovered bug or exploit cannot be changed in a timely manner (or sometimes at all), making smart contract audits a core part of the smart contract development process.

One workaround that many developers use to combat this limitation is creating upgradable smart contracts, where a proxy contract is used to point to a new, updated smart contract. This does not break smart contract immutability, but rather unlocks the ability to direct users to a new, upgraded smart contract.

Smart Contract and Offchain Resources

Blockchains are isolated networks, meaning blockchains have no built-in connection to the outside world. Without external connectivity, smart contracts cannot communicate with external systems to confirm the occurrence of real-world events nor can they access cost-efficient computational resources. Similar to a computer without the Internet, smart contracts are extremely limited without real-world connectivity. For example, they can’t know the price of an asset before executing a trade, they can’t check the average monthly rainfall before paying out a crop insurance claim, and they cannot verify that goods have arrived before settling with a supplier.

Thus, the major evolution underway in the blockchain industry is programmable smart contracts that connect with real-world data and traditional systems outside a blockchain, expanding the inputs and outputs used within smart contract logic. These hybrid smart contracts use Chainlink to combine on-chain code with off-chain infrastructure—e.g., trigger a smart contract with external data or settle a contract off-chain on a traditional payment rail.

What Are Smart Contracts in Blockchain? | Chainlink (3)

Similar to the Internet’s effect on computers, Chainlink’s decentralized computing platform is the key to connecting emerging blockchain networks with today’s legacy systems to enable interconnected, performant, and privacy-preserving smart contracts that retain the security and reliability of the underlying blockchain network. By enabling externally connected smart contracts, Chainlink greatly expands and enhances the valuable properties of blockchains, leading to superior, verifiable digital agreements across more industries and use cases.

Smart Contract Use Cases

Rights Management (Tokens)

Token smart contracts are used to create, track, and assign ownership rights to specific digital tokens existing on blockchain networks. The token contract programs functionalities into the tokens it issues, providing holders features like utility/insurance in a dApp (utility token), voting weight in a protocol (governance token), equity in a company (security token), ownership claim to a unique real-world or digital asset (non-fungible token), and more. For example, the FIL token is used to pay for Filecoin’s decentralized storage services and the COMP token allows users to participate in the governance of Compound protocol.

Financial Products (DeFi)

Decentralized finance (DeFi) consists of applications that use smart contracts to recreate traditional financial products and services such as money markets, options, stablecoins, exchanges, and asset management, as well as combine multiple services to create new financial primitives via permissionless composability. The smart contract can hold user’s funds in escrow and distribute them between users based on predefined conditions. For example, BarnBridge uses smart contracts to automate trades for users wanting fixed asset exposure to a price pair (e.g., 45% token A, 55% token B), and Aave uses smart contracts to facilitate lending and borrowing in a permissionless and decentralized manner.

What Are Smart Contracts in Blockchain? | Chainlink (4)

Gaming and NFTs

Blockchain-based games use smart contracts for tamper-proof execution of in-game actions. One example is PoolTogether, a no-loss savings game where users stake their funds in a shared pool that is then routed into a money market where it earns interest. After a predefined time period, the game ends and a winner is randomly awarded all the accrued interest while everyone else can withdraw their original deposit. Similarly, limited-edition NFTs can have fair distribution models and RPGs can support unpredictable loot drops using randomness, helping to ensure all users have a fair shot at getting rare digital assets. Many projects access randomness using Chainlink Verifiable Random Function (VRF)—a random number generator (RNG) that uses cryptography to prove it's tamper-proof, meaning the RNG process is publicly auditable.

What Are Smart Contracts in Blockchain? | Chainlink (5)

Insurance

Parametric insurance is a type of insurance where a payout is tied directly to a specific predefined event. Smart contracts provide tamper-proof infrastructure for creating parametric insurance contracts that trigger based on data inputs. For example, crop insurance can be created using smart contracts, where a user purchases a policy based on specific weather information like seasonal rainfall in a geographic location. At the end of the policy, the smart contract will automatically issue a payout if the amount of rainfall in the specific location exceeds the original stated amount. Not only do end-users receive timely payouts with less overhead, but the supply side of insurance can become open to the public via smart contracts. The smart contract allows users to deposit funds into a pool and then distributes collected premiums to pool participants based on the percentage of their contribution to the pool.

What Are Smart Contracts in Blockchain? | Chainlink (6)

{{cta-block}}

Frequently Asked Questions (FAQ) on Smart Contracts

How Do I Create a Smart Contract?

Creating a smart contract requires preliminary knowledge of smart contract development. This blog provides an example of a bare-bones, “Hello World” smart contract written in Solidity.

How Do I Deploy a Smart Contract?

Much of smart contract development happens on test networks (testnets), where developers test their code before deploying on mainnet. Read this blog for a guide to deploying your first smart contract.

How Are Smart Contracts Executed?

Smart contracts require an external party to trigger functions based on preset triggers, which requires a dedicated automation service. To learn how to automatically execute smart contract functions, read this blog.

How Do I Audit a Smart Contract?

Smart contract security isn’t just a nice-to-have, it’s a necessity. Learn the basics of auditing smart contracts by reading this blog.

How Do I Start Learning Smart Contract Development?

One of the best resources for getting up to date on smart contract development this Chainlink smart contract bootcamp, which provides step-by-step guidance on the basics of smart contract coding.

What Is a Smart Contract ABI?

ABIs are application binary interfaces. They define the methods and variables that are available in a smart contract and which we can use to interact with that smart contract. For a deeper dive on Solidity, the Ethereum Virtual Machine (EVM), bytecode, and ABIs, read this blog.

What Is a Smart Contract Oracle?

Smart contract oracles provide smart contracts with a connection to offchain data, compute, and systems, which is necessary for developers to build real-world use cases.

What Is the Best Smart Contract Programming Language?

There are a variety of popular smart contract programming languages, including Solidity, Vyper, Rust, and more. This blog walks through the most popular programming languages.

What Are Smart Contracts in Blockchain? | Chainlink (2024)

FAQs

What Are Smart Contracts in Blockchain? | Chainlink? ›

What are smart contracts? Smart contracts are digital contracts stored on a blockchain that are automatically executed when predetermined terms and conditions are met.

What are smart contracts in blockchain? ›

A smart contract is a self-executing program that automates the actions required in a blockchain transaction. Once completed, the transactions are trackable and irreversible.

What are smart contracts in blockchain medium? ›

Smart contracts are self-executing contracts with the terms of the agreement directly written into code. They run on blockchain technology, which is a decentralized and immutable ledger.

What is the most used blockchain for smart contracts? ›

Ethereum is the world's first and one of the best smart contract platforms which remains the most popular choice among developers. Following Bitcoin's decentralized concept, Ethereum has become a leader in smart contract platforms. Since its inception in 2015, the platform has launched more than 4,400 dApps.

What is smart contract in blockchain Javatpoint? ›

For instance, if a certain set of circ*mstances are satisfied, a smart contract may be set up to automatically transfer money from one party to another. There are several applications for smart contracts, including supply chain management, real estate transactions, and digital identity verification.

How many smart contracts are there in blockchain? ›

A Flipside Crypto report shows that over 637 million Ethereum Virtual Machine (EVM) smart contracts have been deployed across seven layer-2 blockchains since January 2022. EVM-compatible smart contracts refer to software that the computing state of the Ethereum blockchain can understand.

What is blockchain in simple words? ›

Blockchain is a shared, immutable ledger that facilitates the process of recording transactions and tracking assets in a business network. asset can be tangible (a house, car, cash, land) or intangible (intellectual property, patents, copyrights, branding).

How to understand smart contracts? ›

A smart contract works by monitoring the blockchain or other credible information source for certain conditions or triggers. These triggers can include almost anything that can be verified digitally—a date reached, a payment completed, a monthly bill received, or any other verifiable event.

How do you write a smart contract for blockchain? ›

How to create a smart contract
  1. The concept. The first step is defining what you want your contract to do. ...
  2. The coding. Next is the process of actually coding your smart contract using a programming language. ...
  3. The testing. ...
  4. Compiling. ...
  5. Deploying. ...
  6. Follow through. ...
  7. Costs in dollars and cents.

Do you need blockchain for smart contracts? ›

Smart Contracts cannot function without Blockchain

Smart contracts cannot work without blockchain technology, as blokchain's unique features allows contracts to be conducted and executed without a third party.

What are examples of smart contracts? ›

Now you understand how smart contracts work, let's look at some smart contract examples from the real world.
  • Clinical trials. Data sharing between institutions is vital to effective clinical trials. ...
  • Music industry. ...
  • Supply chain management. ...
  • Property ownership. ...
  • Mortgages. ...
  • Retail. ...
  • Digital identity. ...
  • Recording financial data.

How do I find smart contracts on blockchain? ›

An individual can see the transaction record for a smart contract that occurred on the blockchain by looking at a block explorer. In the figures below, we discuss the information available for smart contracts on the Ethereum Blockchain as shown on numerous websites such as www.etherscan.io.

What is smart contract in blockchain medium? ›

A smart contract is a digital agreement written in code and executed automatically on a blockchain. It allows parties to exchange assets or information transparently without intermediaries, ensuring a conflict-free process.

What are smart contracts in blockchain in simple words? ›

A Smart Contract in Blockchain explained

A Smart Contract (or crypto contract) is a computer software that manages the transfer of digital assets between a peer-to-peer network of involved parties directly and automatically under specific conditions.

What are the benefits of a smart contract? ›

Smart contracts leave no room for tinkering or forgery. The computer code on the blockchain is fixed and cannot be altered. Once the code is written, and the contract is deployed, it can only execute the agreement as it was coded.

Is bitcoin a smart contract? ›

Bitcoin does have simple smart contracts on its mainchain, in addition to more complex smart contract functionality that is programmed with Bitcoin layers.

What is a real world example of a smart contract? ›

Examples of smart contract applications include financial purposes like trading, investing, lending, and borrowing. They can be used for applications in gaming, healthcare, and real estate; and they can even be used to configure entire corporate structures.

What is smart contract cryptocurrency example? ›

This type of smart contract is especially relevant in legal and real estate industries, where trust and compliance are paramount. For example, a real estate transaction can be facilitated using a smart legal contract, ensuring that the property title is automatically transferred once payment is received.

What is the primary purpose of smart contracts in Web3? ›

The main goal of these contracts is to increase security and reduce transaction costs associated with traditional contracts. Their code contains a set of rules outlining how the parties to the contract agree to interact with each other. If these rules are met, the contract is automatically enforced.

Top Articles
Criticism of Marxism
Roth IRAs: How to Open a Roth IRA Account With Merrill
English Bulldog Puppies For Sale Under 1000 In Florida
Katie Pavlich Bikini Photos
Gamevault Agent
Pieology Nutrition Calculator Mobile
Hocus Pocus Showtimes Near Harkins Theatres Yuma Palms 14
Hendersonville (Tennessee) – Travel guide at Wikivoyage
Compare the Samsung Galaxy S24 - 256GB - Cobalt Violet vs Apple iPhone 16 Pro - 128GB - Desert Titanium | AT&T
Vardis Olive Garden (Georgioupolis, Kreta) ✈️ inkl. Flug buchen
Craigslist Dog Kennels For Sale
Things To Do In Atlanta Tomorrow Night
Non Sequitur
Crossword Nexus Solver
How To Cut Eelgrass Grounded
Pac Man Deviantart
Alexander Funeral Home Gallatin Obituaries
Energy Healing Conference Utah
Geometry Review Quiz 5 Answer Key
Hobby Stores Near Me Now
Icivics The Electoral Process Answer Key
Allybearloves
Bible Gateway passage: Revelation 3 - New Living Translation
Yisd Home Access Center
Pearson Correlation Coefficient
Home
Shadbase Get Out Of Jail
Gina Wilson Angle Addition Postulate
Celina Powell Lil Meech Video: A Controversial Encounter Shakes Social Media - Video Reddit Trend
Walmart Pharmacy Near Me Open
Marquette Gas Prices
A Christmas Horse - Alison Senxation
Ou Football Brainiacs
Access a Shared Resource | Computing for Arts + Sciences
Vera Bradley Factory Outlet Sunbury Products
Pixel Combat Unblocked
Movies - EPIC Theatres
Cvs Sport Physicals
Mercedes W204 Belt Diagram
Mia Malkova Bio, Net Worth, Age & More - Magzica
'Conan Exiles' 3.0 Guide: How To Unlock Spells And Sorcery
Teenbeautyfitness
Where Can I Cash A Huntington National Bank Check
Topos De Bolos Engraçados
Sand Castle Parents Guide
Gregory (Five Nights at Freddy's)
Grand Valley State University Library Hours
Hello – Cornerstone Chapel
Stoughton Commuter Rail Schedule
Nfsd Web Portal
Selly Medaline
Latest Posts
Article information

Author: Amb. Frankie Simonis

Last Updated:

Views: 6279

Rating: 4.6 / 5 (56 voted)

Reviews: 87% of readers found this page helpful

Author information

Name: Amb. Frankie Simonis

Birthday: 1998-02-19

Address: 64841 Delmar Isle, North Wiley, OR 74073

Phone: +17844167847676

Job: Forward IT Agent

Hobby: LARPing, Kitesurfing, Sewing, Digital arts, Sand art, Gardening, Dance

Introduction: My name is Amb. Frankie Simonis, I am a hilarious, enchanting, energetic, cooperative, innocent, cute, joyous person who loves writing and wants to share my knowledge and understanding with you.