Scalability has been an issue related to the Ethereum blockchain for years, so the next time you hear terms like Sidechains, Plasma, Channels, or Rollups, you’ll no longer have to wonder what they mean. These are all proposed solutions to help Ethereum scale. Moreover, so-called Layer-2 solutions are widely seen as potentially holding the keys to helping Ethereum to scale and reduce Ethereum gas fees.

After all, Ethereum’s congestion and high fees attest to it becoming a victim of its own success. Sections of its ecosystem like DEXs and Yield Farming have become inaccessible to the average user who can only afford moderate gas fees.

So, what are Ethereum developers doing about all this? Well, a lot actually, and we’re going to be touching on some of the most popular proposed solutions in this article.

Scaling Ethereum

Basically, there are two ways to scale a blockchain. One is to work on the main chain itself to improve transaction capacity. That is what Ethereum 2.0 is all about. The other way is to change how people use the blockchain. In other words, instead of putting all the interactions on the main chain, some can go off-chain to alleviate congestion. 

That is a simple way to differentiate between Layer 1 and Layer 2 scalability solutions. For example, in a Layer-2 solution, the smart contract on the main chain could only have two tasks: (a) process deposits and withdrawals, and (b) verify proofs to ensure that everything happening off-chain is obeying the rules. And that brings us to Sharding.

What Is Sharding?

Sharding is ETH 2.0’s scalability solution that will take place when Ethereum moves its consensus mechanism from Proof of Work (PoW) to Proof of Stake (PoS). This is a complex, major upgrade, and it is a Layer-1 solution.

Sharding is a technique that takes large chunks of computational work and splits it into smaller pieces called “shards.” But Sharding won’t happen overnight as it’s only one part of the larger Ethereum upgrade.  

The good news is that other solutions can take some of the pressure off Ethereum now, which makes the Sharding solution less urgent. 

Ethereum’s Layer-2 Scaling Solutions

We’ll be covering the following Layer-2 solutions along with their different strengths and weaknesses.

  1. Sidechains 
  2. State Channels
  3. Plasma
  4. Optimistic Rollups
  5. ZK-Rollups

To get a better understanding of Ethereum, make sure and take the Ethereum 101 course at Ivan on Tech Academy.

What Are Sidechains? 

Sidechains are independent blockchains that are considered more of a hybrid of Layer 2 and Layer 1. That’s because Layer 2 solutions rely on the security of the main chain. A Sidechain doesn’t do that because it has its own security properties. It also employs its own consensus mechanisms to process transactions. 

To understand Sidechains remember that the Ethereum blockchain is the main chain. So if Ethereum is the main chain, then Sidechains are like sister chains. Essentially, Sidechains run alongside the main chain. Furthermore, these blockchains can communicate with each other so that assets can move between the chains. 

To create a Sidechain, developers must first create another blockchain and a consensus mechanism like PoW, PoS, Proof of Authority (PoA), or Delegated Proof of Stake (dPoS). 

Next, moving assets between the blockchains requires a smart contract on Ethereum. To get assets to the Sidechain, users would first deposit into an Ethereum smart contract and then recreate them on the Sidechain. Getting the assets back to Ethereum requires removing them from the Sidechain and unlocking them once they’re back on Ethereum. 

Sidechain Pros and Cons

Pros:

The cool thing about Sidechains is that even if users make loads of transactions, the only two that occur on the main chain are the deposit and the withdrawal. Since transactions are less expensive on the Sidechain than on Ethereum itself, scalability is the result.

Cons:

There are some flaws with Sidechains, however. Granting the power to create new blocks brings the power to stop producing blocks. Worse yet, Sidechains grant operators the power to prevent users from withdrawing their funds. To see Sidechains in action, check out Polygon (Matic) or xDai.

What Are State Channels? 

Think of State Channels as a way to conduct interactions off the blockchain that would normally be on the blockchain. For example, only the most important element of a chess game would get broadcast to Ethereum in State Channels—that would be the outcome. 

To demonstrate how State Channels work, we’ll use the much-loved Bob and Alice characters. Let’s say that Alice sells Bob her internet service, charging him 10 cents per megabyte. But instead of creating a transaction on the main chain for each megabyte payment, they could use a State Channel.

First, Bob locks up some ETH into a smart contract to get things rolling. Next, he signs an off-chain message (ticket) that says he has paid 10 cents to Alice. Bob later signs another ticket that says he has paid 20 cents. This can continue until they conclude their business. Let’s say Alice wants to cash in when the payments reach $1. At that point, she publishes the ticket to the main chain. The smart contract verifies both of their signatures, pays Alice the $1 amount and returns Bob’s remainder. 

State Channels and Bi-Directional Payments

State Channels can handle bidirectional payments between two parties like Alice and Bob, but they can also transact with others who have an open channel in common. For example, if Bob has an open channel with Ted, Alice can also interact with Ted. 

But Channels are limited. Amongst other things, they can’t send funds off-chain to non-participants. Also, if things get more complex than recurring payments, the participants have to lock up large amounts of capital.

What Is Plasma? 

Essentially, Plasma is made up of Merkle trees and smart contracts. This combination enables Plasma to create unlimited child chains, which are smaller versions of the main chain. Note that developers can build multiple chains on top of each child chain to create a tree-like structure. The smaller chains are called child chains or Plasma Chains. 

Plasma’s secondary chains only need to interact periodically with the main chain for things like settling disputes. Notice that Plasma Chains and Sidechains are similar but not the same thing. It’s important to understand their differences because Sidechains and Plasma make different promises regarding securing funds.

Plasma Deposits and Withdrawals

To make a deposit, a user sends the asset to the smart contract that manages the Plasma Chain. The Plasma Chain will assign a unique ID to the asset. An operator then generates a batch of Plasma transactions they have received off-chain at intervals. 

To withdraw an asset, the contract starts a “challenge period.” During this time, anyone can use Merkle branches to invalidate the withdrawal if they can prove the exit is fraudulent. After the challenge period is up, the user can withdraw the asset.

One advantage Plasma has over State Channels is that the capital requirements are a lot lower. Also, a user can send assets to participants who are not part of the system. 

Plasma Pros and Cons 

Pros:

Plasma is a good solution for payments and is great for dealing with non-fungible tokens (NFTs), because each unit of an asset gets a unique ID. Also, Block roots are a “pro” because they behave like “save points” on the blockchain. One of the issues with Sidechains is that the consensus mechanisms can stop producing blocks and even lock up user funds. Plasma users can call on block roots, so if the consensus mechanism stops creating blocks, users can still make claims to Ethereum to get their funds. 

Cons:

The “mass exit” problem is one of the biggest concerns with Plasma. If many users exit their Plasma chain simultaneously, they could flood the root chain and congest the network. Things like fraudulent activity or network attacks could cause such a mass exodus. 

Another “con” of plasma chains is a lack of complexity. Users can’t perform the same kinds of complex actions as they can on Sidechains. That’s because of the necessary precautions in place to keep user’s funds secure.

At the end of the day, it comes down to the fact that it is impossible to simulate the full Ethereum environment with either Plasma or the Channel system, which brings us to Rollups.

What Are Rollups? 

We’ve touched on some of the strengths and weaknesses of the other scalability solutions. What users want is a solution as secure as Ethereum but fast and inexpensive. That’s why Rollups are all the rage. They are in a position to deliver and become Ethereum’s savior for now and the foreseeable future. But what exactly is this Rollup technology, and how does it work? 

First of all, they’re called Rollups because they roll up transactions and fit them into a single block. Doing so thankfully relieves the Ethereum network from some of its congestion and makes transactions faster and less expensive. Rollups also help scalability because they process transactions off the main chain. 

Ethereum’s co-founder Vitalik Buterin stated that transaction speeds could increase by a factor of 100 with Rollups. Eric Wall, CIO of Arcane Assets, said that he expects rollups to push transaction speeds up to 2,000-3000 per second.

So, while Plasma and State Channels try to move both the data and its computation off-chain, the security issues this causes demand that both solutions rely on what’s called “owners.” Are you ready to learn more about the blockchain? Take the Crypto for Beginners Course at Ivan on Tech Academy.

Rollups Improve Transactions Per Second (TPS)

On the other hand, Rollups move state storage and computation off-chain but keep some of the data on-chain. This requires some compression tricks to improve efficiency, and while the main chain’s bandwidth still limits scalability for Rollups, it still retains a favorable ratio. 

One estimate has an ERC-20 token transfer costing 45,000 gas on Ethereum costing less than 300 gas with only 16 bytes of space required on-chain with a Rollup. Other estimates predict Rollups might even do 10,000 TPS once Ethereum 2.0 Shards go live. 

Rollups Compression Tricks and on-Chain Data

These kinds of numbers can only be possible because of superior encoding and some clever compression tricks. Compression is instrumental because, without it, Rollups are estimated to only make a 10x improvement to main chain scalability.

Putting data on-chain is also key. Offline operators or malicious actors can’t do damage or cause delays like they can with the other solutions. Also, Rollups don’t suffer the necessity of mapping assets to owners. Developers can even run an Ethereum Virtual Machine (EVM) inside a Rollup. This breakthrough makes it possible for developers to migrate their dApps to Rollups without any new code, so you can see why Vitalik and the Ethereum community are so excited about Rollups.

A big question regarding Layer 2 solutions is, “who controls the exits? With Rollups, the exits are under the control of Layer 1, and that is the Ethereum blockchain. While Google may use the slogan, “Don’t Be Evil,” Rollups take a “Can’t Be Evil” approach when it comes to fraud proofing their system.

How Rollups Work

The short version is that an on-chain smart contract maintains a state root with things like the account balances and contract code inside the Rollup. A batch is a compressed collection of transactions. When a user publishes a batch with the previous state root and the new state root with processed transactions, the smart contract makes sure it all matches up. Then it will switch the old state root to the new state root. 

The next question is how to prevent a fraudster from submitting a post-state root that conveniently transfers the assets inside the Rollup to themselves? The solution to this potential problem is what has split Rollups into two different camps.

What Is a ZK-Rollup?

The Zero Knowledge Proof Rollup uses validity proofs. This means that every batch includes a Zero-Knowledge Proof (SNARK). The SNARK is cryptographic proof that proves the post-state root is correct after it executes the batch. Moreover, on-chain verification is quick regardless of the computation size.

Operators must generate a SNARK for every state transition, and this will be verified by the smart contract on the main chain. That means operators can’t steal the funds. Nor can they corrupt the Rollup state, so no monitors are necessary. User funds are guaranteed once a block is verified, even if operators become uncooperative.

Furthermore, ZK-Rollups have two types of users: transactors and relayers. Transactors create and broadcast their transfer to the network. Relayers create a rollup by collecting a large number of transfers and rolling them up together. Relayers are tasked with generating the SNARK proof. Anyone desiring to be a relayer can do so once they have staked their bond. This requirement encourages the relayer to play it straight and not tamper with the Rollups.

ZK Rollups Pros and Cons

Pros:

  1. Reduced fees per transfer
  2. Faster than Plasma and Optimistic Rollups (see below)
  3. Less data means increased throughput and scalability
  4. No fraud game verification (like Optimistic Rollups), which can cause withdrawal delays

Cons:

  1. The initial setup promotes centralization
  2. Quantum computing could pose future hacking threats

What Is an Optimistic Rollup?

Optimistic Rollups are close cousins of ZK-Rollups and have overcome the limitations that hampered Plasma, Sidechains, and State Channels in the past. 

Block producers rollup transactions and post the data to Layer 1 with a signature. Everyone assumes the state transition is correct, reminiscent of how courts in the United States presume its citizens are innocent until proven guilty. 

But when an incorrect state transition gets published, operators and users can revert the incorrect block and slash any malicious operator’s bond. Also, to prevent operators from censoring anyone, the smart contract accepts transactions directly from users. Even a rogue operator can’t prevent a user from rightfully exiting with his or her funds.

This is a vast improvement over Sidechains, where miners or validators could steal a user’s funds. With Optimistic Rollups, whistleblowers can detect and report fraud just by combing through the data available on Layer 1. 

Pros and Cons of Optimistic Rollups

Pros:

  1. Turing-complete / EVM compatible.
  2. 200 to 2000 transactions-per-second vs. Ethereum’s 10 transactions per second
  3. Better User Experience

Cons:

  1. Limited throughput compared to ZK Rollups
  2. Additional security issues

Optimistic Rollups vs. ZK Rollups

There are some complex tradeoffs when deciding between these rollups. A compression trick that ZK Rollups does is leave parts of a transaction off-chain if it’s not relevant to the state update. Optimistic Rollups can’t do this because that data may need to be checked later in a fraud-proof. 

Optimistic Rollups work on the assumption that everything is okay until a whistleblower reports otherwise, while ZK Rollups makes no such assumptions. They use complex mathematics and cryptography to verify that everything is okay.

All in all, Optimistic Rollups are a promising option in the near term because they offer developers an easy way to migrate their dApps which enables Ethereum to deal with growing demand while working towards ETH 2.0.

ZK Rollups are the more sophisticated solution. For now, it can do token transfers but implementing general-purpose smart contracts will take more time. ZK Rollups will also fix some of the issues with Optimistic Rollups, like reducing withdrawal times to a few minutes and enabling fast transactions and exits in nearly unlimited amounts.

Overall though, Optimistic Rollups spell good news for ZK Rollups. Optimistic Rollups will help prepare the ecosystem for this massive Layer-2 scaling movement that will involve changes to dApps, oracles, wallets, and even user habits. This will give ZK Rollups the time it needs to evolve and mature. 

Projects Using Rollups

Some big-name platforms and protocols are already starting to integrate Rollups or at least test them out, in case you were wondering. When these projects get rolling, it’s sure to give others the confidence to climb on board the Rollup train.

  1. Optimism (Optimistic Rollups) 

Chainlink, Maker, Synthetix, and Uniswap.

  1. Matter Labs / zkSync (ZK Rollups) 

1inchAave, Balancer, Curve, and Loopring. 

  1. StarkWare (ZK Rollups)

dYdX and DiversiFi.

Conclusion

Congratulations for making it through this long article on scalability and Layer-2 solutions. Now, you’re probably thinking, “what can I do with all this info?” Well, for one thing, if you’re an investor looking for projects with a future, you can pick the Layer-2 solutions that seem the most viable and start researching platforms that will begin deploying them. 

The face of the Ethereum franchise, Vitalik Buterin, supports Optimistic Rollups for the near term and ZK Rollups for the longer term. With everything still at an early stage and development moving rapidly, consider yourself already ahead of the curve with this introduction. 

On the other hand, if you’re a developer, you can decide which of the above solutions most interest you and start building up your skills to meet future employer’s upcoming demands. The best way to do that is to enroll at Ivan on Tech Academy and become a blockchain developer. What are you waiting for? Get started today! 

Author: MindFrac