Debating the Layer-2 for ApeChain
An unopinionated overview of Ethereum Layer-2s for the ApeCoin ecosystem.
In recent weeks, the ApeCoin DAO has been actively discussing the launch of an Ethereum Layer-2 ApeChain. Proposed solutions include creating a standalone chain using either Polygon's zkEVM stack or Optimism's stack.
Read the full discussion for Polygon zkEVM here and Optimism here.
The goal of this article is to provide the community with an informed and unopinionated look into the two options and explore a few other potential approaches. Before we dive in, let's first take a minute to understand what a layer-2 blockchain is and why they exist in the first place.
TL;DR - Jump to Summary
Layer-2 Blockchain Background
What problem does a layer-2 blockchain solve?
When it comes to blockchains there is a technical problem called the blockchain trilemma.
The blockchain trilemma refers to the challenge of achieving a balance between three fundamental properties in a decentralized blockchain system. These three properties are:
Decentralization:
Definition: The distribution of control and decision-making across a network of participants, often achieved through a distributed consensus mechanism.
Importance: Decentralization is a key principle of blockchain technology as it enhances security, censorship resistance, and trustlessness.
Security:
Definition: The protection of the blockchain system against various attacks, ensuring the integrity and immutability (ability to prevent it being changed) of the data.
Importance: Security is crucial to prevent unauthorized access, double-spending, and other malicious activities that could compromise the trustworthiness of the blockchain.
Scalability:
Definition: The ability of the blockchain network to handle a large number of transactions per second (TPS) or to scale in terms of computational resources as the user base grows.
Importance: Scalability is essential for accommodating a higher volume of transactions, reducing confirmation times, reducing transaction fees, and enabling widespread adoption of blockchain technology for various applications.
The blockchain trilemma suggests that it is challenging to maximize all three of these properties simultaneously. Improving one aspect often comes at the expense of the others.
A Layer-2 blockchain’s primary purpose is to improve scalability and reduce transaction costs without compromising decentralization and security. Unfortunately, all Layer-2 blockchains still compromise some level of decentralization and security, but as time goes on and the tech behind them improves, they are getting much closer to solving the blockchain trilemma.
Types of Layer-2 Blockchains
Now that we understand what a Layer-2 blockchain is, let’s look at the different types.
State Channels
State channels enable participants to conduct multiple transactions off-chain while only settling the final state on the main blockchain. Participants sign and exchange transactions among themselves without requiring on-chain verification for each step.
Use Cases: Micropayments, gaming transactions, and applications requiring frequent interactions between participants.
Examples: Ethereum Raiden Network, Bitcoin Lightning Network
Sidechains
Sidechains are separate blockchains that can operate independently but are “pegged” to the main blockchain. Assets can be moved between the main chain and the sidechain, allowing for off-chain transactions with the option to settle back on the main chain.
Use Cases: Scalable smart contract platforms, private chains for specific applications.
Examples: Polygon’s Proof of Stake Network, Bitcoin’s Liquid Network
Plasma
Concept: Plasma is a framework for creating scalable blockchains with their own consensus mechanisms linked to the main blockchain. It allows for the creation of "child chains" with their own rules, and only a summary of the child chain's state is periodically submitted to the main chain.
Use Cases: Decentralized applications (dApps) and asset tokenization.
Examples: Ethereum Plasma, OPN (Formerly OmiseGO)
Rollups
Rollups bundle multiple transactions off-chain and submit a single proof (rollup) to the main blockchain. There are two main types: ZK Rollups (Zero-Knowledge Rollups) and Optimistic Rollups.
ZK Rollups use zero-knowledge proofs to validate transactions without revealing their details.
Optimistic Rollups assume transaction validity initially and rely on a dispute resolution mechanism.
Use Cases: Decentralized Finance (DeFi), non-fungible tokens (NFTs), and general-purpose scalable applications.
Examples: Polygon’s zkEVM, Optimism, Arbitrum
Hybrid Solutions
Some Layer 2 solutions combine elements of multiple approaches. For example, projects may use state channels for certain interactions and rollups for others, offering a flexible and adaptable scaling strategy.
Use Cases: Versatile scaling solutions that can accommodate various types of applications.
All of the options currently being discussed within the ApeCoin DAO are focused on Layer-2 Rollups or option #4. This is likely because Rollups currently dominate the Layer-2 market and are often accepted as the most optimal scaling solution for Ethereum to-date.
Zero Knowledge vs. Optimistic Rollup
To fully understand Rollups it’s important to know the difference between the two most widely-used versions of a Rollup. Both the ZK Rollup (Zero-Knowledge Rollup) and Optimistic Rollup share the goal of reducing transaction fees and increasing throughput, however, they differ in their approaches to achieving this objective.
ZK Rollup (Zero-Knowledge Rollup)
Alright, bare with us here but to understand a ZK Rollup you will need to have a basic understanding of a Zero-Knowledge Proof (ZKP).
Zero-Knowledge Proofs
A Zero-Knowledge Proof uses a mathematical proof to enable a prover to demonstrate the truth of a statement without revealing any additional information other than the statement's validity.
When used in a Zero-Knowledge Rollup, it means that the validity of the transactions that are being submitted can be proven without revealing the details of each transaction, thereby providing a high level of privacy.
Basically, it’s mathematical magic that compresses (rolls-up) transactions and ensures that the transactions remain private all the way up until they are “submitted” back to the layer 1 blockchain. If you are nerds like we are and want to dive deeper into ZKPs you can here.
Data Availability
As we briefly mentioned before, in a ZK Rollup, the transaction data is not published on the blockchain directly. Instead, it is stored off-chain in what is known as a "rollup chain," while only the cryptographic proof of the validity of the transactions is posted on the main blockchain.
Security and Finality
ZK Rollup’s achieve a high level of security through the cryptographic proofs. Once a proof is submitted and verified, the results are considered final, providing a strong guarantee of the correctness of the transactions and enabling instant withdrawals back to the L1.
Optimistic Rollup
Optimistic Rollups take an optimistic approach to transaction execution. Transactions are initially assumed to be valid, and only if a dispute arises will the system fall back on the underlying blockchain for a resolution. Optimistic rollups use a dispute-resolution system instead of mathematical proofs (ZKPs) to validate state.
Data Availability
Unlike a ZK Rollup, Optimistic Rollups publish the transaction data directly on the main blockchain. The main chain serves as a "data availability layer," ensuring that the information is available for anyone who wants to validate the transactions.
Dispute Resolution
In case of a dispute, anyone can submit a fraud proof to challenge the validity of a transaction. Typically there is a challenge period (generally 7 days) with which this is possible. This triggers a process where the system verifies the contested transactions, and if they are found to be invalid, the state is rolled back. This also means that unlike ZK Rollups, withdrawal times from the L2 back to the L1 can take days.
Additional Components
There are a few additional terms and components of Layer-2 chains that are important to understand.
EVM Equivalence
"EVM Equivalence" refers to compatibility with the Ethereum Virtual Machine (EVM). The Ethereum Virtual Machine is a crucial component of the Ethereum blockchain. It is a runtime environment for executing smart contracts, which are self-executing contracts with the terms of the agreement directly written into code.
When we talk about EVM equivalence in the context of other blockchain platforms or Layer-2 solutions, it means that these platforms or solutions strive to be compatible with the Ethereum Virtual Machine. In practical terms, this compatibility implies that smart contracts written for the Ethereum blockchain can potentially be executed on these other platforms without modification.
The following is a good outline of the varying levels of EVM Equivalence by Jarod Watts:
Type 1: Fully Ethereum equivalent, i.e. they do not change any part of the Ethereum system to make it easier to generate proofs. ZK proofs take several hours to generate in this kind of system.
Type 2: Fully EVM-equivalent, but changes some different internal representations like how they store the state of the chain, for the purpose of improving ZK-proof generation times.
Type 2.5: Fully EVM-equivalent, except they increase the gas costs of some operations to "significantly improve worst-case prover times".
Type 3: Almost EVM-equivalent ZK-EVMs make sacrifices in exact equivalence to further enhance prover times and simplify EVM development.
Type 4: High-level language equivalent ZK-EVMs compile smart contract source code written in a high-level language to a ZK-SNARK-friendly language, resulting in faster prover times but potentially introducing incompatibilities and limitations.
When it comes to ZK Rollups, full EVM equivalence can be very challenging due to the complexity of the ZK proofs and the time needed to generate these proofs. All current ZK Rollups tend to fall into type 3 or 4 while striving to become type 2.
When it comes to Optimistic Rollups, it’s less challenging to obtain true EVM-Equivalence therefore Optimistic Rollups tend to be type 1/2.
Sequencers
Rollups typically use a sequencer that is responsible for ordering and sequencing transactions before they are submitted to the main chain. It ensures that the transactions are processed in the correct order and that the resulting state transitions are valid.
Sequencers introduce some centralization risk, however, they also provide a mechanism for operators to earn “Sequencer Fees”. In the event that ApeChain is running it’s own sequencer this could act as a source of revenue for the ApeCoin ecosystem.
Fin.
To summarize, ZK Rollups prioritize privacy and achieve finality through cryptographic proofs. These cryptographic proofs require more expensive hardware and add complexity and cost, however, they enable instant withdrawal times.
Optimistic Rollups take an optimistic approach, revealing transaction details on-chain and relying on a dispute resolution mechanism for security. This saves a lot of costs for data submission but because the transactions need to be validated during the dispute period, withdrawals can take days.
Each approach has its advantages and trade-offs, and the choice between them may depend on the specific use case and priorities of the blockchain network.
The Layer-2 Wars
Now that we understand the differences between the Layer-2 options, let’s dive into more details on each solution. Each option offers the ability to create a custom version of its stack (a copy) designed specifically for ApeCoin, alternatively the L2s can be used as-is by bridging assets directly to them.
To compare the chains across a consistent framework we are using four properties, a risk analysis done by L2Beat.com, and one general statement based on our research for each.
Total Locked Value (TVL): The sum of all canonically bridged, externally bridged, and natively minted tokens, converted to USD.
Avg. Daily Transactions: Average number of transactions on a daily basis for each chain since they launched.
Avg. Transaction Gas Fee: A rough estimate of gas fees required for a basic ETH transfer and a smart contract ERC-20 spending approval.
Github Stats: Simple statistics on Github for each chain to get a general sense of the developer community.
Polygon zkEVM
TVL: $106M
Avg. Daily Transactions: 33k
Avg Transaction Gas Fees:
Transfer (0.00003927ETH, $0.09)
Approval (0.00009ETH, $0.20)
Github Stats:
315 followers (0xPolygon)
740 followers (zkEVM)
380 stars
97 repository mentions
Risk Analysis (L2Beat )
Sequencer Failure
The Sequencer is currently a central point of failure for Polygon’s zkEVM. According to L2Beat research, “There is no mechanism to have transactions be included if the sequencer is down or censoring. Although the functionality exists in the code, it is currently disabled.”
Research Finding
Polygon excels at building strong technology and their business development initiatives; including their ability to establish and foster relationships with big brands in the Web2.0 industry.
Optimism
TVL: $3.7B
Avg Daily Transactions: 173k
Avg Transaction Gas Fee:
Transfer (0.00004ETH, $0.10)
Approve (0.00006ETH, $0.14)
Github Stats:
1.9k followers
4.7k stars
922 repository mentions
Risk Analysis (L2Beat)
State Validation
The state validation system is still under development which means that the system can technically permit invalid state roots. That said, all state is auditable and visible on-chain.
Upgradeability
The systems code can be upgraded at any time without delay. This means that the code that secures the system can be changed arbitrarily and without notice. However, the project has strong decentralized governance and updates are made by opensource contributors.
Proposer Failure
Only the whitelisted proposers can publish state roots on to Ethereum, so in the event of failure all withdrawals would be frozen.
Research Finding
Optimism puts significant emphasis on open source technology, non-plutocratic governance, public goods funding, and has one of the healthiest developer ecosystems in the industry.
Arbitrum
TVL: $7.3B
Avg. Daily Transactions: 331k
Avg Transaction Gas Fee:
Transfer (0.00006ETH, $0.14)
Approve (0.00009ETH, $0.22)
Github Stats:
860 followers
1.9k stars
815 repository mentions
Risk Analysis (L2Beat )
While Arbitrum has not mitigated all centralization risk, over recent years, it has made significant progress on decentralizing most of the system. This has been accomplished via deliberate technology decisions such as creating a mechanism where anyone can propose state in the event of proposer/sequencer failure, and the setup of a “security council” which acts independently and oversees certain operations of the system.
Research Finding
Arbitrum is the most developed Rollup from a technology perspective in the industry.
Wait, Do We Need an ApeChain?
Typically, the establishment of a standalone blockchain becomes necessary only when the demand for decentralized applications (dApps) and transaction throughput reaches a point where the migration of all activities to its own dedicated chain is justified. Examples include Ronin for Axie Infinity and Flow for CryptoKitties/NBA Top Shots. Both of these dApps were so popular that they were bogging down the entire Ethereum network and needed to move to their own chain to scale and keep up with the demand.
Under the current conditions, ApeCoin experiences fairly minimal activity, and there isn't a very compelling scalability need for a separate ApeChain. One factor to consider is that ApeCoin is currently struggling with an adoption problem, not a scaling problem, therefore a standalone chain may actually make the adoption problem harder due to the added complexity of on-boarding developers, building infrastructure, and incentivizing users to use the new blockchain.
A potential pragmatic approach towards both enhancing the scalability of the ApeCoin ecosystem and improving the UX through faster/cheaper transactions may involve simply bridging ApeCoin to an existing Layer-2 solution.
Bridging ApeCoin is a standardized process that would require only a fraction of the costs and resources when compared with launching a standalone chain. In addition, by using an existing Layer-2 it’s easier to leverage it’s current developer community, tools and infrastructure, and can act as an intermediary step toward a standalone chain.
Summary
Both Polygon zkEVM and Optimism have their trade-offs. Polygon zkEVM has a slightly more modern and complete technology stack and a proven track record of strong business development and growth. Optimism technology stack still has aspects under development which introduce some centralization risk, however, it has a strong developer ecosystem, emphasis on opensource, and built-in public goods funding initiatives. Outside of Polygon zkEVM and Optimism, Arbitrum offers a balance of strong technology, a healthy developer ecosystem, and a proven track record with a number of large gaming projects already using it.
However, a topic that is not being actively addressed on the DAO is if there truly is a need for an ApeChain at this time. In addition to launching a standalone L2 ApeChain, there are other potential options that may be a viable intermediate solution to the ApeCoin scaling problem, specifically, a simple bridge of ApeCoin to any of the aforementioned L2s.
Polygon zkEVM
Semi Centralized Governance
Strong Business Development
Strong Technology
Optimism
Some Aspects of Technology Still Under Development
Emphasis on Opensource / Public Goods Funding
Thriving Developer Ecosystem
Arbitrum L2 or L3
Most Used L2 (Highest TVL & Daily Transactions) / Proven Track Record
Strong Technology
Thriving Developer Ecosystem
ApeCoin Bridge to One/Many L2’s
Ability to Leverage Existing Developer Community and Infrastructure Instead of a Cold Start
A Fraction of the Complexity and Cost of Deploying a New Chain
Solves the Scaling Problem in the Short-to-Medium Term
Want More?
Join the conversation on the ApeCoin DAO forum: Polygon zkEVM here and Optimism here and her.
Build on Optimism
Build on Arbitrum
Build on Polygon zkEVM
Learn more about token bridging
Sources
https://mirror.xyz/msfew.eth/JJudP_Kf-IS6VhbF-qU0BUor1Ap6SFEb0TzYOHZ34Rc
https://twitter.com/optimismFND/status/1727105321817219488
https://www.galaxy.com/insights/research/optimism-arbitrum-pt2-decentralization
https://community.optimism.io
https://wiki.polygon.technology
https://docs.arbitrum.io
https://l2beat.com
About CR3 Labs
CR3 Labs builds tooling for Web3 gaming to help creators, collectors, and gamers unlock value in the new digital frontier.
Learn more at cr3labs.com.
Seeking more information about a particular topic, project, or technology?
Submit a research request!