What Is Layer 1 vs Layer 2 in Blockchain?
If you are a crypto investor, while you are reading a crypto whitepaper, you may see the phrase "Layer 1" or "Layer 2". You may confuse about the meaning of these two phrases and what's the relation with blockchain. Actually, Layer 1 and Layer 2 are the solutions to the scalability of blockchain, this article will explain these two concepts and their Scaling Solutions.
What Is a Layer 1 Blockchain?
"Layer-1" in crypto refers to the basic main blockchain architecture. This is the main structure of one blockchain network. For example, the Bitcoin, Ethereum, and Litecoin Chain are Layer 1 Blockchain. They are the underlying architectures.
What Is a Layer 2 Blockchain?
Layer 2 Blockchain means the network that was built on top of other underlying blockchains. It is built by a third party and co-operation with Layer 1 that can boost the number of nodes, and upgrade the throughput.
What Is the Difference Between Layer 1 and Layer 2?
Take the most classic example, Bitcoin and the Lightning Network, Bitcoin is the layer-1 network, while the lightning network is the layer-2 network because it works on top of Bitcoin. This is the main difference between Layer 1 and Layer 2. However, we are more concerned about the scalability of blockchain, so we have to mention the Layer 1 solution and Layer 2 solution. They are the ways to improve network scalability. The Layer 1 solution tries to directly modify the original blockchain network while the Layer 2 solution deploys another parallel network to facilitate the transactions and no need to mess with the original one.
What Is the Problem of Layer 1?
For Layer 1 Blockchain, the obvious problems are confirmation times and high transaction fees. Take Bitcoin, for example, all transactions should be verified by multiple nodes, and the nodes compete to calculate a complex mathematical puzzle in order to get rewards. It is an effective way to verify data of the blockchain and kick out the bad actors. However, if more and more users start to use the network, the throughput demand will become a serious problem. The confirmation time will get slow and the gas fee will increase.
How's the Layer 1 Scaling Solution Work?
In order to increase the throughput, there are several Layer 1 solutions. The basic rule of Layer 1 solutions is to improve the base protocol itself to make the overall system more scalable. The common Layer 1 solutions are:
- Switch consensus protocol
- Change block size
Projects such as Ethereum are switching the consensus protocol from PoW(Proof of Work) to POS(Proof of Stake) or other kinds of consensus protocol. Proof of Stake will increase the transactions per second (TPS) significantly, compare to Proof of Work. Another way is to increase the block size, for example, increasing Bitcoin's block size to 8MB. In recent years, sharding is also adopted by more and more projects. Sharding will divide transaction sets into small data sets called "shards" that can be parallelly processed by the network, different from the original network that handles every transaction sequentially. In a word, Layer-1 scaling solutions improve scalability by supplementing the blockchain protocol's base layer, and the developers will need to hard fork or soft fork the network.
How's the Layer 2 Scaling Solution Work?
Different from the Layer 1 solution, the Layer 2 solution transfers the Layer 1 transactions pressure to another network layer that is independent from the main chain. The layer 2 solutions include:
- State channels. A state channel is a two-way communication channel between participants of transacting parties. Through a smart contract or a multi-signature, the parties connected to an off-chain channel instead of the underlying blockchain. So the participants can directly interact with each other without submitting anything to the miners. Once the entire transaction set is over, the final state of the channel is added to the blockchain. This solution will improve transaction speed and the capacity of the network. Bitcoin’s The Lightning Network of Bitcoin and Raiden Network of Ethereum are the two most common state channel solutions.
- Nested blockchains. The well-known application is OMG Network's Plasma project. There are several multiple levels of blockchains sitting on top of the main chain called Nested blockchains. These blockchains connect with each other and form a parent-child chain connection. The parent chain delegates work to its child chains. Then the child chains execute these actions and send the result back to the parent chain. As for the main chain, it doesn't participate in any executing transactions and is only limited to dispute resolution. In this case, this solution will reduce the workload and increase the scalability of the main chain significantly.
- Rollups. Rollups are one of the Layer 2 Scaling solutions. There are two main types of rollups: optimistic rollups and zero-knowledge rollups. Optimistic rollups assume all the data is valid and nobody hides spurious transactions. It allows people to contest bunk trades to protect against fraudulent transactions. Optimistic rollups don't compute the transaction, so there needs to be a mechanism to ensure transactions are legitimate and not fraudulent. This is where fraud proofs come in. If someone notices a fraudulent transaction, the rollup will execute a fraud-proof and run the transaction's computation, using the available state data. Participants get penalized for conducting fraud and reimbursed for proving fraud. The applications are Arbitrum One, Optimism, and Boba Network. Zero-knowledge rollups work differently, they bundle off-chain Layer 2 transactions and submit them as one transaction on the main chain. The zero-knowledge proof allows someone to mathematically prove that a statement is true without disclosing additional information about that statement. It can be used to check the integrity of transactions and keep the original network security. The Zero-knowledge rollups examples are Loopring, Immutable X, and ZKSync.
- Sidechains. It was an interoperability solution to enable two blockchains to verify information about each other's progress via lightweight proofs.
What Is the Common Problem of Layer 1 and Layer 2 Solutions?
Both Layer 1 and Layer 2 solutions have their own pros and cons. For Layer 1 solutions, there is no need to add any architecture on top of the main chain. However, the developer or community should convince the validators to accept the hard fork. Layer 2 solutions are easier to achieve, but the cons are obvious, in a way, it may lose the security when compared to the original blockchain. Scalability trilemma was mentioned by Vitalik Buterin. It means that a blockchain project how to optimize the architecture of balancing decentralization, security, and scalability. Some projects, such as Bitcoin, have optimized security and decentralization, however, they compromise on scalability. In a word, no matter whether using Layer 1 Solutions or Layer 2 Solutions, they are unable to solve the scalability trilemma perfectly, the balance between three of the following properties, decentralization, security, and scalability.
What Are the Solutions after Layer 1 and Layer 2?
The perfect solutions after Layer 1 and Layer 2 should figure out the scalability trilemma. Some of the projects are trying toward this mission. There are a lot of projects that try to based on Layer 1 ( as a security layer) and build a Layer 2 for use cases (application layer). Some are building a new blockchain with a new consensus protocol that is more scalable and also figuring out the decentralization and security issues. Still, it is a long way to run since keeping cryptocurrencies fast enough for transactions safely and decentralized is not an easy thing. Another thing is that building a large user and developer community is also a hardship.