CBCP Certification Program | Module 2: Cryptocurrency Ecosystem
All Modules Take Quiz
♦ Part 2 of 7

Ethereum & Smart Contract Platforms

Master the world's programmable blockchain - from the Ethereum Virtual Machine architecture and gas economics to the Proof of Stake transition and competing Layer 1 platforms.

🕑 ~2 hours 📖 6 Sections 💻 Smart Contracts

2.1 Vitalik Buterin's Vision

In late 2013, a 19-year-old programmer named Vitalik Buterin published a whitepaper proposing Ethereum - a blockchain that could execute arbitrary code. While Bitcoin was digital gold, Ethereum would be a "world computer" capable of running decentralized applications.

Beyond Digital Cash

Buterin recognized that Bitcoin Script was intentionally limited. While this was a security feature, it prevented many use cases:

"What Ethereum intends to provide is a blockchain with a built-in fully fledged Turing-complete programming language that can be used to create 'contracts' that can be used to encode arbitrary state transition functions." Vitalik Buterin, Ethereum Whitepaper, 2013

Key Innovations

  1. Turing-complete smart contracts: Programs that can implement any computable logic
  2. Account-based model: Unlike Bitcoin's UTXO, Ethereum tracks account balances directly
  3. State machine: The blockchain maintains a global state that contracts can read and modify
  4. Gas system: Computational resources are metered and paid for, preventing infinite loops

Ethereum Timeline

Date Event Significance
Nov 2013 Whitepaper published Concept introduced
Jul-Aug 2014 ICO crowdsale Raised ~$18M (31,500 BTC)
Jul 30, 2015 Frontier launch Mainnet goes live
Jun 2016 The DAO hack $60M stolen, leading to ETH/ETC fork
Aug 2021 EIP-1559 (London) Fee market reform, ETH burning
Sep 15, 2022 The Merge Transition to Proof of Stake
The DAO Fork

The 2016 DAO hack led to a controversial hard fork to recover stolen funds. Those who disagreed with "code is law" being overridden continued the original chain as Ethereum Classic (ETC), while the majority followed the new chain as Ethereum (ETH).

2.2 The Ethereum Virtual Machine (EVM)

The EVM is a stack-based virtual machine that executes smart contract bytecode. It provides a sandboxed environment where contracts can interact with each other and the blockchain state in a deterministic manner.

Ethereum Virtual Machine (EVM)
A quasi-Turing complete state machine that processes transactions and smart contract execution. "Quasi" because computation is bounded by gas limits, preventing true infinite loops.

EVM Architecture

Ethereum Stack Architecture
DApps / Smart Contracts (Solidity, Vyper)
EVM Bytecode Execution
Consensus Layer (Proof of Stake)

Account Types

Ethereum has two types of accounts, both stored in the global state trie:

Feature EOA (Externally Owned) Contract Account
Controlled by Private key Contract code
Has code No Yes (immutable after deployment)
Can initiate tx Yes No (only respond to calls)
Has storage No Yes (key-value store)
Address format 0x + 40 hex chars 0x + 40 hex chars

Smart Contract Languages

  • Solidity: Most popular, JavaScript-like syntax, ~90% of contracts
  • Vyper: Python-like, designed for security and auditability
  • Yul: Intermediate language, low-level EVM access
  • Fe: Rust-inspired, newer alternative to Solidity

Sample Solidity Contract

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract SimpleStorage {
    uint256 private storedValue;

    event ValueChanged(uint256 newValue);

    function set(uint256 _value) public {
        storedValue = _value;
        emit ValueChanged(_value);
    }

    function get() public view returns (uint256) {
        return storedValue;
    }
}
Smart Contract Risks

Smart contracts are immutable once deployed. Bugs cannot be patched - they can only be mitigated through upgrade patterns (proxies) or migration to new contracts. Always audit code before deployment and use established patterns.

2.3 Gas Mechanics & EIP-1559

Gas is Ethereum's unit of computational work. Every operation in the EVM has a gas cost, and users must pay for the gas their transactions consume. This mechanism prevents spam and infinite loops while creating a fee market for block space.

Gas
A unit measuring computational effort. Each EVM opcode has a fixed gas cost (e.g., ADD = 3 gas, SSTORE = 20,000 gas). Transaction fee = Gas Used x Gas Price.

Gas Costs by Operation

Operation Gas Cost Notes
Simple ETH transfer 21,000 Minimum for any transaction
SSTORE (new slot) 20,000 Writing to storage is expensive
SLOAD 2,100 Reading from storage
ERC-20 transfer ~65,000 Typical token transfer
Uniswap swap ~150,000 Complex DeFi operation
NFT mint ~100,000-200,000 Varies by contract complexity

EIP-1559: London Upgrade (August 2021)

EIP-1559 fundamentally changed Ethereum's fee market:

  1. Base Fee: Algorithmically determined fee that is BURNED (destroyed), not paid to validators
  2. Priority Fee (Tip): Optional fee paid to validators for transaction priority
  3. Dynamic block size: Blocks can expand up to 2x target size during congestion
  4. Better fee estimation: Base fee adjusts predictably based on previous block utilization
// EIP-1559 Fee Calculation
Transaction Fee = (Base Fee + Priority Fee) x Gas Used

// Example: Simple transfer during moderate congestion
Base Fee: 30 gwei
Priority Fee: 2 gwei
Gas Used: 21,000

Total Fee = (30 + 2) x 21,000 = 672,000 gwei = 0.000672 ETH

// Of this: 630,000 gwei burned, 42,000 gwei to validator
🔥 ETH Burning & Deflationary Pressure

Since EIP-1559, over 4 million ETH has been burned. During periods of high network activity, more ETH is burned than issued as staking rewards, making ETH temporarily deflationary. This is tracked at ultrasound.money.

Gas Optimization Strategies

  • Time transactions: Gas prices are lowest during weekends and off-peak hours (US night time)
  • Use gas tokens: Some protocols allow pre-purchasing gas when cheap
  • Batch operations: Combine multiple operations into single transactions
  • Layer 2: Use rollups for 10-100x cheaper transactions

2.4 The Merge: Proof of Stake Transition

On September 15, 2022, Ethereum completed "The Merge" - the most significant upgrade in its history. The network transitioned from energy-intensive Proof of Work to Proof of Stake, reducing energy consumption by ~99.95%.

Proof of Stake Mechanics

Staking
Validators deposit 32 ETH as collateral to participate in block production. Dishonest behavior results in "slashing" - loss of staked ETH. Honest participation earns rewards.
Aspect Proof of Work (Pre-Merge) Proof of Stake (Post-Merge)
Block production Mining (computation) Validation (staking)
Energy use ~112 TWh/year ~0.01 TWh/year
Hardware required GPUs/ASICs Consumer PC
Block time ~13 seconds (variable) 12 seconds (fixed slots)
Finality Probabilistic (~6 min) Deterministic (~13 min)
New ETH issuance ~13,000 ETH/day ~1,700 ETH/day

Validator Economics

  • Minimum stake: 32 ETH per validator
  • Current APR: ~3-5% (varies with total staked)
  • Total staked: ~30 million ETH (~25% of supply)
  • Active validators: ~900,000+

Liquid Staking

Since staked ETH was initially locked, liquid staking protocols emerged to provide liquidity:

Lido (stETH)

  • ~30% of all staked ETH
  • Receive stETH token 1:1
  • Can use stETH in DeFi
  • Daily rebase for rewards

Rocket Pool (rETH)

  • Decentralized node operators
  • Minimum 0.01 ETH to stake
  • rETH appreciates vs ETH
  • More decentralized than Lido

Coinbase (cbETH)

  • Centralized/custodial
  • Easy for retail users
  • Regulatory compliance
  • Exchange integration
Centralization Concerns

Lido's dominance (~30% of staked ETH) raises centralization concerns. If a single entity controls >33% of stake, they could potentially disrupt finality. The community actively monitors and encourages diversification.

2.5 Alternative Layer 1 Platforms

While Ethereum pioneered smart contracts, its scalability limitations led to the emergence of alternative Layer 1 blockchains. Each makes different tradeoffs between decentralization, security, and scalability (the "blockchain trilemma").

Major Alternative L1s

Platform Consensus TPS Key Features
Solana PoS + PoH ~4,000 High speed, low fees, centralization concerns
Cardano Ouroboros PoS ~250 Academic rigor, eUTXO model, Haskell
Avalanche Avalanche Consensus ~4,500 Subnets, EVM compatible, fast finality
Polkadot NPoS ~1,000 Parachains, interoperability focus
BNB Chain PoSA (21 validators) ~300 EVM compatible, Binance ecosystem

Solana Deep Dive

Solana uses a unique combination of Proof of History (PoH) and Proof of Stake:

Proof of History (PoH)
A cryptographic clock that provides verifiable ordering of events without requiring nodes to communicate. Enables parallel transaction processing by pre-establishing consensus on time.
  • Advantages: Very high throughput, sub-second finality, low fees (~$0.00025)
  • Disadvantages: High hardware requirements, multiple outages, validator centralization
  • Ecosystem: Strong in NFTs (Magic Eden), DeFi (Marinade, Raydium)

EVM Compatibility

Many chains chose EVM compatibility to leverage Ethereum's developer ecosystem:

  • BNB Chain: Fork of Geth, largest EVM-compatible chain by TVL
  • Avalanche C-Chain: Native EVM, subnet customization
  • Polygon: Ethereum sidechain, commits to Ethereum mainnet
  • Fantom: Opera chain with DAG-based consensus
🛠 Developer Perspective

EVM compatibility means the same Solidity code can deploy across multiple chains with minimal changes. This creates network effects but also means vulnerabilities propagate - a bug in one chain's contracts may exist on others.

2.6 Layer 2 Scaling Solutions

Rather than competing with Ethereum, Layer 2 solutions build on top of it. They execute transactions off-chain but inherit Ethereum's security by posting proofs or data to mainnet. This provides the best of both worlds: Ethereum's security with dramatically lower fees.

Types of Layer 2

Optimistic Rollups
Assume transactions are valid by default. Anyone can submit a "fraud proof" during a challenge period (~7 days) if they detect invalid transactions. Examples: Arbitrum, Optimism, Base.
ZK Rollups
Use zero-knowledge proofs to cryptographically verify transaction validity. No challenge period needed - validity is mathematically proven. Examples: zkSync, Starknet, Polygon zkEVM.

L2 Comparison

L2 Solution Type TVL (2024) Key Features
Arbitrum One Optimistic ~$15B Largest L2, full EVM, Nitro upgrade
Optimism Optimistic ~$7B OP Stack, Superchain vision
Base Optimistic ~$5B Coinbase L2, uses OP Stack
zkSync Era ZK ~$1B Native account abstraction
Starknet ZK ~$500M Cairo language, STARK proofs

Cost Comparison

// Approximate costs for ERC-20 transfer (2024)

Ethereum Mainnet:  $2 - $20  (varies with congestion)
Arbitrum One:      $0.10 - $0.50
Optimism:          $0.10 - $0.50
Base:              $0.05 - $0.20
zkSync Era:        $0.05 - $0.30
Polygon PoS:       $0.01 - $0.05  (sidechain, less security)

EIP-4844: Proto-Danksharding

The March 2024 "Dencun" upgrade introduced blob transactions, dramatically reducing L2 costs:

  • Before EIP-4844: L2s paid ~$0.10-0.50 per transaction for calldata
  • After EIP-4844: Costs dropped 10-100x using blob space
  • Blob lifecycle: Available for ~18 days, then pruned (sufficient for fraud proofs)
Best Practice

For most users and applications, Layer 2s now offer a superior experience to Ethereum mainnet. Use L1 only for high-value settlements or when L1 security is specifically required. Bridge assets to L2 for everyday use.

Key Takeaways

  • Ethereum enables Turing-complete smart contracts - arbitrary programmable logic on the blockchain
  • EVM is the execution environment - deterministic, sandboxed, gas-metered
  • EIP-1559 reformed the fee market - base fee burned, priority fee to validators
  • The Merge (Sep 2022) transitioned Ethereum to Proof of Stake, reducing energy use by 99.95%
  • Alternative L1s make different tradeoffs - usually sacrificing decentralization for speed
  • Layer 2 rollups are the scaling solution - inherit L1 security with 10-100x lower fees
  • EIP-4844 (Mar 2024) dramatically reduced L2 costs via blob transactions