A smart contract is a program stored on a blockchain that runs exactly as written whenever someone calls it. It holds its own funds and rules, and it executes automatically — no company or middleman decides whether to honour it. "If this happens, do that" becomes code that the whole network enforces. This is what turns a blockchain from a simple ledger of balances into a platform for applications.
What makes it "smart"
The name is a little misleading: a smart contract is not clever and not a legal contract. It is just code with two unusual properties:
- It lives on-chain. The code is deployed to an address and stored by the network, so anyone can see it and call it.
- The network enforces it. Every node runs the same code and must agree on the result, so no single party can change the outcome or refuse to run it.
Think of a vending machine: put in the right input, and it releases the output automatically, with no cashier to approve the sale. A smart contract is that idea, generalised and running on a blockchain.
How it works, step by step
- A developer writes the code, often in a language like Solidity (on Ethereum) or Rust (on chains such as Solana).
- It's deployed to the blockchain, getting its own address. The code is now fixed and public.
- Users call its functions by sending transactions — for example, "swap 1 ETH for USDC" or "deposit into this pool."
- Every node executes the code in a shared environment (on Ethereum, the EVM, the Ethereum Virtual Machine) and agrees on the new state.
- The result is recorded on-chain: balances move, data updates, events fire.
Two properties make this trustworthy:
- Deterministic. The same input always produces the same output on every node, so everyone agrees.
- You pay gas. Running code costs gas fees, which prevents infinite loops and spam by charging for computation.

