Layer-2 is a scaling solution to enable faster and lower-cost transactions on a blockchain network like Bitcoin or Ethereum.
As crypto has exploded in popularity it has inevitably stretched the capabilities and limitations of the major blockchain crypto networks like Bitcoin and Ethereum.
You could imagine the early days of crypto like a shiny new three-lane highway, freshly tarmacked for a smooth ride and almost no traffic due to the relatively small number of cars.
Fast forward to today and that same highway is bursting at the seams just as our real highways are.
It’s not easy or sometimes even possible to add a new lane to ease the traffic. Crypto networks like Bitcoin and Ethereum face a similar dilemma.
The limitations of layer-1 when it comes to transaction speed
The core blockchain network is what is known as Layer-1.
In the case of crypto, one major problem with layer-1 is the relatively slow speed at which transactions can be confirmed.
Take the case of the credit card company Visa, it is capable of processing up to 20,000 transactions per second (TPS).
Bitcoin on the other hand is capable of 3 to 7 transactions per second on the main blockchain.
This is a gigantic difference and poses serious scalability issues.
The reasons why are too complex to get into here but in essence, Visa uses a centralised system whereas Bitcoin uses a completely decentralised system where every single transaction needs to be verified by every node on the blockchain.
This produces a highly secure, cost-effective and super-resilient network but this security and robustness comes at the cost of lower transaction speeds.
Layer-2 is one solution to the problem of scaling
As a result technologists in the crypto world have been exploring ways to ease this congestion and layer 2 is one such solution.
To illustrate what layer-2 is we can use a different analogy this time. That of banking.
Imagine a major bank like HSBC or Barclays. It has a centralised technology or systems that store all the balances and transactions for thousands or maybe even millions of customers.
Every time money is deposited, withdrawn or transferred by an account holder the information is updated on the central network and most often in real-time. So far so good.
Now imagine we didn’t have online banking or ATMs and like the old days of banking, every single customer would have to physically visit a branch office and conduct the desired transaction no matter how small. Imagine the queues!
Well, this is what layer-1 kind of looks like.
As you can imagine, even with lots of branches it would take a lot of time to get things done.
Banking solved much of this problem by going online and by offering ATMs.
This has resulted in a huge amount of daily transactions being removed from the workload of branch offices. We could think of ATMs and online banking as layer-2 in crypto.
Now that we have an idea of what layer-1 and layer-2 are we can go a little deeper into what they are in crypto terms
Blockchain networks like Bitcoin and currently Ethereum, (although this will change), use what is known as a Proof of Work (PoW) consensus mechanism.
In simple terms, every time a transaction or “block” is recorded on the blockchain a miner has to solve a highly complex computational puzzle first by beating other miners and winning the opportunity to record the new block and in return earn some coins and corresponding transaction fees.
This transaction has to be verified by the entire blockchain network and then it is set in concrete so to speak.
This process takes time and energy, literally. If this proof of work consensus mechanism didn’t exist, say in the case of Visa, a transaction could be recorded instantly and naturally 20,000 transactions per second are possible.
In the case of Bitcoin, it is a physical limitation due to how the blockchain was originally conceived and developed.
Layer-2 is designed to divert transactions from the layer-1 network onto a faster network
What layer-2 does in very simple terms is “divert” a transaction away from the main layer-1 network, process it on a faster separate layer, “layer 2” and then when the transaction has been completed punch it back into the main layer 1 and set it in concrete so to speak.
This results in a reduction in small transactions occurring on the main layer 1 of the blockchain but still recording the final transaction with the same level of surety.
In addition to reducing congestion layer-2 also helps by offering lower transaction fees which are essential for very small transactions or micro-transactions where high fees simply wouldn’t work.
We could go back to the highway analogy again to illustrate layer-2 as well.
Imagine the main highway as layer-1, the primary blockchain of say Bitcoin or Ethereum.
Layer-2 could be an exit onto a separate super wide and fast stretch of road that leaves the main highway and then rejoins again several junctions later.
Now if we imagine a lot of these separate stretches of road in existence that are diverting traffic away we could expect a reduction in traffic on the main layer-1 highway.
Of course, it’s not as simple as that but hopefully, the analogy makes it easier to understand the issue and how layer 2 can ease congestion.
The Lightning Network is an example of a layer 2 crypto scaling solution for Bitcoin
One example of a layer-2 scaling solution is the Lightning Network on the Bitcoin blockchain.
The Lightning Network simultaneously takes transaction loads from the Bitcoin layer-1 and reports to it as well.
This results in an increase in processing speed on the Bitcoin blockchain. In addition to this, the Lighting Network brings smart contract capabilities to the Layer-1 Bitcoin blockchain.
This is pretty major as the layer-1 Bitcoin blockchain, unlike Ethereum, does not inherently support smart contracts.
Smart contracts, in very simple terms, are automated contracts that allow for more complex possibilities on a blockchain beyond the storing and transferring of cryptocurrencies.
As with almost all new technologies that experience mass adoption, like banking or cars, there is inevitably going to be a scaling problem.
Crypto is experiencing this scaling problem right now. In order for crypto to truly go mainstream robust solutions will be needed.
Layer-2 is one such solution trying to help ease congestion and keep traffic moving!