What Is a Smart Contract?
A smart contract is self-executing code deployed on-chain. It makes "code is the rule" — the foundation of DeFi and NFTs.
The "Vending Machine" Analogy
Think of a smart contract as a vending machine: insert coins → it dispenses, no clerk needed. On-chain contracts work the same: when agreed conditions are met, they execute automatically (release funds on payment, unlock a stake at maturity) — no trusted middleman, with public, verifiable rules.
Risks to Note
But "code is law" also means a bug can be exploited and funds drained (contract vulnerabilities are the leading cause of DeFi hacks). Before interacting with an unfamiliar contract, note what permissions you grant and avoid unlimited approvals.