Layer 2 networks are protocols that build on top of existing blockchains and are blockchain networks relative to the underlying Layer 1. Layer 2 networks are able to improve the performance and output of blockchains without compromising the security of their main chains. As the number of users and transactions on Layer 1 blockchains such as Bitcoin and Ethereum continue to grow, there is a need for higher throughput performance of the blockchain while maintaining the premise that the blockchain operates with re-security and decentralization features. As a result, Layer 2 solutions have been created.
Blockchain Trilemma
Blockchain Trilemma refers to the inability of blockchains to simultaneously combine scalability, security and decentralization, a concept first proposed by Vitalik Buterin, the founder of Ether. As cryptocurrencies have spread and become popular, the number of active users and transactions on various blockchain networks has increased. It has become a necessity to speed up transaction processing and meet the product.
As mentioned in the previous course, although the Bitcoin and Ether networks already have a certain user base and technical development, they are still dwarfed by the speed of payment processing compared to transactions like Visa, Mastercard, etc. For example, Ether can only process about 30 transactions per second, which is far from enough to meet the millions of transactions that occur every day, so there is an urgent need for a speed-up solution that does not compromise security and decentralization.
What is Layer 2 and How It Works
Layer 2 is a protocol built on top of the block base layer (Layer 1) to improve the performance of the blockchain and accelerate processing power. The goal of Layer 2 scaling is to reduce the burden on the base layer blockchain, thereby increasing processing speed. Layer 1 is relieved of its workload by transferring transactions from Layer 1 to Layer 2 for processing, and the results of these completed transactions are sent back to the base layer for permanent recording. And through the direct interaction between Layer 1 and Layer 2, scalability is achieved without compromising security.
Layer 2 is called an off-chain solution. Arbitrum and Optimism are Layer 2 extensions to the Ethereum, capable of processing Ethereum transactions and sending transaction data results back to the main Ethereum chain. Compared with Layer 1, Layer 2 is cheaper and faster to process transactions. For example, the block time of Arbitrum is about 2 to 6 seconds, while on Ether it is about 10 seconds; the transaction fee of Arbitrum ranges from $0.0005 to $0.2, while the Gas fee on Ether is $1 to $3 and may reach $10 or more when the network is congested.
Types of Layer 2 Solutions
Sidechain
A sidechain is a blockchain that runs with the main blockchain, but is a separate blockchain that reduces the workload of the main chain by using sidechain resources. Sidechains combine information from the underlying chain with their Virtual Machine to execute smart contracts and validate transactions, and finally send the results back to the main chain. Sidechains are independent of the main chain and have their own validators, providing cheaper and faster transactions. The most typical example of a sidechain is the early Polygon, where transactions on Polygon are faster and cheaper than on the main chain, Ethereum.
State Channel
A state channel is a linking channel between two counterparties. This channel allows users to lock up their funds and then transact on a faster, cheaper off-chain network before sending the results of the transaction to the main chain. One example of this is the Bitcoin Lightning Network. When you use the Lightning Network, your BTC is locked in advance by another person connected to the main blockchain during a transaction, and then a faster normal transaction can be made through the status channel, with the final transaction result being forwarded to the Bitcoin main chain. The Lightning Network has been used to extend the Bitcoin blockchain to avoid high transaction costs.
Rollup
Rollup can combine a lot of fragmented transaction data into a single transaction data and push it to the main blockchain, thus saving a lot of space for the main chain and making transactions faster and cheaper. There are two types of Rollup: Zero Knowledge and Optimistic.
Zero Knowledge Rollups, or zkRollups, perform calculations off-chain and submit the results to the main chain, which are called Validity Proofs. Validity proof means that the transactions to be submitted have been checked and can be safely submitted to the underlying blockchain and recorded. Zero-Knowledge Rollup is a Proof of Work (PoW) performed off-chain, which reduces the workload on the main blockchain, so transactions are processed faster.
In contrast, Optimistic Rollup defaults all transactions to be valid and pushes them to the main chain. Fraud is only checked when the system encounters it, and if fraudulent transactions are detected, they are revoked and the verifier of the block is penalized. Compared to ZK Rollup, Optimistic Rollup is relatively slower to process, but more secure and decentralized for blockchain.
Ethereum Layer 2 Solution
Since Ethereum was the first blockchain network to support smart contracts, there are a large number of applications on the Ethereum blockchain. And as the number of users grows and the volume of transactions increases, the main Ethereum network becomes more and more congested, causing transaction fees to rise and processing speed to slow down. As a result, Ethereum is in dire need of scaling solutions. A number of Layer 2 solutions have already been put into practical applications, including but not limited to Arbitrum One, Optimsim, StarkNet, zkSync, etc.
Disclaimer
-
Crypto investment involves significant risks. Please proceed with caution. The course shall not be considered investment or financial advice.