Blockchain: Layer One VS Layer Two
Layer 2 solutions are currently a hot topic in crypto as many look to them as a solution for congestion issues on Ethereum. However, not everyone fully understands just what this means and what the benefits are. In this article, we will discuss the difference between layer 1 and layer 2 solutions.
Layer 1
Layer 1 blockchains are the main blockchain architecture. Ethereum and Bitcoin are layer 1 blockchains, for example. The earlier blockchain projects like Ethereum and Bitcoin have a lack of scalability, being able to process only roughly 15 transactions per second and 7 transactions per second respectively, and high mining costs associated with them due to the nature of the Proof of Work (PoW) consensus mechanism. This has led to long transaction confirmation times and high transaction fees.
Layer 1 solutions
Layer 1 solutions refer to ways to improve these blockchains at their core level such as a more efficient consensus mechanism. A good example of this is what Ethereum is currently trying to do with Eth 2.0. Instead of the basic Proof of Work blockchain it operates now, Ethereum will move to a Proof of Stake blockchain that utilizes sharding technology as well.
Proof of Stake
Simply said, the current consensus protocol that Ethereum uses, Proof of Work, requires miners to use computing power to generate blocks. This has become a very costly process for miners which trickles down to transaction fees in order to make up for it. By changing the consensus mechanism to Proof of Stake, the computing power required to generate blocks is kept to a minimum, thus lowering the costs associated with the mechanism.
Sharding
Ethereum will use sharding in its upgraded blockchain. This will be done by creating new chains, referred to as shards. These will run parallel to the main chain of Ethereum which is known as the Beacon Chain. The Beacon Chain will handle things like the overall state of the network and contains all logic for keeping shards secure and synced up.
By utilizing sharding technology, Validators will only need to store and run data of the shards that they are validating. In the current version of Ethereum, they have to do this for the entire network, making the job more difficult. More shards can be added as usage of the network grows, therefore allowing for the handling of more transactions as well.
Other
There are other ways of making the layer 1 blockchain more efficient such as adjusting the block sizes or times.
Although it might seem simple to make some adjustments to the core blockchain and thereby solve issues like scalability, this takes much more time to execute properly than you think. Developers have been working on the Eth 2.0 upgrade for years. Thus far, they have only launched phase 0, with the final phase expected for later this year or perhaps even next year.
Layer 2 solutions
Layer 2 solutions are secondary frameworks built on top of an existing layer 1 blockchain. The layer 2 solution allows for transactions to happen without the layer 1 blockchain being involved. These are later settled on the layer 1 blockchain, effectively lowering the burden. There are different types of layer 2 solutions with different purposes, such as faster throughput, lower transaction fees, smart contracts implementation, and privacy features.
Sidechains
Sidechains are separate blockchains that run parallel to the layer 1 blockchains. These sidechains can have their own consensus mechanism and could have other customizable features. This is the case with the Skale Network, for example. So, they often rely on security provided by third parties.
Rollups
Rollups bundle transactions performed on side chains into a single transaction that is settled on the layer 1 blockchain. By doing so, potentially thousands of transactions can be handled as if they were just one. There are two versions:
Zero-knowledge rollups, or ZK-rollups
With Zero-knowledge rollups, or ZK-rollups, transactions are bundled off-chain and verified with the validity proof being submitted to the blockchain. Loopring uses this version of rollups.
Optimistic rollups
With optimistic rollups, a node sends a claim to the layer 1 blockchain with the other nodes being optimistic about its outcome, meaning that they do not vote on the block directly or perform computation to approve it. Instead, a challenge period is started where other nodes can state their disagreement with the node’s proposal. This is called executing a fraud-proof. While computational power is saved, confirmation times could last longer than with ZK-rollups due to the challenge period. Optimism uses optimistic rollups.
Channels
Channels allow two addresses to send transactions to each other multiple times before ultimately settling on the layer 1 network. This is done through depositing tokens in a multisig contract, a contract that requires the signature of multiple private keys to execute. This opens a channel when transactions happen freely off-chain. An example of such a solution is the Lightning Network for Bitcoin and Raiden for Ethereum. State Channels can be used for anything such as for a game. Payment Channels are strictly used for payments.
Other and hybrid
Besides focusing on scalability issues, layer 2 solutions can also solve other issues or add functionalities such as privacy features or smart contracts. RSK is a layer 2 solution which allows for smart contracts for Bitcoin.