🎇

Layer 2 Breakdown (draft)

Go back:

đź’Ľ
Our Projects

L2 Introduction

Layer 2s are an extension of Layer 1, which is the base blockchain. L1s are made up of the blockchain and a network of nodes which operate to keep the network secure and validate transactions. Blockchain has three goals which include decentralization, security, and scalability. L1s can only meet two of these goals, so L2s are necessary to meet all three. L2s inherit the same security features as L1, but they help with scalability which is needed to make the network grow and continue processing transactions at efficient speeds.

Rollups

Rollups are a way to make blockchains, like Ethereum, faster and cheaper to use. They are able to do this by “rolling up” multiple transactions together and then adding them into the main blockchain(layer 1) as a single package. This process reduces a significant amount of computation and storage off of the main chain. As a result, the network can handle more transactions at a faster pace and lower cost, ultimately improving the overall user experience. Essentially, the Rollup process helps to save space and makes everything run smoothly.

Optimistic Rollup

Optimistic Rollup is like a helper at a busy party. The helper gathers snacks for many people at once, speeding up the process and reducing wait times. In the blockchain world, this helper groups multiple transactions off-chain and adds them as one unit to the main blockchain (Layer 1). This increases speed and lowers transaction costs.

The main idea of Optimistic Rollups is that all transactions in the rollup are assumed to be valid, just like the helper believes all snack orders are correct. If there's a mistake in a transaction, someone can report it, like pointing out a wrong snack order. Reporting a mistake is like submitting a fraud proof in blockchain terms.

When a fraud proof is submitted, a challenge period starts. During this time, the network checks the reported transaction. If the claim is true, the bad transaction is removed, like fixing the snack order. By assuming transactions are valid and using fraud proofs, Optimistic Rollups balance speed and security. This makes them a good way to help solve blockchain scalability problems.

Zero Knowledge Rollup

Zero-Knowledge Rollup (ZK-Rollup) is like Optimistic Rollup; a way to make blockchains work faster and better. Picture a party with a long snack line. A friend (the ZK-Rollup) gets snacks for several people at once, making things faster. The special part is that your friend can check if the snack orders are right without knowing the details.

In the blockchain world, ZK-Rollup combines multiple transactions off-chain and adds them as one unit to the main blockchain (Layer 1). The important part is that it uses a technique called "zero-knowledge proofs" to make sure all transactions are valid without revealing any data. This makes the process quicker, cheaper, and safer.

Zero-knowledge proofs are a way to prove something is true without giving away the details. It's like showing you have a secret without telling the secret. In ZK-Rollup, these proofs are used to check the transactions while keeping the information private.

So, ZK-Rollup is like a smart friend at a party who makes everything better. In the blockchain, it helps fix problems with speed, privacy, and cost, making the network more useful for everyone.

The different of Layer 2’s

Chain
Total Average Transactions Per Minute
Arbitrum
368.219
Solana
17579.431
Ethereum
725.197
Optimism
161.741
Polygon
1871.826

Note: This is not a measure of transaction speed. Rather, this is a measure of the total average transactions per minute for each of these L1s and L2s. This data is also recent as of 4/26/22.

The main L2s of Ethereum include Optimism, Arbitrum, Boba Network, and now Base. All three are Optimistic Rollups which means that they use the Proof of Stake consensus mechanism of Ethereum L1.

Optimism

Optimism L2 is a recently launched Ethereum layer two solution that aims to tackle the issues of high gas fees and slow transaction times on the Ethereum network. Similar to other optimistic rollup solutions, Optimism L2 processes transactions off-chain before submitting them to the main Ethereum chain, resulting in significantly faster and cheaper transactions. Optimism L2 is backed by a team of experienced developers and researchers, including co-founder Jinglan Wang, a former Google engineer and cryptography researcher, and CTO Ben Jones, a former software engineer at Google and Microsoft.

Optimism L2 has gained attention in the crypto community for its impressive performance metrics, including 10x faster transactions and 100x lower fees compared to the Ethereum mainnet. Additionally, Optimism L2 boasts a high level of security, as transactions are verified by a decentralized network of validators and fraud proofs.

One of the unique features of Optimism L2 is its open-source design, which allows developers to build on top of the platform and customize it to their needs. This has led to a growing ecosystem of dApps and protocols being built on Optimism L2, including Uniswap, Synthetix, and Chainlink.

Optimism L2 has shown promise as a solution to Ethereum's scaling issues, and its growing popularity suggests that it may become a significant player in the Ethereum ecosystem. As more developers and users adopt Optimism L2, it may help to alleviate the congestion and high fees that have plagued the Ethereum network in recent years.

Arbitrum

Arbitrum as an optimistic rollup Ethereum layer two was launched in August 2021 and is primarily developed by Offchain Labs led by an impressive trio of founders:

  • Ed Felten: A Princeton Professor who once served as Obama’s Deputy CTO
  • Steven Goldfeder: A Princeton PhD now Cornell postdoctoral researcher
  • Harry Kalodner: Another Princeton PhD turned founder

Aside from its founders, Arbitrum boasts $7 billion of value locked in its chain along with a 66% rollup market share and 4.8 million users.

Arbitrum is split between Arbitrum One and Arbitrum Nova:

Arbitrum One is the original optimistic rollup that posts transaction data to the main Ethereum chain as a conventional L2.

Arbitrum Nova is a chain that posts transaction data to a Data Availability Committee.

[add more info]\text{[add more info]}

The plus-side of this difference is it enables even lower costs and faster transactions, at the cost of true decentralization. Data is only transmitted to the main Ethereum chain in the event of a failure by the Data Availability Commitee.

Base

Outside of Optimistic Rollups, the most promising Zero Knowledge Rollup L2s are Loopring, zkSync, ZKSpace, and Aztec.

Polygon- @Aniketh

Gas Comparison

For a transaction to be processed on the blockchain, it must be validated. This requires the usage of computational resources, so gas fees are a form of compensation given to the validators. Even if a transaction fails, gas fees still exist because computational effort was still used when trying to verify the transaction. As the number of transactions increases, the amount of gas used increases since more computational resources are needed to validate them. Gas fees on Ethereum are measured in gwei which is equivalent to 10-9 ETH.

image

In terms of transactions per day, Arbitrum was able to process the most when L1 and L2 transactions were taken into account. With a peak on March 23, 2023, 4.17 million transactions were processed on Arbitrum which is about 3 million more than what was processed on Ethereum L1.

image
image

The average gas used per transaction for L2s is greater than just L1 because there is a higher demand and more transactions are processed. In the past six months, Optimism and Avalanche have had the highest gas fees. This can be attributed to the rising popularity of these L2s.

When taking both the transactions per day and average gas used per transaction into account, we can see that the average gas used has declined even though the number of transactions has increased. The rollups group transactions together, making it more efficient to validate transactions so less gas is used.

Let’s also take a look into the average gas price per month for each of these L2s and see how it compares to the average token price per month. In this scenario, the L1s and L2s we will be investigating are Ethereum, Polygon, Optimism, Arbitrum, and Base.

image
image
image
image
image

As we can see, the highest peak in average gas price for each of these L2s appears to be Polygon with an average gas price of almost 300 in the month of February 2023. For most of the L2s, the average gas price appears to be pretty stable within a certain range (Optimism 0-0.05, Arbitrum 0-1) with a few outliers/peaks (Base’s peak is at 58, Arbitrum’s peak is at 4, etc.)

Polygon’s average gas price is especially interesting because it seems to be the only case where the gas price is increasing at a steady rate per month and is much larger than the average value of the MATIC token. It’s also interesting to see the spikes in gas price for Base, as it’s only been recently released. As always, there are certain factors that really affect gas fees that are paid for blockchains (network congestion, time of day, network upgrades, etc.). This means that we can’t really point to a definitive event for most of these L2s to explain why the average gas price per month is the way that it is.

However, one event that is particularly interesting to analyze is the Ethereum Merge, which pledged to reduce gas fees due to its more environmentally friendly upgrade. The Ethereum Merge happened in September 2022, and it’s interesting to see the decrease in gas price that has resulted. Before this, the average gas price per month had a peak of around 200 and was relatively high, but looking at the data from recently, it seems that the gas price is more stable within a certain range.

Market Share

In theory, the market share of Layer 2 solutions in blockchain reflects the level of adoption and usage of these solutions among users of the underlying blockchain. Layer 2 solutions are designed to address the scalability issues of blockchain networks by processing transactions off-chain, thereby reducing the burden on the main blockchain.

One important factor that affects the market share of L2 solutions is their technical capabilities. For example, a L2 solution that offers faster transaction processing times, lower transaction fees, and better security features is more likely to attract more users and transactions than a solution that lacks these features.

Another factor that influences the market share of L2 solutions is their compatibility with existing blockchain infrastructure. Ideally, L2 solutions should be designed to work seamlessly with the underlying blockchain network, enabling users to easily switch between the main chain and L2 as needed. Solutions that require significant changes to the existing blockchain infrastructure or that are difficult to integrate may struggle to gain market share.

The market share of L2 solutions can also be influenced by external factors such as regulatory policies, market competition, and user preferences. For example, regulatory uncertainty or unfavorable policies towards L2 solutions can hamper their adoption and usage, while intense competition from other solutions can lead to fragmentation of the market.

Overall, the market share of L2 solutions in blockchain is an important metric that reflects the level of adoption and usage of these solutions among blockchain users. A higher market share indicates greater acceptance and trust in these solutions, which can contribute to the overall growth and development of the blockchain ecosystem.

The market share of layer 2s in blockchain can be divided into two sections: the number of users on the platform and the number of transactions. @Rishi Shah -Users info based of data analysis from queries

image

Regarding the number of users on the platform, we can use the provided code to analyze the market share of three layer 2 solutions: Arbitrum, Optimism, and Ethereum. The code selects the daily number of distinct addresses that sent transactions on each platform since January 1st, 2023 (as per the WHERE clause), and groups them by day. The resulting tables (arbitrum, optimism, and eth) show the number of unique addresses that transacted on each platform per day.

Next, the code joins the arbitrum and optimism tables by date and creates a new table (Partone) with columns for the date, the number of unique addresses on Arbitrum, and the number of unique addresses on Optimism. Then, the code joins Partone with the eth table by date, creating a final table (part_two) with columns for the date, the number of unique addresses on Arbitrum, the number of unique addresses on Optimism, and the number of unique addresses on Ethereum.

Finally, the code selects all columns from the part_two table and orders them by date in descending order, showing the daily market share of the three layer 2 solutions in terms of the number of users.

To analyze the market share in terms of the number of transactions, we would need to modify the provided code to select and group the number of transactions per day on each platform. This would require a different set of tables and queries. Nonetheless, the code provided can give us insight into the adoption of layer 2 solutions among users of the Ethereum blockchain.

[insert transactions visualization]\text{[insert transactions visualization]}

Contract

Ethereum

Using a combination of SQL queries and R data cleaning and visualization, we can take a glance at the total monthly transactions by the top 10 contracts. First, we will look into the top contracts just before and after the ethereum merge.

image

At a glance, the most popular contract now is the Wrapped Ether contract, which facilitates the conversion of Ether into Wrapped Ethereum tokens that are compatible with the ERC20 token standard. Although this article will not go into great detail, this contract essentially enables the native Ether currency to be used as tokens in smart contracts.

The next biggest players are the Tether USDT Stablecoin and the Centre USDC Stablecoin contracts. Stablecoins as a more stable store of value is commonly used across DeFi protocols to facilitate transactions and can be seen as a digital equivalent to the US dollar.

After that, OpenSea NFT contracts are the next most popular, consistently being a third or fourth most frequently used contract. We see this even as OpenSea upgrades their contract, first with the Wyvern Exchange v2 up until June, then Seaport 1.1 until February, and finally Seaport 1.4 starting in March.

However, when contract transactions are converted from transactions to a % of the total transactions each month, one realizes how “top heavy” Ethereum really is.

image

While it is may be understandable that Wrapped Ether facilitates Ether and contract interactions, it is definitely eye opening that nearly 15% of all transactions on Ethereum were through Wrapped Ether and about 20% of all transactions on Ethereum in March of 2023 were from USDC and USDT.

To keep the graph visible, we only show contracts that are consistently in the top 10 (for at least 12 months).

image

Aside from the top four contracts mentioned earlier, some notable contracts that showed both dominance and longevity in the early years of Ethereum are:

  • EtherDelta 2, the successor to the original trading platform that was hacked in 2017
  • Dice2Win, a crypto casino whose contract we saw was ordered to self-destruct in April last year
  • Shiba Inu, the internet’s favorite dog-turned shitcoin
  • Maker, another stablecoin similar to USDC and USDT

When we take a step back and look at just what share of all transactions the monthly top 10 contracts take up, we see a shocking image and trend:

Vertical black line marks the introduction of Wrapped Ether.
Vertical black line marks the introduction of Wrapped Ether.

It seems like starting in 2019, the contract ecosystem has grown increasingly concentrated into the top 10 contracts by transaction volume, with much of this driven by the avenues opened from using Ether as an ERC20 token (Wrapped Ether) and incorporating a stable store of value pegged to the US Dollar (USDC and USDT).

This leads to a philosophical question: Should just a few contracts account for such a large percentage of all on-chain transactions?

Arbitrum

The top contract on Arbitrum is the same as that on Ethereum: Wrapped Ether.

Monthly Top 4 Contracts
Monthly Top 4 Contracts

The most commonly interacted contract is Wrapped Ether across the board. Especially so on a Layer 2, the ability to use Ether as a token in smart contract transactions opens the world of DeFi, Dapps, and more.

After that,the stablecoins USDC and USDT and the large decentralized exchange Uniswap V3 are regular contracts that break into the top four contracts by transaction volumn.

Occasionally, it seems like the next largest contracts are either for cross-chain solutions like The Hop Protocol and Layer Zero, then Web3 Gaming like Treasure DAO, and finally digital credential NFTs through Galxe.

If we drop contracts that are not persistently in the top 10 (fewer than 6 times over a year), it paints a more clear picture of what protocols and tokens are most influential on Arbitrum.

image

Aside from the contracts that are in the top 4, we another consistently popular contract (hovers in the top 5 to 10 range) with GMX, a decentralized exchange.

While contract top heaviness in a popular Layer 2 like Arbitrum is an interesting question, there seems to be an issue with how our current queries count total and contract transactions.

The graph below reveals the inconsistency with our data, with the transactions from the top 10 contracts occasionally accounting for over 100% of all transactions.

Incorrect % of Total Transactions Graph
Incorrect % of Total Transactions Graph

Optimism

This graph shows the top 10 contracts (unlabeled) on Optimism.

image

Now, we drop the contracts that were in the top 10 for fewer than 5 months. Looking the legend, we see that USDC was the top contract on Optimism.

image

Similar to the analysis done for Arbitrum, the top heaviness in Optimism has issues where transactions from the top 10 contracts always account for over 100% of all transactions.

image

L2 Transaction Failure Rate @Aniketh Chedalla

Queries

Introduction

Gas

@Aishwarya P

Market Share

@Rishi Shah

Contracts

Additional R-Markdown Code:

@Larry Peng

Failure Rate

@Aniketh Chedalla