The blockchain is like onions, they both have layers. Onions have layers. The blockchain also has layers.
Let’s peel back the blockchain layers one at a time!
What Is a Layer 1 Blockchain?
Layer 1 is the base blockchain; it can validate and finalize transactions using its own network. Examples of Layer 1 blockchain projects are Bitcoin, Ethereum, and Cardano.
Layer 1 blockchain networks have their own native token, also known as a coin, which is used to pay transaction fees.
Scaling With Layer 1
Layer 1 networks have issues with scaling. When the blockchain struggles to process the number of transactions the network is requiring, the transaction fees increase.
When addressing scaling, you’re faced with the Blockchain Trilemma, a term coined by Vitalik Buterin. This is where you’re trying to balance decentralization, security, and scalability. All scaling solutions will attempt to strike a balance between these three.
You could also fund a number of supernodes (by purchasing supercomputers, big servers, etc.) to secure and scale your network. But this would make your blockchain centralized.
There are three main approaches to improving a Layer 1’s scalability: block size, changing the consensus mechanism, and sharding.
Increase Block Size
If a Layer 1 network is struggling to handle the number of transactions required, you can increase the block size. This will allow more transactions to be processed in each block.
However, this only scales so far. Larger block sizes can also end up slowing transaction speeds due to the download required for the block data. This is why you can’t simply create an infinitely big block. Super-sized blocks would also reduce decentralization.
Consensus Mechanism Changes
Some consensus mechanisms are less scalable than others.
For example, the proof-of-work consensus mechanism is less sustainable and scalable than proof-of-stake. This is why Ethereum is slowly transitioning away from the former to the latter.
We’ve previously covered consensus mechanisms in more detail here.
Sharding
Put simply, Sharding is where a set of data is split into smaller, more easily managed shards. This is an easy way to help spread the load. Think about eating a cake, it’s much easier to eat it once it’s cut into slices and handed out to other people.
Sharding increases the transaction output by dividing the network into different shards. Due to the way the network is divided, each shard doesn’t hold all the information from the blockchain. Once a node is finished with its shard, it broadcasts it to the blockchain, where it’s then validated.
This helps spread the workload and, in turn, increases the transaction speed.
What Is Layer 2?
Layer 2 protocols are built on top of the Layer 1 blockchain to address Layer 1’s scalability issues.
This is done by creating a secondary framework, which doesn’t need the Layer 1 chain — also known as “off the chain”.
Two things that Layer 2 can improve are transaction speed (how long one transaction takes), and transaction throughput (how many transactions the network can process in a defined time period).
When the Layer 1 network becomes congested, Layer 2 can pick up the slack to improve transaction times and lower transaction fees.
How Does It Work?
There are a few ways that Layer 2 can solve Layer 1’s scalability issue.
Channels
Channels are a Layer 2 solution that allow users to transact multiple times off-chain before reporting it to the base layer.
There are two types of channels: state channels and payment channels. Payment channels are straight-forward; they allow payments to be dealt with off-chain. On the other hand, state channels are a bit broader; they allow any interactions that could happen on the blockchain to happen off-chain (for example, smart contracts).
An issue with this solution is that the users must be known to the network, meaning, open participation is not an option. These users will also have to lock up their tokens in a multisig…
Read More: web3.hashnode.com