What Are Layer 1 and Layer 2 Blockchain Networks?
A Guide to the Blockchain Trilemma and Scalability
By: Rahul Nambiampurath •DeFi Tutorials
As the smart contract wars heat up, Layer 1 vs. Layer 2 blockchains are differentiating.
From Proof-of-Work to Proof-of-Stake blockchains, each has its own way to scale to accommodate transaction volume.
All computer networks rely on bandwidth to relay data, including blockchain networks. However, the latter are more susceptible to a bandwidth scaling problem than highly centralized networks:
What Is the Blockchain Scalability Problem?
- Blockchain networks are decentralized, composed of nodes (computers in a network holding the entire ledger). This means that each node has to exert considerable computing, bandwidth, and storage resources to provide and maintain access to the ledger.
- The more decentralized a blockchain is, the more nodes it will have. While this redundancy is great for the network’s security, it is not good for its speed. That’s because more nodes are contributing to transaction verification.
This balancing act between security, decentralization, and scalability is known as the Blockchain Trilemma. Simply put, if a blockchain network is highly centralized, it is less secure and more scalable. The low node count would make transactions faster because the computing power would be less distributed.
In turn, the low node count would increase the network’s vulnerability. After all, it takes control of 51% of nodes to be compromised by hackers.
In such a scenario, it would then be possible to block new transactions from being added to the blockchain. Moreover, the transactions could be re-ordered or even reversed. The latter would then lead to the double-spending problem, in which the same amount of digital cash is spent more than once.
Needless to say, the looming threat of the 51% attack would render all cryptocurrencies valueless. For this reason, it is not a coincidence that the most decentralized blockchain networks are the ones that are the most popular: Ethereum (ETH) with 4,457 nodes and Bitcoin (BTC) with 15,733 nodes. Out of thousands of cryptocurrencies, the pair have a market capitalization of $503B, or 57% of the total value of all cryptocurrencies.
However, because they are so decentralized and secure, they are less scalable. In practice, this translates to high transaction fees and long transaction confirmation times.
So the more decentralized the blockchain the more popular it is, yet it becomes less affordable and slower. That’s quite the conundrum.
How Is the Blockchain Trilemma Addressed?
What do you do with a safe but congested highway? It’s quite simple — you connect a road to it in order to offload the traffic. This is exactly the difference between Layer 1 and Layer 2 blockchain networks.
Layer 1 is the main blockchain network in charge of on-chain transactions, while Layer 2 is the connected network in charge of off-chain transactions. The Bitcoin network is Layer 1.
It offers an abysmal speed of five to seven transactions per second (tps). This resulted in transactions that sometimes took hours to complete. Suffice it to say, such a network could never enable Bitcoin to be used as a cryptocurrency in regular daily shopping.
Bitcoin’s Lightning Network is a Layer 2 scalability solution making Bitcoin transactions with negligible fees and near-instant transaction time.
Since May 2021, the number of LN channels has more than doubled. Its channels facilitate off-chain transactions, which are then bundled and brought back to be recorded on Bitcoin’s Layer 1 mainchain.
On a technical level, Lightning Network is a peer-to-peer (P2P) system that opens channels between parties, such as a customer and a shop. Although the amount of transactions is unlimited and nearly instant, one does have to lock a certain Bitcoin amount first. Once locked in, recipients effectively invoice the locked amount as needed and as long the channel remains open and funded.
Most importantly, because there are no Layer 1 confirmations needed on an LN channel. When the transactions on a channel are completed, the channel is closed, and its payment record is consolidated as a single transaction. As such, it is then added to Bitcoin’s Layer 1.
The end result is bundling multiple transactions off-chain (on Layer 2) and adding them in a compact form to Layer 1. Likewise, the same principle of bundling off-chain data to feed back to Layer 1 works with Ethereum and its many Layer 2 scalability solutions.
Top 10 Layer 2 scalability solutions for Ethereum. Image credit: L2beat.com
Although serving the same purpose, Layer 2 scalability solutions can further be divided into:
- State channels, such as Lightning Network, which employ two-way channel communication without submitting transactions to miners. Aside from LN, state channels are employed by Celer, Ethereum’s Raiden Network, and Liquid Network.
- Nested blockchains, such as Ethereum’s OMG Plasma Network, in which the two act in a parent-child relationship. While Layer 2 executes transactions, Layer 1 issues and verifies them.
- Rollups, as the most common Layer 2 scalability solutions. They rollup and run multiple transactions off-chain and bring them back to Layer 1 for permanent record.
- Sidechains, a hybrid between channels and nested blockchains. They link to Layer 1 mainchain via “bridges” and have their own consensus mechanisms, which alleviates the mainchain from having to validate transactions. Sidechains are commonly used to batch a large number of transactions. For example, the largest blockchain game, Axie Infinity, has its Ronin sidechain connected to Ethereum.
However, there are blockchain Layer 1 networks that don’t rely on external Layer 2 networks of any type. They were designed from the get-go to internally deal with scalability as layer 1 networks.
Layer 1 Blockchains and Scalability Solutions
Although Ethereum relies on external L2 scalability networks, it, too, has some Layer 1 scalability tricks up its sleeve. However, they are most likely to be implemented later in 2023 as a part of the overall ETH 2.0 upgrade from Proof-of-Work to Proof-of-Stake consensus.
The main one is sharding. Even before blockchain technology became popular, sharding has been a popular database management method. This Layer 1 scaling solution breaks the network into chunks called shards. Each shard processes and validates transactions in parallel.
Furthermore, nodes assigned to shards don’t have to hold the entire blockchain record. Instead, they share data (balances, addresses) between each other and feed proofs to the mainchain. Alongside Ethereum, blockchains that are using or exploring sharding are Tezos, Zilliqa, and Qtum.
Here are some PoS blockchains that are Layer 1s:
Algorand has its modified Pure Proof-of-Stake (PPoS) consensus. Simply put, it means that all ALGO holders with just one token gain network rewards when people use the blockchain. In contrast, Ethereum has a rather high barrier to entry at a 32 ETH (~$90k) stake.
When it comes to scalability, Algorand has an integrated two-tier architecture in which more complex transactions reserved for DeFi protocols are handled by one chain, while simple transactions (token transfers) are handled by another. This way, Algorand can inherently achieve tps up to 1,000, drastically outperforming Ethereum’s Layer 1 at 14–17 tps.
However, considering that Algorand has under 100 dApps available, compared to Ethereum’s nearly 3,000, it remains to be seen if it is truly scalable. One could make a case that a low barrier to staking could make the network more vulnerable to malicious actors. Likewise, Algorand doesn’t have a slashing mechanism to punish bad actors, unlike Ethereum.
Elrond uses sharding as its main Layer 1 scalability solution. Theoretically, it can process up to 100,000 tps thanks to the combination of secure proof-of-stake (SPoS) consensus protocol and Adaptive State Sharding (ASS).
ASS is dynamic sharding, in which shards either split or merge, depending on the network’s traffic load. Furthermore, not only is the network sharded, but so are transactions themselves. The security is boosted by the fact that validators are distributed across shards, making it less likely for a malicious shard takeover to happen.
Bear Market Survival Guide: The Metrics You Need to Know in a Tough Market
A Primer on FDV, Circulating Supply and Other Key MeasuresThe Defiant
Celo is a hard fork from Go Ethereum (Geth), which happened in 2017. After forking, it implemented proof-of-stake and a brand-new address system. This makes it possible to use a phone number as a public key, pushing Celo as the global mobile payment solution.
Celo has its own stablecoin. In fact, three of them: cEUR, cUSD, and cREAL. Because Celo uses PBFT (Practical Byzantine Fault Tolerance) for its PoS consensus, it can tolerate malicious nodes even when there is a small number of them. In other words, an extra node added increases the network’s communication overhead exponentially.
Another blockchain with its own tweaked PoS, Harmony uses effective proof-of-stake (EPoS). Its mainchain consists of four shards that simultaneously verify and add new transactions. Not only does each one have separate validators, but each one can execute transactions at different speeds, resulting in different block heights.
Block height is critical for blockchain security because it differentiates between the blocks. With both sharding and block height randomization, Harmony strikes a balance between scalability and security. This is further boosted by Harmony’s cross-chain Horizon bridge, allowing the network to connect to Ethereum’s Layer 2 scalability solutions.
Will Self-Contained Layer 1 Blockchains Prevail?
There are many more layer 1 networks to consider: Cardano (ADA), Solana (SOL), THORChain (RUNE), Polkadot (DOT), Avalanche (AVAX), Fantom (FTM), Binance Smart Chain (BNB), Tron (TRX), Kava (KAVA) Radix (DLT), and others.
However, none of them have been stress-tested in real-world conditions as much as Ethereum has been, with its large portfolio of dApps. On paper, each L1 network makes a claim to solve the Blockchain Trilemma in some way.
The most realistic and practical way seems to be to offload the bottleneck to Layer 2 networks. This bridging does introduce some level of complexity for the end-user, but so does cross-chain bridging as well.
In the end, the blockchain ecosystem will be diversified with many Layer 1 vs. Layer 2 solutions working together as a meta-blockchain network.