Scaling Ethereum: comparing L2 solutions
For years, Ethereum blockchain developers have been working tirelessly to fix scalability in a variety of ways. But what’s the lowdown in layman’s terms?
The principal idea of ‘scalability’ is simply improving the blockchain in order to accommodate increasing network usage without compromising base functions.
With the rise in popularity of Decentralised Finance (DeFi) applications and non-fungible tokens (NFTs), this issue has become all the more pertinent. In fact, since Q4 2020, the Ethereum network has become increasingly congested with some transactions costing up to $100 in gas fees.
To fix this, several second layer solutions are attempting to ease this pain point, whether it’s Plasma, Sidechains, State Channels or Rollups. Indeed, these so-named Layer 2 solutions are widely viewed as potentially holding the keys to bring Ethereum to scale and reduce fess.
In a way, Ethereum's congestion and high fees are a testament to the network becoming a victim of its own success. In fact, parts of the ecosystem like DEXs and yield farming are relatively inaccessible to the average user and have given rise to new ecosystems on other blockchains like Binance Smart Chain which attempts to offer similar scaled-down services.
There are two ways to scale a blockchain. One is to work on the main chain itself in order to directly improve transaction throughput. This is the entire purpose of Ethereum 2.0.
However, another solution is to alter how users interact with the blockchain. In other words, instead of forcing all transactions on the main chain, certain parts can be processed off-chain to alleviate congestion. In layman’s terms, this is the main difference between Layer 1 and Layer 2 scalability solutions.
For instance, in a Layer 2 solution, the smart contract on the main chain could only have two tasks: (a) processing deposits and withdrawals, and (b) verifying mathematical proofs to ensure that everything happening off-chain is sticking to the rules.
This brings us to the concept of ‘sharding’.
What is sharding?
Sharding is a solution that will be deployed once Ethereum fully migrates its consensus mechanism from Proof of Work (PoW) to Proof of Stake (PoS). Migration is a complex and major Layer 1 upgrade, which is taking place in steps. Briefly, the technique involves taking large chunks of computational work and splitting it into smaller ‘shards’ to remove excess load from the network.
However, the process won’t happen overnight and has a longer time-horizon than other solutions which will be operational this year (2021). So, the good news is that as Layer 2 solutions roll out, sharding is not too urgent.
What are Layer 2 solutions?
As noted earlier, there are two types of scaling techniques. Due to the development plan, Layer 2 solutions are currently given the most attention. This is to say that when ETH 2.0 is fully deployed, a significant chunk of activity will likely take place on Layer 2 solutions, which will have been increasing in activity for months. Briefly, these are the categories which define types of layer 2 scaling projects on Ethereum.
Sidechains are independent blockchains that are more like a hybrid between Layer 1 and Layer 2 solutions. This is because the separate chain relies on the security of the main chain while also employing its own consensus mechanism to process transactions.
It’s good to think of sidechains like networks running in parallel with Ethereum’s main chain, which can also communicate (or interoperate) with each other. Sidechains operate on a separate blockchain with a consensus mechanism like PoW, PoS, Proof of Authority or delegated PoS.
Finally, assets are then created using a smart contract on Ethereum and recreated on the sidechain, where they can operate. In order to get the asset back on Ethereum, the sidechain asset must be removed and unlocked on ETH.
2. State channels
State channels are a means to conduct interactions on the blockchain outside the system. The simplest way to understand state channels is with a direct example. Let’s say that Sophie sells Bob a phone with monthly payments, charging him €20 per month. But instead of doing this on the main chain, they could use a State Channel.
First, Bob locks up some Ethereum into a smart contract, after which he signs an off-chain message which records a €20 payment to Sophie. This process is repeated every month until they conclude their business. Let’s say Alice wants to cash in when payments reach €100 (half the mobile price). At this point, she publishes the ticket to the main chain which is then verified with both signatures. Once this happens, the smart contract releases €100 for Sophie and returns Bob’s remainder.
Plasma is made of Merkle trees and smart contracts which, when combined, create an infinite number of smaller chains with smaller versions of the main Ethereum blockchain. Developers can build on top of these tree-like structures also called ‘Plasma chains’. These secondary chains are useful for settling disputes and are not to be confused with sidechains due to their exclusive mechanisms for storing funds.
Finally, rollups are widely touted as the solution to fast and inexpensive transactions without compromising security.
So what is a rollup?
In brief, a rollup is an off-chain collection of transactions inside an Ethereum smart contract which reduces fees and congestion by increasing data broadband in the blockchain from 15 transactions per second (tps) to over 1,000 tps.
There are two types of rollup technology – Optimistic Rollups and ZK Rollups. Without going into the technical details, it’s worth noting that both technologies sort out complex trade-offs in order to function. For example, ZK rollups leave part of a transaction ‘off-chain’ if it is not relevant to the state update (main chain). On the other hand, Optimistic Rollups do not do this because that data might be needed in an anti-fraud mathematical proof.
Optimistic rollups assume that the transaction is working well until a whistle-blower reports an incident, while ZK rollups do not make this assumption and use cryptography to verify transactions.
Ethereum is the most widely adopted platform in the crypto market and developers continue to favour building on its core infrastructure so as to improve the technology. It’s worth noting that Vitalik Buterin supported Optimistic Rollup technology (Berlin upgrade) in the near-term and ZK Rollups as a longer-term solution.
While developers can independently choose which technology to build, both Layer 1 and Layer 2 scaling solutions will be responsible for forming Ethereum’s scaling landscape.
Similar to a perfect game of Tetris where all shapes have a use-case, Ethereum’s scaling technologies are bringing the network closer to becoming the default international settlement system for global trade.