Smart Contract
Last Updated: October 30, 2026
Quick Answer: A smart contract is a program stored on a blockchain that runs automatically when predefined conditions are met, carrying out actions such as transferring tokens without an intermediary. Once deployed, its code and results are recorded on the blockchain and cannot be quietly changed. Smart contracts power tokens, decentralized exchanges, lending protocols and stablecoins: DeFi applications built on them held about $95.6 billion on October 30, 2026, according to DefiLlama.
Key Takeaways
- A smart contract is code plus data at a blockchain address; anyone can call its functions, and the network executes them exactly as written
- Ethereum popularized general purpose smart contracts, and its developer documentation defines one simply as “a program that runs on the Ethereum blockchain”
- Smart contracts cannot read real world data on their own; they rely on oracles for prices and other outside information
- Bugs are costly because deployed code is hard to change: DefiLlama’s hacks database counted about $7.9 billion stolen from DeFi protocols over time as of October 30, 2026
- “Smart contract” does not automatically mean “legal contract,” although the Law Commission of England and Wales concluded in 2021 that existing law can support smart legal contracts
How Smart Contracts Work
Smart contracts follow simple “if this, then that” logic. Computer scientist Nick Szabo defined a smart contract in a 1994 essay as “a computerized transaction protocol that executes the terms of a contract.” Ethereum’s documentation cites his comparison to a vending machine: put in the right input and a certain output is guaranteed. On a blockchain, the steps look like this:
- Write. A developer writes the contract in a language such as Solidity or Vyper for Ethereum, or Rust and Move on other networks. Solidity’s latest release, version 0.8.38, came out on October 22, 2026, according to its official site.
- Compile and deploy. The code is compiled to bytecode and sent to the network in a transaction that pays a gas fee. On Ethereum it runs inside the Ethereum Virtual Machine (EVM), which many other chains also use. A single Ethereum contract can be at most 24KB, according to ethereum.org.
- Call. Users and other contracts send transactions to the contract’s address. Every node runs the same code and reaches the same result, so no single party decides the outcome.
- Record. State changes, such as new balances, are written to the blockchain. They are public and, once final, cannot be reversed by the contract’s owner unless the code itself allows it.
Many contracts are upgradeable through proxy patterns or admin keys, which makes fixes possible but requires trust in whoever controls the upgrade.
Examples of Smart Contracts in 2026
| Use | How smart contracts are used | Example |
|---|---|---|
| Tokens | Track balances and transfers under a common standard | ERC-20 tokens and stablecoins |
| Decentralized exchanges | Pools that price and swap tokens automatically | Automated market makers |
| Lending | Accept collateral, issue loans and liquidate positions | Overcollateralized lending markets |
| Liquid staking | Pool deposits and issue a receipt token | Staked ETH tokens |
| NFTs | Record ownership of unique tokens | ERC-721 collections |
Scale of DeFi. DefiLlama showed about $95.6 billion locked in DeFi on October 30, 2026, with lending protocols at about $41.3 billion and liquid staking at about $35.8 billion. Stablecoins, which are themselves smart contract tokens on most networks, had a combined market value of about $315.9 billion. All of this is part of decentralized finance (DeFi).
Legal use. In its advice published on November 25, 2021, the Law Commission of England and Wales said that “the current legal framework in England and Wales is clearly able to facilitate and support the use of smart legal contracts,” without new legislation.
Limitations and Risks
Code is final, bugs included. A contract does what its code says, not what its developers intended. Logic errors, faulty math and access control mistakes have caused large losses; DefiLlama’s database counted about $16.9 billion stolen across all crypto hacks over time, with about $7.9 billion from DeFi and about $3.3 billion from bridges. Not every incident is a code bug, since some involve stolen private keys.
The oracle problem. Contracts cannot fetch web data themselves. An oracle supplies prices or events, and a manipulated or faulty feed can trigger wrong outcomes, such as unfair liquidations.
Admin keys and audits. Contracts that a small group can pause or upgrade are only as trustworthy as that group, and audited contracts have still been exploited.
Common Misconceptions
“Smart contracts are smart.” They have no judgment and cannot adapt to situations their code does not cover.
“Smart contracts are legally binding contracts.” Some are used to carry out legal agreements, but most are just software. Whether code is enforceable as a contract depends on the jurisdiction and the agreement around it.
“Only Ethereum has smart contracts.” Ethereum popularized them, but Solana, BNB Chain, Cardano, Tron, Avalanche and many layer 2 networks support them too.
Related Terms
- Ethereum Virtual Machine (EVM): the environment that runs Ethereum smart contracts
- Solidity: the most widely used language for EVM contracts
- Oracle: a service that feeds outside data to contracts
- ERC-20: the token standard implemented as a smart contract
Frequently Asked Questions
What is a smart contract in simple terms?
A smart contract is a program on a blockchain that runs by itself when set conditions are met. For example, it can release tokens once a payment arrives or swap one asset for another at a calculated price. Because every node runs the same code and records the result on the blockchain, no bank, broker or other intermediary is needed to carry out the agreement.
Who invented smart contracts?
Computer scientist Nick Szabo described smart contracts in a 1994 essay as computerized transaction protocols that execute the terms of a contract, and he compared them to vending machines. Bitcoin supports limited scripts, but Ethereum, which launched in July 2015, made general purpose smart contracts widely available by giving developers a full programming environment, the Ethereum Virtual Machine, on a public blockchain.
Can a smart contract be changed after deployment?
Deployed code cannot be edited directly. However, many projects use proxy contracts or admin functions that let a designated group replace the logic, pause the contract or change settings. This makes bug fixes possible but adds trust in the people holding those keys. Fully immutable contracts cannot be fixed, so any bug they contain stays there permanently.
Are smart contracts safe?
Smart contracts are only as safe as their code, their oracles and the people who control any admin keys. DefiLlama’s hacks database counted about $7.9 billion stolen from DeFi protocols over time as of October 30, 2026. Audits, bug bounties and long track records lower the risk, but they do not remove it, and losses are often unrecoverable.
Are smart contracts legally binding?
It depends on the jurisdiction and on whether the parties intended a legal agreement. In England and Wales, the Law Commission concluded in November 2021 that existing law can support smart legal contracts without new legislation. Most blockchain smart contracts, however, are simply software that moves digital assets, and they are not written as legal agreements between identified parties.
What does DeFi smart contract development involve?
Developers usually write DeFi contracts in Solidity or Vyper, then compile and test them on a local blockchain with frameworks such as Hardhat or Foundry, both listed on ethereum.org, before deploying to a test network. Contracts typically build on shared standards such as ERC-20 for tokens. Because deployed code controls user funds, teams usually add independent audits, bug bounties and upgrade or pause controls, each with trade offs.
Is smart contract trading the same as futures trading?
No. On many crypto exchanges, “contract trading” means trading futures or perpetual contracts, derivatives that let traders take positions on price moves, often with leverage. The CFTC defines a futures contract as an agreement to buy or sell a commodity for future delivery at a price set when the contract starts. Blockchain smart contracts are programs, although some decentralized derivatives exchanges are built on them.
Data sources: ethereum.org smart contract documentation, Solidity official site and release notes (October 22, 2026), DefiLlama DeFi, category, stablecoin and hacks data (October 30, 2026), Law Commission of England and Wales (November 25, 2021), ethereum.org development frameworks page and CFTC glossary (checked October 30, 2026).