Skip to main content

> cat ./linkedin_post.md

[terminal_mode]

Ethereum L1, L2, L3: The Complete Guide to Ethereum's Scaling Architecture

DATE:2021-06-15|FORMAT:linkedin_post
Nelson Lourenço's avatar
Nelson Lourenço
Senior Software Engineer | AI & Web Development
2021-06-15•🌐

Ethereum L1, L2, L3: The Complete Scaling Architecture Guide

Ethereum's scaling strategy embraces a layered approach. Understanding L1, L2, and L3 is crucial for building scalable decentralized applications.

Ethereum Layer Architecture

┌─────────────────────────────────────────────────────────────────────┐
│                    ETHEREUM LAYERED SCALING ARCHITECTURE                  │
├─────────────────────────────────────────────────────────────────────┤
│                                                                     │
│   ┌─────────────────────────────────────────────────────────────┐  │
│   │                      LAYER 3 (APPLICATION)                   │  │
│   │   ┌─────────────┐ ┌─────────────┐ ┌─────────────┐         │  │
│   │   │   dApp A    │ │   dApp B    │ │   dApp C    │         │  │
│   │   │ Custom Rollup│ │ Custom Rollup│ │ Custom Rollup│        │  │
│   │   │  Specific   │ │  Specific   │ │  Specific   │         │  │
│   │   │  Chain      │ │  Chain      │ │  Chain      │         │  │
│   │   └─────────────┘ └─────────────┘ └─────────────┘         │  │
│   │                                                             │  │
│   │   • Application-specific chains                            │  │
│   │   • Custom virtual machines                                 │  │
│   │   • Sovereign rollups                                       │  │
│   │                                                             │  │
│   └─────────────────────────────────────────────────────────────┘  │
│                              │                                   │
│                              ▼                                   │
│   ┌─────────────────────────────────────────────────────────────┐  │
│   │                      LAYER 2 (EXECUTION)                    │  │
│   │                                                             │  │
│   │   ┌─────────────────┐    ┌─────────────────┐              │  │
│   │   │  OPTIMISTIC    │    │    ZK ROLLUPS   │              │  │
│   │   │    ROLLUPS     │    │                 │              │  │
│   │   │                 │    │                 │              │  │
│   │   │ • Arbitrum     │    │ • zkSync        │              │  │
│   │   │ • Optimism     │    │ • StarkNet      │              │  │
│   │   │ • Base         │    │ • Polygon zkEVM │              │  │
│   │   │ • Boba         │    │ • Scroll        │              │  │
│   │   │                 │    │                 │              │  │
│   │   └─────────────────┘    └─────────────────┘              │  │
│   │                                                             │  │
│   └─────────────────────────────────────────────────────────────┘  │
│                              │                                   │
│                              ▼                                   │
│   ┌─────────────────────────────────────────────────────────────┐  │
│   │                    LAYER 1 (SETTLEMENT)                      │  │
│   │                                                             │  │
│   │   ┌─────────────────────────────────────────────────────┐ │  │
│   │   │              ETHEREUM MAINNET                        │ │  │
│   │   │                                                     │ │  │
│   │   │   • Data Availability (DAS)                         │ │  │
│   │   │   • Consensus (Proof of Stake)                      │ │  │
│   │   │   • Settlement (finality)                           │ │  │
│   │   │   • Security (validity/fraud proofs)               │ │  │
│   │   │                                                     │ │  │
│   │   └─────────────────────────────────────────────────────┘ │  │
│   │                                                             │  │
│   └─────────────────────────────────────────────────────────────┘  │
│                                                                     │
└─────────────────────────────────────────────────────────────────────┘

Layer 2 Scaling Solutions

┌─────────────────────────────────────────────────────────────────────┐
│                    LAYER 2 SOLUTIONS COMPARISON                          │
├─────────────────────────────────────────────────────────────────────┤
│                                                                     │
│   ROLLUP FUNDAMENTALS:                                               │
│   ┌─────────────────────────────────────────────────────────────┐  │
│   │                                                             │  │
│   │  Rollup Architecture:                                        │  │
│   │                                                             │  │
│   │  ┌─────────────────────┐                                    │  │
│   │  │   L2 Sequencer     │                                    │  │
│   │  │   (Off-chain)      │                                    │  │
│   │  │                    │                                    │  │
│   │  │   • Batch txns    │                                    │  │
│   │  │   • Order txns   │                                    │  │
│   │  │   • Compress data│                                    │  │
│   │  └─────────┬───────────┘                                    │  │
│   │            │                                               │  │
│   │            ▼                                               │  │
│   │  ┌─────────────────────┐                                    │  │
│   │  │  Compressed Batch   │                                    │  │
│   │  │  + Validity Proof  │                                    │  │
│   │  └─────────┬───────────┘                                    │  │
│   │            │                                               │  │
│   │            ▼                                               │  │
│   │  ┌─────────────────────┐                                    │  │
│   │  │   L1 Ethereum      │                                    │  │
│   │  │   (On-chain)       │                                    │  │
│   │  │                    │                                    │  │
│   │  │   • Store tx data  │                                    │  │
│   │  │   • Verify proofs │                                    │  │
│   │  │   • Finalize state │                                    │  │
│   │  └─────────────────────┘                                    │  │
│   │                                                             │  │
│   └─────────────────────────────────────────────────────────────┘  │
│                                                                     │
│   OPTIMISTIC VS ZK ROLLUPS:                                          │
│   ┌─────────────────────────┬───────────────────────────────────┐  │
│   │    OPTIMISTIC ROLLUPS  │       ZK ROLLUPS                 │  │
│   ├─────────────────────────┼───────────────────────────────────┤  │
│   │ • Assume tx valid     │ • Prove every tx valid            │  │
│   │ • 7-day challenge    │ • Immediate finality              │  │
│   │   period            │                                   │  │
│   │ • Fraud proofs      │ • Validity proofs                 │  │
│   │ • EVM-compatible    │ • EVM compatibility emerging      │  │
│   │ • Lower compute     │ • Higher compute (proof gen)      │  │
│   │   costs            │                                   │  │
│   │ • Higher L1 data   │ • Smaller calldata                │  │
│   │   costs            │   (SNARK/STARK compression)       │  │
│   │ • Arbitrum,        │ • zkSync, StarkNet,              │  │
│   │   Optimism, Base   │   Polygon zkEVM                   │  │
│   └─────────────────────────┴───────────────────────────────────┘  │
│                                                                     │
└─────────────────────────────────────────────────────────────────────┘

Cross-Layer Communication

┌─────────────────────────────────────────────────────────────────────┐
│                    CROSS-LAYER COMMUNICATION PATTERNS                      │
├─────────────────────────────────────────────────────────────────────┤
│                                                                     │
│   L1 → L2 MESSAGING:                                               │
│   ┌─────────────────────────────────────────────────────────────┐  │
│   │                                                             │  │
│   │  Canonical Bridge Pattern:                                   │  │
│   │                                                             │  │
│   │  1. User locks tokens on L1                               │  │
│   │  2. L1 contract emits event                               │  │
│   │  3. L2 relayer picks up event                            │  │
│   │  4. L2 mints wrapped tokens                              │  │
│   │  5. User receives on L2                                   │  │
│   │                                                             │  │
│   │  Code Example (L1):                                        │  │
│   │  function bridgeToL2(uint256 amount) external {           │  │
│   │      _burn(msg.sender, amount);                           │  │
│   │      emit TokenLocked(msg.sender, amount);                │  │
│   │  }                                                        │  │
│   │                                                             │  │
│   └─────────────────────────────────────────────────────────────┘  │
│                                                                     │
│   L2 → L1 MESSAGING:                                               │
│   ┌─────────────────────────────────────────────────────────────┐  │
│   │                                                             │  │
│   │  Optimistic Verification Pattern (Optimistic Rollups):     │  │
│   │                                                             │  │
│   │  1. L2 executes transaction                              │  │
│   │  2. L2 posts state root to L1                            │  │
│   │  3. 7-day challenge window begins                         │  │
│   │  4. No challenge → Finalize                              │  │
│   │  5. Challenge → Fraud proof verification                  │  │
│   │                                                             │  │
│   │  Immediate Finality Pattern (ZK Rollups):                  │  │
│   │                                                             │  │
│   │  1. L2 executes transaction                              │  │
│   │  2. Generate validity proof                              │  │
│   │  3. Submit proof + state root to L1                     │  │
│   │  4. Immediate verification → Finalize                    │  │
│   │                                                             │  │
│   └─────────────────────────────────────────────────────────────┘  │
│                                                                     │
└─────────────────────────────────────────────────────────────────────┘

Layer 3 Emerging Concepts

┌─────────────────────────────────────────────────────────────────────┐
│                    LAYER 3 APPLICATION CHAINS                           │
├─────────────────────────────────────────────────────────────────────┤
│                                                                     │
│   WHY L3?                                                           │
│   ┌─────────────────────────────────────────────────────────────┐  │
│   │                                                             │  │
│   │  Sovereign Rollups:                                        │  │
│   │  • Custom gas tokens and pricing                          │  │
│   │  • Application-specific virtual machines                   │  │
│   │  • Independent sequencing and ordering                     │  │
│   │  • Protocol-level customization                            │  │
│   │                                                             │  │
│   │  Shared Security with L2:                                  │  │
│   │  • Data availability via L2 (DACs)                         │  │
│   │  • Settlement proofs to L2                                 │  │
│   │  • Inheritance of L2's security model                      │  │
│   │                                                             │  │
│   │  Examples:                                                 │  │
│   │  • dYdX (application-specific L3)                         │  │
│   │  • Arbitrum AnyTrust chains                               │  │
│   │  • Custom zkEVM deployments                                │  │
│   │                                                             │  │
│   └─────────────────────────────────────────────────────────────┘  │
│                                                                     │
│   L3 ARCHITECTURE:                                                  │
│   ┌─────────────────────────────────────────────────────────────┐  │
│   │                                                             │  │
│   │  ┌─────────────────┐                                        │  │
│   │  │   L3 App Chain │                                        │  │
│   │  │                │                                        │  │
│   │  │ • Custom VM   │                                        │  │
│   │  │ • App logic   │                                        │  │
│   │  │ • State sync  │                                        │  │
│   │  └────────┬────────┘                                        │  │
│   │           │                                                 │  │
│   │           ▼                                                 │  │
│   │  ┌─────────────────┐                                        │  │
│   │  │   L2 Rollup    │                                        │  │
│   │  │                │                                        │  │
│   │  │ • Shared seq  │                                        │  │
│   │  │ • DAS layer   │                                        │  │
│   │  │ • Settlement  │                                        │  │
│   │  └────────┬────────┘                                        │  │
│   │           │                                                 │  │
│   │           ▼                                                 │  │
│   │  ┌─────────────────┐                                        │  │
│   │  │   L1 Ethereum   │                                        │  │
│   │  │                │                                        │  │
│   │  │ • Final settle │                                        │  │
│   │  │ • Trust anchor │                                        │  │
│   │  └─────────────────┘                                        │  │
│   │                                                             │  │
│   └─────────────────────────────────────────────────────────────┘  │
│                                                                     │
└─────────────────────────────────────────────────────────────────────┘

Security Considerations

┌─────────────────────────────────────────────────────────────────────┐
│                    SECURITY CONSIDERATIONS BY LAYER                       │
├─────────────────────────────────────────────────────────────────────┤
│                                                                     │
│   L1 SECURITY (Highest):                                            │
│   ✓ Proof of Stake finality                                        │
│   ✓ Decentralized validator set                                    │
│   ✓ Economic security (~$50B+ staked)                              │
│   ✓ Censorship resistant                                           │
│                                                                     │
│   L2 SECURITY:                                                     │
│   ✓ Inherits L1 security for data availability                     │
│   ✓ Fraud proofs (Optimistic) / Validity proofs (ZK)              │
│   ⚠ Sequencer liveness requirements                               │
│   ⚠ Bridge security assumptions                                    │
│                                                                     │
│   L3 SECURITY:                                                     │
│   ✓ Shares L2 data availability                                    │
│   ⚠ Independent sequencer set required                            │
│   ⚠ Additional trust assumptions                                   │
│   ⚠ Bridge security from L2 to L3                                 │
│                                                                     │
│   RISK MATRIX:                                                     │
│   ┌────────────────────┬────────────┬────────────┬─────────────┐  │
│   │   Component        │   L1      │   L2       │   L3        │  │
│   ├────────────────────┼────────────┼────────────┼─────────────┤  │
│   │ Consensus Risk    │ Low       │ Medium    │ High       │  │
│   │ Data Avail Risk   │ Low       │ Medium    │ Medium     │  │
│   │ Bridge Risk      │ N/A       │ Medium    │ High       │  │
│   │ Sequencer Risk   │ N/A       │ Medium    │ High       │  │
│   │ Smart Contract   │ Medium    │ Medium    │ Medium     │  │
│   └────────────────────┴────────────┴────────────┴─────────────┘  │
│                                                                     │
└─────────────────────────────────────────────────────────────────────┘

How is your project navigating Ethereum's layered scaling landscape? Share your experience!

#Ethereum #Layer2 #Rollups #Arbitrum #Optimism #BlockchainScaling


What scaling solutions are you evaluating for your dApp?

👍338💬80🔁49