What is a Layer 2:
Layer 2’s are off-chain solutions to the high transaction costs and congestion caused by the limited transaction throughput of Ethereum (although technically Layer 2’s can exist for any Layer 1 protocol that needs to scale). They achieve this by building on top of the base chain (Layer 1) to improve scalability and increased transaction speeds, while utilizing the security of the base chain and not being at the expense of decentralization.
Rather than performing all activity on the base chain (Layer 1), users can use Layer 2 protocols to perform the majority of their activity. The base chain is therefore the consensus layer, while Layer 2 protocols are the execution layer. Layer 2’s execute transactions off-chain (outside of Layer 1), and then the data is posted to Layer 1, where consensus is reached. Since transaction data is included in Layer 1 blocks, Layer 2’s are still secured by native Ethereum security.
The smart contract on the base chain performs only two tasks: processing deposits/withdrawals and verifying proofs that the transactions off-chain, on Layer 2’s, are following the rules. Instead of doing all original computation on-chain, instead now only proof verification happens on chain, which leads to transactions being cheaper - e.g. right now it costs $0.81 to send ETH using Optimism when on Ethereum it costs $4.65.
There are other Layer 2 solutions (plasma and validium), but in all honesty my interest (and from what I can sense/see most of the community’s interest as well) lie in rollups.
Optimistic Rollups:
Optimistic rollups are a form of Layer 2 that rely on fraud proofs. They don’t compute transactions, they instead assume that transactions are legitimate and that aggregators run without committing fraud, and only run computation via a fraud proof, which ensures that transactions are not fraudulent.
Optimistic rollups run on the assumption that there is at least one honest participant that can and will submit a fraud proof. If someone notices and challenges fraudulent transaction, the rollup will execute the fraud proof and compute the transaction, to ensure that it is legitimate. Whistleblowers have the data needed to detect and report fraud available on Layer 1, and are rewarded for fraud challenges by the Optimistic Rollup smart contract. These fraud challenges can lead to long wait times, up to almost 1-2 week withdrawal delays, for on-chain transactions.
ZK Rollups:
ZK (zero-knowledge) rollups are a form of layer 2 that use validity proofs. Each batch of transactions comes with a cryptographic proof (SNARK or STARK) that is verified by a smart contract. As ZK rollups do not need all transaction data and instead rely on validity proof, validating a block is quicker and cheaper.
There are two main differences between ZK-SNARKs and ZK-STARKs. Firstly, ZK-SNARKs require a trusted setup phase, where a trusted party or parties have to initially setup the ZK proof system. ZK-STARKs instead use publicly verifiable randomness to create a system that is not susceptible to the vulnerabilities of trusted parties. Secondly, ZK-STARKs allow computations and storage to be moved off-chain, which allows increased scalability.
Although STARKs are more secure and scalable, SNARKs benefit from being more heavily adopted, as they were discovered earlier, and from cheaper transactions. As they are more heavily adopted, SNARKs have more published code, developer libraries and projects. If a developer were to use ZK rollups, they would have much more information and support using SNARKs.
ZK versus OR:
Comparing Within:
Please ensure that when you are assessing/looking into rollups that you are looking at actual rollups and not at pretenders.
Comparison of Popular Optimistic Rollups (Arbitrum, Optimism, Metis and Boba):
Optimism sends the entire fraudulent transaction again through the EVM, while Arbitrum processes the suspicious transactions off-chain and sends only the suspicious part through the EVM, allowing it to have a higher transaction capacity. However, both fraud-proof systems take a significant amount of time (1 to 2 weeks), when in contrast, Metis’ system executed through “Rangers”, who sample a range of blocks and validate transactions, dramatically reduces the fraud proofing window.
While withdrawal from Optimism and Arbitrum can take up to 7 days, through the use of community-driven liquidity pools, Boba allows users to deposit/withdraw in a short time span.
Arbitrum is the only Layer 2 optimistic rollup that boasts native ETH support, while Optimism, Boba and Metis use WETH (Wrapped Ether).
While Arbitrum and Optimism use a single virtual machine to run all dapps, Metis runs multiple virtual machine’s simultaneously. Each Metis Virtual Machine corresponds to a decentralized autonomous company (DAC). As such, Metis benefits from increased scalability and decentralization.
Boba provides cross-chain compatibility through hybrid computing, which allows Ethereum developers to run various codes on web-scale infrastructure and implement algorithms that are not possible to run on-chain.
Comparison of Popular ZK Rollups (zkSync and Loopring):
Loopring and zkSync are extremely dissimilar. zkSync is a Layer 2 in a more “traditional” sense. It’s EVM-compatible, and seeks to attract other protocols and applications to build on it, much like Arbitrum, Optimism, Metis and Boba. In contrast, Loopring is an application-specific ZK rollup. Both use ZK-SNARK.
Tokened Up:
Currently, Metis and Boba are the only ones out of the optimistic rollups mentioned in this article that have tokens out. Both Arbitrum and Optimism do not have tokens, and Optimism has stated that they have no plans to release tokens.
Metis tokens are used within Metis’ platform:
Users can pay for transaction fees in $METIS
DAC contributors must stake $METIS to become a sequencers, collaborate or launch a new Metis Virtual Machine.
DACs get rewarded for contributing and Rangers get rewarded for winning fraud challenges with $METIS.
Boba tokens ($BOBA) are governance tokens, where token holders can vote, submit proposals or delegate votes on proposals.
On the ZK side, Loopring has $LRC. It is used as a governance token, it can be locked up to run a DEX, DEX operators can stake it to reduce fees and traders pay in $LRC when processing each trade. zkSync has a token coming out, and as of now the plan is that it will be used for staking in order to become a validator in their network.
NFA.
Sources:
Ali Atiia, Optimistic Rollup from the Bottom Up
DeFi Slate, Introduction: Layer 2 Scaling on Ethereum
Curve Substack: February 20, 2021: Optimistic vs ZK-Rollups, ELI5
Further Reading/Research:
Ali Atiia, Optimistic Rollup from the Bottom Up