DEV Community

Waylon Jepsen
Waylon Jepsen

Posted on • Updated on

Layer 1 vs. Layer 2

If you are learning about web3, the chances are that you have heard different projects referred to as being a layer-one project or a layer-two project. Hearing these terms without any prior knowledge or context can be confusing. In this post, I'll explain the differences between layer one and layer two networks and provide examples of both.

Disclaimer: This is just a brief overview of the mentioned topics and is in no way a complete piece of work on the topic.

Layer 1

A layer one network is a network that acts as infrastructure for other projects to build on top of. A public decentralized layer one network's primary characteristic is its consensus mechanism. Different consensus mechanisms provide different levels of speed, security, and throughput. Some examples of layer one networks and their consensus mechanisms are given below. Two common categories of consensus mechanisms are proof of work (PoW) and proof of stake (PoS). Note that these are just two categories and that there are many unique PoS consensus mechanisms.

Bitcoin - Consensus: Proof of work, Native Token: BTC
Ethereum - Consensus: Proof of work (moving to proof of stake in Eth2), Native Token: Eth
Algorand - Consensus: Proof of Stake, Native Token: Alg
Hedera - Consensus: Proof of Stake, Native Token: hbar
Cardano - Consensus: Proof of Stake, Native Token: Ada

Qualities of Layer one networks

All layer one networks have a native token that serves as network fuel within the network. You use a network's native token to pay for network services like transactions, file services, and smart contract services. Note that not all layer one networks support the same array of services, although all support transactions. When comparing layer one networks, it is essential to learn about its consensus mechanism and the pros and or con's that it provides the network.

Layer Two

Layer 2 networks extend the functionality of their layer 1 counterpart. This can be to increase the layer 1 network’s performance, reduce transaction fees, or increase programmability. For example, on Ethereum, where gas fees can be highly variable and transaction times slow, it is increasingly common for application developers to provide its user the ability to interact with a layer 2 network, like Polygon, to decrease their user’s fees and transaction latency.

Qualities of Layer Two Networks

Similar to how Layer 1 networks have different approaches to consensus, each layer 2 network will implement a scaling solution, or means to map transactions back to its layer 1. For instance, a commonly discussed layer 2 scaling solution is the implementation of zero-knowledge rollups. The idea is that a side-chain performs transaction ordering and processing and submits mathematical proof that they have processed the transactions fairly. Some examples of layer two scaling solutions are the Lightning Network, Polygon, and Starknet. The majority of scaling layer two solutions depend on cryptographic systems. For resources on the cryptography behind zero knowledge proofs I recommend this resource. The watered down version of what is happening, is that a mathematical proof is created by a verifier that some knowledge is correct.

Lightning Network - 2-party multi-signature channels
Starknet - Zero Knowledge Rollups
Polygon - Side Chains and Optimistic Rollups (coming soon)

Note that only layer one 1 with scaling limitations needs scaling solutions. Networks like Algorand and Hedera with high native speeds for scale don't need to scale with layer-2s because they scale at the network layer.

Top comments (3)

Collapse
 
protonmotivated profile image
Katie

Beautifully explained. Thank you!

Collapse
 
0xjepsen profile image
Waylon Jepsen

Thank you for reading!

Collapse
 
suhailkakar profile image
Suhail Kakar

Great explanations, Waylon!

Thanks for sharing :)