Layer 2 – What is it and what problems does it solve?
Blockchain technology offers tremendous benefits – decentralization, high levels of security, immutable record-keeping and trustless interactions. It has enabled a cryptocurrency ecosystem to develop and has underpinned consistent technological innovation and bloom. However, one of the main problems with many blockchain networks is their scalability. Scalability is part of the Blockchain Trilemma: the balancing act between decentralization, security, and scalability within a blockchain infrastructure. You can read more in our article – What are L1 & L2?
The scaling problem is an issue when the amount of data passing through the blockchain hit a limitation due to the insufficient capacities of the given blockchain.
If you’ve ever stood in line for anything, you know the agony of waiting, no?
Blockchain faces the same problem but on a larger scale.
A blockchain network stores transactional data every time someone makes a transaction. When too many transactions happen simultaneously, the network slows down, and users have to wait.
In an ideal case, a blockchain would be able to handle an infinite number of transactions per second (also referred to with the acronym TPS).
However, Ethereum can only process 30 transactions per second. Bitcoin, can only process 4.6 transactions per second. In comparison, Visa, alone, can process the whopping 65,000 TPS using the centralized VisaNet electronics payment network. The difference lies in the level of decentralization and privacy that blockchains like Bitcoin and Ethereum aim to provide.
Why the need for Layer 2?
Layer 1 is the base layer of some blockchain networks – the ground floor of all their transactions. Bitcoin, Ethereum, and Litecoin are some of the examples of Layer 1 blockchains. The base network is spread across many individual computers around the globe, often referred to as nodes. These nodes use their computing power to verify all transactions that happen on the blockchain. Due to reliance on that many nodes with varying capacities, a blockchain cannot handle that many requests simultaneously, making scalability the most commonly discussed challenge for blockchains – increasing transaction throughput or the number of transactions that can be executed on a blockchain. In the case of public blockchains, this has most often been referred to as the “Layer 1 issue”.
There are two ways to think of Layer 1 scalability solution and all two of them have limits:
- Horizontal scalability
Horizontal scalability refers to adding more nodes to a network to handle the increasing demands. The issue with horizontal scalability, however, is that in a public blockchain every node in the network validates and updates the ledger. Because every transaction needs to be processed by every single node, adding more nodes to the network does not make it faster.
- Vertical scalability
Vertical scalability refers to adding more power to the machines that are in the network to handle the increasing demands. This typically involves increasing block size, however, improving scalability through bigger blocks has drawbacks. It requires more work from the nodes, which means less powerful computers may not have the capacity to operate in the network. Thus, vertical scalability can result in fewer validating nodes, which means more centralized mining.
Vertical Layer 1 scalability solutions sacrifice one of the three core tenants of blockchain technology: decentralization, security, and speed. In essence, it is not possible to scale on the base-layer without sacrificing some of the essence of the technology.
Layer 2 solutions, on the other hand, are the option for scalability.
They are built on top of a secure base-layer blockchain and can achieve high throughput without compromising security, by leaving the base-layer alone and building protocols on top of it.
Layer 2 is only a little less secure but provides higher throughput, but it is important to keep in mind is maintaining a secure base-layer is critical for Layer 2 solutions to work. You can build an insecure layer on top of a secure base-layer, but you cannot build a secure layer on top of an insecure base.
Layer 2 Solutions:
Let’s look into the Layer 2 solutions:
- State Channels;
- Nested Networks
A state channel is a two-way communication channel between participants, which enables them to operate with transactions, which would typically occur on the blockchain, off the main blockchain. Doing this helps in cutting down the waiting time since you are no longer dependent on a third-party validation. This is how a state channel works:
- A portion of the blockchain is sealed off via a smart contract, which is pre-agreed by the participants.;
- The participants can directly interact with each other without submitting anything to the miners and the main blockchain.;
- When the entire transaction set is over, the final state of the channel is added to the main blockchain.
Bitcoin’s Lightning Network and Ethereum’s Raiden Network are the two most popular state channel solutions.
In this kind of network, the main blockchain sets the rules for the whole network and is not expected to participate in any operation unless there is a need for resolving a dispute. This system allows several levels of blockchains to be built on top of each other, linking them through a parent-child connection. The parent chain assigns and distributes the tasks among its children, who in turn execute them and send back the result to the main blockchain, relieving their parent of its workload and increasing scalability.
Currently, Ethereum is working on a nested blockchains solution called Plasma.
Scalability is a big reason for inhibiting the mainstream adoption of blockchain technology. As users, we often want to get things done as fast as possible, and the second layer provides just that. To make sure that transactions are scalable and fast enough for day-to-day transactions Layer 2 solutions turn out to have a big impact for applications that need high throughput while still benefiting from a secure base-layer.