Layer 2 is a collective term for solutions that aim to scale Bitcoin, Ethereum, or any other “core” blockchain through increasing TPS performance and thereby reducing gas fees. These solutions are known as “Layer 2” as they sit on top of (and rely on) the Layer 1 network.
Why Are Scaling Solutions Needed?
Scalability remains a key bottleneck for the development and adoption of blockchain applications. At present, the Bitcoin (BTC) main chain averages 3–7 transactions per second (TPS), while the Ethereum (ETH) main chain averages 10–15 per second. Both pale in comparison to traditional payment processors such as Visa or Mastercard, which average around 2,000 per second with a capacity of up to 20,000.
Despite the benefits inherent in the decentralized and private nature of blockchains, the fact that each transaction must be accepted, mined, distributed, and validated by a global consensus network creates problems in terms of speed. Blockchain projects have found it difficult to realize decentralization, scalability, and security all at the same time. This problem is called the blockchain trilemma.
Visualization of the blockchain trilemma (Source: SEBA Bank Research)
This is of particular concern to the Ethereum network, which has undergone a stress test from the explosion of decentralized finance (DeFi) applications and increased adoption. When the network becomes congested, users compete to have their transactions processed faster. The resulting bidding war for space in each block has often driven gas prices through the roof (up to as high as $80 in ETH), rendering most decentralized applications (DApps) completely unviable.
In a post made in October 2020, Vitalik Buterin noted that many non-DeFi DApps had been priced out of the network by rising gas fees. The UniLogin service was built to onboard new users to Ethereum directly from the browser, but found itself unable to keep up with gas fees, which at times cost more than $130. Other applications such as the crypto game Dark Forest were forced to migrate to testnets as gas prices made execution on the Ethereum mainnet unfeasible.
What Is the Difference Between Layer 1 and Layer 2 Scaling Solutions?
The term “Layer 1” refers to the underlying core blockchain architecture of any given network, while “Layer 2” refers to the overlaying network that lies on top of the underlying blockchain. As an example, Bitcoin itself is a Layer 1 network, while the Lightning Network is Layer 2.
Solutions such as the Ethereum 2.0 upgrade are known as Layer 1 because they fundamentally alter the blockchain as a whole. While Ethereum 2.0 is working to improve by separating the network’s computational load into sub-blockchains through a process known as sharding, the upgrade is not expected for completion anytime soon.
Built on top of Layer 1, the majority of Layer 2 solutions are centered around servers run by a project, third-party, or group of decentralized parties (similar to the mainnet). Rather than directly submitting transactions to the Layer 1 network, users can save on gas by submitting them to the Layer 2 network, which bundles them into batches for submission to the Layer 1 network.
What Are the Different Types of Layer 2 Solutions?
The aim of Layer 2 scaling solutions is to increase TPS without increasing centralization or tampering with the underlying blockchain’s security characteristics. Unlike sidechains, which make use of validators to ensure security, Layer 2 solutions directly inherit the underlying chain’s security. There are three primary types of Layer 2 solutions:
- State channels,such as Bitcoin’s Lightning Network and Ethereum’s Raiden Network facilitate the interconnection between blockchain and off-chain channels to improve capacity and TPS. State channels do not require validation by nodes on the underlying network. Instead, when transactions are completed on the state channel, the final “state” and all associated changes are recorded onto the underlying network. Generally speaking, state channels improve scalability at the cost of decentralization.
Visualization of a state channel Layer 2 solution (Source: Finematics)
- Zero-knowledge (ZK) rollups, such as Loopring and Starkware bundle (rollup) off-chain transfers with a cryptographic proof known as a succinct non-interactive argument of knowledge (SNARK), which is then delivered to the Layer 1 network. The ZK rollup smart contract, which maintains a record of all transactions on the Layer 2 network can only be updated with the SNARK proof. As this structure allows ZK rollups to operate with only the proof rather than all transaction data, block validation is quicker and cheaper. ZK rollups support the instant transfer of funds from Layer 2 to Layer 1 as the proof accepted by the ZK rollup smart contract has already verified the submitted transactions. ZK rollups offer rapid finality and high levels of security and decentralization, but are less EVM-compatible than optimistic rollups and more compute-heavy compared to other solutions.
- Optimistic rollups such as Optimism and OMGX derive their namesake from the fact that they assume the proof (the “rolled up” batch of transactions) is valid. These solutions deliver enhanced scalability as they don’t perform any computation by default, but rather simply propose a new state to the mainnet after each transaction. To ensure that frauds are detected before submission to Layer 1, a bond is required for the submission of each transaction. After a transaction is submitted, a one to two week period is provided in which anyone can challenge a submitted proof. Should a fraud be proven, the bond is slashed and the user that discovered the fraud is reimbursed for the gas they spent in proving the fraud. As all transaction data is kept on the Layer 1 chain, optimistic rollups offer high levels of security and decentralization, but at the cost of long wait times for on-chain transactions. As optimistic rollups are compatible with Ethereum Virtual Machine (EVM) and Solidity, they also offer a higher level of flexibility than ZK rollups.
Visualization of a rollup Layer 2 solution (Source: Finematics)
- Plasma chains such as Polygon (MATIC) and the OMG Network (OMG) operate as a separate blockchain connected to the Ethereum network, similar to the Polkadot (DOT) and Kusama (KSM) parachains. As they are essentially smaller copies of the Ethereum mainnet, these solutions are also known as “child chains.” Instead of processing everything on the Ethereum network, this solution allows the offloading of transactions into multiple plasma chains, which are then synchronized with the mainnet on a scheduled basis. Like with optimistic rollups, plasma chains ensure security through a fraud-proof The solution offers high TPS performance and low transaction costs, with zero fees required between two users on the same plasma chain. The drawback is that plasma chains only support a limited range of computations (such as transfers and swaps), and require a waiting period before withdrawal to Layer 1 to check for fraud.
Visualization of a plasma chain Layer 2 solution (Source: Finematics)
What Are the Problems of Ethereum Layer 2 Solutions?
One of the crucial innovations drivers in the DeFi space has been composability, which means the ability for any project to leverage the work of another DApp to develop innovative, more powerful applications. The ERC-20 standard allows Ethereum smart contracts to work as building blocks that can be mixed and matched into larger and more complex systems, a concept commonly referred to within DeFi as “money legos.”
The advent of Layer 2 solutions poses a major threat to this composability as DApps lose the ability to interoperate with any DApps that are not on the same Layer 2 solution. While on Layer 1, transactions could interact with a large variety of DeFi protocols to create a new product, Layer 2 locks these transactions onto its own chain. So far, AAVE is only available on Polygon while Uniswap (UNI) is only available on Optimism, therefore, no one transaction would be able to call both their smart contracts.
In addition to limiting composability, the fragmentation of DApps across Layer 2 solutions poses major liquidity issues. Each time a DApp moves onto a Layer 2 chain, it removes its associated liquidity from the broader ecosystem. Where all ERC-20 liquidity once existed on the underlying Ethereum network, the move towards Layer 2 will splinter this liquidity into a variety of smaller pools.
Despite potential drawbacks, Layer 2 solutions will play a major role in ensuring the Ethereum network’s scalability. With such a wide variety of different projects still in development, no single Layer 2 solution has come out on top. Vitalik Buterin himself favors the adoption of rollups, and has stated that “the Ethereum ecosystem is likely to be all-in on rollups as a scaling strategy for the near- and mid-term future.”
With Layer 2 technologies continuing to mature, segmentation should decrease as the major players establish themselves. Projects such as Polygon are also working towards limiting the damage to composability and liquidity through the development of interoperability technologies such as Layer 2 to Layer 2 bridges.