What is a Layer 2? Everything You Need to Know
Layer 2 (L2) is a common term among crypto natives, but the concept can be confusing for many people, especially those who have just joined the industry.
It is a generic name used to describe solutions built on a base network, popularly called layer 1 (L1) or the main network (Mainnet). This means that L2 cannot exist without the base layer, which makes it essential to first have a basic knowledge of L1 before learning about L2.
Layer 1 Explained
So what is layer 1? It is the base network and underlying infrastructure of a blockchain platform. The main network is responsible for validating and finalizing all on-chain transactions without depending on another network. This means the base layer defines the rule of the ecosystem. L1 protocols also have native tokens used for transaction fees or gas fees.
Every base network has its own mechanism for nodes to reach a consensus, such as proof-of-work (PoW) and proof-of-stake (PoS). However, there’s a very common concept in the industry known as the blockchain trilemma, where a network can achieve two of the three main goals – security, scalability, and decentralization – but not all three together. This was popularized by Ethereum’s co-founder, Vitalik Buterin.
Layer 1 blockchains such as Bitcoin and Ethereum focus on decentralization and security while sacrificing scalability – the ability to handle many transactions. This is where layer 2 protocols come in. Developers build L2 solutions on L1 to solve scalability issues.
What is Layer 2 and How Does it Work?
Layer 2 protocols are solutions built on top of a base network to help scale transactions and data. L2 serves as an extension or a secondary framework for their respective main networks.
So how does it work? Layer 2 networks process transactions in large bundles on their own before submitting proof of the transactions to the base layer. This process is commonly referred to as “off-chain” scaling, and it takes a massive load off the base network.
L1 focuses on security, decentralization, and data availability, while L2 handles scalability. This makes the entire blockchain ecosystem more scalable since the base network is less congested. So basically, it’s teamwork.
Layer 2 Vs Sidechains
Layer 2 solutions and sidechains are designed to help their main networks scale faster. While L2 is built on top of its base chain, a sidechain runs in parallel as an independent EVM-compatible chain interacting with the primary network through bridges.
The main difference between layer 2 protocols and sidechains is that L2 inherits the security of the mainnet, while sidechains may adopt their own security or that of other protocols. Thus, sidechains are technically not considered L2 solutions.
Interestingly, projects such as Polygon Network combine multiple L2 and sidechain technologies to make transactions faster and cheaper.
Benefits of Layer 2 Networks
Scalability: Scalability deals with transaction throughput and speed. In other words, it ensures higher transactions are processed per second with faster completion. Many base networks prefer to sacrifice scalability for decentralization or security, which leads to congestion during high network usage.
Layer 2 networks solve this problem as they help blockchain ecosystems to scale without compromising security or decentralization.
Lower fees: As mentioned earlier, L2 bundles multiple transactions and submits them to the mainnet as a single transaction. This helps to reduce transaction fees, making the base layer cheaper and faster.
Maintain Security: Security and decentralization are the core focus of layer 1 networks. Since layer 2 chains are built on top, users can benefit from the security of the primary blockchain.
Drawbacks of Layer 2 Networks
Liquidity Reduction: Liquidity is an important aspect of the crypto market. Layer 2 networks can reduce the liquidity of their primary blockchains, which ought to be robust and liquid at all times.
May Require Multiple Accounts: When multiple L2 solutions are built on top of a network, the L1 and its different applications will require more bridges to ensure smooth communication between the two layers. This means end-users will often have to create multiple accounts to transfer funds between the different protocols. The process can be daunting, especially since users have to track the movement of their assets at all times.
Security Concerns: While this is a matter of implementation, the past year saw multiple bridging solutions getting hacked, leading to hundreds of millions worth of cryptocurrency being compromised.
Types of Layer 2 Solutions
There are different types of layer 2 technologies that provide scaling solutions for blockchain networks, thus allowing many people to use layer 1 protocols such as Bitcoin and Ethereum for daily transactions.
The most popular layer 2 scaling solutions include Rollups, centered on Ethereum, while the Bitcoin Lightning Network works to increase the scalability of Bitcoin.
Rollups
Rollup is a popular layer 2 system that scales the Ethereum mainnet and other blockchains. So how does it work?
Rollups are regular smart contracts that relay data between layer 1 and layer 2. They help the blockchain scale by transferring bulk transactions and data from the base layer onto the L2. Once the transactions have been processed on layer 2, rollups return the transaction data to the mainnet for storage.
In addition to scaling the base layer, rollups are designed to significantly reduce gas fees by grouping or “rolling up” hundreds of transactions into a single transaction before moving it to the base layer. The transaction fee is then shared by everyone in the group, making it cheaper for each user. This allows rollup solutions to reduce transaction fees by up to 100x compared to the base layer.
Furthermore, rollups are built on top of the L1, which allows them to derive their security from the primary blockchain.
That said, there are two types of rollups – zero-knowledge (ZK) and Optimistic. The major difference is how they transfer the transaction data back to the mainnet.
Zero-Knowledge Rollups
Zero-knowledge rollups or ZK rollups take multiple transactions from the base layer and process them off-chain, and then push the transactions in batches back to the mainnet through an on-chain rollup smart contract.
During this process, ZK rollups generate a cryptographic proof called SNARK (Succinct Non-Interactive Argument of Knowledge) or STARKs (scalable transparent argument of knowledge) sent to the L1 to prove the correctness of the transactions. This allows verifiers to know that they have the same information without revealing what they know, hence the name, zero-knowledge.
Zero-knowledge rollup chains can produce a block within a minute while processing up to 2,000 transactions per second. This drastically reduces the cost and time required for processing transactions on the blockchain.
Examples of L2 protocols leveraging Optimistic rollups
Loopring
zkSync
ZKSpace
Aztec
Optimistic Rollups
Like ZK rollups, Optimistic rollups process large volumes of transactions off-chain before posting the data back to the base layer.
The main difference, however, is that Optimistic rollups don’t generate cryptographic proof to prove the authenticity of the transactions. Instead, they assume that the transactions are valid until proven otherwise.
Optimistic rollups offer a time window called the challenge period that allows anyone to challenge the results of submitted state data. This can be done by computing a “fraud-proof.” If the fraud-proof is confirmed and accepted, the roll-up chain re-executes the false transaction and updates the state data.
Overall, Optimistic rollups offer less throughput when compared to ZK rollups and Plasma (explained below).
Examples of L2 protocols leveraging Optimistic rollups
Arbitrum One
Optimism
Boba Network
Plasma
Plasma is an Ethereum layer 2 scaling framework created by Vitalik Buterin and Joseph Poon, the author of the Bitcoin Lightning Network (explained below).
Unlike rollups, the Plasma structure combines smart contracts and Merkle trees to create an unlimited number of sidechains called “child chains” on top of the Ethereum main chain. Although these child chains are small copies of the mainnet, they process transactions off-chain with their own consensus mechanism for validating blocks. Taking the transactions off the main chain helps reduce congestion and improve scalability.
Like Optimistic rollups, each child chain in the Plasma structure uses a proof of fraud system for security, with a time period for anyone to challenge the transaction’s validity.
It’s worth noting that, unlike other sidechains, Plasma inherits the security of Ethereum. This is because the “root” of each chain block in the Plasma structure is published on the mainnet.
Polygon and OMG are examples of protocols leveraging the power of Plasma on the Ethereum network.
It’s worth noting, though, that Plasma Group (the Ethereum research organization) ceased operating and donated the remaining of its funds to Gitcoin to be used on optimistic rollups.
Bitcoin Lightning Network
The Lightning Network (LN) is Bitcoin’s most popular layer 2 scaling solution. It was proposed in 2016 to solve the scalability issues on the Bitcoin network by processing transaction bundles at a lightning-fast speed.
Like other L2 scaling solutions discussed above, LN takes multiple transactions from the mainnet and processes them off-chain through micropayment channels before returning the transaction data.
Although the Lightning Network was originally designed to scale Bitcoin, cryptocurrencies such as Litecoin and Dogecoin have also integrated the solution.
Final Thoughts
In summary, layer 2 protocols are scaling solutions built on top of a primary blockchain to help increase transaction speed and decrease costs. L2 chains are fast becoming the answer to the scalability issues found in major blockchains such as Bitcoin and Ethereum.
Binance Free $100 (Exclusive): Use this link to register and receive $100 free and 10% off fees on Binance Futures first month (terms).
PrimeXBT Special Offer: Use this link to register & enter POTATO50 code to receive up to $7,000 on your deposits.