Smart contracts explained
A smart contract is a program stored on a blockchain. It runs exactly as written whenever its conditions are met. This lesson explains what that makes possible and where the risks are.
A vending machine, not a lawyer
The computer scientist Nick Szabo coined the term in 1994. His comparison was a vending machine: choose a product, pay the price, and the machine hands it over. No shop assistant has to decide anything.
A smart contract works the same way. It holds rules in the form "if this happens, then do that". Send it the right input and it produces the programmed result.
Despite the name, a smart contract is not a legal contract. It is code. It does what the code says, even when that is not what its authors meant.
What makes them useful
- Automatic. The code runs when its conditions are met. Nobody has to approve each step.
- Predictable. The same input always gives the same result.
- Public. Anyone can inspect a contract's activity, and often its code, before using it.
- Hard to change. Once deployed, a contract's code cannot be edited.
Some projects add an upgrade switch that lets their developers replace the code later. That can fix bugs. It also means you are trusting whoever holds the switch.
What they are used for
Smart contracts create tokens, run exchanges and lending services, and issue stablecoins. They can hold large sums with no company holding the keys. That is their strength, and it is also why mistakes are so costly.
When the code is wrong
In 2016, thousands of people pooled their ether in an investment fund on Ethereum called The DAO. An attacker found a flaw in its code and drained more than 3.6 million ETH.
The contract did what its code allowed. To return the money, most of the Ethereum community agreed to change the ledger itself on 20 July 2016. Some people refused on principle and kept the old chain, which continues today as Ethereum Classic.
A rescue like that is not expected to happen again. Today, when a contract is exploited, the money is usually gone.
What this means for you
Using a smart contract means signing a transaction with your wallet. That signature can give the contract permission to move your tokens.
- Read what your wallet says before you sign. Approving something you do not understand is called blind signing, and it is a major risk.
- Prefer contracts that have run for a long time and have been reviewed by independent auditors. An audit lowers the risk. It does not remove it.
- Never sign to "claim" a surprise reward. Lesson 37 covers malicious approvals.
If a smart contract has a bug, can its developers always edit the code to fix it?
A smart contract is code that enforces itself. It removes the middleman, and with it the person who could fix a mistake.
Sources
- ethereum.org: Introduction to smart contracts
- ethereum.org: Timeline of all Ethereum forks
- ethereum.org: What is Ethereum?
- ethereum.org: Ethereum security and scam prevention
Facts checked against these sources on 8 October 2026.
The course by email
Five short emails to get you started, then one a month about what is new. No price tips and no hype.
Free. Unsubscribe any time. See our privacy notice.
Want your progress saved too? Create a free account.