Smart Contract
Last Updated: November 16, 2026
A smart contract is a program stored on a blockchain. It runs on its own when set conditions are met, for example to send tokens, with no middleman. Once it is live, its code and results are recorded on the blockchain and cannot be quietly changed. Smart contracts power tokens, decentralized exchanges, lending apps and stablecoins. DeFi apps built on them held about $71.0 billion on November 16, 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 runs them exactly as written
- Ethereum made general purpose smart contracts popular. 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 live 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 always mean “legal contract.” Still, 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 vending machine example: put in the right input and you are sure to get a set output. 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 can be upgraded through proxy patterns or admin keys. That makes fixes possible, but users must trust whoever controls the upgrade. This is the main practical limit on immutability.
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 $71.0 billion locked in DeFi on November 16, 2026 in its default view. That was down from about $81.1 billion on October 30. Stablecoins are smart contract tokens on most networks too. Their combined market value was about $287.1 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 lists about $27.6 billion stolen across all crypto hacks as of November 16, 2026. That includes about $9.3 billion from DeFi protocols and about $3.7 billion from bridge hacks. Not every case is a code bug. Some involve stolen private keys.
Famous failures. The 2016 attack on The DAO drained about 3.6 million ETH through a reentrancy bug. It led to the hard fork that split Ethereum and Ethereum Classic. Flash loan attacks show a newer pattern: an attacker borrows a large sum inside one transaction, moves prices in a weak contract, then repays the loan.
The oracle problem. Contracts cannot fetch web data themselves. An oracle supplies prices or events. A rigged 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 can be enforced as a contract depends on where you are and the agreement around it.
“Only Ethereum has smart contracts.” Ethereum made them popular, but Solana, BNB Chain, Cardano, Tron, Avalanche and many layer 2 networks support them too.
Related Terms
- Ethereum Virtual Machine (EVM): the system 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. Every node runs the same code and records the result on the blockchain. So no bank, broker or other middleman is needed to carry out the agreement.
Who invented smart contracts?
Computer scientist Nick Szabo described smart contracts in a 1994 essay. He called them computerized transaction protocols that execute the terms of a contract, and he compared them to vending machines. Bitcoin supports limited scripts. Ethereum, which launched in July 2015, made general purpose smart contracts widely available. It gave 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. But many projects use proxy contracts or admin functions. These let a chosen group replace the logic, pause the contract or change settings. This makes bug fixes possible, but users must trust the people holding those keys. Fully immutable contracts cannot be fixed, so any bug in them stays there for good.
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 lists about $9.3 billion stolen from DeFi protocols over time as of November 16, 2026. Audits, bug bounties and long track records lower the risk, but they do not remove it. Losses often cannot be recovered.
Are smart contracts legally binding?
It depends on where you are and on whether the parties meant to make 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, though, are simply software that moves digital assets. They are not written as legal agreements between named parties.
What does DeFi smart contract development involve?
Developers usually write DeFi contracts in Solidity or Vyper. They compile and test them on a local blockchain with tools such as Hardhat or Foundry, both listed on ethereum.org. Then they deploy to a test network. Contracts usually build on shared standards such as ERC-20 for tokens. Live code controls user funds, so teams often add audits, bug bounties and upgrade or pause controls. Each has trade offs.
Is smart contract trading the same as futures trading?
No. On many crypto exchanges, “contract trading” means trading futures or perpetual contracts. These are 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. Some decentralized derivatives exchanges are built on them, though.
Data sources: ethereum.org smart contract documentation, Solidity official site and release notes (latest release October 22, 2026, checked November 16, 2026), DefiLlama DeFi, stablecoin and hacks data (November 16, 2026, about 19:40 UTC), Law Commission of England and Wales (November 25, 2021), ethereum.org development frameworks page and CFTC glossary (checked October 30, 2026).