L2 & Scaling Solutions — Web3

An L2 runs transactions outside Ethereum, then sends their data and state root to L1 so it inherits Ethereum's security. An optimistic rollup takes a state…

The same 100 PTS redeem, the same code, the same 33,946 gas. On Ethereum it costs 33,946 gwei; on an OP Stack chain about 268 gwei (with the example prices in the cost section below). The difference is where the transaction runs. A Layer 2 (L2) is a network that runs transactions outside Ethereum (L1), then sends their data and a summary of the result to L1, so Ethereum keeps it secure. It's like Raka opening a stall at a bazaar. The head office (L1) records everything very carefully, but slowly and at a high price per entry. At the stall (L2), sales are recorded fast and cheaply; every evening, a copy of all the day's entries (packed tight) and the closing balances go to the head office. If the stall lies, it can be proven at the head office, because the copy of the entries is there.

Why L2s

Every Ethereum node re-runs every transaction, so what fits in a block is capped by the gas limit. When demand goes over the target, the base fee rises, and everyone pays more. Dinda's redeem in the sending transactions lesson needs 33,946 gas: at a gas price of 1 gwei that is 33,946 gwei (0.000033946 ETH), at 20 gwei it is already 678,920 gwei. An L2 runs thousands of transactions like that on its own machines, then sends only the packed data to L1, so the L1 cost is shared by many transactions.

A rollup: execution on L2, data on L1

The most used kind of L2 today is the rollup:

  1. The sequencer (the L2's operator) receives transactions, orders them and runs them. Users get a confirmation within seconds.
  2. Those transactions are packed into a batch and sent to L1.
  3. The result (the state root, a fingerprint of all of the L2's balances and storage) is sent to L1 too.
  4. A contract on L1 accepts that state root only when it is proven right, in one of the two ways in the next section.

Because all the data is on L1, anyone can rebuild the L2 state without trusting the sequencer. That is the difference from a sidechain (Polygon PoS, for example): a sidechain has its own validators and does not inherit Ethereum's security.

Optimistic rollups and ZK rollups

Optimistic rollup ZK rollup
Assumption a state root is taken as correct unless someone disputes it a state root must come with a proof
Proof fault proof: anyone can prove a state root wrong during the challenge period validity proof (a zero-knowledge proof): a mathematical proof for each batch, checked by a verifier contract on L1
Withdrawing to L1 through the official bridge waits for the challenge period; on OP Mainnet about 7 days (initiate on L2, prove on L1, finalize after 7 days) once its proof is verified on L1, usually hours
Examples OP Mainnet, Arbitrum One zkSync Era, Starknet, Scroll, Linea

Optimistic is simpler and runs exactly the same EVM. ZK needs no challenge period, but making its proofs takes heavy computation.

Data availability and blobs

Data availability (DA) means the L2's transaction data is really published somewhere anyone can download it. Without that data, nobody can rebuild the state or make a fault proof. Since the Dencun upgrade (13 March 2024, EIP-4844), rollups send batches in blobs: 128 KiB chunks of data (4,096 × 32 bytes = 131,072 bytes) that ride along with Ethereum blocks, have their own fee market (the blob base fee), and are deleted by nodes after about 18 days (4,096 epochs). Far cheaper than calldata, which becomes a permanent part of the block.

Upgrade Target blobs per block Maximum
Dencun, 13 March 2024 (EIP-4844) 3 6
Pectra, 7 May 2025 (EIP-7691) 6 9
BPO1, 9 December 2025 10 15
BPO2, 7 January 2026 14 21

Fusaka (3 December 2025) brought PeerDAS (nodes only sample blobs instead of downloading all of them) and BPO forks (Blob Parameter Only): small forks that only change the blob numbers. The values in force as of October 2026, a target of 14 and a maximum of 21, were set by BPO2. BPO3 is still a draft (EIP-8138) with no date.

What changes for a developer

The Solidity contract, the ABI, viem and wagmi stay the same. RakaPoints deploys with the same code, and because a contract address depends only on the deployer's address and nonce, a deploy from Raka's first transaction (nonce 0) on any chain gives 0x5FbD...0aa3 again. What differs:

Chain (testnet) Chain ID Public RPC viem
Sepolia (L1) 11155111 from an RPC provider sepolia
OP Sepolia 11155420 https://sepolia.optimism.io optimismSepolia
Base Sepolia 84532 https://sepolia.base.org baseSepolia
Arbitrum Sepolia 421614 https://sepolia-rollup.arbitrum.io/rpc arbitrumSepolia
// hardhat.config.ts (Hardhat 3.19.0, hardhat-toolbox-viem template)
import hardhatToolboxViemPlugin from "@nomicfoundation/hardhat-toolbox-viem";
import { configVariable, defineConfig } from "hardhat/config";

export default defineConfig({
  plugins: [hardhatToolboxViemPlugin],
  solidity: "0.8.37",
  networks: {
    opSepolia: {
      type: "http",
      chainType: "op", // its viem clients get OP Stack actions, such as estimateTotalFee
      url: "https://sepolia.optimism.io",
      accounts: [configVariable("SEPOLIA_PRIVATE_KEY")], // read from the keystore, not written in the file
    },
  },
});

The deploy is npx hardhat run scripts/deploy.ts --network opSepolia. The key is a dedicated testnet key stored with npx hardhat keystore set SEPOLIA_PRIVATE_KEY, never your main wallet's key. The difference you feel most is the fee.

Dinda's redeem: L1 vs L2

On an OP Stack chain, a transaction's fee = L2 execution (gasUsed × L2 gas price) + the L1 data fee (+ an operator fee, which is 0 on OP Sepolia and Base Sepolia). The L1 data fee formula since the Fjord upgrade:

fastLzSize    = the size of the signed transaction after FastLZ compression
estimatedSize = max(100 bytes, -42.5856 + 0.8365 × fastLzSize)
L1 data fee   = estimatedSize × (16 × baseFeeScalar × l1BaseFee + blobBaseFeeScalar × blobBaseFee) / 1,000,000

This is an estimate with its inputs stated, not today's price:

Input Value
Redeem gasUsed 33,946 (the same EVM, so the same gas)
Dinda's signed transaction 146 bytes, FastLZ 132 bytes, so estimatedSize = 100 bytes (the floor)
baseFeeScalar, blobBaseFeeScalar 7,600 and 862,000 (OP Sepolia's GasPriceOracle, 12 October 2026)
L1 gas price, blob base fee, L2 gas price examples: 1 gwei, 1 gwei, 0.005 gwei
L1 gas price 1 gwei L1 gas price 20 gwei
Redeem on L1 33,946 gwei 678,920 gwei
L2: execution 169.73 gwei 169.73 gwei
L2: L1 data 98.36 gwei 329.40 gwei
L2: total 268.09 gwei (about 127 times cheaper) 499.13 gwei

The L1 gas price went up 20 times (1 to 20 gwei), the L2 fee only 1.86 times: less than 2 times. On the L2, execution is paid at the L2 gas price; only the data part follows L1 prices, and it is worked out from 100 compressed bytes times a scalar, not from 33,946 gas. The formula and the FastLZ were checked against the GasPriceOracle's getL1Fee (0x420000000000000000000000000000000000000F) on OP Sepolia and Base Sepolia: the results match exactly. For real numbers, read l1BaseFee(), blobBaseFee() and both scalars from that contract, or use estimateTotalFee from viem/op-stack.

Bridges: the risks in plain words

A bridge moves assets between chains: the asset is locked in an L1 contract, then its L2 version is minted (a deposit, usually a few minutes). On the way back, the L2 version is burned and the asset on L1 is released once it is proven (a withdrawal). The risks:

📌 L2BEAT stages: how mature an L2 is

L2BEAT rates rollups in three stages (definitions as of October 2026; last changed on 30 April 2026):

Stage What it means
Stage 0 calls itself a rollup, state roots and data on L1, software to rebuild the state exists, a proof system exists, at least 5 outside parties can submit fault proofs
Stage 1 the only way (bugs aside) to block or fake a withdrawal is to control 75% of the Security Council (a multisig of at least 8 people); upgrades from outside the Council give at least 5 days to exit; an optimistic challenge period of at least 5 days (it used to be 7)
Stage 2 fault proofs open to anyone, unwanted upgrades give at least 30 days to exit, the Security Council may only act on bugs proven on-chain

Projects with no proper proof system, or whose data is not available enough, are put in L2BEAT's Others category, not counted as rollups. Check the L2BEAT page before you pick a chain for users' assets.

⚠️ What's different on an L2 when you assume it's the same

TL;DR: An L2 runs transactions outside Ethereum, then sends their data and state root to L1 so it inherits Ethereum's security. An optimistic rollup takes a state root as correct unless it is disputed with a fault proof during the challenge period (withdrawals take about 7 days on OP Mainnet); a ZK rollup attaches a validity proof that L1 checks. Data goes in 128 KiB blobs with their own fee market; since BPO2 (7 January 2026) the target is 14 and the maximum 21 per block. For a developer, Solidity and the libraries stay the same; what differs is the chain ID, the RPC and the fee: on OP Stack, L2 execution + the L1 data fee (the Fjord formula, FastLZ). Dinda's redeem (33,946 gas) with example inputs: 33,946 gwei on L1, 268.09 gwei on the L2, and when L1 gas goes up 20 times, the L2 fee goes up only 1.86 times. A bridge locks assets in one contract, so bugs, upgrade keys and operators are its risks; L2BEAT stages (0, 1, 2) show how far the training wheels have come off.

⚡ L2: execution outside, data on L1

Meaning: An L2 runs transactions outside Ethereum, then sends their data and state root to L1. Because the data is on L1, anyone can rebuild the L2 state without trusting the sequencer.

⚡ Optimistic versus ZK

Meaning: An optimistic rollup takes a state root as correct unless it is disputed with a fault proof during the challenge period, so withdrawals on OP Mainnet take about 7 days. A ZK rollup proves each batch valid with a zero-knowledge proof.

⚡ L2 fee = execution + L1 data

Write:

estimatedSize = max(100 bytes, -42.5856 + 0.8365 × fastLzSize)
Guess first: the L1 gas price goes up 20 times, from 1 to 20 gwei. How many times does Dinda's redeem on the L2 go up?

Only 1.86 times. Execution is paid at the L2 gas price, and only the data part follows L1 prices, worked out from 100 compressed bytes.

Meaning: Solidity code, the ABI and the libraries stay the same on an L2. What differs is the chain ID, the RPC and the fee formula.

⚡ A bridge is one big target

Meaning: A bridge locks assets in one contract, so bugs, upgrade keys and operators are its risks. Check the L2BEAT stage before you pick a chain for users' assets.

What you will learn