logo
dummyGradient

6 mins

Last Edited: Oct 27, 2023

Ethereum Layer 2 Scaling Solutions: Plasma, Sidechains, and Beyond

Discover Layer 2 scaling solutions like Plasma, Sidechains, Payment, State Channels, Rollups, and their transformative role in enhancing blockchain scalability, efficiency, and security.

Blockchain Infra

Intermediary

Blockchain technology is a revolutionary way to store and manage data in a decentralized, secure, and transparent way. However, blockchains face some challenges, such as network congestion and high transaction fees, as all transactions are processed on the base layer. Additionally, high energy consumption is also a concern. Layer 1(L1) blockchains must choose between sacrificing decentralization or security in order to scale. Fortunately, Layer 2 scaling solutions provide an alternative solution.

Layer2

Blockchain Trilemma

Ethereum scaling solution

A network that helps L1 blockchain improve scalability without sacrificing security or decentralization.

Objectives

  • Process tens of thousands of transactions per second
  • Reduce the transaction fee.
  • Do all of this while maintaining security against attacks from significant portion of the network and without relying heavily on centralized full nodes.

There were several attempts made to solve Layer 1 scalability issues. Plasma and Sidechains are two of the most talked scaling solutions for Ethereum. But what exactly are they?

Plasma

Plasma chains are separate blockchains that are connected to the Ethereum mainnet. They process transactions off-chain, which means that they are faster and cheaper than transactions on the Ethereum mainnet.

Plasma chains use a system called "fraud proofs" similar to Optimistic Roll-up to ensure that transactions are valid.

Fraud proofs are a way to prove that a transaction is invalid without having to prove that it is valid. This makes them very efficient, and it is one of the reasons why Plasma chains are so fast.

Plasma chains can be stacked on top of each other, which means that they can be used to scale Ethereum infinitely.

Read more about Plasma here

Limitations

However, Plasma chains have some limitations. For example, A malicious operator could create fake transaction data and submit it to the Plasma chain. This would allow them to steal funds from users or reverse valid transactions. Plasma chains can be less secure than the Ethereum mainnet, and they can be difficult to use.

  • Data unavailability: Plasma chains only store transaction data with the operator, and do not publish it to the main Ethereum blockchain. This means that users must rely on the operator to provide this data if they need to create fraud proofs to challenge invalid transactions.
  • Mass exit problem: If a large number of users try to withdraw from a plasma chain at the same time, it can cause network congestion on Ethereum and make it difficult for users to withdraw their funds before the operator drains every account on the plasma chain.

Plasma chain

Plasma chains

Sidechains

Sidechains are separate blockchains that are connected to a main blockchain, such as Ethereum. This enables different blockchains to interact and exchange assets, improving interoperability between different blockchain networks.

Sidechains are not secured by the main blockchain, so they must have their own security mechanisms, such as proof of stake (PoS) or proof of work (PoW).

Read more on the Sidechain here

Limitations

  • Sidechains are less decentralized and trustless than Ethereum, but they are more scalable.
  • Sidechains use their own consensus mechanisms, which are not as secure as Ethereum's.
  • Sidechains require users to trust the validators on the sidechain, who could potentially commit fraud.

Sidechain.jpg

Sidechains

What is Layer 2 in Blockchain?

Layer 2 refers to a set of off-chain solutions that are built on top of Layer 1 blockchain to address scalability issues. This works by creating a secondary framework that does not require the Layer 1 chain.

Layer 2 can improve on two fronts:

  1. Transaction Speed (the amount of time it takes to complete a transaction), and,
  2. Transaction Throughput (the number of transactions that a network can process in a given amount of time).

On top of that Layer 2 can drastically reduce the gas fee.

Layer 2.jpg

Layer 2

There are a few more scaling solution that the blockchain community have worked on, i.e. Channels and Rollups.

  • Channels are peer-to-peer protocols that allow two parties to make many transactions between themselves off-chain and then only post the final results to the blockchain. This reduces congestion and increases transaction processing speeds. Each channel is managed by a multi-sig smart contract, which ensures that both parties agree to the final state of the channel before it is closed. Channels are particularly useful for high-frequency transactions, such as micropayments or gaming.

Example: Alice and Bob want to play a game where they bet small amounts of ETH on each hand. They could open a channel and then make all of their bets off-chain. At the end of the game, they would close the channel and the smart contract would distribute the winnings to the winner.

  • Rollups provide scaling by bundling hundreds of transactions into a single batch and submitting it to layer 1, Ethereum's mainnet. This spreads the cost of Ethereum's transaction fees across all users in the rollup, making it cheaper for everyone. Rollups are executed off-chain, but the transaction data is submitted to layer 1, which gives rollups the same security as Ethereum. Once the data is uploaded to layer 1, it is very difficult to reverse a rollup transaction, as it would require reverting Ethereum itself.

Example: A decentralized exchange wants to offer high-frequency trading pairs. They could use a rollup to bundle all of the trades together into a single batch and submit it to Ethereum. This would allow traders to execute trades quickly and cheaply.

Let's dive deeper into these scaling solutions.

Channels

Here, channels are again divided into two categories: payment channels and state channels.

  • Payment channels are a fast and cheap way to do transactions off the main blockchain. They allow two parties to create a private payment channel and conduct a series of transactions off the main blockchain. Payment channels work by locking funds in a contract and recording the final state of the transactions on the blockchain when the channel is closed.
  • State channels are a type of scaling solution that allows users to execute smart contracts off-chain, without having to submit a transaction to the Ethereum network. This can significantly improve the scalability and performance of smart contracts, but it comes with some security trade-offs. State channels are similar to payment channels, but they allow users to track the current state of a smart contract's storage, in addition to holding the user's balances. This makes it possible to execute a smart contract off-chain between two users.

Although channels can perform thousands of transactions per second at lower transaction fees. They have some limitations, including:

  • Liveness assumptions: State channels assume that peers will always be online and available. If a peer goes offline, a malicious peer could steal their funds.

Example: Alice and Bob open a state channel to bet on a football game. If Bob goes offline before the game is over, Alice could steal his funds by closing the channel and claiming the full bet.

  • Data unavailability: State channels require users to have access to the latest state of the channel. If a user loses this data, they could lose their funds to a malicious peer.

Example: Carol opens a state channel with a merchant to buy goods. If Carol loses her phone containing the latest state of the channel, the merchant could steal her funds by closing the channel and claiming the full payment.

  • Liquidity issues: To establish a blockchain channel it require users to lock funds in a smart contract for the channel's lifecycle. This can reduce liquidity and make state channels inaccessible to some users.

Example: David wants to open a state channel with a friend to play video games. However, David does not have enough funds to lock in the smart contract to establish the channel. As a result, David is unable to play video games with his friend using the state channel.

  • Griefing attacks: State channels are susceptible to griefing attacks because the honest party must respond to every dispute, even invalid ones, or risk losing funds that's where a malicious peer could force the honest party to spend money on gas fees.

Example: A malicious peer could repeatedly send the honest party invalid state updates, forcing the honest party to pay gas fees to respond to each dispute.

Read more on the state channel here

Roll-ups

There are two types of rollups: Optimistic rollups and Zk rollups.

Rollups.jpg

Rollups

Optimistic rollup

As mentioned above, the optimistic rollup executes transactions outside of Ethereum but posts transaction data to the Mainnet.

Optimistic rollups assume that off-chain transactions are valid and do not provide proof of validity for transaction batches posted on-chain. This is different from zero-knowledge rollups, which publish cryptographic proofs of validity for off-chain transactions.

Optimistic rollups use a fraud-proving scheme to detect incorrect transactions. After submitting a rollup batch on Ethereum, there is a challenge period where anyone can challenge the results of a rollup transaction by providing fraud-proof.

Limitations

  • Fraud proof delay: Delays in transaction finality due to potential fraud challenges. Users must wait for the one-week challenge period to expire before withdrawing funds back to Ethereum.
  • Data availability problem: Ensuring off-chain accessibility of full-block data is a challenge, as unavailability or corruption of data can compromise system security and integrity. Centralized and decentralized data availability solutions exist, but each has its own trade-offs.
  • Compatibility trade-off: Optimistic rollups use the same execution model as Ethereum, so they share some of Ethereum's limitations and inefficiencies, such as high gas fees for complex computations.

Zk Rollups

Zk rollups and optimism rollups are similar in how they process and bundle a large number of transactions. They handle computations off-chain and then consolidate them into a simpler transaction that is published to Ethereum's execution layer. Zk rollups also provide validity proofs to verify the accuracy of their changes.

In the Zk roll-up protocol, transactions happen on a separate virtual machine in the Ethereum blockchain. Off-chain virtual machines are used to execute Zk rollup transactions. Validity proofs on the Ethereum blockchain make sure that transactions on the off-chain virtual machine are accurate. Off-chain protocols work independently but are protected by the Ethereum mainnet. Ethereum guarantees the validity of updates and the availability of data after each update to the rollup's state. This makes Zk rollups safer than sidechains.

Read more about Zk rollup here

Limitations

  • Trusted setup: A potential risk for ZK rollups. This means that there is a small group of people who are responsible for generating the keys that are used to verify zero-knowledge proofs. If these people are compromised, the security of the ZK rollup could be at risk.
  • Centralisation risk: ZK rollups rely on sequencers to order and batch transactions. If the sequencer is controlled by a single entity, that entity could censor transactions or manipulate their order.

What is the future of L2?

Despite their limitations, optimistic and ZK rollups are promising scaling solutions for Ethereum. They have the potential to make Ethereum much more scalable and efficient and could revolutionize blockchain development.

Layer 2 solutions can address current challenges and shape the future of the industry. We can expect to see specialized and versatile scaling solutions emerge, as well as increased integration with Ethereum to improve usability and security. This integration will unlock new use cases and accelerate mainstream adoption.

🔑  Key Takeaway

Layer 2 scaling solutions offer increased transaction efficiency and scalability in blockchain while introducing unique challenges and the potential for revolutionary improvements in the Web3