Primer
Smart contract
A program deployed on a blockchain that executes automatically and exactly as written whenever it is called.
- Its code and state are replicated on every node, so no one can alter the outcome, and it can hold and move funds by its own rules.
- This powers decentralised exchanges, lending and stablecoins without an operating company in the middle.
- Each computational step costs 'gas', a fee paid by the caller, which prices scarce block space and stops infinite loops.
- Deployed code is usually immutable or changeable only through governance, so bugs are costly; exploits have drained billions of dollars.