Lesson 3: Understanding Smart Contracts – Code That Executes unlocks the most powerful layer of blockchain, transforming it from a simple ledger into a global, decentralized computer.
You will learn what smart contracts are—self-executing code that automatically enforces agreements without lawyers or courts—and explore the "Code is Law" philosophy through the infamous DAO hack of 2016, where a $60 million bug forced the Ethereum community to choose between immutability and human intervention.
You will understand how the Ethereum Virtual Machine (EVM) ensures determinism (same inputs produce same outputs across all nodes), why every computation costs gas (to prevent infinite loops, spam, and compensate validators), and how oracles act as bridges to bring real-world data onto the blockchain. You will also explore the anatomy of an NFT as an ERC-721 smart contract, understanding that an NFT is a unique token ID recorded on-chain, not the image itself.
Through a smart contract flowchart activity and a video on gas and oracles, you will complete a group forum debate on whether a buggy contract's outcome should stand or human authorities should intervene.
What is a smart contract and the "code is a law" philosophy.pptx by Jovan Karamachoski
Question:
"A smart contract for a community fund has a bug that accidentally sends funds to the wrong address. The person who received the funds refuses to return them, saying 'Code is Law – I followed the rules.' Should the community intervene to recover the funds? Why or why not?"
Share with a partner, then we'll hear 2-3 perspectives.
Gas and fees.pptx by Jovan Karamachoski
Oracles - bridging blockchain and reality.pptx by Jovan Karamachoski
Anatomy of an NFT (as a smart contract).pptx by Jovan Karamachoski
Group Forum Discussion
Scenario:
"A community savings group uses a smart contract where members deposit monthly. The contract has a bug: the withdrawal function doesn't check if the requester is the actual owner – it only checks if the requester's address starts with '0x123'. By chance, an attacker's address matches. They drain 50% of the funds. The community discovers the bug immediately after."
Debate question:
"Should the 'code is law' outcome stand (attacker keeps funds), or should the community hard-fork the blockchain to revert the transaction?"
Requirements:
Guiding Questions:
📜 Immutability: Does reverting the transaction break the promise of blockchain?
🔥 The DAO precedent: Ethereum hard-forked to revert the $60M hack. Is this case similar or different?
⚖️ Intent vs. code: Was the community's intent clearly violated?
🛡️ Precedent: If you revert this, where do you draw the line? What about future "accidents"?
👥 Community governance: Who decides? A vote? A foundation? The developers?
💰 Practicality: Hard forks are disruptive and controversial. Is it worth it for 50% of funds?
Use at least 2 concepts from the lesson in your post.