Ethereum & Smart Contracts – FIN451

Programmable blockchain, gas & fees (EIP‑1559), tokens, DeFi, rollups, risks, and hands‑on tools.

1) Ethereum in 90 seconds

What it is

  • Programmable blockchain (2015) that runs smart contracts.
  • Native currency: ETH for gas, staking, and value transfer.
  • Consensus: Proof‑of‑Stake since the Merge (2022).

Why it matters

  • General‑purpose computation → tokens, DEXes, lending, NFTs.
  • Composability: protocols snap together like “money LEGOs.”

FinTech takeaways

  • Fees (gas) fluctuate with demand; UX depends on L2s & wallets.
  • Risk: contract bugs, permissioning, oracle design, and key custody.

2) Accounts & Transactions

Two account types

  • EOA: externally owned (your private key).
  • Contract: code‑controlled; no private key.

noncevaluedatagas limitmaxFee/maxPriority

Signature & replay protection

Transactions are signed (ECDSA/SECP256k1). The nonce prevents replays and enforces ordering per account.

3) Gas, EIP‑1559 & Fees

Gas pricing (intuition)

  • Each opcode costs gas.
  • You bid with maxFee and a tip (maxPriorityFee).
  • Pay: gasUsed × (baseFee + tip).

Base fee burn

The base fee adjusts block‑by‑block and is burned; only the tip goes to the validator. Wallets auto‑estimate sane values.

Class tip: Check a block explorer’s pending base fee before demos.

4) Smart Contracts & Tokens

EVM & languages

  • EVM executes bytecode deterministically.
  • Common languages: Solidity, Vyper.

Token standards

  • ERC‑20 (fungible), ERC‑721 (NFT), ERC‑1155 (multi).
  • Interfaces standardize transfers & approvals.

5) DeFi Building Blocks

DEX & liquidity

  • AMMs (e.g., Uniswap) price via pools.
  • LPs earn fees; risk: impermanent loss.

Lending & oracles

  • Over‑collateralized borrowing (e.g., Aave).
  • Oracles (e.g., Chainlink) feed external prices.

6) Layer 2 Rollups

Optimistic vs ZK

  • Optimistic: assume valid; challenge with fraud proofs.
  • ZK: validity proofs attest correctness upfront.

Practical UX

  • Same ETH on L2; lower fees, higher throughput.
  • Bridges, withdrawal times, and security assumptions differ.

7) Major Upgrades & Forks

UpgradeWhat changed
DAO split (2016)Ethereum ↔ Ethereum Classic after recovery fork.
London / EIP‑1559 (2021)Base fee burn; fee market redesign.
Merge (2022)PoW → PoS transition.
Shanghai/Capella (2023)Validator withdrawals enabled.

8) Security & Wallet Hygiene

Personal safety

  • Hardware wallet for savings; hot wallet for daily use.
  • Review on‑device; avoid blind approvals.
  • Back up seed (+ optional passphrase) offline.

Common pitfalls

  • Malicious approvals, phishing, fake airdrops.
  • Protocol risks: reentrancy, price oracle manipulation.

9) Interactive Learning Tools

Gas Cost Calculator ⛽

Formula: ETH = gasUsed × (baseFee + priority) × 1e‑9

ETH Unit Converter 🔁

L2 Savings Estimator 🏎️

Toy model for class demos (ignores priority fee).

10) Watch & Learn

Ethereum (clip 1)

Ethereum (clip 2)

Wallet security

11) When Ethereum is the Wrong Tool

12) Quiz – Check Your Understanding

  1. What are the two account types on Ethereum?
  2. After EIP‑1559, which fee component is burned?
  3. List the fields that determine what you pay for a transaction.
  4. Name two common token standards and what they represent.
  5. How do Optimistic and ZK rollups differ?
  6. Give one major protocol upgrade and what it changed.
  7. What is the security benefit of using a hardware wallet?