What is Layer 2 Blockchain?
Since Satoshi Nakamoto released the Bitcoin whitepaper in 2008, blockchains have continued to gain popularity. People have applied blockchain technology to other areas, besides payments, thanks to its decentralised and secure nature.
While blockchain technology holds several benefits for economic activities, one factor continues to stem its widespread acceptance: scalability. Scalability is what Ethereum founder, Vitalik Buterin, calls a component of the "blockchain trilemma."
Buterin's thesis explains that no blockchain network can equally provide decentralisation, security, and scalability. They must sacrifice certain elements to achieve near-optimal functionality.
Bitcoin and Ethereum trade off scalability for security and decentralisation for scalability. That explains why a major blockchain network like Bitcoin can process around 7 transactions per second. For context, Visa's payments system can process up to 24,000 transactions per second.
If blockchain technology must attract more users, it must solve the scalability problem. Several solutions have appeared in recent years, including the now-popular “layer 2” protocols.
In this deep dive, I explain what layer 2 blockchain means, how it works, and why it’s important for blockchain adoption.
Let's dive in!
Layer 2 Blockchain Explained
Layer 2 is a secondary protocol designed to operate atop another blockchain network. Layer 2 is so-called because it’s designed to operate separately from Layer 1, the base layer in a blockchain.
So—what's the big deal about layer 2 blockchain?
Layer 2 protocols act as a auxiliary framework for processing transactions, which reduces the base layer's workload. That increases the transaction speed of a blockchain network (throughput) and enhances the system's ability to handle more users.
Ever wondered why blockchain transactions take so long? The answer lies in the blockchain's structure. Unlike centralised systems, like PayPal or Visa, blockchain transactions must pass through several stages—acceptance, mining, distribution, and validation—before getting approved.
In the status quo, layer 1—the base layer of the blockchain—must handle all the activities involved in validating each transaction. Inevitably, processing speed will fall, affecting scalability and user experience.
Layer 2 is designed to operate atop the existing base layer and relieve the main chain of specific tasks. In this case, the base layer may only be responsible for specific functions like security and control.
I should point out that layer 2 blockchain must still report to the base layer. This ensures that transactions are still appropriately validated, keeping the security of the blockchain network intact.
Common examples of layer 2 blockchain solutions include:
- Bitcoin Lightning Network
- Ethereum Raiden Network
- OMG Plasma Network
What are Examples of Layer 2 Blockchain Solutions?
Layer 2 protocols operate independently of the main chain in a blockchain. That’s where they get their “off-chain” description from. In the following In the following paragraphs, I explore the different layer 2 blockchain solutions currently in use:
A nested blockchain is one operating atop another blockchain. The main chain has a parent-child relationship with secondary blockchain chains in this case. It assigns tasks and control overall parameters, but auxiliary chains execute transactions.
A helpful analogy here is a company hierarchy.
Instead of tasking one person with an enormous task, the manager spreads the job across the team. Then team members must return the task to the manager for approval.
Nested blockchains work the same way: multiple chains receive tasks from the main chain, which they report to the latter upon completion. An example of a nested blockchain is Ethereum's OMG Plasma Network.
State channels facilitate direct communication between participants on a blockchain network. Users can conduct transactions off the main chain, removing the need for a middleman. That means less time spent waiting for miners and faster transaction processing rates.
State channels don't need transactions validated by layer-1 nodes. Instead, the resource is sealed-off through a smart contract mechanism. When a transaction is complete, a final state of the channel is recorded on the base layer.
It is also important to note that state channels keep details of transactions private between parties. However, the final transaction is added to the public ledger for recordkeeping purposes.
Examples of state channels include Bitcoin’s Lightning Network and Ethereum's Raiden Network.
The Lightning Network allows users to handle multiple microtransactions within a limited timeframe. Meanwhile, Ethereum’s Raiden Network lets participants on the blockchain run smart contracts through their channels.
A sidechain is a smaller chain linked to the main chain via a “channel” or “bridge”. If the main chain is a forest, sidechains are the trees.
Sidechains are primarily designed to process large batch transactions. A sidechain has its consensus system, relieving the main chain of some of the work in validating transactions. In this arrangement, the main handles overall security, dispute resolution, and maintenance of records.
Sidechains vs. State Channels
Sidechains differ from state channels due to the following reasons:
- They record transactions on the public ledger.
- An attack on a sidechain cannot affect the main chain or other sidechains.
- Sidechains require more effort to develop
Bitcoin’s Liquid Network is an excellent example of a sidechain.
Rollups are layer 2 protocols that run computations off the main chain. However, rollups will transfer a record of transactions at periodic intervals to the main chain for recordkeeping purposes.
Rollups execute data transactions without relying on the base layer, increasing throughput and decreasing gas fees. Transaction data is posted on the main layer, which guarantees the security of rollups.
- Optimistic Rollups
Optimistic rollups are so-called because they assume all transactions to be valid by default. However, there's usually a seven-day waiting period for optimistic rollups to validate a transaction—enough time for dispute resolution if there's a challenge.
- Zero-Knowledge Rollups
Zero-knowledge rollups perform computations off-chain before submitting proof of validity to the main chain. A zero-knowledge rollup could hold funds in a smart contract on the base layer. Proof is submitted, transaction is confirmed, and the funds released.
Why is Layer 2 Blockchain Important?
Layer 2 solutions solve the predominant issues keeping developers from scaling apps built on the blockchain network. Here are four benefits layer 2 protocols offer the blockchain ecosystem:
Layer 1 blockchain solutions rewrite the base layer protocol to improve scale. This could involve increasing block capacity or boosting the speed at which new blocks are validated.
Although a decent solution, tampering with the blockchain’s main architecture may compromise network security.
With a layer 2 blockchain, the base layer is left as is, with no changes to the underlying protocol. Instead, layer 2 solutions build on and complement the active base layer.
Higher Transaction Speed
With layer 2 protocols, transactions can be performed off-chain, reducing workload and increasing speed and scalability. Freed from mundane tasks, the main chain can focus on providing security and decentralisation. On the other hand, layer 2 can be optimised for faster computations and greater throughput.
Scale is the biggest raison d'etre for using layer 2 blockchain. These off-chain solutions increase the transaction-per-second rate, otherwise called the "throughput" of blockchain networks.
This means good news for scalability and ensures that each user gets a rich experience, regardless of the load on the network. In fact, experts predict layer 2 solutions will enable blockchain networks to process hundreds, if not thousands, of transactions per second.
Lower Transaction Fees
Blockchain relies on middlemen, i.e., miners, to validate transactions. Typically, miners solve cryptographic algorithms to validate transactions—an activity that requires heavy computing power.
But, as more users join the blockchain network, transactions will increase, clogging up the system. Miners have limited computing power, so they often select transactions with higher fees. Unsurprisingly, this has caused transaction fees, aka "gas fees," to skyrocket.
Layer 2 blockchain promises to decrease the computing power required to process transactions. This will allow miners to handle more transactions while users can pay lower fees, a win-win solution for everyone.
Currently, layer 2 solution represents blockchain's best chance of displacing traditional centralised systems. With increased processing power, lower transaction fees, and richer user experience, blockchain technology will gain rapid acceptance.
More importantly, layer 2 protocols will accelerate the integration of blockchain into global commerce. We'd be able to build blockchain networks that can be used in multiple industries and scale to accept more users