What are Layer 2 Scaling Solutions?
Blockchain’s moon race is on as the ecosystem grapples with developing scalability solutions to meet demand without sacrificing security or decentralization – the classic blockchain trilemma.
The rapid growth in decentralized finance, NFTs, and gaming has seen adoption congest the Ethereum network, in particular, leading to bottlenecks and high transaction fees given its capacity for processing only a few transactions per second, rendering many dApps usable at times.
Ethereum’s transition to a proof-of-stake sharded network may alleviate some of that pressure on layer 1, with sharding splitting the Ethereum network into new chains or shards to spread the load, reducing congestion, and increasing transactions per second.
However, given full deployment is still years away and participation isn’t showing signs of slowing down any time soon, the pressing need for scalable solutions has accelerated the adoption of layer 2 technology that runs on top of Ethereum’s layer 1, rather than trying to improve performance at the base layer.
Layer 2 and related technology offer several different solutions for Ethereum scaling, each with its own benefits and trade-offs, including:
State Channels and Payment Channels
Plasma chains are separate blockchains that anchor to Ethereum, sometimes called child chains, as they operate as smaller copies of the Ethereum mainnet. These child chains use a combination of smart contracts and cryptographic verification to offload transactions from the parent chain.
Each with its own mechanism for block validation, Plasma chains periodically report back to the Ethereum main chain, using its security to settle disputes when challenged via fraud proofs.
Plasma chains enable high throughput at a low cost per transaction. However, only basic transactions like token transfers and swaps are supported, there is a liveliness requirement, and chain withdrawals can be lengthy to allow for challenges.
Several projects provide implementations of Plasma for dApp integration, including OMG Network and LeapDAO.
Layer 2 sidechains are independent Ethereum Virtual Machine (EVM) compatible blockchains running parallel to the Ethereum main chain. Validator nodes in the sidechain network are responsible for confirming and processing transactions, adding blocks, and maintaining the sidechain’s own consensus rules, such as proof-of-authority or delegated proof-of-stake, to provide more efficient transactions.
Compatibility is achieved via a two-way bridge to Ethereum, though its security is not directly inherited and is the responsibility of the sidechain.
Sidechains utilize established technology and support more complex transactions with EVM compatibility, though they are less decentralized and rely on their own consensus mechanisms rather than the security of layer 1 and so aren’t technically layer 2 in that sense.
Projects offering sidechain implementations include POA Network and xDai chain.
State Channels and Payment Channels
One of the first widely discussed layer 2 scaling solutions, state channels use multi-signature contracts to enable participants to transact quickly and frequently off-chain, settling back to layer 1 for finality as required.
State channels can manage more complex interactions like a game, whereas payment channels are simplified state channels that only deal with payments between two participants. State channels allow for extremely high transaction throughput at a very low cost, making them ideal for micropayments. However, the time and cost to set up and settle channels are not ideal for one-off payments, liveliness is required, and funds have to be locked up in open payment channels.
The main projects leveraging state channels on Ethereum are Celer, Perun, and Raiden.
Optimistic rollups sit in parallel to the Ethereum main chain on layer 2. They allow transactions to be executed cheaply and scalably in batches outside layer 1 while still using the security of the Ethereum base layer when submitting them as a single transaction.
As computation is the slow and expensive element of the Ethereum network, optimistic rollups offer up to 100 times scalability improvements as they don’t run any computation by default, a number that will increase further with the future introduction of Ethereum sharding.
Instead, optimistic rollups assume transactions are valid and only run computation if challenged via a fraud-proof. Optimistic rollups use a bonding system, and anyone proven responsible for a fraudulent transaction or challenge will forfeit their bond with some slashed and some used to incentivize the correct party.
Optimistic rollups can handle anything done on Ethereum layer 1 as they are EVM and Solidity compatible. As all transaction data is stored on the layer 1 chain, optimistic rollups remain secure and decentralized. At the same time, they are providing execution scalability. However, long wait times for on-chain transactions are possible due to the potential fraud challenges.
As optimistic rollups support both simple payments and complex smart contracts, they are seen as more immediately suitable for DeFi applications, with Optimism, Arbitrum, and Cartesi among the multiple projects offering implementations.
In a sign of the future direction of the space, the leading DEX platform Uniswap recently also announced it would be taking the next step in adopting layer 2 tech by launching on Optimism to sharply reduce transaction costs for its users.
Zero-knowledge rollups, or ZK-rollups, bundle transactions off-chain and generate a cryptographic proof, known as a SNARK. In contrast to optimistic rollups, ZK-rollups run computation off-chain and submit these validity proofs to the layer 1 chain.
ZK-rollup smart contracts maintain the state of all transactions on layer 2, which can only be updated with validity proof. As ZK-rollups only need the validity proof rather than all the transaction data, validating a block is quicker and cheaper as it includes less data and requires less gas.
Additionally, as the ZK-rollup contract has already verified the transactions, there are no delays in moving from layer 2 to layer 1.
As a result, ZK-proofs offer faster finality times while remaining secure and decentralized since the data needed to recover the state is stored on Ethereum layer 1. However, some ZK-rollups do not have EVM support, and validity proofs are intensive to compute, making them unsuitable for dApps with little on-chain activity.
Multiple implementations of ZK-rollups also exist, including zkSync and ZKSwap. zkSync offers a trustless protocol for scalable, low-cost payments on Ethereum using ZK-rollup technology, helping crypto wallets and defi platforms to unlock PayPal-like scale. ZKSwap provides a ZK-rollups-based layer 2 DEX with zero gas fees and high-transaction throughput, transforming the future of the AMM model.
Harmony’s interoperable layer 2 for Ethereum offers something more unique, combining the best of both the optimistic and ZK-rollup worlds. Harmony provides full EVM compatibility, unlike ZK-rollups, faster settlement with shorter withdrawal times compared to Optimistic rollups, and gas-efficient interoperability based on its sharded Proof-of-Stake blockchain that bridges to Ethereum via smart contracts.
By building on the benefits of both Optimistic rollups and ZK-rollups, generally seen to be the most promising of layer 2 scaling technologies, while addressing their shortcomings, Harmony can provide a more wholescale solution for projects to deploy. Harmony’s interoperability also extends beyond Ethereum with its Horizen bridge to Binance Smart Chain, opening up access to the broader defi ecosystem.
Validium uses validity proofs like ZK-rollups, but instead, data is not stored on Ethereum layer 1, allowing for scalability of up to 10,000 transactions per second per Validium chain, of which multiple can run in parallel.
Validium offers no withdrawal delays, improving capital efficiency, and is not vulnerable to certain economic attacks faced by high-value dApps using fraud-proof-based systems. However, Validium chains have limited smart contract support.
Projects providing implementations of Validium include Loopring and StarkWare. Immutable X, the first layer 2 scaling solution for NFTs on Ethereum, utilizes StarkWare’s Validium and ZK-rollup technology to enable transaction speeds of over 9,000 per second with zero gas fees while retaining Ethereum’s security for its ecosystem of marketplaces, apps, and games.
Polygon is something of an aggregator of these layer 2 solutions, offering multiple implementations of several layer 2 technologies. As a result, Polygon has become the fastest-growing layer 2 network, bringing blockchain infrastructure to the masses by opening up the accessibility, usability, and use cases of decentralized applications on Ethereum’s internet of blockchains.
Polygon’s suite of layer 2 scalability solutions has witnessed adoption from Defi blue chips, with platforms like Aave, SushiSwap, and 1inch already integrating with it.
CVI, the decentralized volatility index for the crypto space powered by the COTI network, has also followed that lead in integrating with Polygon. CVI users can open positions, provide liquidity and stake, while processing transactions out of the main ETH blockchain.
No one scaling solution alone is sufficient to fulfill the secure, decentralized, and scalable vision of Ethereum 2.0, avoiding the problem of high fees and bottlenecks.
Sharding will certainly help on-chain scaling on layer 1, but off-chain layer 2 solutions that can flexibly tailor to the unique requirements and acceptable trade-offs of the plethora of dApp projects being developed are key to the future of blockchain.
The ecosystem as a whole is greater than the sum of its parts, and different layer 2 solutions can exist and work together in harmony to respond to the increasing demands of mainstream adoption, continuing to help reduce congestion and prevent single points of failure as we transition to the world of Web 3.0.