A smart contract is a piece of code stored on a blockchain that automatically executes predefined actions when certain conditions are met. The concept was popularized by Ethereum, which was specifically designed to support these programmable agreements.
Think of a smart contract like a digital vending machine: you put in the right input (payment), and the machine automatically delivers the output (product) without any human intermediary. Once deployed on the blockchain, a smart contract runs exactly as programmed and cannot be altered or stopped by any single party.
Smart contracts power a wide range of applications:
- Decentralized finance (DeFi) – Lending, borrowing, and trading without banks. See our DeFi beginner's guide.
- NFTs – Creating, buying, and selling non-fungible tokens.
- Token launches – Issuing new tokens with built-in rules for distribution.
- Decentralized exchanges – DEXs use smart contracts to enable peer-to-peer trading.
- Real-world asset tokenization – Representing physical assets on-chain. Learn more in our RWA tokenization guide.
While smart contracts remove the need for trust between parties, they are only as good as their code. Bugs or vulnerabilities can be exploited, which is why security audits are essential before interacting with any smart contract.