Decentralization
Smart Contracts
DeFi, smart contracts, dApps, and DAOs — software replacing middlemen.
In this lesson
- What a smart contract is
- Why immutability matters
Key takeaways
- 1A smart contract is self-executing code on a blockchain
- 2It runs exactly as written when conditions are met
- 3Once deployed it's very hard to change — bugs are costly
Lesson summary
A smart contract is code that runs on a blockchain and follows predefined rules.
Mental model
Smart Contracts in plain terms
A smart contract is code that runs on a blockchain and follows predefined rules. It is powerful because users can verify and execute shared logic without trusting a private server.
Treat smart contracts as a tool for making a decision, not a term to memorise for its own sake.
- What a smart contract is
- Why immutability matters
Mechanics
How to reason about smart contracts
Contracts hold state, receive transactions, and update balances or permissions.
Once deployed, many contracts are hard to change unless an upgrade path exists.
Users interact by signing transactions from wallets or applications.
The reason these steps matter in practice is simple: a smart contract is self-executing code on a blockchain.
- A smart contract is self-executing code on a blockchain
- It runs exactly as written when conditions are met
- Once deployed it's very hard to change — bugs are costly
Example
Smart Contracts, applied
An automated market maker contract can hold two tokens and quote swap prices from its reserves without a human market maker approving each trade.
If the example only works with these exact details, you have memorised a case rather than learned smart contracts.
Ask what you would need to see on screen or on chain to trust a smart contracts outcome before you act on it.
Common mistakes
What to unlearn about smart contracts
Readable code is not the same as safe code. A transparent bug is still a bug, and attackers can read it too.
Catch the smart contracts version early by asking which evidence would prove the claim, then actually looking for it.
Most costly smart contracts errors are not exotic; they are this ordinary shortcut repeated under time pressure.
Risk notes
Reading the risk in smart contracts
Reentrancy, bad access control, unsafe upgrades, and unlimited token approvals are common smart-contract failure modes.
Risk in smart contracts grows when markets move fast, liquidity thins, or an interface hides the warning that actually matters.
None of this means avoid smart contracts; it means using it with eyes open and a clear exit if you are wrong.
- Explain what executes the rule.
- Check whether upgrades are possible.
- Review approvals before signing.
Practice
Turn smart contracts into a habit
Lock in Smart Contracts by applying it once — choose a real Decentralization example and walk it through the checks below.
Write your smart contracts answers as specific, testable sentences; if a sceptic could not challenge them with evidence, they are still too vague.
- Explain what executes the rule.
- Check whether upgrades are possible.
- Review approvals before signing.
Review
Key terms
- Blockchain
- A shared, append-only ledger replicated across many computers, secured by cryptography and consensus.
- DeFi
- Decentralized Finance — permissionless, composable financial services built on smart contracts.
- Smart Contract
- Self-executing code on a blockchain that runs exactly as written when conditions are met.
- Market Maker
- A participant that continuously quotes buy and sell prices to provide liquidity.
- Consensus Mechanism
- The process by which a distributed network agrees on the valid state of the ledger (e.g. PoW, PoS).
Source notes
Editorial references
These references are starting points for verifying the mechanisms, risk checks, and product context behind this lesson.
Before you continue
Can you do these?
- Explain what executes the rule.
- Check whether upgrades are possible.
- Review approvals before signing.
Related learning
Keep reading
Checkpoint
Finish this lesson
Pass the check to save progress, then continue through the track in order.
Lock in this lesson
Answer every question correctly to complete the lesson.
A smart contract is…