Typefully

Explaining the various L2 scaling solutions for Ethereum

Avatar

Share

 • 

4 years ago

 • 

View on X

A mega-🧵 about Layer 2 scaling solutions for @ethereum. • Why are Layer 2s necessary? • Understanding sidechains, plasma chains, channels, and rollups (differences, pros & cons) • What does this mean for L1s? [1/42] 👇
Note: much of the information in this thread comes straight from the @ethereum docs. I've tried to organize and compress it as best as I can, but I recommend referring to the official docs for best info. I'll also link to other helpful resources. ethereum.org/en/developers/docs/scaling/
A lot of this content is highly technical, and was challenging to understand. If I made any mistakes or didn't explain something perfectly, feel free to leave comments so others can understand it better.
It's no secret that $ETH has a scalability problem. Currently, Ethereum can only handle about 15-30 transactions per second (tps) In comparison, other L1s like $FTM, $AVAX, $SOL, etc have much better throughput, and can support thousands of transactions per second.
But they are a lot less decentralized, and therefore more vulnerable. $ETH is still the king when it comes to security and decentralization. 👑
Now, $ETH's scalability problem means the network is always congested. This means people usually have to be exorbitant gas fees (hundreds of $) to get simple transactions through. @txstreetCom has an awesome tool that shows this congestion visually: txstreet.com
So what are Layer-2 solutions? Layer 1s (or L1s) are blockchains like Ethereum, Avalanche, Fantom, Solana, etc. Layer 2s are scaling solutions built on top of Layer 1s designed to help the L1 chains scale.
Why are L2 scaling solutions needed? Scaling an L1 like ETH directly might require more specialized validator nodes, which would mean compromising on decentralization. $ETH is focused on security and decentralization, and leaves scaling to the L2s.
Now, while the sharding upgrades to Ethereum will improve scalability, they are meant to work alongside (not instead of) L2s to improve the usability of the Ethereum network. L2s + sharding will allow for 100,000 transactions per second. twitter.com/shivsakhuja/status/1507188737133883424?s=20
Using Layer 2 solutions means: • Increased tps • Reduced congestion on $ETH Mainnet • They still benefit from Ethereum's security & decentralization since they are built on top of $ETH.
An analogy that might help explain the value of L2s: @ethereum is like land in NYC. It's very valuable - setting up shop there costs a lot of money. So you might not want to build a single house on that land, just as you might not want to transact directly on Ethereum L1.
Instead, you might build a skyscraper so you can put lots of people in there and make more efficient use of that valuable piece of land. This is the value of L2s - they help to make more efficient use of the extremely valuable blocks on $ETH.
There are a number of categories of off-chain scaling solutions based on the technology they use: 1. Sidechains (not technically an L2) 2. Plasma 3. State channels 4. Rollups
1. Sidechain It is a separate blockchain which runs in parallel to Ethereum Mainnet and operates independently using its own consensus mechanism. Sidechains are responsible for their own security and therefore they are not considered layer 2 solutions.
Examples: @0xPolygon, @gnosischain The downsides of using Sidechains: • Less decentralized • Less security (since the validation of tx happens through a separate consensus mechanism, not through L1)
2. Plasma Chains Plasma chains are also separate blockchains, but they are anchored to the Ethereum Mainnet. This makes them more secure than sidechains.
Plasma chains may be called child chains, since they are smaller copies of the ETH mainnet. Plasma chains can create more child chains infinitely to offload work from parent chains. They use fraud proofs (explained later) to resolve disputes.
Downsides of Plasma: • Cannot be used to scale general purpose smart contracts • Very long withdrawal time Examples: @0xPolygon and @omgnetworkhq are implementations of Plasma.
3. Channels: Participants can transact x number of times off-chain, but only 2 transactions need to be finally sent to the ETH mainnet for on-chain validation.
Imagine a game of tic-tac-toe where every move is described by a tx. You don't need every move to be validated on-chain (slow + costly). Instead you could create txs off-chain and send an ordered list of moves to the mainnet after the game ends to validate the final state.
At any point, the transactions being sent back and forth for the tic tac toe game *could* be sent to validate on-chain. @0xstark wrote a great Medium article explaining this in 2018: medium.com/l4-media/making-sense-of-ethereums-layer-2-scaling-solutions-state-channels-plasma-and-truebit-22cb40dcc2f4
Features of channels: • Great for privacy since only opening & closing txs must be public - all else is off-chain in a channel b/w participants • Great when exchanging many state updates over a period since cost per state update is very low • They have instant finality
The downsides of using Channels: • They require high availability • Not good for one-off transactions • Solutions are application specific (can't work for a generic smart contract) • No open participation
4. Rollups Rollups execute transactions off-chain, bundle the transaction data and then posts it to the @ethereum mainnet in a compressed format. Since data is posted to $ETH mainnet, rollups are still secured by the $ETH consensus.
So how does $ETH know that the posted data is valid? Rollups need to offer some kind of "proof" that the transaction data they are posting is valid. There are two types of rollups: 1. Optimistic Rollups 2. Zero-knowledge (Zk) Rollups
Optimistic Rollups (like Plasma chains) assume the data is correct and use fraud proofs. If the data is incorrect, someone can submit a "fraud proof" which will penalize the bad actors. If the incentives are set up correctly, the dispute resolution should be a rare occurrence.
A quote from Ben Jones from @optimismPBC: You basically take some ETH and lock it up and you say "Hey, I promise to tell the truth"... If I don't tell the truth and fraud is proven, this money will be slashed.
Some implementations of Optimistic Rollups include @optimismPBC, @arbitrum, @MetisDAO, @bobanetwork. One downside of Optimistic Rollups is that withdrawal times can be very long to give sufficient time to submit fraud proofs.
Zero-knowledge rollups use validity proofs to prove the data is correct. Proofs can be SNARKs or STARKs (won't go into details - but feel free to look them up). Since Zk-rollups use validity proofs, the time to finality is much quicker, and no long wait time for withdrawals.
Projects using Zk-rollups: @0xPolygon, @loopringorg, @StarkWareLtd, @zksync Downsides of Zk-rollups: • Much harder to create EVM-compatibility • Requires lots of computation to create validity proofs for every tx
This is probably the best explanation of rollups you'll find on the internet - @finematics comes through yet again with an excellent video. I highly, highly, HIGHLY recommend watching this if you want to understand rollups: youtube.com/watch?v=7pWxCklcNsU&t=12s
Validium is another type of scaling solution which is very similar to zkRollups except that the data availability is off-chain instead of on-chain. twitter.com/the_matter_labs/status/1269266586390745089
Is your mind as fried from all the technicalities of the L2 solutions above as mine was? Just curious which is best? They all have tradeoffs, but it seems that rollups are the preferred scaling solution for general purpose L2s. Why so?
Plasmas and state channels are application specific (not good for general purpose smart contracts), and sidechains don't have the security benefits of an L2. Rollups can be general purpose, EVM compatible, offer high throughput and leverage the security of $ETH.
Which is why @ethereum's roadmap is now also focused on scaling alongside rollup based L2s polynya.medium.com/understanding-ethereums-rollup-centric-roadmap-1c60d30c060f
Note: You might have noticed @0xPolygon mentioned a few times for various types of solutions. That's because Polygon is building a suite of $ETH scaling solutions using a few of the different technologies mentioned, including sidechains and zk-rollups.
Just here to make $? Many of the rollup-based L2s like @arbitrum and @optimismPBC don't have tokens yet, but they may in the future. A common practice is to retroactively airdrop tokens to people who used the chains. @Uniswap airdropped users 400 $UNI tokens (~$17k at its peak)
Also, keep a close eye on the on-chain activity on different L2s (TVL, transactions, wallets, dapps, etc). You can find this kind of information on l2beat.com, defillama.com, dune.xyz, etc. These will tell you where the $ is flowing.
Will this be a winner takes all market? Hard to say, but ultimately, the L2s that attract the dapps will attract the TVL and users. twitter.com/shivsakhuja/status/1507823098493431809?s=20
What does this mean for L1s? I think the rapid growth of L2s is going to create some serious competition for the L1 chains. It's very easy for devs to port over dapps to EVM compatible L2s, and ultimately, everyone wants the security benefits of $ETH.
I think some L1s still have competitive advantages. For example, $AVAX has a strong narrative around subnets, which can be used to scale high volume dapps (like gaming applications) without impacting the main blockchain.
Different chains have different strengths. I do think the future is multichain. That being said, I think that the days of random L1s that solved for scalability while compromising on security and decentralization are numbered unless they have something else going on.
Avatar

Shiv

@shivsakhuja

SWE @ Google. I write about #Crypto and #DeFi Threads 🧵, infographics and videos 🎥 explaining projects, strategies and concepts. 👨‍🌾 🦍 shivsak.com