Blockchain technology · · 6 min read
What are Layer 2 solutions and how do they work?
Layer 2 (L2) is the umbrella term for systems that execute transactions outside a main blockchain, record the results back on that chain, and borrow much of their security from it. The goal is to process far more transactions at far lower fees without giving up most of the main chain's security.
In this setup, base chains such as Bitcoin or Ethereum are called "Layer 1". Layer 1 stays the final judge and the ledger of record, while most everyday transaction traffic moves to the layer above it.
The problem: why is base-layer capacity limited?
On a blockchain, independent computers that take part in the network (nodes) verify every transaction themselves. That redundancy is what makes the system secure and decentralized, but it also caps capacity. Block space is scarce, and when demand rises, users compete for it through fees. That is why a simple transfer can cost several times more during busy hours.
The obvious fix seems to be bigger or faster blocks. But that raises the hardware and bandwidth needed to run a node, and as fewer people can run one, the network becomes more centralized. This tension is known as the scalability trilemma: it is hard to maximize security, decentralization and scalability at the same time.
Layer 2 offers a different answer: keep the base chain simple and secure, and move most of the computation to another layer.
How does a Layer 2 work?
The details depend on the type, but most Layer 2s follow the same three steps:
- Deposit: You lock your assets in a smart contract (a program that runs on-chain by itself) on the main chain. This contract acts as the bridge between the two layers.
- Execution: Transactions happen quickly and cheaply on Layer 2. The main chain does not process each one individually at this stage.
- Settlement: Transaction data, a summary, or a proof of correctness is written to the main chain in batches. If a dispute arises, the rules on the main chain have the final say. To withdraw, you move your assets back to the main chain through the same contract.
A hypothetical example shows why fees drop. Say posting one batch to the main chain costs $300 and the batch contains 3,000 transactions. The main-chain cost per transaction is then $0.10. Had each of those transactions been sent separately on the main chain during a busy hour, each could have cost several dollars. Layer 2 spreads the main-chain cost across many users, much like a bus ticket is cheaper than a private taxi.
The main types of Layer 2
| Type | Core idea | What to watch |
|---|---|---|
| State channels | Two parties update the balance between them off-chain with mutual signatures; only opening and closing the channel hit the chain. Bitcoin's Lightning Network is the best-known example. | The channel needs enough balance, and the other party must be reachable |
| Optimistic rollup | Bundles transactions and treats them as valid unless proven otherwise; a fraudulent batch can be reverted if it is challenged within a dispute window. | Direct withdrawals to the main chain usually take about a week |
| ZK rollup | Produces a mathematical validity proof for each batch showing the transactions followed the rules; the main chain verifies the proof. | Generating proofs is computationally heavy, and the technology is more complex |
| Sidechain | A separate chain with its own validators, connected to the main chain by a bridge. | Does not inherit security from the main chain, so most sources do not count it as a true Layer 2 |
Most of the Layer 2s that have taken off in the Ethereum ecosystem are rollups. Because rollups publish transaction data on the main chain, anyone can rebuild the balances from that data even if the operator disappears. With its Dencun upgrade in 2024, Ethereum added a cheaper, temporary data space for rollups (blobs), which cut rollup fees significantly.
What does "inheriting security from the main chain" mean?
Three questions determine how much a Layer 2 really leans on its base chain:
- Where is the data? If transaction data is published on the main chain, the state can be rebuilt even if the Layer 2 operator vanishes. If the data is kept only by an off-chain committee, you have to trust that committee.
- How is correctness proven? Can a fraudulent batch be rejected with a fraud proof or a validity proof, or is that mechanism not yet live?
- Who can change things? On many Layer 2s, the developer team or a security council can upgrade the contracts on the main chain. That power helps fix bugs quickly, but it also means users are trusting those people.
The answers show how accurate the phrase "as secure as the main chain" really is. Many projects start out more centralized and aim to reduce these powers over time.
Risks and things to watch
- Sequencer centralization: On most rollups, a single sequencer orders the transactions. If it goes down, the network can slow or halt temporarily. In well-designed systems, you can force your transaction through the main chain directly.
- Bridge and contract risk: The assets on a Layer 2 are backed by funds locked in contracts on the main chain. A bug in those contracts or a bridge exploit can cause serious losses.
- Withdrawal times: A direct withdrawal from an optimistic rollup waits until the dispute window ends. "Fast withdrawal" services shorten the wait, but they add fees and another counterparty.
- Sending on the wrong network: On most Ethereum-compatible networks, addresses look identical. Funds sent from a network the receiving exchange does not support may arrive very late or never. Checking the supported network before a transfer, and sending a small test amount first for larger sums, is a common precaution.
- Fragmented liquidity: The same token can exist on different Layer 2s under different contract addresses. A bridged version and a network's native version are not always the same thing.
Key takeaways
- Layer 2 runs transactions off the main chain and records the outcome on it, lowering fees and adding capacity.
- The main types are state channels, optimistic rollups and ZK rollups; sidechains are treated separately because they do not inherit the main chain's security.
- A Layer 2's security depends on where the data lives, how correctness is proven, and who can change the contracts.
- Sequencer centralization, bridge risk, withdrawal delays and sending on the wrong network are the risks users run into most often.