Skip to main content

Layer 1 vs Layer 2

What is Layer 1?

Layer 1 (L1) is the main Ethereum blockchain.

  • All transactions are processed directly on Ethereum.
  • Very secure and decentralized, but limited in speed and costly.

Example on Layer 1

Alice sends 0.1 ETH to Bob:

// Simple Ethereum L1 transfer
address payable bob = payable(0xB0B...);
bob.transfer(0.1 ether);
  • Every Ethereum node verifies this transaction.
  • It takes ~12 seconds or more depending on block time.
  • Gas fee could be $5–$10 in busy times.

What is Layer 2?

Layer 2 (L2) is built on top of Ethereum to handle transactions faster and cheaper.

  • Transactions are executed off-chain.
  • A proof or summary is submitted to Ethereum later.
  • Still inherits Ethereum’s security because Ethereum verifies the proof.

Example on Layer 2 (zkSync)

Alice sends 0.1 ETH to Bob on zkSync:

// Example using ethers.js with zkSync provider
import { Provider, Wallet } from "zksync-web3";
import { ethers } from "ethers";

const zkProvider = new Provider("https://zksync2-testnet.zksync.dev");
const alice = new Wallet("ALICE_PRIVATE_KEY", zkProvider);

async function sendFunds() {
const tx = await alice.sendTransaction({
to: "0xB0B...",
value: ethers.utils.parseEther("0.1")
});
await tx.wait();
console.log("0.1 ETH sent to Bob on zkSync");
}

sendFunds();
  • Transaction is confirmed in seconds.
  • Fee is just a few cents.
  • Later, zkSync posts a validity proof to Ethereum.

Real-Time Example

  • Buying an NFT on Ethereum L1: may cost $10–$50 in gas.
  • Buying the same NFT on zkSync L2: may cost only a few cents, but proof still ensures Ethereum-level security.

Comparison Table

FeatureLayer 1 (Ethereum Mainnet)Layer 2 (zkSync, Arbitrum, Optimism)
Speed~15 TPS1000+ TPS
FeesHigh (several dollars)Low (few cents)
SecurityDirectly on EthereumInherits Ethereum via proofs
Example UseSending ETH, minting NFTCheap transfers, DeFi, gaming, NFTs
Final SettlementImmediate on EthereumAfter proof is posted to Ethereum

Brief Summary

  • Layer 1 is Ethereum itself: secure, decentralized, but slow and costly.
  • Layer 2 scales Ethereum: faster, cheaper, while still relying on Ethereum’s security.
  • Real-world: Instead of paying $10 gas to send ETH or buy an NFT, you can use zkSync/Arbitrum/Optimism and pay just cents.