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.
- 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.
- 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.
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.
Risk notes
Reading the risk in smart contracts
Reentrancy, bad access control, unsafe upgrades, and unlimited token approvals are common smart-contract failure modes.
- Explain what executes the rule.
- Check whether upgrades are possible.
- Review approvals before signing.
Practice
Turn smart contracts into a habit
- 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…

