nft

What Are Layer 2 Solutions and Why Are They Important?

MOBILE 22 2
Michael Caloca / ONE37pm

What are layer 2 solutions?

Layer 2 is a term used for solutions created to help scale an application by processing transactions off of the Ethereum Mainnet (layer 1) while still maintaining the same security measures and decentralization as the mainnet. Layer 2 solutions increase throughput (transaction speed) and reduce gas fees. Popular examples of Ethereum layer 2 solutions include Immutable X, Polygon, and Polkadot.

Why are layer 2 solutions important?

Layer 2 solutions are important because they allow for scalability and increased throughput while still holding the integrity of the Ethereum blockchain, allowing for complete decentralization, transparency, and security while also reducing the carbon footprint (less gas, means less energy used, which equates to less carbon.)

Although the Ethereum blockchain is the most widely used blockchain and arguably the most secure, that doesn’t mean it doesn’t come with some shortcomings. The Ethereum Mainnet is known to have slow transaction times (13 transactions per second) and expensive gas fees. Layer 2s are built on top of the Ethereum blockchain, keeping transactions secure, speedy, and scalable.

Each individual solution has its own pros and cons to consider such as throughput, gas fees, security, scalability, and of course functionality. No single layer 2 solution currently fulfills all these needs. However, there are layer 2 scaling solutions which aim to improve all these aspects; these solutions are called rollups.

What are layer 2 rollups?

Rollups are layer 2 scaling solutions that perform transaction operations off the main Ethereum blockchain, but still post the transaction data onto layer 1. Considering the transaction data is on layer 1, rollups are secured by the same layer 1 security measures. In fact, this is the defining feature that rollups offer to users.

There are three properties of a layer 2 rollup: 

  1. Transactions are executed outside of layer 1 (reduces gas fees)
  1. Data and proof of transactions reside on layer 1 (maintains security)
  2. A rollup smart contract which is found on layer 1, can enforce proper transaction execution on layer 2, by using the transaction data that is stored on layer 1

Ultimately, rollups require users like you and me to stake a bond in the rollup smart contract, which encourages users to verify and execute transactions correctly. 

Rollups are useful because they reduce fees, increase transaction throughput, and expands participation. There are two kinds of rollups with different security measures:

  1. Optimistic rollups assume transactions are valid by default and only runs computation, via a fraud proof, in the act of a challenge
  2. Zero-knowledge rollups runs computation off-chain and submits a validity proof to the main-chain

Optimistic Rollups:

Optimistic rollups sit in parallel to the Ethereum Mainnet on layer 2 and don't perform any computation (mathematical equations) by default. Instead, after the transaction is complete, they submit the new state to the Ethereum Mainnet, essentially notarizing the transaction.

Optimistic rollup transactions are written into the main Ethereum blockchain, further optimizing transactions by reducing the cost of gas.

Advantages of optimistic rollups include:

  • Low gas fees 
  • Increased throughput
  • Smart contract capability
  • Security (guaranteed by the Ethereum Mainnet)

Disadvantages of optimistic rollups:

  • Long withdrawal time (challenge periods can last for weeks)
    • If a fraudulent transaction is discovered, the rollup will automatically call a fraud-proof and run the transaction’s computation using the available written data, leading to long withdrawal times if the transaction is challenged.

There are several applications of optimistic rollups that you can integrate into your own dapps:

Zero-knowledge rollups:

Zero-knowledge rollups (ZK rollups) bundle thousands of transactions off the main Ethereum chain and create cryptographic proof which is known simply as SNARK (succinct non-interactive argument of knowledge). This is called validity proof, which is posted to the Ethereum Mainnet.

The smart contract for a ZK rollup keeps the data of all transfers on layer 2 and the data can only be edited with a validity proof. Meaning, ZK rollups only need validity proof, opposed to all the transaction data. This function decreases the cost to transact due to less data being included.

When it comes to ZK rollups, there is minimal hesitation when moving assets from layer 2 to layer 1, considering the validity proof has already been approved by the ZK rollup and has already authorized the transaction.

Advantages of ZK rollups include:

  • Near instant transfers 
  • Not vulnerable to the attacks that optimistic rollups may be affected by
  • Still secure and decentralized

Disadvantages of ZK rollups:

  • Validity proofs are extreme to compute for smaller applications with less on-chain activity
  • A user can influence transaction ordering
  • Some rollups don’t offer Ethereum Virtual Machine (EVM) support

There are numerous applications of ZK rollups that you can integrate into your own dapps:

Ethereum layer 2 solutions have some serious potential to change the blockchain landscape for the better. Layer 2 solutions ensure that users are able to maintain all the safety measures used on the Ethereum Mainnet while still being able to transact quickly and at little to no cost for users.

This type of technology may encourage more people to try out the Ethereum blockchain and everything it has to offer. Also, keep in mind that many layer 2 solutions are still in their beta phase, meaning you should research everything in-depth and always remain curious and cautious when exploring the various layer 2 solutions.

Did you like this article?
Thumbs Up
Liked
Thumbs Down
Disliked