The Current State of Layer 2
Disclaimer: Any information posted on Polkastarter’s social media accounts shall not be considered personal investment advice or be construed as an express or implied promise, guarantee, or implication by Polkastarter that clients will profit from the strategies or that losses in connection therewith can or will be limited.
Author: @dariuskohsg, @_WaterAmi
Editors: Antonis Kazoulis
Are scaling solutions still necessary after Ethereum 2.0?
The essence of Layer 2 scaling solutions is to solve Ethereum’s speed and cost problems. Even though Ethereum had successfully transitioned to proof-of-stake with proto-danksharding and danksharding planned and expected to bring down data costs by 10x and 30x (a conservative estimate), scaling solutions that synergized with the upcoming upgrades are still needed to help Ethereum to scale by another order of magnitude. The Layer 2 sector has a market cap of $5-10B, with plenty of room to grow.
Layer 2 is a term used for solutions created to enhance the capacities of Layer 1 by handling transactions off of the Ethereum Mainnet with high levels of security. There are different types of L2 scaling solutions, such as Sidechains, Plasma, Validium, and Rollups, and in this report, we are going to do a deep dive into rollups.
What are Rollups?
Rollups have become one of the most popular scaling solutions for dApps. Rollups scale the mainchain by essentially ‘rolling up’ transactions into a batch, and validating them off-chain, which leads to higher throughput, more speed, and lowered transaction costs.
There are two main categories of rollups – Optimistic Rollups (OP Rollups) and Zero-knowledge rollups (ZK-rollups).
Optimistic - Assumes transactions are valid by default and only runs computation, via a fraud-proof, in the event of a challenge.
ZK - runs computation off-chain and submits a validity proof to the chain. It uses advanced cryptography to prove there’s no fraud.
Comparing Optimistic and ZK rollups
Although Optimistic Rollups (OP) use the same tooling as Ethereum, so they can quickly be compatible with EVM and port existing dApps to OP Rollups, there are several shortcomings with OP Rollups. First, Sanjay from Electric Capital has concluded that costs associated with OP Rollup are not much lower than ZK-rollups.
Furthermore, the security of optimistic verification is widely understood as a notch below ZK-rollups' algebraic verification as OP Rollups do not come with inherent validity proofs i.e. users would have to challenge a transaction bundle in optimistic rollups for computation of fraud proofs to determine the validity of transactions. That results in a 1-week delay from the challenge period, while the correctness of validity proofs in zk-rollups can be guaranteed with mathematical proof with no delays in transaction finality. The outcome? The industry focus is on ZK-Rollup.
Property | ||
EVM-compatibility | Easy | Attainable with zkEVMs but with tradeoffs |
Security | Emphasizes crypto-economic incentives to users for ensuring rollup security
| Guaranteed security with mathematical proofs Seeks to ensure that that’s actually the case |
Delay time (time for finality) | 1-week from the challenge period | No delays in transaction finality |
Cost | Low to medium | Medium 600 gas per tx |
What’s new in the Optimistic Rollups world?
Optimism and Arbitrum are the leading Optimistic Rollups protocols. Both use certain types of compression to replace data and improve Ethereum’s mainnet efficiency. Here’s what you need to know about them:
Arbitrum has two notable upcoming developments on its roadmap:
- Arbitrum Nitro mainnet employs WebAssemly (Wasm) architecture to improve performance and reduce cost.
- Launches Nova, a new chain built on the AnyTrust sidechain with Rollup as backup, making it much safer than the general side chain with a gaming and social applications focus.
Optimism has reached two significant milestones:
- The Optimism Collective, which is a band of companies, communities, and citizens working together to reward public goods and build a sustainable future for Ethereum. It’s the industry’s first attempt to involve soulbound NFT holders in governance, diminishing the governing power of the token holders.
- Recently released Bedrock architecture which is its new rollup design that enables scaling with its modular design and flexibility.
Let’s talk about ZK Rollups
Over the last six months, ZK Rollups blockchains have made significant progress. Much of the narrative revolves around EVM-Compatible ZK Rollups also known as zkEVM. So what does it entail?
Most developers are familiar with Solidity, and changing languages can be challenging. What zkEVM does is that it allows the execution of Solidity-based smart contracts compatible with zero-knowledge proof computation, making the development process on ZK Rollups much easier. While Vitalik’s zkEVM article has attempted to explain the various types of zkEVM in accordance with their tradeoff between compatibility and performance, below seeks to explain things from a more straightforward angle:
The entire zkEVM can be classified into Language, Bytecode and Native types. As the Native type zkEVM is still in its early implementation by the Privacy & Scaling Explorations team at the Ethereum Foundation, we shall only discuss the other two types: Language- and Bytecode-based:
Close-up: Language-based zkEVM projects
The Language-based zkEVM is being advanced by Starkware.
StarkNet runs Cairo, which was developed in-house by StarkWare. To translate Solidity smart contracts into Cairo, they use Warp, a Solidity to Cairo transpiler developed by the Nethermind team.
Warp takes Solidity contracts, translates them into Cairo, and deploys them to StarkNet.
Most developers are familiar with Solidity and changing languages can be challenging for them. StarkWare's approach to EVM compatibility allows Solidity codes to be compiled to Cairo and run them on StarkNet with scaling benefits.
Close-up: Bytecode-based zkEVM projects
i) Hermez zkEVM: Led by the Hermaz team, who was once on the verge of collapse and then acquired by Polygon.
ii) Scroll: which is being developed by a Chinese team; the project has made good progress and its zkEVM, which is claimed to be the most EVM-compatible, is expected to go live by the end of this year.
iii) zkSync: which has repivoted from its zkVM to zkEVM and has announced that it would be going live on its mainnet within the next 100 days. It is worth noting that many of their Dapps are developed natively and not ported over from other chains/L2s.
4 Under the Radar Innovations in L2 Sector
We would like to set out 4 other key innovations in the L2 sector:
1. Hardware acceleration for zero-knowledge proofs (ZKPs)
ZKPs are slow and expensive to produce due to large numbers of expensive math operations. We need hardware improvements & software solutions to scale.
Intel, AMD, Samsung, Nvidia, Texas Instruments, and many others are at the forefront of innovation and manufacturing of specialized hardware such as Field Programmable Gate Arrays (FPGAs) and Application Specific Integrated Circuits (ASICs). The advancements would accelerate the generation of ZKPs by 10-100x.
2. Fractal Scaling / Recursive rollups of Starkware
How does Fractal Scaling work? Transactions can be processed on L3 and the associated proofs are verified on L2 and rolled up into a single proof that is sent to L1, allowing ultra-scaling and unimaginable numbers of transactions to be rolled up into one proof and be verified efficiently on Ethereum.
Privacy StarkNet instances (in this example also as an L4) to allow privacy-preserving transactions without including them in public StarkNets. The relationship among the various layers is set out below.
dApps need scaling solutions customized to their needs. StarkNet’s L2 gives devs the power to build anything. The new layer-on-layer world means parallel L3s, each tailored for different uses, preserving Ethereum security. It lets every dApp express itself best. We will write an article to discuss StarkWare’s suite of product offerings in detail in the near future.
3. Distributed Auto Market Makers (DAMM)
The entire DeFi cycle may repeat itself whereby there would be an influx of DEX, lending/borrowing, and stablecoin projects built on these L2s which may lead to further liquidity fragmentation since liquidity would be siloed to each respective underlying projects’ vaults. This would further aggravate the already-existing liquidity fragmentation situation which has not been addressed in today’s market.
Distributed AMM, a cross-L2 AMM that is jointly developed by Loopring and Starkware may be a solution. DAMM allows the same liquidity pool to be used across multiple L2s asynchronously. This design supports the scaling of AMMs without liquidity fragmentation. This will bring a chain of benefits:
- an increase in the number of trades for the LP
- an increase in fees generated
- an increase in capital efficiency
- reduced slippage
- better price, resulting in an efficient positive feedback loop
However, DAMM has its own set of problems and limitations:
1. DAMM may only fix the liquidity fragmentation across ZK Rollups and Ethereum L1
2. No one knows when it will happen
3. The complexity of this solution is very high and could possibly give rise to new problems. For example, MEV and impermanent losses are widely known problems on its original chain, Ethereum and if we were to integrate multi-chain via DAMM, asynchrony among the L2s is going to increase, leading to an increase in complexity of already known problems such as MEV, impermanent loss, etc.
4. Fuel - Modular Execution Layer
Another notable rollup solution is Fuel which is the first OP Rollup solution developed by Fuel Labs in 2019. Today, it has evolved into a flexible modular execution layer solution via its v2 iteration that can be operated in different configurations - as a rollup, state channel, or as a sidechain. It’s agnostic to both optimistic or zk-based configurations for fraud proofing. Moreover, it’s optimized to handle a large amount of L1 bandwidth, unlike typical L2 and rollup solutions.
Fuel is unique in that it uses its own custom blazing-fast virtual machine — the Fuel VM — with smart contracts written in Sway. Sway’s syntax is very intuitive and the core concepts from smart contract development in Solidity translate easily. Some of the key differences are set out in Fuel Labs’s documentation. Sway also has a compiler that is optimized to audit smart contracts, catching issues that typically discovered by auditing firms.
One of Fuel’s key selling-points is its unrivaled speed with its UTXO model and strict access lists. This enables Fuel to:
i) perform parallel processing (in comparison to Ethereum, which process transaction sequentially) since each transaction specifies the contract it is interacting with
ii) overcome a widely known limitation of a standalone UTXO model - the no shared state - hence it is not suitable for complex smart contract design.
Closing
Ethereum can and is scaling up through L2.
However, the roadmap to scaling the Ethereum blockchain to 1 million TPS will be a bumpy journey. It requires a concerted effort by various parties in and alongside the L2 space to refine their solutions.
The L2 is poised to grow significantly in the coming months.
Get ready to watch the race of scaling.🚀