If you’ve tried DeFi recently, you’ve probably experienced the frustrations of high transaction fees due to increased demand for DeFi services on the Ethereum network, and it’s become the new norm to pay higher fees such as $20 per transaction. But if we don’t resolve the blockchain scalability problem, these transaction fees will act as a major roadblock to the mission of allowing widespread use, and in that case, DeFi really becomes more of a playground for the rich.
Thankfully, this is why countless research teams have been working for years on upgrades to layer one with Ethereum, as well as a series of layer two solutions, which act as an overlay network that lies on top of the underlying blockchain, doing a lot of the work for it.
So let’s consider Ethereum as a whole:
First, it’s the underlying main blockchain architecture, layer one and Ethereum only recently launched phase zero of its long-awaited transition to Ethereum 2.0 and proof of stake which will mean Ethereum no longer uses a proof of work consensuses like Bitcoin, or more miners. That means fast transactions, less electricity burned, and reduced carbon footprint of the Ethereum network. It reduces centralization risks and is a layer one design that aims to be nuclear bombing resistant. The NODs today will outlive their creators, with the current layout of things.
If the rest of the world goes into shambles, you’ll still be able to buy ETH.
So layer two is a collective term for solutions we have designed to help scale your application by handling transactions off the main Ethereum network.
Layer 2 scaling solutions are protocols that allow developers to build applications with faster transaction finality and cheaper gas costs than if they were to build on the layer 1 chain. There are various types of scaling solutions for Ethereum that will assist in the rollout of Ethereum 2.0.
This includes both layer 1 solutions (implementing scaling protocol updates on the main Ethereum chain such as sharding) and layer 2 solutions (such as state channels and rollups largely executing transactions off-chain, explained further on). For Ethereum to be suitable for global enterprise and mass adoption, there first needs to be improvements that facilitate scaling. In short, Ethereum needs to keep up with user demand, whilst accommodating the various types of users and transaction requests.
What about the transaction speed?
Transaction speed suffers when the network is busy, which can make the user experience poor gas fees for certain types of dab’s (Distributed Autonomous Banks), especially in DeFi’s and those related to gaming with NFT’s.
As the Ethereum network gets busier, gas prices increase as transactions senders aim to outbid each other, this can make using Ethereum very expensive. To summarize, we need layer two because some use cases like blockchain games just make no sense with current transaction times. It can also be increasingly expensive to use blockchain applications.
Any updates to scalability should not be at the expense of decentralization or security, so layer two successfully builds on top of Ethereum. It’s doing a ton of the work so that the network doesn’t have to. And then they write back the transactions to the Ethereum Blockchain.
The key takeaway is that 2020 was about DeFi, stretching layer one’s limits, which led many in the community to finally understand firsthand just how badly we need scaling solutions.
Funny how often the answer is right there in front of us, but we just don’t go there because it’s not that big enough of a problem. But the good news is that many teams with much greater foresight than most of us have been working on this for years and it feels like DeFi is the final kick in the butt that we needed to get building web three applications on layer two.
Why are layer 2 solutions important?
Layer 2 solutions are important because they allow for scalability and increased throughput while still holding the integrity of the Ethereum blockchain, allowing for complete decentralization, transparency, and security while also reducing the carbon footprint (less gas, means less energy used, which equates to less carbon.)
Although the Ethereum blockchain is the most widely used blockchain and arguably the most secure, that doesn’t mean it doesn’t come with some shortcomings. The Ethereum Mainnet is known to have slow transaction times (13 transactions per second) and expensive gas fees. Layer 2s are built on top of the Ethereum blockchain, keeping transactions secure, speedy, and scalable.
Each individual solution has its own pros and cons to consider such as throughput, gas fees, security, scalability, and of course functionality. No single layer 2 solution currently fulfills all these needs. However, there are layer 2 scaling solutions that aim to improve all these aspects; these solutions are called rollups.
What are layer 2 rollups?
Rollups are layer 2 scaling solutions that perform transaction operations off the main Ethereum blockchain, but still, post the transaction data onto layer 1. Considering the transaction data is on layer 1, rollups are secured by the same layer 1 security measures. In fact, this is the defining feature that rollups offer to users.
There are three properties of a layer 2 rollup:
- Executing transactions outside of layer 1 (reduces gas fees)
- Data and proof of transactions reside on layer 1 (maintains security)
- A rollup smart contract which exists on layer 1, can enforce proper transaction execution on layer 2, by using the transaction data that is stored on layer 1
Ultimately, rollups require users like you and me to stake a bond in the roll-up smart contract, which encourages users to verify and execute transactions correctly.
Rollups are useful because they reduce fees, increase transaction throughput, and expand participation. There are two kinds of rollups with different security measures:
- Optimistic rollups assume transactions are valid by default and only runs computation, via a fraud-proof, in the act of a challenge
- Zero-knowledge rollups run computation off-chain and submit a validity proof to the main-chain
Optimistic rollups sit in parallel to the Ethereum Mainnet on layer 2 and don’t perform any computation (mathematical equations) by default. Instead, after the transaction is complete, they submit the new state to the Ethereum Mainnet, essentially notarizing the transaction.
Optimistic rollup transactions direct their flow into the main Ethereum blockchain, further optimizing transactions by reducing the cost of gas.
Advantages of optimistic rollups include:
- Low gas fees
- Increased throughput
- Smart contract capability
- Security (guaranteed by the Ethereum Mainnet)
Disadvantages of optimistic rollups:
- Long withdrawal time (challenge periods can last for weeks)
- When discovering a fraudulent transaction, the rollup will automatically call a fraud-proof and run the transaction’s computation using the available written data. That leads to long withdrawal times in case of challenging the transaction.
There are several applications of optimistic rollups that you can integrate into your own Dapps:
Zero-knowledge rollups (ZK rollups) bundle thousands of transactions off the main Ethereum chain and create a cryptographic proof which we refer to as simply as SNARK (succinct non-interactive argument of knowledge). This is validity proof, which one uploads to the Ethereum Mainnet.
The smart contract for a ZK rollup keeps the data of all transfers on layer 2 and the data can only be edited with validity proof. Meaning, ZK rollups only need validity proof, opposed to all the transaction data. This function decreases the cost to transact due to including fewer data.
When it comes to ZK rollups, there is minimal hesitation when moving assets from layer 2 to layer 1, considering that ZK rollup has approved the validity proof and has already authorized the transaction.
Advantages of ZK rollups include:
- Near-instant transfers
- Not vulnerable to the attacks that may affect the optimistic rollups
- Still secure and decentralized
Disadvantages of ZK rollups:
- Validity proofs are extreme to compute for smaller applications with less on-chain activity
- A user can influence transaction ordering
- Some rollups don’t offer Ethereum Virtual Machine (EVM) support
There are numerous applications of ZK rollups that you can integrate into your own Dapps:
Ethereum layer 2 solutions have some serious potential to change the blockchain landscape for the better. Layer 2 solutions ensure that users are able to maintain all the safety measures used on the Ethereum Mainnet while still being able to transact quickly and at little to no cost for users.
This type of technology may encourage more people to try out the Ethereum blockchain and everything it has to offer. Also, keep in mind that many layer 2 solutions are still in their beta phase, meaning you should research everything in-depth and always remain curious and cautious when exploring the various layer 2 solutions.