0%
Overview page background
HomeOverviewsLayer 2
What Are Layer 2 Blockchains?

What Are Layer 2 Blockchains?

Max's headshot

Written by Max Crawford

Published on October 7, 20256 min read

2 blockchains stacked on top of each other

Deploy a smart contract on Ethereum during peak hours, and watch your transaction fees spike, or your transaction get stuck in the mempool for hours. Blockchains aren’t infinitely scalable networks: blockspace is inherently limited, and as demand for that space grows, UX deteriorates, which can be a dealbreaker for apps: what builder wants to use a chain where every code deployment costs hundreds of dollars? What user would want to swap $20 of tokens in an app if gas fees alone cost them $10?

Layer 2 blockchains solve that problem.

What Is a Layer 2 Blockchain?

A Layer 2 blockchain moves computation and transaction execution off a foundational layer 1 blockchain like Ethereum or Bitcoin, while still leveraging that L1 chain to validate and secure those L2 transactions. In other words, the L1 acts as a sort of clearing house for the L2, ensuring that all L2 transactions and users balances are sound, and in addition the L1 chain stores the state of the L2, so the L2 gets the additional security benefits of the L1 network.

The mechanics of an L2 blockchain are designed for scale. Transactions execute offchain, reducing load on the more crowded blockspace of the L1. And instead of submitting the output of each transaction individually back to the L1, L2s bundle hundreds or thousands of transactions together first—and post that aggregated data to the L1 chain in a single transaction. Mathematical proofs on the L1 guarantee the validity of those transactions without needing to re-execute every transaction in the L1 chain.

The end result: L2s get the benefits of an L1’s security by settling back on that chain, but gets 100x better performance at a fraction of the cost by moving computation and transaction sequencing offchain.

The Main L2 Designs

There are a number of different kinds of L2 blockchain designs, including rollups, state channels, and sidechains, that each make different tradeoffs between security, cost, and speed. Let’s take a closer look at the differences between these various L2 implementations.

Optimistic Rollups

Optimistic rollups like Arbitrum and Optimism assume transactions are valid by default—innocent until proven guilty. Transactions first execute on the L2 and then get posted to Ethereum. After that transactions enter a seven-day challenge period where validators can dispute invalid transactions. If unchallenged, transactions are final.

The trade-off is clear: fast and cheap transactions (because there’s no computational cost to prove transactions as correct), but that cheapness comes with delays - a week-long wait for withdrawals back to Ethereum to be finalized.

Zero-Knowledge Rollups

ZK rollups like ZkSync Era, Starknet, and Polygon zkEVM use cryptographic proofs to validate transactions instantly. The L2 generates a validity proof (SNARK or STARK), posts it to Ethereum, and Ethereum verifies it mathematically. No challenge period needed—transactions achieve finality almost instantly.

That instant settlement comes with a cost: generating validity proofs is computationally expensive, so users pay more for that speed premium. ZK rollups are also a more complex technology. Optimistic rollups beat ZK tech to market and have a significantly larger market share. Though as further research makes ZK tech more feasible, that balance could change.

State Channels

State channels enable peer-to-peer transactions without touching the blockchain for every interaction—like opening a bar tab and settling the final balance at the end of the night. Networks like Lightning and Raiden implement this for transfers and payment use cases.

Since state channels don’t have a concept of global state (users can’t see activity occurring inside an individual channel until it closes), you can’t build smart contract logic that interacts with chain state, limiting the use cases you can build with state channels.

Sidechains

Sidechains like Polygon PoS run parallel to Ethereum (or another L1) with an independent consensus mechanism and validator network. The design space for sidechains can be quite wide, but generally sidechains share some relationship to the L1, whether it is using merge-mining where L1 miners simultaneously mine the L2, a native bridge that enables assets to move between the L1 or L2, or using the L1 for data availability or settlement.

Given the breadth of sidechain design, sidechains are sometimes not considered a true “L2” in the way that rollups are, but sidechains can offer a fast and flexible implementation for apps where absolute security tied to the L1 isn’t paramount.

L2 Design Trade-offs Matter

Every L2 makes different compromises, and the compromises across security, finality time, cost, and devex can make a big difference in both the builder and user experience. When picking the right L2 for your business, you want to think through what requirements your use case needs to succeed:

  • Security: Different L2s offer different types of security guarantees. Optimistic rollups inherit Ethereum's full security but require fraud proofs. ZK rollups provide mathematical guarantees but rely on complex cryptography. Sidechains have independent security models.

  • Transaction fees: At some level, all L2s reduce cost compared to building on the L1, but the specific reductions can vary quite a bit. ZK rollups have higher proof generation costs but can achieve better data compression on the L1. Optimistic rollups have simpler economics, and so have lower transaction fees, but need to store more data on-chain on the L1, increasing costs from a different vector.

  • Confirmation speed: Optimistic rollups need a 7-day challenge window while ZK rollups and state channels can offer near-instant finality. How quickly do you need transaction finality? How impactful is it to your users if transactions periodically get rolled back over the course of a 7-day challenge window?

  • DevEx: Optimistic rollups typically offer better EVM compatibility—you can often deploy existing Solidity code with minimal changes. For an ecosystem with robust Solidity tooling and template code, that compatibility can reduce a lot of friction in the building process. Compare that to ZK rollups, which can require learning entirely new programming languages and tools.

  • Decentralization: Most L2s today use centralized sequencers, though this is starting to change, and some L2s are more centralized than others. How much do you building on a decentralized network against the other tradeoffs mentioned above?

Your use case, and your ideological stance, will determine which L2 solution you choose to build with. If you have more questions about what sort of rollup is the right fit for your business, our rollups team can help guide that decision. You can reach out to our rollups team here.

The Future of L2 Chains

The L2 landscape evolves rapidly. Just a few years ago, nobody was talking about L2s, let alone building on them. Today, rollups have hundreds of millions of users, with billions of dollars of transactional value. There’s no doubt that L2s are here to stay, even as many businesses choose to build new bespoke L1s for their use case (L2s come with lower operational costs, meaning businesses can hold more of their revenue and focus on shipping value to customers, in ways that you simply can’t if you tackle the harder problem of cold-starting your own L1).

And as L2 blockchains continue to gain marketshare, there’s a lot of exciting innovation happening in the space to drive L2s forward even further.

ZK research continues to push forward the mainstream feasibility of the ZK design. Organizations like ZKSync Era, Scroll, and Polygon zkEVM, have made ZK rollups EVM-compatible, eliminating the main adoption barrier for these ecosystems, and alongside that work, new breakthroughs continually drive down computation costs for generating zk proofs.

On the optimistic front, teams are shipping work to integrate ZK proofs into their stack, enabling dynamic solutions where transactions can be routed to different proof systems based on needs. Orgs are also shipping better interoperability between different L2 chains, helping bring deeper liquidity and a unified ecosystem.

Lastly, we are even seeing the rise of L3s and appchains, chains solely dedicated to individual apps, that are customized for specific use cases, unlocking optimizations and better UX that aren’t possible when sharing chain space with other entities.

Getting Started on L2 Chains

Layer 2s aren't a band-aid of a scaling solution—they are working in production, supporting millions of transactions and driving mainstream adoption, across all different types of designs.

The good news is that the most popular L2 options are EVM-compatible, and your existing Ethereum tools work across these various L2 environments, including Hardhat, Foundry, and of course Alchemy.

We support all major L2s with our infrastructure and suite of devtools for building anything onchain. Get your free API key and make your first API call to a leading L2 blockchain and start to explore what it feels like to build in one of the fastest growing onchain spaces.

Frequently Asked Questions

What's the difference between a layer 1 and layer 2?

Layer 1 refers to a base blockchain (like Ethereum or Bitcoin) that handles consensus, security, and data availability and is entirely independent. Layer 2s are secondary networks built on top of an L1 that handle computation and transaction sequencing and bundling off the L1 chain to keep costs down. L2s then post those transactions back to the L1 and are dependent on the L1 chain for network security.

Are layer 2s as secure as Ethereum?

Most L2s inherit Ethereum's security through cryptographic proofs or fraud detection mechanisms. While the security model differs between solutions, properly designed L2s maintain the same security guarantees as the base chain.

How much cheaper are layer 2 transactions?

Transaction costs on L2s are typically 10-100x cheaper than Ethereum mainnet. During high congestion, the savings can be even greater. A transaction costing $50 on mainnet might cost $0.50 or less on an L2.

Can I move assets between different layer 2s?

Direct L2-to-L2 interoperability is still improving, but you can move assets between L2s by bridging back to Ethereum first, or using a 3rd party bridge to move assets from one chain to another.

Do I need to learn new programming languages for layer 2 development?

Most L2s support Solidity and standard Ethereum development tools. Some solutions like StarkNet originally required Cairo, but even they're adding Solidity support.

What happens if a layer 2 goes offline?

Most L2s have escape hatches that let users withdraw funds directly through Ethereum even if the L2 stops operating. Sometimes called “forced withdrawals”, this functionality lets users reclaim their L2 assets back to the L1, regardless of the state of the L2.

Overview cards background graphic