Blog > Technology > Articles
If you've ever stood in line for anything, you know the agony of staring at the back of a person's head, waiting for them to move.
Blockchain faces the same problem but on a much larger scale.
A blockchain network stores transactional data every time someone spends cryptocurrency. When too many transactions happen simultaneously, the network slows down, and users have to wait.
This is where Layer 2 comes into play. It is a second framework built on the blockchain that can process transactions at a much higher capacity. Imagine standing in line for a concert ticket, but there's only one ticket booth. Layer 2 is the second booth with extra staff that handles most customers from the first one.
To understand how Layer 2 works, we first need to get to the root of Layer 1's problems. This article talks about the inherent difficulties of blockchain scalability and some of the most efficient Layer 2 solutions.
Layer 1 Solutions
Layer 1 is the base layer of a blockchain network - the ground floor of all transactions. Bitcoin, Ethereum, and Litecoin are Layer 1 blockchains.
A Layer 1 network is spread across many individual private networks, often referred to as nodes. These nodes use their computing resources to verify cryptocurrency transactions.
Due to reliance on many nodes with varying capacities, a blockchain cannot handle that many requests simultaneously.
Layer 1 solutions help solve this problem by adding more processing power to the entire network. It can also increase the amount of data each block can hold or the confirmation rate of blocks for faster throughput.
Proof of Work (PoW) is one of the best examples of Layer 1 protocols at work. It's an algorithm that requires nodes to solve complex mathematical problems to verify transactions. This method is more secure than most but also the slowest.
Modern blockchains like Ethereum 2.0 use Proof of Stake (PoS). It also works in a distributed network but is much faster as there are no complex problems to solve. Members of the network deposit their crypto as a stake to earn the right to validate transactions.
Both PoW and PoS are considered consensus mechanisms that support Layer 1 blockchains. You can read more about the difference between them here.
Each node in Layer 1 has to process all the data in every transaction. They can include public keys, inputs, and outputs, etc.
Sharding separates those data into smaller sets, so each node has to process a bit of data at a time and all of the same type. This results in higher throughput for the entire blockchain.
These are some of the applications with which developers attempted to solve the Layer 1 problems. Despite their effort, blockchain scalability was still too low for the rising demand in cryptocurrency. The problem runs deeper than just speed, and it's often referred to as the blockchain trilemma.
A trilemma is when the perfect outcome requires three elements, but you can only achieve two simultaneously.
In the case of blockchain, the three elements involved are decentralization, security, and scalability. During its initial stages, blockchain was all about decentralization. Its sole design was to obviate financial intermediaries, such as banks. With individual networks coming together, the system would reward them for their work instead of paying central banks.
Security is also a big selling point. When each node has a copy of every transaction, it's extremely difficult, if not impossible, to tamper with it in any way. Also, the more nodes a network has, the less likely it is to face a 51% attack since it would take an unimaginable amount of energy or money to do so.
Since blockchain excels in both decentralization and security, scalability becomes an issue. The Bitcoin blockchain can process up to 7 transactions per second (TPS), but there weren't too many users back then, so this wasn't a huge deal. Nowadays, when we compare that to Visa's speed, which is about 1,700 TPS, it's laughable.
Layer 2 Solutions
Layer 2 is a protocol or technology that goes on top of Layer 1. It works independently of Layer 1 but is still part of the entire network. That means if there were any security issues, users could always go back to Layer 1 and double-check on the data. As they work on a separate network, Layer 2 solutions are often called off-chains.
A large portion of transactions that go through Layer 1 gets shifted to Layer 2. This results in a shorter wait time and smoothens the traffic flow in Layer 1. Hence, scalability.
Layer 2 solutions are built with much higher capacity and processing speed. Most of them operate on their channels and rarely require validation from Layer 1. Some examples include state channels, Ethereum Plasma, and Lightning Network.
A network can have multiple off-chain channels on top of its base layer. State channel lies in between those channels and Layer 1. It acts as a facilitator and records transactions to Layer 1 only when they are finalized. Bitcoin's Lightning Network is an example of this protocol.
Plasma is a type of nested blockchain, which works similarly to state channels. The slight difference here is that each channel can have its own set of rules. Ethereum uses smart contracts for all transactions so that the same thing can be applied to these chains.
Most Layer 2 solutions are still in their experimental phase, but the positive results speak for themselves. As users, we often want to get things done as fast as possible, and Layer 2 provides just that.
The only problem is that that it doesn't fully solve the trilemma. Having more channels means needing more parent chains, which would eventually lead to some degree of centralization. That goes against the very foundation of blockchain. For now, though, it's the best we've got.
If you want to invest in cryptocurrency and don't know where to start - join Liquid! Founded in 2014, Liquid is one of the world's largest cryptocurrency-fiat exchange platforms serving millions of customers worldwide.