Layer 2 Demystified: How Polygon Scales Ethereum

Polygon Labs
September 12, 2023
Polygon Giga Brain
Image source: Dribbble

Scaling Ethereum is a problem nearly as old as Ethereum itself. The complexity of the task is directly the result of what makes Ethereum great: It’s a living protocol that has evolved, slowly, to ensure the chain’s security and decentralization. 

When increased activity fuels greater demand, using Ethereum can become prohibitively expensive. But what does it mean to scale Ethereum? 

This post answers everything you wanted to know but was afraid to ask: What is Layer 2, how is it different from Layer 1, how does it solve the problem of the blockchain trilemma, and what differentiates one scaling solution from another?  

ELI5: Layer 2 v. Layer 1

Layer 1 and Layer 2 are often referred to as the parent chain (L1) and the child chain (L2). This is because, like parents and children, the L1 doesn’t rely on the L2 for any functionality. An L1 is entirely self-sustaining, whereas the L2 depends on the L1 for some things. That dependency varies by the type of L2, though most rely on the L1 for security and storing transaction data. 

All Ethereum L2s are designed to do at least this one important thing: process and execute transactions. 

In this sense, the L2 acts as an execution layer for Ethereum. In turn, the L1 provides the L2 with consensus—the complex, expensive task of verifying transaction data and updating the balances of all accounts across the blockchain. 

Reaching consensus safely is more important than reaching consensus quickly. While it’s not incorrect to say that Ethereum moves slowly, it’s more accurate to say that Ethereum moves securely. Slowness is a byproduct. 

What Problem Does Layer 2 Solve?

There is an old engineering adage: good, cheap, fast -- pick two. What is good and fast, won’t come cheap. What is cheap and fast, can’t be good. In the case of blockchain technology, that tradeoff matrix is decentralization, scalability, and security. 

Given how security and decentralization are the essential features that make blockchains distinct from Web2.0, scalability became the most useful feature that L2 solutions could offer. 

While the tech-stacks for deploying L2s were maturing, there were some intermediary scaling solutions that made tradeoffs on the trilemma.

How Does a Layer 2 Scale Ethereum?

Blockspace is a blockchain’s only resource. When users execute a transaction on a blockchain, they pay a fee. That fee buys them blockspace, or the space in the ledger where their transaction will eventually be recorded. 

L2s scale Ethereum by extending that blockspace.

But not all scaling solutions are L2s. State channels and plasma chains are two approaches for scaling Ethereum by offering a low-cost environment parallel to Ethereum. 

State channels 

State channels exist off-chain, with a smart contract on-chain. Users deposit assets to this smart contract, which are then available to the user in the state channel. State channels do not interact with the L1. Instead, these sidechains impose their own logic for how transactions are validated and how disputes are settled. Because of this, using state channels requires a high degree of trust.

Plasma chains

Plasma chains still require trust, but to a lesser degree than state channels. That’s because plasma chains periodically submit a summary of their transactions to the underlying L1, in the form of block commitments. These block commitments are made by validators, according to a consensus mechanism.

Rollups: Optimistic and ZK

What distinguishes sidechains from true L2s is simple: security. Where state channels and plasma chains use a consensus mechanism to generate state transitions, L2s use cryptographic proofs to provide the underlying L1 a guarantee that the transactions occurring on the L2 are legitimate.

The distinction between these approaches is the kind of proof they use. ZK rollups use validity proofs, while optimistic rollups use fraud proofs.

A fraud proof takes as fact that a block of data—transactions, whatever it may be—is valid. Hence why fraud proof rollups are called optimistic rollups. For Ethereum L2s, an optimistic rollup posts transaction batches to Ethereum, at which point the block may be checked for fraud.

This check is not required, but must be performed within a certain timeframe known as the dispute time delay, or DTD, during which time assets in that batch are inaccessible.

Perhaps not all men are knaves, but certainly some are. And so if a valid fraud proof is submitted after the block has been committed to Ethereum, the transactions in the block may be partially or entirely reverted, with a penalty for the dishonest party. 

A validity proof, or zero knowledge (ZK) proof, is much more straightforward: a ZK proof can only be generated if the batch of transactions it represents are valid. A ZK proof allows the L2 to prove to the L1 that a statement is true without having to reveal any specific information. Essentially, tell me without telling me. 

How Does ZK Tell Without Telling?

ZK proofs contain three basic elements. The first is a witness: the parameters by which a prover can efficiently show a verifier that they indeed know the contents of some thing—like a batch of transaction data—to be valid. The prover and verifier continue their cycle of challenges. If the prover responds incorrectly even once, a proof cannot be not generated. 

This is how zero knowledge proofs allow for verifiable computation performed outside of Ethereum. Crucially, this proof is much smaller than the batch of data it represents, reducing network congestion and lowering costs, all without compromising any of its security or decentralization.

It’s all of Ethereum’s exceptional security and protocols, but faster. And cheaper. Good, cheap, and fast. No tradeoffs. 

How does Polygon Scale Ethereum?

There are no one-size-fits-all scaling solutions. A gaming platform, for example, is best served by an L2 that offers the highest possible throughput, while a decentralized exchange would prioritize security over per-tx costs. 

Polygon 2.0 is the long-term vision for scaling every possible use-case, according to its needs.    The Polygon protocols currently live on Ethereum include Polygon PoS, Polygon zkEVM and Polygon CDK, with Polygon Miden coming soon. All of these chains will be interoperable, meaning users can execute near-instant cross-chain transactions, without having to bridge back to Ethereum. ZK proofs are the only known tech that make this possible. 

Polygon PoS

Polygon PoS is the original Polygon chain, launched in 2020. Since then, the network has processed more than 2 billion transactions, from more than ten thousand dApps, with average transaction fees of $0.015. 

The network is designed, in-part, like a plasma chain, and 100 validators reach consensus on block commitments to Ethereum.

However, Polygon Labs has proposed a path for converting Polygon PoS into a zkEVM validium. A validium has the cryptographic security of ZK proofs, but with the cost-reduction of storing transaction data off-chain. If the Polygon community accepts the proposal, Polygon PoS would become a true L2. 

Polygon zkEVM

The reason most L2s are built on Ethereum is because Ethereum leads all blockchains in terms of developer activity. Onboarding those developers should also be seamless. This means supporting all of the great tooling and smart contracts developers already know and love.

That’s Polygon zkEVM, an EVM-equivalent ZK rollup. Having this degree of parity means that using Polygon zkEVM is exactly like using Ethereum.

Since launching on Mainnet, the rollup has processed more than five million transactions from 400,000 unique addresses and generated more than 600,000 ZK proofs. Polygon zkEVM is open-source licensed with MIT/Apache, and transaction fees are on-par with optimistic rollups. 

Polygon Miden

Polygon Miden is also a ZK rollup, but with very different design priorities. As opposed to being EVM-equivalent, such as Polygon zkEVM, Polygon Miden has a ZK-centric design. This allows Polygon Miden to effectively extend the feature set of the EVM, allowing developers to create applications that are currently difficult or impractical to build on account-based systems like Ethereum. The design of Polygon Miden has two primary benefits:

  • Enhanced privacy
  • High-throughput

Polygon CDK

Polygon CDK is the open-source chain development kit that allows anyone, anywhere to deploy their own ZK-powered L2s. These are appchains, meaning that they are deployed to fit a particular use-case. Polygon CDK is modular and configurable for performance and cost. 

Chains built with Polygon CDK are interoperable with all other Polygon CDK chains.

Existing appchain solutions either produce walled gardens with isolated liquidity, or offer interoperability with significant latency and additional security assumptions and concerns. These limitations are due to the architecture and technology of existing solutions. 

Polygon CDK chains benefit from the massive liquidity that exists across all networks, while maintaining the highest levels of scalability, security and sovereignty.

Explore tens of thousands of decentralized apps in the Polygon ecosystem that these solutions make possible. Tune into the Polygon Labs Blog and our social channels to keep up with updates about the Polygon ecosystem.

Together, we can build an equitable future for all through the mass adoption of Web3!

Website | Twitter | Developer Twitter | Forum | Telegram | Reddit | Discord | Instagram | Facebook | LinkedIn

More from blogs