Loading...
What smart contracts are and how they work
A smart contract is a program stored on a blockchain that automatically executes when predetermined conditions are met.
Smart contracts run on the Ethereum Virtual Machine (EVM) — a decentralized computer shared by thousands of nodes. Once deployed, the code cannot be changed (it’s immutable).
Key concepts:
• Deterministic — Given the same input, every node produces the same output
• Trustless — No need to trust a third party; the code enforces the rules
• Gas — Computational cost paid by the caller to execute the contract
• State — Data stored permanently on the blockchain
Real-world analogy: A smart contract is like a vending machine. You insert the right amount (input), and it automatically gives you a product (output) without needing a cashier.
EVM-compatible chains include Ethereum, Avalanche, Polygon, BNB Chain, and Arbitrum. Code written for one can generally run on all others.