Ethereum Layer 2s: The Network’s Scaling Solution
But I know you’re thinking: what exactly is the Ethereum Mainnet? And furthermore, what are Ethereum’s layer 2s, and what purpose do they serve?
The Ethereum Mainnet is one of the largest base networks in the crypto ecosystem, and it’s what led to the creation of industries like NFTs, DeFi, dapps, and even blockchain-based games. Let’s just say…it’s kind of a big deal.
But the Ethereum Mainnet doesn’t stand alone—there are other popular layer 1 blockchains like Bitcoin, Solana Network, BNB Chain, and more. Ethereum’s layer 2s, on the other hand… well, we’ll be getting into that later. You’ll see why in a moment.
The blockchain trilemma
Layer 1 blockchain networks need layer 2s to solve one of blockchain’s most prominent pain points.
Vitalik Buterin, Ethereum’s co-founder, brightest mind, and renowned spokesperson, once emphasized that the networks powering cryptocurrencies suffer from the so-called “blockchain trilemma“; that is, a trade-off between decentralization, scalability, and security when developing a functional blockchain network.
The Ethereum Mainnet sacrifices scalability and speed for decentralization and security. EOS famously trades-off decentralization with its low-node count for scalability and security.
And although Solana has thousands of nodes, record-breaking transaction speeds, and trusted security, it’s still centralized because of its reliance on the Solana Foundation.
I could go on and on about the various layer 1 networks and their key issues, but I’ll only be taking a look at Ethereum due to its sizable popularity and recognized potential.
The Ethereum Mainnet lacks scalability, or the ability for the blockchain network to increase throughput and handle a growing amount of transactions.
Ethereum’s current iteration of its blockchain network processes 15-45 transactions per second (TPS). This is nothing compared to other payment methods and blockchains like Solana’s industry-leading 65,000 TPS, which is on par with Visa. Avalanche, dubbed as an “Ethereum killer,” processes 4,500 TPS. Yet again, The Ethereum Mainnet falls behind.
What’s important to understand is that if a network cannot scale, the blockchain will never reach the heights of incumbent payment methods like Visa and Paypal. There are several reasons for this:
- People are impatient, and they want their transactions to be processed on the spot.
- Gas wars are notorious on Ethereum. People outbid each other just so they can complete their transactions quicker than other users.
- The more traffic on the network, the higher the gas fees users have to pay.
So all in all, the Ethereum Mainnet is inefficient at the moment, and we hope that in a couple of years, we’ll see drastic improvements with the introduction of its Proof of Stake (PoS) consensus mechanism and sharding.
For now, Ethereum layer 2 networks are solving the scalability bottleneck.
What’s a layer 2 network and how is it improving Ethereum?
“Layer 2 is a term used for solutions created to help scale an application by processing transactions off of the Ethereum Mainnet [through a smart contract] while still maintaining the same security measures and decentralization as the mainnet.”
By doing the brunt of the transaction work off-chain, then reporting back to the layer 1 network with its results, Ethereum layer 2s remove traffic and congestion from the base network.
Think of Ethereum layer 2s as an Amazon warehouse and Ethereum’s Mainnet as the network of residential, commercial, and industrial properties that make up a city. Employees in the warehouse are in charge of figuring out where the packages are being sent to, then distributing the packets to the correct delivery vehicles before they’re sent out.
In this case, the transactions are the packages. The employees are what execute the transactions on the Ethereum layer 2 network. You could think of them as the lines of code that make up the layer 2. The delivery vehicles, filled to the brim with packages, are what’s posted to the layer 1 network. For layer 2 networks, these would be the results of the transactions.
Now, this is a relatively barebones analogy, but you get the gist of it.
So to recap, there are three properties to Ethereum layer 2 networks (also called rollups):
- Transactions are executed outside of layer 1 (reduces gas fees)
- Data and proof of transactions reside on layer 1 (maintains security)
- A rollup smart contract which is found on layer 1, can enforce proper transaction execution on layer 2, by using the transaction data that is stored on layer 1
The two kinds of Ethereum layer 2 networks
There are two similar yet vastly different Ethereum layer 2 networks: Optimistic rollups and Zero-knowledge (ZK) rollups.
The process and verification method for transactions are what differ between these two networks.
For optimistic rollups, which are arguably the least scalable solution out of the two, the network assumes all transactions are good-to-go and submits batches of data without performing any computational work to validate the transactions… hence the “optimistic” in its name.
However, if a transaction is invalid, other users must point out the null transaction and revert the incorrect batch of data associated with it, thus cutting out malicious activity. This occurs with each batch, and it’s called the challenge period.
Popular optimistic rollups for Ethereum layer 2 networks include Arbitrum, Optimism, and Boba Network.
On the other hand, ZK rollups use Zero-Knowledge cryptographic proofs (“SNARK” is the only one we’ll be looking at today) to validate transactions on the Ethereum layer 2 network. Basically, SNARK is a protocol that seeks to prove a transaction is legitimate by allowing one party to show it possesses certain information without actually revealing the information.
Think of it like this:
Let’s say Jennifer is looking to send an eTransfer from her online bank to her friend. In this case, she would need to login into her profile before she can do anything. Now, Jennifer forgot her password—it’s no worries, it happens to the best of us. She would simply click “forgot password?” and receive an email from the bank with a unique code to put in a new password.
Either way, the bank has her information stored, so they know her old password, and they’ll know her new password.
But let’s say the online bank doesn’t store its users’ passwords, and it has no idea if the passwords the users type in are correct. In a situation like this, Jennifer would need to demonstrate to the online bank that she knows the password to her account without revealing the password itself.
Since you’re never revealing your password, there’s no chance someone could access your account. That’s the SNARK proof for you.
Some of the most recognized ZK rollups are Loopring, zkSync, Immutable X, and dYdX.
The pros and cons of each Ethereum layer 2 network
Optimistic and ZK rollups are scalable solutions for the Ethereum Mainnet, but their benefits and use-cases differ.
Unlike ZK rollups, transactions on optimistic rollups are directly written into the Ethereum Mainnet. Thus, gas fees are reduced, and security falls upon the main Ethereum blockchain. Also, optimistic rollups can execute smart contracts on the base network, largely in part due to their EVM-compatibility.
And you know what the integration of smart contracts means for a blockchain network. Dapps, games, programs…. you name it.
As explained before, the problem with optimistic rollups stems from the challenge period.
If a fraudulent transaction is discovered, it could take up to seven days to validate said transaction. And the longer the challenge period, the more time you have to wait to withdraw funds. Not suitable for swapping tokens and DeFi as a whole.
ZK rollups already verify transactions when moving data from the Ethereum layer 2 to the Mainnet. So what does this mean for ZK rollups?
Transaction speeds are near-instant, and the layer 2 network is 100% secure since transactions are validated prior to uploading data on the Mainnet. However, since a ZK rollup runs a validity proof, unlike its counterpart, more hash power is required to process the data.
So when it comes down to it, optimistic rollups are better suited for blockchain-based software, whereas ZK rollups are better equipped for DeFi.