With millions of users joining every day and new applications constantly being launched, Ethereum is now severely limited by the number of transactions. Ethereum's ability to process transactions, its transaction throughput, is limited to 15 transactions per second, causing it to become increasingly expensive and overcrowded, making it unusable for many.
The Ethereum network is the main chain, and all transactions that happen directly on it are "on-chain", while anything else is considered "off-chain". Some off-chain solutions such as sidechains and L2 can help Ethereum scale, increase transaction speed, and increase the number of transactions that the network can handle. In this article, we will show what sidechains and L2 solutions are and how they can help with scalability.
Sidechains and L2 Ethereum solutions help solve Ethereum’s scaling problems. Attempts to improve on-chain performance often result in Ethereum’s decentralization or scalability trade-offs — known as the scalability trilemma.
Sidechains and L2 solutions allow for continuous and incremental innovation, improving Ethereum for everyone while maintaining security and decentralization.
The main difference between sidechains and Ethereum's L2 solution is that L2 inherits the security of the Ethereum main network, while sidechains rely on their own security.
An Ethereum sidechain is an independent blockchain network that runs in parallel to the Ethereum main chain. Sidechains are connected to the mainchain through a two-way peg system, allowing assets to be exchanged between sidechains.
There are two basic types of sidechains, one that is interdependent and one that is independent of each other.
When a chain depends on another chain (such as Ethereum), it can be considered a child chain of this parent chain. Typically, child chains do not create their own assets, but acquire assets from transfers from the parent chain.
Sidechains have their own consensus protocols, usually designed for specific types of transactions, in order to make them faster and more affordable. However, this also means that they generally do not inherit the security properties of Ethereum, and when using sidechains we only rely on the security of the sidechain, including nodes participating in its own consensus protocol.
Sidechains reduce congestion on the mainchain, reducing costs for everyone and increasing the usability and scalability of the Ethereum ecosystem. Developers can also use sidechains to explore and test new features and use cases not available on the main chain.
Popular sidechains include Polygon PoS, Skale, and Rootstock. Ethereum 2.0 has its own variant of sidechains, called shard chains, connected to the recently launched Beacon Chain, which aims to eventually become the proof-of-stake (PoS)-based Ethereum main chain.
Sidechains connect to the mainchain through a two-way peg system or bridge. On the main chain, we can send our ether to an exit address that acts as a lockbox so we can't spend it elsewhere.
Once the transaction is complete, and the "contest period" has passed (for added security), a receipt called "Simple Payment Verification" (SPV) is provided. This will trigger the release of the same value from a lockbox on the sidechain via the smart contract. When "transferring" from a sidechain to the mainchain, the exact same process occurs, only in reverse.
Sidechains are based on the Ethereum Virtual Machine (EVM), Ethereum's computing engine, and this compatibility with the EVM means that developers don't need make any changes. It's just a matter of deploying the same code, since they all share the same solidity software layer and are accessible via the same Web3 API!
The L2 protocol is a chain that exists within the Ethereum chain, but enables greater scalability through a secondary framework. Reduce congestion on the main layer by handling heavy activity at L2. Unlike sidechains, L2 typically inherits the security properties of the main chain.
Layer 1 is the underlying blockchain. Ethereum is a layer 1 blockchain because it is the underlying foundation upon which various L2 blockchains are built. Simply put, L2 compresses transaction bundles and submits them to the Ethereum main network.
L2 scaling solutions include channel, rollup, and plasma. Here's a breakdown of these individual solutions:
Channel Through channels, users transact directly off-chain and reduce on-chain transactions to only the most important information. Specifically, a portion of the blockchain is locked via a smart contract, so that participants involved in a transaction must fully agree before it can be updated.
Participants update their own state by creating and signing transactions that can be submitted to the blockchain. Once we want to stop using the channel, we exit and submit the last state update to the main chain, which will unlock the state again.
rollup A rollup executes transactions off the Ethereum main network blockchain, then batches together multiple transactions before sending them back to the Ethereum main network. Rollups rely on proofs, allowing Ethereum to verify the correctness of transactions without processing them.
Two types of rollups
In general, there are two types of rollups: Zero-knowledge (ZK) rollup and Optimistic rollup.
Zero-Knowledge rollup (ZK rollup) uses proof of validity. Each batch of transactions contains a cryptographic proof known as a SNARK, which is verified by a contract on Ethereum's main layer.
Since only proof of validity needs to be stored on the main chain instead of a large amount of transaction data, this off-chain calculation saves a lot of processing time and makes ZK-rollup faster and more efficient.
Optimistic rollups use fraud proofs. As the name suggests, they optimistically assume that all transactions are valid and submit batches without any initial proof. There is a challenge period during which others are able to detect and prove that some data is false.
If the batch proves to be fraudulent, Optimistic rollps perform a fraud proof and run the correct transaction calculations using data available on the Ethereum main chain. Incentivize good behavior by asking participants to make rewards or cuts based on their behavior.
Companies like Optimism help Ethereum scale by offering greater throughput, less latency, and lower gas fees. At the time of writing, Optimism’s gas fees are 10x cheaper than Ethereum’s.
plasma Think of Plasma as Ethereum’s native sidechain, using a combination of smart contracts and Merkle trees to create infinite forks of subchains. These child chains are smaller copies of the Ethereum main chain, with their own consensus mechanism.
The bandwidth required to compute and transact data is offloaded from the parent chain, but is periodically committed to the root chain. Each subchain relies on a fraud proof system for security, which is similar to a rollup, with a period of time during which anyone can challenge its validity.
A key difference from other sidechains is that the "root" of each Plasma chain block is published to Ethereum, meaning it inherits the security of the main chain.
Companies like Polygon provide developers and end users with lower gas fees, resulting in faster transactions. These obvious benefits make developing on Plasma very attractive, and it's easy to see why they're seeing explosive growth.
Alchemy currently supports Ethereum Layer 1 chains and Arbitrum L2 chains. Arbitrum is an independent chain built on top of Ethereum. As a smart contract, it supports faster transaction speed, higher throughput, lower gas fees and more benefits. Activity and transactions are ultimately relayed from Arbitrum to the Layer 1 chain via an Optimistic rollup.
Massive adoption of scalable solutions such as sidechains and L2 (channel, rollup, and plasma) relieves the pressure on the Ethereum mainnet, thereby helping more users enjoy faster transaction times and reduce high transaction fees while still maintaining the same Security (in L2 solutions) and decentralized applications.
Source: https://www.web3.university/article/sidechains-vs-layer2s