Layer 2s

Blockchain technology has layers, just like onions.

  • Layer 0 is the humans that build the protocols

  • Layer 1 is the base blockchain layer, or protocol layer. Bitcoin and Ethereum are both examples of a Layer 1 blockchain

  • Layer 2 is essentially a blockchain built on top of blockchain that allows for scalability by rolling up many txs on the layer 2 as a single tx on Layer 1

The Impetus for an Ethereum Layer 2

Layer 2 (L2) is a term that describes Ethereum scaling solutions via various methods. A layer 2 is a separate blockchain that extends and inherits the security guarantees of Ethereum. As individual blocks on the base layer (Layer 1) of Ethereum fill up with transactions some transactions may not be included in the current block being proposed. This leads to delays in getting a transaction broadcasted and finalized. Blockchain users want their transactions to be included in a block as soon as possible and they are willing to pay more than the current gas rate to insure that it gets added to the next block, resulting in gas auctions that create high gas prices to have a tx included as soon as possible. After all, block space is a time-limited resource. So, as the cost of having a tx broadcast onto the layer 1 blockchain increases other options have been created to satisfy the insatiable demand for block space. Enter the Layer 2 of Ethereum.

How a Layer 2 works

Layer 2's are particularly useful when there's high demand for transactions within a network, because they allow multiple transactions to take place and bundle them as a single transaction on the main chain.

There are different methods to create Layer 2 scaling solutions, each with their own set of strengths and weaknesses, but they are all designed to increase scalability and privacy while maintaining the trustless nature of public blockchains. A common method employed by layer 2s is to 'roll up' transactions from the layer 2 as a single transaction on the base layer. Thousands of transactions on a layer 2 could be rolled up in this way saving tons of gas from being spent on the base chain.

In general, your address on an L2 is the same as your address on mainnet and is backed up by the same seed phrase. An important distinction is with a multi-signature wallet like Gnosis Safe where your safe contract's L2 address is different when compared to it's mainnet counterpart. Assets sent to a Gnosis Safe address to the mainnet address will be lost permanently. You must set up your safe for each L2 and use the correct address for each layer 2.

Bridges

While centralized exchanges like Coinbase now have support for buying assets directly on the Polygon L2, assets on mainnet that you'd like on an L2 must be bridged.

There are layer-native bridges for Polygon, Arbitrum, and Optimism etc. which allow users to bridge assets to those specific L2s, but there are also cross-chain bridges like Connext and Hop Protocol that allow users to bridge assets from an EVM compatible L2 to any other EVM compatible L2. Using a layer-native bridge to the most common Ethereum L2, Polygon, works as follows: tokens that are "bridged" to Polygon are sent to the bridge contract and locked there while the exact amount of tokens are minted on the Polygon network. When a user wants to bridge back to mainnet the polygon tokens are burned and the mainnet tokens are unlocked from the contract. There is always a 1 to 1 amount of tokens in the layer 1 contract and on the Polygon L2.

A cross-chain bridge such as Hop Protocol works by employing liquidity providers (LPs) whose main function is to hold tokens on both L2s that an end user wishes to bridge to. When a user initiates a bridge tx with Hop they send their tokens to the LP who then sends the equal amount to the end user's address on the destination L2 (or mainnet) minus a small fee for their service.

How to start using a Layer 2

Adding a L2 to MetaMask

Add the network of your choosing to MetaMask by clicking the networks drop-down and selecting "Add network".

Now, simply select the network you are interested in using from the list.

All of the most popular Layer 2s are listed here. If you want to add a network not listed, then click "Add a network manually" at the bottom of the list. Make sure you trust the network you are adding and get the correct values to input into the fields.

To switch between networks click the networks drop-down list and select the network you would like to use.

Adding a L2 to Frame

Adding a Layer 2 network to Frame is extremely straight-forward. Simply click the settings sidebar and turn on the networks you wish to add.

You will also need to make sure to select the correct network in the Frame Companion extension depending on which network the the dApp you are using is deployed.

Last updated