What are layer two blockchains?
In this article, we take a closer look at layer two blockchains, and how they can increase blockchain efficiency, reduce load as well as gas fees.
Written by Efe Bravo
Layer two blockchains are protocols built on layer one blockchains to improve their functionality. Layer two protocols allow blockchain transactions to be done away from the main blockchain. Thus, transactions can be faster and cheaper with layer two protocols without changing anything on the base blockchain.
More layer two protocols have been built for the Bitcoin and Ethereum networks than any other network. The Bitcoin lightning network, the Liquid Network, and the Omni layer are examples of layer two protocols for Bitcoin. For Ethereum, Polygon is a layer two protocol built to improve the speed of transactions on the blockchain.
Why Layer Two Blockchains?
In the early days of blockchain, only a few blockchain networks like the Bitcoin and Ethereum networks existed. These layer one blockchains were enough to support blockchain users conveniently. However, with the increasing adoption of blockchain and cryptocurrencies today, there is a need for faster blockchain transactions.
Layer one and layer two scaling solutions are the way to achieve that. Notably, layer one scaling can be complex. It requires a lot of planning and careful implementation, and the scaling of Ethereum, which has been ongoing for years, is proof of this.
Layer two blockchains and scaling solutions are quicker solutions to improve a blockchain’s efficiency. It does not require any change to the base blockchain (layer one blockchain). This article will focus on layer two scaling solutions. You can read about layer one blockchains and their scaling solutions if you want to learn more about them here.
Layer Two Scaling Solutions
Layer two scaling solutions are off-chain solutions implemented to reduce the load on the main blockchain. There are several layer two scaling solutions. Each of these has its strengths and its weaknesses. State channels, side chains, plasma chains, and rollups are layer two scaling solutions. What exactly are these, and what are the pros and cons of implementing these scaling solutions?
State channels require users to lock up funds on the network to enable them to carry out several transactions off-chain. They are primarily used for bi-directional payments between two parties. When implemented, users can deposit and withdraw at the speed of light.
To make state channels more practical, imagine you use the supermarket to buy groceries every day while coming back from work. Sadly, after picking the items you need, you always need to join the long queue to make payments before leaving, which takes a lot of time.
To make your daily shopping more straightforward, you strike a deal with the supermarket owner. You deposit a fixed sum, perhaps $10,000, telling him to deduct the price of whatever you buy each day from the $10,000. This way, you don’t need to queue each evening to make payments. You simply pick what you need, and the amount gets deducted from your fixed deposit. You may decide to get your change or roll it over to the next month at the end of the month.
That’s how state channels work, but with a smart contract. Users lock up some amount of funds and transact multiple times off-chain. An on-chain transaction is only submitted at the start and end of the interaction. This makes transactions faster. Although state channels keep transaction costs low, they do not support open participation. Also, state channels may not be the best scaling solution for transactions that will be carried out occasionally.
As the name implies, side chains are chains that run alongside the main blockchain. They are also called sister chains. A new blockchain will need to be developed to create a side chain. The new blockchain may run on a different consensus model from the main chain and rely on its security. After that, a smart contract can be developed to enable interaction between the main chain and the side chain.
A typical example of sidechain implementation is in the Polygon network. Polygon is a layer two blockchain designed to scale the Ethereum blockchain. The Polygon chain communicates with the Ethereum chain without necessarily relying on the security of Ethereum. Also, assets can be moved from the Polygon chain to the Ethereum chain and vice versa.
Side chains are the most independent of all the layer two scaling solutions. The side chain can create new blocks. This can also be a disadvantage because the sidechain can stop producing new blocks, and operators can restrict users from making withdrawals. Thus, users' funds are not 100% secure when using sidechains.
Plasma is a layer two scaling solution built with smart contracts with Merkle trees. The combination of smart contracts and Merkle trees makes it possible to create smaller chains. These smaller chains are called plasma chains or child chains. Although the child chains are separate chains, they are anchored to the primary chain and rely on the security of the primary chain.
The Polygon network utilizes plasma chains too. The implementation of Plasma chains implies that smaller copies of the Ethereum blockchain are created. Transactions are then offloaded from the main chain to these children chains, making transactions faster. There is no limit to the number of plasma chains that can be created.
Since plasma chains rely on the security of the layer one blockchain, they are more secure to use than side chains. Additionally, plasma chains have a block root feature that users can call on if the protocol is attacked. This feature allows users to safely transfer their funds back to the mainnet when appropriate proofs are provided.
While plasma chains are more secure than side chains, they do not support general computation. Users can only perform simple tasks like swapping and transferring tokens. Although plasma implementation reduces network congestion, users can still experience network congestion when multiple users try to leave the plasma chains simultaneously.
These are scaling solutions implemented by rolling up and compressing multiple blockchain transactions in a single block. State channels, side chains, and plasma chains all require data and transactions to be moved and processed off-chain. This makes them relatively less secure. Unlike these, rollups do not carry all the data off-chain.
Rollups ensure that transactions are processed off-chain, but some data related to the transactions remain on-chain in case of validation. This makes it possible for rollups to scale the network while ensuring peak security for network users. With the implementation of rollups, blockchain experts estimate the throughput on the Ethereum network to scale as high as 10,000 TPS.
There are two main kinds of rollups. The Optimistic rollup and the ZK-Rollup. Optimistic rollups are simpler to implement and give a better user experience than ZK-rollups. On the other hand, ZK-rollups are more complex to implement but are more scalable than optimistic rollups. Some DeFi protocols are already implementing rollups in their architecture. Chainlink, Uniswap, and Synthetix utilize optimistic rollup while Curve, 1inch, and Aave protocol use ZK-rollup.
Although all layer two scaling solutions have their pros and cons, rollups seem to be the most balanced scaling solution to implement.
The Future of Layer Scaling Solutions
It’s no longer a secret that Ethereum is upgrading its blockchain. Notably, many layer two scaling solutions have been built for the Ethereum network. Blockchain users may be wondering if these scaling solutions will be needed when the layer one blockchain is finally improved.
Interestingly, layer two protocols will not be dead even when Ethereum’s mainnet has been enhanced. Layer two protocols and scaling solutions can still work with a fully upgraded Ethereum. The blockchain ecosystem has enough room for growth. Rather than layer one scaling being the only option, a combination of layer one and layer two scaling solutions will be needed to sustain the increasing number of blockchain users in the coming years.
This article is written by Efe Bravo as a part of enter.blog's bounty program. Do you have an interesting topic, series or subject you think would be fitting for enter.blog?
You can now submit your articles to enter.blog and get paid for your contributions!
Read more and submit your article here.
Crypto & Learning
Hungry for knowledge? Here you can get acquainted with blockchain, wallet security, DeFi and much more.
PUBLISHED 13TH MAY 2022
What Are Layer One Blockchains?
Layer one blockchains are like the foundation of a building. They are the base on which layer two blockchains are built. In this guest article, we’re getting to the core of what layer one blockchains are, and how scaling them is essential for NFTs.