Blockchain Scalability: What are Layer 2 Scaling Solutions - Web3 Oversimplified
14 September, 2022
18
18
1
Contributors
This reason has led to the creation of layer two scaling solutions that are much cheaper and faster when compared to the Ethereum network.
What are layer 2 scaling solutions?
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:
β’
β’
β’
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:
The Scalability Trilemma
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:
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.
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.
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.
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.
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.
Conclusions
β’
β’
β’
blockchain
web3
crypto