What is the Difference Between Layer 1 vs Layer 2? Blockchain Layers Explained

What is the Difference Between Layer 1 vs Layer 2? Blockchain Layers Explained

Ryan S. Gladwin's photo
Ryan S. Gladwin
·Jun 9, 2022·

7 min read

Play this article

Table of contents

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!

Shrek Onions Have Layers

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.

SNL Off The Chain

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 contract.

Simpsons Change the Channel

Plasma

Created by Joseph Poon and Vitalik Buterin, Plasma utilizes smart contracts and numerical trees to create "child chains", which are copies of the original blockchain — also known as the "parent chain".

This framework pushes transactions away from the original chain onto the child chain, in order to improve transaction speed and lower transaction fees.

However, the plasma solution cannot be used to help scale general-purpose smart contracts. Also, users have to wait a period of time before being able to pull their money from Layer 2.

Sidechains

Sidechains have their own independent blockchains that use their own consensus mechanisms and block requirements. They can connect to Layer 1 by using the same virtual machine. This means that all contracts and transactions that can be used on Layer 1 can also be used on sidechains.

Rollups

The rollup solution groups together (or rolls up) sidechain transactions into a single transaction to generate cryptographic proofs called a SNARK (succinct non-interactive argument of knowledge). Once the SNARK has been generated, it’s broadcasted to the base layer.

There are two types of rollups: ZK rollups and optimistic rollups.

Optimistic rollups utilize a virtual machine which makes it easy to migrate from Layer 1 to Layer 2.

ZK rollups are faster and more efficient, but don't use a virtual machine because it makes it harder to move between layers.

Modern Problems Solutions

What Are Layer 0 Protocols?

Layer 0 protocols allow cross-chain interoperability between Layer 1 projects. This is a major issue with Layer 1; once you're in the ecosystem, it's quite hard to move to another — Layer 0 fixes that.

Not all blockchains built on the same Layer 0 will have the same design. They can use different consensus mechanisms, block parameters, etc.

Often, Layer 0 tokens act as an anti-spam filter, requiring you to stake the Layer 0's token to access their ecosystem.

Layer 0 Example

Cosmos is the most well-known example of a Layer 0 protocol.

They provide open-source tools such as Tendermint, Cosmos SDK, and IBC to help developers easily create their own blockchains that can communicate with each other. Their aim is to create the "Internet of Blockchain".

Projects like Binance, Crypto.com, and Polygon were created using Cosmos.

Does Layer 3 Exist?

Yes!

Layer 3 is the protocol(s) that enables blockchain-based applications like dApps, games, storage, etc. Layer 3 is often referred to as the “application layer”.

The “application layer” provides information to Layer 1 for it to process (e.g. smart contracts). Without applications, Layer 1 protocols would be fairly boring. Layer 3 is what gives the base blockchain function outside of just transactions.

Most Layer 1 blockchains allow you to easily build Layer 3 projects directly onto their network, but this isn't possible with Bitcoin. Some forks of Bitcoin are trying to bring dApps to the network, but we're yet to see a true Layer 3 project on the base Bitcoin network.

Bitcoin might be missing out, as blockchains like Ethereum, Solana, and Cardano have flourishing Layer 3 ecosystems that enrich their blockchain.

Often, these projects have cross-chain functionality, such as Uniswap, which allows users to trade assets across different blockchains.

It may be important to note that each blockchain uses a different programming language. This means that Layer 3 applications that provide cross-chain functionalities must be multilingual. For example, translating from Solidity for Ethereum to Haskell for Cardano.

Layer 3 gives the layers below real-world applications outside of just transactions. Now, you can create NFTs, swap your tokens, play games, and so much more. The application layer unlocks the blockchain's full potential.

The Rock Sees Potential

Does Layer 4 Exist?

No. The layers we've discussed are often referred to as the four layers of blockchain, but this is because we start counting from 0 in the programming world.

Conclusion

The blockchain has a lot of layers and they're all fairly important. Let's quickly recap them all:

  • Layer 1: The base blockchain network. They validate and finalize transactions but have issues with scaling (e.g. Bitcoin).

  • Layer 2: A scaling solution to Layer 1 protocols. It creates a secondary framework which is used for transactions "off chain" (e.g. Bitcoin Lightning Network).

  • Layer 3: Enables blockchain-based dApps, games, and more. Also known as the application layer (e.g. Uniswap).

  • Layer 0: Enables cross-chain interoperability between Layer 1 protocols (e.g. Cosmos).


This article is a part of the Hashnode Web3 blog, where a team of curated writers are bringing out new resources to help you discover the universe of web3. Check us out for more on NFTs, DAOs, blockchains, and the decentralized future.

 
Share this