Chapter 9
Smart Contracts on Ethereum
Smart contracts are Ethereum's core feature: code that lives at an address, holds state, and executes the same way for every node. Instead of sending only payments, users can send instructions that change balances, ownership, votes, or protocol rules.
Deployment is a special transaction with no destination address. The creation code runs once, returns the final bytecode, and assigns the contract a permanent on-chain home. After that, calls execute against the stored code and its persistent storage slots.
Ethereum contracts can call each other, which is why DeFi feels so composable: a wallet signs one transaction, but that transaction may route through a router, lending market, oracle, and token contract before it finishes. The same openness also creates risk, so developers obsess over access control, reentrancy, and careful upgrade patterns.