Ana içeriğe geç

What is layer 2?

Scaling Ethereum for mass adoption

What is layer 2?

Layer 2 (L2) is a collective term to describe a specific set of Ethereum scaling solutions. A layer 2 is a separate that extends Ethereum and inherits the security guarantees of Ethereum.

Now let’s dig into it a bit more. To do this we first need to explain layer 1 (L1).

What is Ethereum

What is layer 1?

Layer 1 blockchains, such as Ethereum and Bitcoin, are the underlying foundation that layer 2 projects build on top of. Examples of layer 2 projects include zero-knowledge rollups and optimistic rollups on Ethereum and the Lighting Network on top of Bitcoin.

Ethereum also functions as a data availability layer for Layer 2s, and if there are any disputes on previous transactions data is provided from Ethereum for these disputes.

Ethereum as the layer 1 includes:

  1. a network of node operators to secure and validate the network
  2. a network of block producers
  3. the blockchain itself and the history of transaction data
  4. the consensus mechanism for the network

Why do we need layer 2?

The three desirable properties of a blockchain are that it is decentralized, secure, and scalable. The blockchain trilemma states that a simple blockchain architecture can only achieve two out of three. Want a secure and decentralized blockchain? You need to sacrifice scalability. This is where layer 2 networks come in.

Ethereum has reached the network's current capacity with 1+ million transactions per day, with high demand for each of these transactions. The success of Ethereum and the demand to use it has caused gas prices to rise substantially. Therefore the need for scaling solutions has peaked as well.

Scalability

The main goal of scalability is to increase transaction speed (faster finality), and transaction throughput (high transactions per second), without sacrificing decentralization or security (more on the Ethereum vision).

The Ethereum community has taken a strong stance that it would not throw out decentralization or security in order to scale. Until sharding, Ethereum Mainnet (layer 1) will only be able to process roughly 15 transactions per second. When demand to use Ethereum is high this causes network congestion, increasing transaction fees, and pricing out those who cannot afford it from using Ethereum until the fees reduce. That is where layer 2 comes in to scale Ethereum today.

Lower fees

By combining multiple transactions into a single transaction on layer 1, transaction fees are massively reduced, making Ethereum more accessible for all.

Maintain security

Layer 2 blockchains settle their transactions on the Ethereum Mainnet, allowing users who use them to benefit from the security of the Ethereum network.

Expand use cases

With higher transactions per second, lower fees, and new technology, projects will expand into new applications with improved user experience.

How does layer 2 work?

As we mentioned above, layer 2 is a collective term for Ethereum scaling solutions that handle transactions off Ethereum layer 1 while still taking advantage of the robust decentralized security of Ethereum layer 1. A layer 2 is a separate blockchain that extends Ethereum. How does that work?

There are several different types of layer 2, each having their own trade-offs and security models. Layer 2s take the transactional burden away from the layer 1 allowing it to become less congested, and everything becomes more scalable.

Rollups

Rollups bundle (or 'roll up') hundreds of transactions into a single transaction on layer 1. This distributes the L1 transaction fees across everyone in the rollup, making it cheaper for each user.

The transaction data in the rollup is submitted to layer 1, but the execution is done separately by the rollup. By submitting transaction data onto layer 1, rollups inherit the security of Ethereum. This is because once the data is uploaded to layer 1, reverting a rollup transaction requires reverting Ethereum. There are two different approaches to rollups: optimistic and zero-knowledge - they differ primarily on how this transaction data is submitted to L1.

Optimistic rollups

Optimistic rollups use fault proofs where transactions are assumed to be valid, but can be challenged if an invalid transaction is suspected. If an invalid transaction is suspected, a fault proof is ran to see if this has taken place.

More on optimistic rollups

Zero knowledge rollups

Zero Knowledge rollups use validity proofs where transactions calculations are computed off-chain, and then this data is then supplied to Ethereum Mainnet with a proof of their validity.

More on zk-rollups

Do your own research: Risks of layer 2

Because layer 2 chains inherit security from Ethereum, in an ideal world, they are as safe as L1 Ethereum. However, many of the projects are still young and somewhat experimental. After years of R&D, many of the L2 technologies that will scale Ethereum went live in 2021. This is not to say these L2s are not secure, only that no layer 2 is as battle tested as Ethereum Mainnet. Always do your own research and decide if you're comfortable with any risks involved.

For more information on the technology, risks and trust assumptions of layer 2s, we recommend checking out L2BEAT, which provides a comprehensive risk assessment framework of each project.

Go to L2BEAT(opens in a new tab)

A note on alt L1s, sidechains, and validiums

Alternative layer 1s have higher throughput and lower transaction fees than Ethereum. These alt L1s have had to sacrifice on security or decentralization in order to achieve higher transactions per second and lower fees. The Ethereum ecosystem is firmly aligned that layer 2 scaling is the only way to solve the scalability trilemma and remain decentralized and secure

Sidechains and validiums are blockchains that allow assets from one blockchain to be bridged over and used on another blockchain. Sidechains and validiums run in parallel with the main chain, and interact with the main chain through bridges, but they do not derive their security or data availability from the main chain. They scale similarly to layer 2s, but have different trust assumptions. They offer lower transaction fees, and higher transaction throughput. More on sidechains and validiums.

Ethereum bilginizi test edin