TLDR: Layer 2 refers to the framework that is built on top of the main blockchain — Layer 1 — to increase the blockchain’s scalability.
Most of us didn't anticipate the day when Starbucks customers would ask for blockchain with their frappuccinos, but Polygon — one of the fastest-growing Layer 2 scaling solutions — recently partnered with the coffeehouse to bring NFTs to the masses via the new Starbucks Odyssey rewards program. Meanwhile, another leading Ethereum scaling solution, Immutable X also made headlines by partnering with GameStop, the world's largest video game retailer, to build a first-of-its-kind gaming NFT marketplace.
Everyone is flocking to Web3, which means Ethereum — the most widely adopted blockchain network — gets congested. Enter Layer 2 scaling solutions, also known as L2s. As the Web3 space grows, L2 scaling solutions are gaining popularity to help accommodate the traffic. But what are they exactly?
Let's start with a quick overview of how Layer 1 and Layer 2 work together.
Layer 1 refers to the base blockchain or, in other words, the main network (mainnet) of an ecosystem. It can validate and execute transactions without relying on any other network. Bitcoin, Ethereum, Solana and NEAR are examples of Layer 1 blockchains. Typically these all have their own native tokens (BTC, ETH, SOL etc).
A Layer 2 scaling solution refers to the framework that is built on top of the main blockchain —Layer 1 — to increase the blockchain’s scalability, meaning the volume and speed of transactions that can be processed.
Layer 2 solutions were introduced because most Layer 1 cannot handle the high transaction volumes and become congested. Layer 2s create a way to increase transaction speeds, reduce fees and scale, while benefiting from the security of the main chain. Hence, L2s are important when it comes to mass adoption of blockchain technology, so it is cheaper and easier to transact and build apps, be it decentralized finance (DeFi) or gaming (more on this later).
Most Layer 1 blockchains are slow in terms of the number of transactions per second (TPS) they can process. This is due the decentralized nature of blockchains — each transaction requires a new block to be created and then validated across the entire distributed database network. When data is centralized and is held by one entity, this process is a lot faster. So for example, Visa payments network, which is centralized and relies on their own database, can process 1,700 TPS because it doesn’t need to verify the transactions with other participants in the ecosystem. In contrast, decentralized blockchain networks such as Bitcoin or Ethereum can process only around 4 TPS and 30 TPS respectively. Building and running applications on blockchain requires much faster processing speeds, which is where the L2 scaling solutions come in.
There are a number of different L2 options for scaling, including state channels, side chains and rollups. Each of these solutions attempt to achieve the same result, but by compromising varying degrees of either decentralization, security or scalability. This problem speaks to what's known as the "blockchain trilemma" — i.e. the idea that a blockchain must be decentralized, secure and scalable (fast), but making improvements in one of these three areas often compromises another.
Here are some common L2 solutions:
A state channel, aka a payment channel, refers to a process where multiple transactions can take place between participants off-chain but only the opening and closing transactions will be recorded on the main chain. Meanwhile, the intermediate transactions are stored in a private ledger. So in simple terms, it is like a separate session, where a ‘two-way ledger’ is created to allow participants to securely transact off-chain, without having to record every interaction on the main blockchain, hence making the process more efficient (particularly for micro-transactions).
Bitcoin’s Lightning Network is an example of a payment channel layer 2 solution, enabling very low-fee micro-transactions. So for example, if I want to make five transactions to my friend Jane, each time sending her 1 BTC, the main blockchain will only record a single transaction at the end validating that Jane now has 5 BTC.
Side chains run as secondary blockchains in parallel to the main blockchain. They take the information from the main blockchain, process transactions, execute smart contracts and then send the information back to the main network. Side chains such as Polygon for example, would run the same code as Ethereum but would have their own consensus mechanism. The smaller the side chain, the higher the security risk (i.e. risk of the blockchain being hacked).
There are two types of rollups, optimistic and zero-knowledge (ZK). In this article we will look at the more common one, ZK rollups. These L2 solution are popular for scaling the Ethereum network.
In simple terms, ZK rollups bundle up thousands of transactions into batches and process those batches off chain, submitting the entire batch as a single transaction onto the main blockchain, thereby decongesting the main network. In order to maintain the integrity of the transactions, a mechanism called Proof of Validity is used. Think of it this way: When you are trying to email large files one by one, the process takes a long time, but if you place all your files into a folder and email it as a “zip” folder, it makes the entire process a lot more efficient.
When it comes to gaming and trading in-game assets (i.e. NFTs), there tend to be lots of transactions at small values. If these transactions were to be processed on Layer 1 you would likely pay more in gas fees than you would for the asset itself. Hence, the batching of transactions that rollups utilise allows for these smaller value transactions to be processed efficiently.
“Currently most production-grade ZK rollups are application specific, which means they have been designed for a specific use case like gaming, NFTs or DeFi. The benefit of this is that we were able to build a full suite of products for game developers, with good UX and UI and which is easy to use”, says Amelia Brown, a Senior Developer Growth Manager at ImmutableX, a leading layer 2 protocol for gaming and trading Ethereum NFTs.
“You might have your ENS name, on-chain identity verification, your NFTs that you use in games," says Brown. "Our presence in the metaverse is made up of these small transactions and interactions."
The Layer 2 ecosystem unlocks these everyday micro-transactions, allowing us to easily transact without prohibitive gas fees.
Similar to what ImmutableX was able to build for game developers, other application specific protocols, such as Loopring and dYdX, were developed to create simpler ways for developers to build DeFi products.
According to the Ethereum Foundation, the Ethereum Merge has not resulted in any significant reduction in gas prices or any meaningful improvements to TPS. The scalability issue is due to be addressed in the upcoming network upgrades over the next few years, hence Layer 2 solutions continue to be an important tool for scaling and building in web3.
Liya Dashkina is a VC, contributor to a number of DAOs, web3 consultant, chapter lead at the Australian DeFi Association and an advocate for women in web3.
This article and all the information in it does not constitute financial advice. If you don’t want to invest money or time in Web3, you don’t have to. As always: Do your own research.