A smart contract is a computer program stored and executed on a blockchain (Ethereum, Solana, Avalanche, etc.). It runs automatically when predefined conditions are met, without human intervention or trusted intermediary.
Concept invented by Nick Szabo in the 1990s but made real by Ethereum in 2015 with its Solidity language. Today, thousands of smart contracts collectively manage hundreds of billions of dollars.
Key characteristics:
- Deterministic: code always executes the same way for identical inputs
- Immutable: once deployed, code can't be modified (unless an upgrade function was explicitly coded)
- Trustless: no need to trust a third party, code is law
- Public and auditable: bytecode is visible to all on-chain, source code typically published on Etherscan
- Execution cost: every operation consumes gas paid in ETH (or equivalent on other chains)
Use cases:
- DEX (Uniswap, PancakeSwap): automatic buyer/seller matching without an order book
- Decentralized lending (Aave, Compound): over-collateralized loans with automatic liquidation
- Decentralized stablecoins (DAI, LUSD): minting against crypto collateral
- NFTs: ERC-721/1155 standards implemented as smart contracts
- DAOs: on-chain organizational governance via weighted voting
Risks: a code bug = unrecoverable losses. Famous cases: DAO hack 2016 ($60M stolen via reentrancy), Wormhole 2022 ($320M), Ronin 2022 ($625M). Always prefer protocols audited by multiple independent firms (Trail of Bits, OpenZeppelin, ConsenSys Diligence) with a TVL history > $1B for 1+ year.