What is the difference between Layer 1 and Layer 2 in blockchain?

Answer

Layer 1 (L1) is the base blockchain protocol — the main chain with its own consensus mechanism, validators, and security. Examples: Ethereum, Bitcoin, Solana, Avalanche. L1 provides security and finality but has limited throughput (Ethereum: ~15-30 TPS) and high fees during congestion. Layer 2 (L2) is a secondary framework built on top of an L1 to improve scalability while inheriting the L1's security. L2 types: (1) Optimistic Rollups — bundle transactions and post compressed data to L1, assuming transactions are valid; fraud proofs challenge invalid transactions within a 7-day window. Examples: Arbitrum, Optimism; (2) ZK-Rollups — use zero-knowledge proofs to cryptographically prove batch transaction validity; no fraud proof window needed; faster finality. Examples: zkSync Era, Polygon zkEVM, Starknet, Scroll; (3) State Channels — off-chain channels for specific parties (Lightning Network for Bitcoin); (4) Validiums — ZK proofs with off-chain data availability. L2s achieve 1000-10,000+ TPS with fees 10-100x lower than Ethereum mainnet, making Ethereum practical for mainstream use.