If we playfully consider blockchain as the “it girl” of Web3, we’re curious to know — how does she do it all? The secret: layers.
Spanning two main types, layer 1 and layer 2, these interoperable networks work together to store, maintain and distribute information across digital decentralized databases that double as peer-to-peer, immutable public ledgers.
Here, we peel back each layer of a blockchain’s makeup for a closer look at their design, purpose and utility.
What Is a Layer 1 Blockchain?
Layer 1 refers to the base infrastructure of a blockchain. Nicknamed “the mainnet,” layer 1 protocols have distinct functionalities such as the ability to process and finalize transactions on their own chain. As the main network within their ecosystem, they define the rules.
What Is Layer 1 in Blockchain?
Layer 1 is the fundamental base network of a blockchain platform. It executes all on-chain transactions and acts as a public ledger’s source of truth.
Most networks process transactions by logging a user’s cryptocurrency wallet via asymmetric key pairs and its corresponding coin or token balances. The deal passes through a consensus mechanism — which is distinct to each platform — to verify and finalize the trade or sale. Additionally, layer 1 blockchains host their own native token, which is used to cover transaction costs or gas fees.
Determining which consensus mechanism is fit for a platform comes down to a trade-off between three main features: security, scalability and decentralization. This compromise is commonly referred to as “the blockchain trilemma,” a concept originally identified by Ethereum co-founder Vitalik Buterin. Whatever isn’t fully covered by layer 1 protocols — typically scalability — can be compensated for in the layer 2 protocol built on top of it (more on that later), serving as an extension to the mainnet’s functionality.
Layer 1 Blockchain Examples
The following list is composed of top layer 1 blockchain networks that power the majority of decentralized applications, or dApps.
Bitcoin
Bitcoin’s layer 1 is the underlying architecture that secures the world’s largest cryptocurrency, with a live market cap of $1.67 trillion. It operates on a proof-of-work consensus mechanism, which verifies new blocks via an algorithm that uses a computationally intensive, cryptographic puzzle. Bitcoin is widely considered to be the most secure, decentralized platform — but processing one transaction can take up to an hour.
Ethereum
Ethereum — the second largest layer 1 network in Web3 — introduced smart contracts, giving it a dynamism beyond simply a cryptocurrency mine and payment platform. Smart contracts are self-executing programs that verify transactions as long as all pre-set conditions are met. Ethereum used a proof-of-work consensus mechanism before transitioning to a proof-of-stake verification method, reducing the platform’s energy consumption by about 99.95 percent. The convergence of the mainnet and the proof-of-stake sidechain is known as the Merge.
Algorand
An alternative layer 1 blockchain option, Algorand operates using smart contracts. It distinguishes itself from the two main players, Bitcoin and Ethereum, by its use of a pure proof-of-stake consensus mechanism. This method selects miners, or block validators, at random to directly decentralize the verification process.
Cardano
One of the first layer 1 blockchains to successfully implement a proof-of-stake model, Cardano is known for its cheap gas fees, high degree of decentralization and ability to generate passive income of its native coin, ADA, for its users. It overwhelmingly outperforms Ethereum’s transaction speed, validating more than 1,000 transactions per second to Ethereum’s 15.
What Is Layer 2 in Blockchain?
Layer 2 consists of any overlaying network built on top of the mainnet — the layer 1 foundation supporting a blockchain. Typically, layer 2 protocols are optimized for reducing network congestion, lightening the load and increasing throughput of the mainnet. They were created to prevent overdependence or collapse of layer 1. As consensus mechanisms are the defining characteristic to layer 1, so are scaling solutions to layer 2.
While layer 1 chains are the primary security provider within the context of decentralization, layer 2 chains have their own security, but to a far lesser degree, explained software engineer Arie Trouw, who holds over a decade of experience in the blockchain space and is the co-founder of XY Oracle Network, a blockchain protocol.
“Layer 2 solutions provide enough security for dApp usage as an alternative to layer 1. They support some or all of the dApp’s functionalities, mimicking the mainnet,” Trouw said. “This allows for bridging between the two layers.”
Layer 2 systems are often confused with sidechains, according to Trouw, but they admittedly function in a similar capacity. Sidechains wholly rely on the security of whatever chain they are connected to, whether it be at a layer 1 or layer 2 capacity, he said.
Layer 2 protocols can be thought of as secondary frameworks designed to optimize a blockchain’s core functionality with a specific use case in mind.
“Improving scale at each level is important,” said Trouw, optimistic about the post-Merge landscape. “Ethereum 2.0 upgrades are a huge gain for blockchain overall, but the continued use and development of layer 2 solutions is imperative.”
Types of Layer 2 Scaling Solutions
Below are the main types of scaling solutions used by layer 2:
- State channels: These apply a two-way channel of communication, allowing participants to conduct an arbitrary amount of off-chain transactions while only needing to submit two transactions to the mainnet to open and close the channel. State channels eliminate the need for miners and keep communication between layer 1 and layer 2 to a minimum.
- Nested blockchains: In nested blockchains, layer 1 and layer 2 work co-dependently in distinguished roles, with layer 2 executing transactions while layer 1 issues and verifies them.
- Rollups: The most common layer 2 scalability solutions, rollups run multiple transactions on separate, independent chains in batches and then store them on the mainnet.
- Sidechains: Sidechains are interoperable channels with their own consensus mechanism that run independent of main chains and are connected by a two-way bridge. This means that sidechains rely on a trusted set of parties to authenticate each user’s participation.
Layer 2 Blockchain Examples
Below are some examples of layer 2 scaling solutions ancillary to Web3’s most ambitious projects.
Lightning Network
Used to support Bitcoin’s main network, Lightning Network helps facilitate speedy transactions during heavy traffic — which can take hours — on separate chains independent of the mainnet, reporting the final balance on layer 1 at a calmer time.
Polygon
An assist to the Ethereum blockchain, Polygon runs a proof-of-stake blockchain concurrently alongside the base layer via multiple sidechains, known as commit chains, to increase network scalability and overall transaction speed. Commit chains operate adjacent to the layer 1 blockchain, bundling together batches of transactions to be confirmed en masse before immutably logged into the main chain.
Starknet
With Ethereum as its base, Starknet is a decentralized, permissionless, censorship-resistant, zero-knowledge rollup. Its speed and scalability are made possible by batching transactions and verifying them together rather than individually, periodically uploading them to the main network’s blockchain. In contrast to Polygon’s open-source layer 2 solution, Starknet is a closed-source project.
Differences Between Layers 1 and 2 in Blockchain
Having covered the basics of how layer 1 and layer 2 work, here are a few major distinctions between the two.
Layer 2 Supports More Efficient Storage and Transactions
Since decentralization and security are the modus operandi of layer 1 protocols, layer 2 networks can concentrate their resources on providing utility and optimized scalability to a blockchain.
Witek Radomski, co-founder of Enjin, a pre-Bitcoin platform that launched a suite of NFT-oriented products, offered his insight on the differentiation.
“Layer 1 blockchains contain a permanent ledger of all transactions,” Radomski said. “A node in a layer 1 network will contain all of the history of the blockchain, whereas a layer 2 chain is a compressed version with only some of the transaction history. Layer 2 protocols are usually optimized for reducing load on the mainnet for common transactions.”
Layer 2 Provides Greater Scalability
Enjin began as a community gaming platform, then pivoted to a blockchain-tech focus in 2017. In development, Radomski’s team approached scalability by first establishing their platform’s key purpose — making NFTs easy to use — then fitted a layer 1 protocol customized with only the necessary code to fulfill that objective.
“As a result, the protocol is super light,” he said. “On top of an optimized layer 1 protocol, we also conduct bulk batch operations instead of minting NFTs one-by-one. This allows us to produce at large scale with relatively light storage capacity. Together, strong infrastructure and efficient operation systems support scalability in the ecosystem.”
Layer 1 Serves More Essential Functions for Blockchains
In terms of features, layer 1 solutions typically consist of a network of nodes and block-producing miners, storage of all transaction data and a consensus mechanism, whereas their layer 2 counterparts can take on many shapes, but often feature complementary chains that implement some sort of scaling solution, as mentioned.
Every blockchain requires a layer 1 mainnet. Layer 2 protocols are considered non-essential, but welcome, to operate most blockchain-based systems.
One Step Below: What Is a Layer 0 Blockchain?
Developed retroactively, layer 0 blockchains run beneath a mainnet to enable interoperability across multiple layer 1 protocols. Highly versatile, layer 0 is an underlying scaling solution that, while compatible with layer 1 and layer 2, does not change a blockchain’s structure. The core standards ruling a blockchain’s ecosystem set in layer 1 are respected.
The Blockchain Trilemma
If layer 1 is the only essential layer, why complicate things further? What is the purpose of kitting out a blockchain with layers at all? The answer to this goes back to the aforementioned triad, a kind of holy grail in the blockchain universe, between security, scalability and decentralization.
“It’s often said that you can have any two, but not all three,” said Vaclav Vincalek, Chief Technology Officer at his consulting firm 555vCTO and writer of weekly tech newsletter, Recurrent Patterns. “For example, Bitcoin and Ethereum are both secure and decentralized because they use proof of work, but neither is scalable. [Open-source platform] EOSIO, on the other hand, is scalable due to its delegated proof-of-stake consensus mechanism, but not as secure or decentralized as either Bitcoin or Ethereum.”
Addressing the Blockchain Trilemma With Sharding
Vincalek’s preferred approach to the blockchain trilemma is sharding. Simply put, sharding is a way of splitting a blockchain network into multiple, smaller networks, or shards, to delegate computational and storage workloads.
“Sharding allows for a more efficient and scalable way of processing transactions,” he said. “This can help to improve transaction speed and reduce congestion on the network.”
Nischal Shetty, co-founder of Shardeum, an Ethereum-based layer 1 network that uses dynamic sharding to achieve linear scalability, shares a similar approach. In this version of the database partitioning technique, each node holds a different address range with a significant overlap between the address sets assigned to their respective nodes. But what sets Shardeum apart is its ability to combine a number of transactions to be processed as one and deliver fast finality while sharding, Shetty said, ensuring that each node added to the network immediately helps increase the transaction rate per second.
“Although no one has been able to definitively solve the blockchain trilemma, which is one of the main obstacles to widespread crypto adoption,” Shetty said, “I believe that [dynamic sharding] will help us achieve scalability and decentralization without compromising on security.”
Removing Consensus Mechanisms Entirely
Another option is to remove the need for consensus from blockchains altogether.
XY Oracle Network co-founder Trouw believes that variations of the encrypted, code-based communication techniques used to secure blockchains, known as cryptography, will eventually settle the debate. He sees self-verifying cryptography, such as zero knowledge proofs, as “the only way to solve the trilemma.” His platform performs many of the decentralized functions currently executed on other layer 1 and layer 2 systems without consensus, using cryptography in its place.
There is one impasse yet to be ironed out, however. Known as the double-spend problem, Trouw said that the duplication of digital tokens, when crypto is mistakenly or fraudulently spent more than once, can only be prevented through a consensus mechanism at this time.
“So removing [the consensus mechanism] is not yet possible,” Trouw said. Still, he is convinced that it’s a matter of when, not if. “Accomplishing security through cryptography instead of consensus is the fusion energy that will give crypto unlimited scale.”
Frequently Asked Questions
What is layer 1 blockchain?
Layer 1 is the foundational layer of a blockchain network, upon which all other protocols and applications are built. This layer is responsible for processing and storing all on-chain transactions, acting as a network’s source of truth.
What is layer 1 vs. layer 2 vs. layer 3 blockchain?
Layer 1 is a blockchain’s base layer that handles all on-chain transactions. Layer 2 is built on top of layer 1 to process off-chain transactions, enhancing a blockchain’s scalability. Layer 3 is then built on layer 2 to further improve scalability, supporting specialized decentralized applications and communication between blockchains.
How many layers in blockchain are there?
There are five layers in blockchain, starting with layer 0 and ending with layer 4. These layers begin with the basic infrastructure of blockchain and build up to more specialized protocols and applications.