Blockchain Scalability: What are Layer 2 Scaling Solutions

Blockchain Scalability: What are Layer 2 Scaling Solutions

Learn why you should use layer two scaling solutions!

Favor Onuoha's photo
Favor Onuoha
·Oct 5, 2022·

8 min read

Subscribe to my newsletter and never miss my upcoming articles

Table of contents

  • What are layer 2 scaling solutions?
  • Why do we need layer 2 scaling solutions?
  • Which scaling solution options are available?
  • Rollups Scaling Solutions
  • Sidechains
  • Which layer is better?
  • Conclusions

If you're a beginner in the web3 space or have used Ethereum before, you would have noticed that the Ethereum network overall does not provide an enjoyable user experience. The fallouts can be frustrating for developers, whether it's high gas fees or slower transaction processing times. This reason has led to the creation of layer two scaling solutions that are much cheaper and faster when compared to the Ethereum network.

If you're wondering what layer 2s are and why you should choose them over layer 1s, then this article is for you.

What are layer 2 scaling solutions?

The Ethereum network has two layers on that you can build your apps. You could use the base layer known as Layer 1 or the faster and cheaper layer 2.

Note: The idea of layers is just abstract. No code is built to enforce a layer style or hierarchical system on the Ethereum network.

Layer 1 is a base layer where all transactions are stored and validated. Layer 1 also includes all native tools and functionalities of the Ethereum blockchain, including smart contracts, consensus, and security.

Imagine layer 1s comparable to the original Linux kernel created by Linus Torvalds, from which all other Linux distros were built.

Layer 2, like the example of the Linux distros, is built on top of layer 1. Layer 2s are tools and solutions that make the Ethereum network faster! To grossly oversimplify, they are built on Ethereum's layer 1 to leverage its security and existing functionalities like Smart Contracts.

Layer 2s primary focus is to scale the Ethereum network by offloading transactions from the Mainnet or Layer 1 while still harnessing Layer 1's robust security features.

Some popular layer two scaling solutions include:

  • Optimistic Rollups
  • Polygon
  • Arbitrum

Note: Several available layer two scaling options when building your apps exist. More on that later!

Why do we need layer 2 scaling solutions?

You may be wondering, "why do we need a layer 2? why can't we directly scale layer 1"; It is a bit complicated to explain why we can't scale layer one but let's get to the basics first!

The Ethereum network can only handle up to 15 transactions/second, which is very slow compared to other blockchains like Solana or even centralized applications like VISA, which handles over 50,000 transactions/second and 100,000 transactions/second, respectively.

Solana's and VISA's numbers, when compared to Ethereum's, might make you laugh but believe me when I tell you, it becomes less funny when the network gets busy or clogged, and the consequences can be felt firsthand.

To put it simply, the Ethereum Mainnet (Layer 1) is very slow and makes running and developing apps on top of it a living hell.

During busy hours, gas prices can skyrocket! They soar every time something interesting happens in the Ethereum ecosystem. – and yes, I mean Elon Musk's interesting levels!

For example, in 2017, when Crypto Kitties became popular, gas prices were at an all-time high – the GWEI was over 500+.

For developers, high gas fees and slow transactions are a recipe for disaster and significantly impact user experience. This recipe is a bane to developers looking to build apps on the Ethereum blockchain to capitalize on the large market share of Ethereum users.

Imagine building a game on the Ethereum network in its current state as a real-world scenario. I am not a prophet, but I assure you that you'll lose all your users due to high gas fees and slower transaction times.

But why can't the devs maintaining the Ethereum network fix this? Why can't they just scale Layer 1? To answer ourselves, they can't! This is because of the Scalability Trilemma. – this is where it gets a little complicated.

Let me explain this in the simplest of terms. Blockchains are built on three main pillars represented in a triangle:

Picture depicting the Scalability Trillema

  • Scalability
  • Decentralization
  • Security

The Scalability Trilemma is not an Ethereum-only problem but a problem many other blockchains face, like the Bitcoin and ZCash blockchains.

In practice, we could forget layer 2s and just scale layer 1. In doing so, we would require the addition of specialized Ethereum nodes to the Ethereum Mainnet. Adding these additional nodes will make the network more centralized and less secure. -- this, generally, is a bad idea.

This is why we need layer two scaling solutions. Sacrificing security and decentralization for scalability is a big no! no!

Now that you know why we can't scale layer 1s, it is best to explore the layer two options for you to use as a developer.

Which scaling solution options are available?

As a developer seeking to build your app more efficiently, there are quite a few scaling implementations for you to use right now! Let’s take a look at the most widely used ones.

Rollups Scaling Solutions

Did you know that you can store extra data as a transaction? It was weird to me the first time I found out, but this is possible!

Next time you make a transaction using your MetaMask wallet, you can check out the "Data" tab on your transaction prompt to look at the additional data included in your transaction.

It would look something like this:

transaction data on Ethereum blockchain

On a high level, Rollups allow you to pack multiple transactions into one transaction and have them all pushed to the layer of one blockchain.

Rollups reduce the network load on layer one by decreasing the number of transactions sent into the Mainnet. There are two popular and well-known rollups out there, namely:

  • ZK Rollups
  • Optimistic Rollups

ZK Rollups or Zero-Knowledge Rollups are smart contracts that can take multiple transactions off the Ethereum Mainnet, pack them all into one transaction, and send the proof of validation back to the Mainnet.

Optimism Rollups are very different from ZK Rollups, but they are not smart contracts on a high level; instead, they fully function EVMs with their nodes and smart contract capabilities.

Unlike ZK Rollups, Optimism Rollups don't do any computational work to validate transactions. They assume that all transactions are valid and submit them to Layer 1. This dramatically improves scalability on Layer 1s 100 folds.

However, Optimism Rollups have a "Challenge Period," a time range when transactions submitted to Layer 1 can be disputed as fraudulent. Optimism transactions can then become significantly slower than ZK Rollups when this happens.

Since Rollups are EVMs like Polygon and BSC, the most popular Optimism Rollups are Optimism (I know, it's confusing, they are an organization) and Arbitrum (A competitor to Optimism)

These two EVM rollups allow you to scale your decentralized applications at a low cost while achieving faster transaction times.

A practical use case of Rollups as a developer would be to develop a blockchain-based game.

For instance, imagine you deployed a blockchain-based game with just ten players on the Ethereum Mainnet. As the number of players in your game scales to about 10,000 more, you can expect bottlenecks and slower processing time, not to mention high gas fees. Your game will be costly to play as time progresses. But with a roll-up solution like Optimism, you can offload all those blockchain calls from the Mainnet (Layer 1) to Optimism (Layer 2) and almost nearly eliminate:

  • High gas fees.
  • Slow transaction processing times.
  • Excess cost to your players.

If that particular scenario also happened to be you, try out Alchemy's Arbitrum or Alchemy's Optimism APIs and scale your applications properly.

Sidechains

Sidechains are EVM compactable blockchains that run parallel to the main chain. Like their parent chain (layer 1), they also possess full EVM capabilities. The Polygon blockchain is an example of such.

The Polygon network runs as a child chain to the Ethereum network and can collect information from the Mainnet and use that information to execute smart contracts or offload transactions from the Mainnet, validate them and send them back to the Mainnet.

Sidechains are the perfect cheaper and faster layer two scaling solutions for developers looking to build their apps and still leverage the full functionality of the Ethereum blockchain like smart contracts and support for Solidity on a different blockchain. Polygon, for instance, can process about 100,000 transactions/second, which is crazy fast even with full EVM functionalities.

Remember our blockchain game example? That would also fit well in a different scenario using the Polygon chain as a scaling solution.

The layer two scaling solutions mentioned above are the most popular ones available to you as a developer on the Ethereum network. However, a few other scaling solutions methods deserve mention, like Loopring Rollup, a scaling solution for developers to build and scale DeFi applications.

Which layer is better?

If you've been reading thus far, then you're simply amazing :D and you may also have concluded that the Layer 2s is the best option for developers.

However, this may not always be the case. Though layer 2s are better in most scenarios, for traditional scenarios like building a simple ERC20 token or building an NFT project, using layer 2s for such projects is not advisable and is not a realistic move.

Building solely on layer one does have its perks. Building an entire Decentralized Finance app on layer one is much easier than on layer 2. This is because implementing some layer two solutions is complicated and confusing.

Some scaling solutions like the sidechains will require you to work on layer one and layer two, increasing development time and making your life more complicated as a developer.

Notwithstanding, for larger projects requiring hundreds of transactions to be processed, it is better to build on top of a layer two scaling solution, which will significantly reduce your gas fees and speed up your decentralized application.

Conclusions

Thanks for reading, and I hope you enjoyed it! Let me know your thoughts on the subject matter, and feel free to reach out whenever. If you're interested in learning about:

  • Web3 and Blockchain
  • Web Development
  • Becoming a better coder

Then, follow me here on Showwcase! Until then, see you at the next one!

 
Share this