Photo by: ROUTE 2 FI

Compiled by: TechFlow

Over the past few months, I have observed that certain Layer 2 solutions (L2) have attracted a lot of transactions and seen various projects built on these L2s. So what are these L2 solutions?

Before diving into Layer 2 solutions, it is important to understand the current situation of the Ethereum mainnet, which currently processes about 12 transactions per second. During peak network activity, the cost of transacting on the mainnet has reached a level that is unaffordable for ordinary crypto users. This has caused Ethereum's scalability problem. The root of this problem is that every node in the network needs to store and verify the transactions that occur on the network.

Layer 2 solutions were introduced in response to this Ethereum scalability issue. L2 is essentially a completely separate blockchain built on top of Ethereum, thereby inheriting the security guarantees of Ethereum itself. Each L2 solution has its own set of security guarantees and trade-offs. The most popular forms of L2 scaling on Ethereum are rollups, such as Arbitrum, Optimism, and Base.

Rollup is an L2 solution that is able to process transactions for L1. General Ethereum transactions are typically 156 bytes, which is somewhat data dense. Therefore, rollup is able to process many transactions on the L2 execution layer, and then package them into a concise transaction to be published to the L1 state verification layer. By packaging many transactions into one on the L2 execution layer, it greatly reduces the gas cost of each transaction. There are many types of rollups, and not all rollups are the same, however, the most popular of all are smart contract rollups: Optimistic rollup and zero-knowledge proof rollup.

Smart Contract Rollup is a Rollup where users are able to send funds to a Rollup smart contract on L1 (Ethereum), which then manages transactions and state changes. A key component of rollups and blockchains is the merkle tree, essentially a merkle tree is a data structure that stores the state of everyone's funds and the transactions that have occurred, allowing L1 to verify the state directly on L2 without downloading the entire state. Simply put, users interact on L2 and make transactions (which changes the state), using their funds, and L2 will send the merkle root of the state changes to L1 so that L1 can verify the state of that chain.

However, L1 needs some kind of proof to ensure that the merkle root sent by L2 is valid, and this is where the two smart contract rollups differ. The two main proofs are fraud proofs and zero-knowledge proofs.

Optimistic rollups like Arbitrum and Optimism use fraud proofs to finalize state.

Fraud proofs work like this:

  1. The L2 node publishes the merkle root to the L1 smart contract, along with a small security deposit;

  2. L1 smart contracts trust L2 nodes by default, which is where the word “Optimistic” comes from. L1 optimistically trusts L2 updates;

  3. However, this status change will not become final for 7 days;

  4. During these 7 days, someone can submit a proof that the published merkle root is fraudulent, which will cause the update to be revoked and penalize the L2 node, giving the submitted bond to the person who reported the fraudulent update;

  5. The reporter is now able to prove that the update was fraudulent by verifying all transactions that occurred in the state root change and confirming that each signature on those transactions is valid;

  6. If the status change is not challenged within 7 days, the update is finalized and immutable.

As for zero-knowledge (ZK) rollups, they use zero-knowledge proofs. Here’s how zero-knowledge proofs work:

  1. The L2 node publishes the merkle root and a ZK proof to the L1 smart contract, proving that L2 processed the transaction correctly and generated a new merkle root.

  2. If an L2 node attempts to publish a fraudulent update, they will not be able to produce a valid ZK proof, so the L1 smart contract will not accept the new merkle root;

  3. Once the ZK proof is verified, the state update is finalized immediately.

Now, as we mentioned earlier, L2 exists to combat Ethereum’s scalability issues due to the high transaction/gas fees on the mainnet. Let’s take a deeper look at how the two main smart contract rollups calculate the gas fees paid by users.

Both Arbitrum and Optimism expect users to pay two costs when transacting on them: L2 Gas (execution fee) and L1 calldata (security fee). L2 Gas (execution fee) is similar to the gas fee on the mainnet. Every transaction on L2 must pay a gas/execution fee, which is equal to the amount of gas used by the transaction, multiplied by the current gas price attached to the transaction: (L2 Gas Price) x (L2 Gas Usage)

As for the L1 calldata/security fee, the L1 calldata fee is to cover the cost of publishing the transaction back to Ethereum. This fee exists because the assembler (the mechanism that L2 aggregates and publishes transactions back to L1) will have to pay the L1 gas fee to publish the transaction on Ethereum. It is calculated as follows: (L1 estimated gas price) x (L1 calldata size + L1 buffer)

Arbitrum and Optimism have different L2 fee pricing methods, and the most important difference between the two is the way Optimism and Arbitrum calculate the cost of L1 computation. Arbitrum uses an oracle that prices L1 computations - while for Optimism, L1 computations include a dynamic overhead (scalar) variable that the Optimism team can adjust to adjust the cost of L1 computations.

The important thing to note here is that the cost of transacting on L2 is much lower than transacting directly on Ethereum mainnet, which is why L2 is so popular. Currently, rollups have cheap costs for L2 execution layer and storage, but the cost of publishing data to L1 is still high for users in order to comply with data availability.

Earlier this year, there was an Ethereum proposal called EIP-4844, which was scheduled to be launched at the end of the year. EIP-4844 proposes to add a completely new transaction type that allows for the acceptance of blocks of data. The size of these blocks is specifically designed to be small enough to reduce storage overhead on the mainnet chain. As mentioned earlier, the high transaction costs on the Ethereum mainnet are also one of the main costs for L2 rollup solutions to issue batches and proofs to verify state changes. The impact of this proposal on this issue is that it may significantly reduce L1 cost overhead. It is expected that EIP-4844 will reduce the cost of L1 batch issuance by 10-50 times.

Some popular L2

Decision

Arbitrum is a layer 2 solution designed to improve the capabilities of Ethereum smart contracts — increasing their speed and scalability while adding additional privacy features.

It was built to address some of the shortcomings of current Ethereum-based smart contracts — such as inefficiency and high execution costs — which have harmed the Ethereum user experience and often made transactions an expensive task.

Arbitrum uses a technique called Optimistic rollup. Transactions are executed off-chain and then submitted to the Ethereum mainnet in large batches as calldata. This process helps to offload much of the computational and storage burden currently borne by Ethereum and move it off-chain.

The most popular protocol is GMX, a perpetual trading platform.

Optimism

Optimism (OP) is a layer 2 blockchain on top of Ethereum. Optimism benefits from the security of the Ethereum mainnet and helps scale the Ethereum ecosystem by using Optimistic rollup. This means that transactions are recorded trustlessly on Optimism but ultimately secured on Ethereum.

Optimism is one of the largest scaling solutions for Ethereum with over $600 million in total value locked. It owns 97 protocols, the largest of which are Synthetix (SNX), a derivatives exchange, Uniswap (UNI), a DEX, and Velodrome (VELO), an AMM.

Matic

Polygon (formerly known as Matic Network) is a layer 2 scaling solution backed by Binance and Coinbase. The project aims to incentivize mass adoption of cryptocurrencies by solving scalability issues on many blockchains.

Polygon boasts up to 65,000 transactions per second on a single sidechain, and a block confirmation time of less than 2 seconds.

MATIC is the native token of Polygon, an ERC-20 token running on the Ethereum blockchain. The token is used for Polygon's payment services and is also used as a settlement currency between users within the Polygon ecosystem.

Total locked value is currently around $800 million, with Quickswap and PearlFi being the largest native protocols currently.

Base

Base is built as an Ethereum L2 with the security, stability, and scalability required to support dapps. It allows developers to confidently deploy any EVM codebase and launch your users and assets from Ethereum L1, Coinbase, and other interoperable chains. Base is built on the MIT-licensed OP stack in partnership with Optimism.

Base has a total locked value of $350 million, Aerodrome and Friend.tech are the largest DeFi protocols.

I would not be surprised to see L2 governance tokens increase in price ahead of EIP-4844 as this change will likely attract more traffic to these chains. My assumption is that the number of transactions on these L2 chains will increase due to users saving on gas costs.