Introduction:
The purpose of this adventure is to serve as a high level introduction to zero-knowledge rollup (zkr) technology and the burgeoning ecosystem of projects utilizing zkr.
Zkr have been touted as the ultimate L2 scaling solution to augment Ethereum L1 by Vitalik Buterin himself. Most experts (including Vitalik himself) thought that general-purpose zkr platforms were years away. Thus, in the meantime, the focus has been on optimistic rollups (and the likes of Optimism, Arbitrum, and Boba Network) as the next step in Ethereum’s rollup centric scaling plan. Then over time, and as zkr technology becomes ready, everyone converges to use zkr. What is so exciting is that this zkr technology is not years away but beginning to come to market now via the likes of StarkWare and zkSync (among others).
In the first part of this exploration the focus will be on the progression of L2 scaling and why it is important.
L2: Importance and History
L1 blockchains like Ethereum face a tradeoff between decentralization, security, and scalability (blockchain trilemma). A blockchain must focus on two of the three, making sacrifices on the third.
Ethereum has been focused on decentralization and security which has led to scalability issues. Transaction fees are so high that most cannot use the L1 chain (see below graph per Messari Research who does great work). This necessitates the need for a solution to the scalability issue without compromising on decentralization or security.
There are two ways to scale a blockchain. The first is to scale the L1 blockchain itself. This is done by creating bigger blocks or sharding (splitting the transaction load across groups of validators instead of all validators processing all transactions). To do so there must be sacrifices made in regards to decentralization and/or security. The second is to move transactions off of the L1 blockchain to L2. Using L2 scaling solutions allows a blockchain to scale without having to sacrifice decentralization or security.
L2 solutions batch transactions together at the L2 level then send to the L1 blockchain for settlement. Instead of paying a gas fee on each individual transaction, a gas fee is paid for the entire batch. Thus, that gas fee can be split across all the transactions; this reduces the gas fee paid per transaction. As a result, L1 becomes the settlement layer for transactions executed on L2 (as the L2 offers far cheaper transactions).
Bringing it all together, L2 solutions help blockchains scale by creating far cheaper transaction gas fees while not sacrificing decentralization or security (because the L2 transactions are batched together and reconciled to the L1 blockchain).
Modular vs. Monolithic blockchains
This is going to serve as a quick tangent on how L2 scaling fits into the broader context of how blockchain architecture is evolving.
L2 scaling is part of a broader “division of labor” that is labeled a “modular” blockchain architecture. This differs from traditional monolithic architecture in which L1 carries out all functionality.
At their core, blockchains do three things:
Execution → Computation: the CPU of the computer; computation layer
Security → Consensus: either proof of work (PoW) or proof of stake (PoS)
Data Availability → Storage: storing the previous blocks in the chain
In a monolithic blockchain, L1 carries out all three functions. As a result, L1 is constrained by the blockchain trilemma and faces inefficiencies. Modular blockchains compartmentalize for each function to build specific solutions for each function - i.e. division of labor. L2 solutions are built to scale the execution layer; doing this by batching and executing transactions at L2 before settling to L1. There are other solutions to improve the security and data availability functions (specifically moving from PoW to PoS and data sharding).
Alt L1 is the real L2?
Many alternative L1 blockchains have gained traction over the past year as new users flock to cheaper gas fees. This has led some to reason that these alternative L1’s are the scaling solution the crypto community has been desperately in need of. While this could be the case to some extent, and blockchains like Solana are introducing novel architectures, many of these alternative L1’s are very similar to Ethereum (EVM compatible). It should stand to reason that, given higher levels of usage, these blockchains will run into the same scalability issues as Ethereum.
This turned out to be the case with the recent surge in activity that Avalanche experienced which resulting in gas prices spiking 10x1.
The point is not anti-Avalanche but rather to show that L2 scaling solutions appear broadly necessary at higher levels of blockchain demand, and not just for Ethereum.
So scaling is an important part of the evolution of blockchains. It appears alternative L1 blockchains will face the same issues Ethereum has had as they gain transaction volume. L2 solutions allow a blockchain to scale while maintaining decentralization and security.
This begs the question, what exactly is an L2 and how does it work?
Evolution of Ethereum L2
The history of L2 scaling on Ethereum has been a progression from channels → plasma → rollups2.
Channels allow users to transact peer-to-peer (P2P) off-chain before settling the channel on-chain.
Ex: User A and User B sign a multisig and deposit funds to create a channel that allows P2P transaction (without settling each transaction to the L1 blockchain). Once the channel is no longer needed, the channel is closed out and reconciled to L1. See below depiction per Finematics3
This saves money on fees because each transaction is not processed on L1 but is application specific (P2P payments in this example) and does not allow open participation given that users must sign a multisig to transact with specified other parties.
Plasma creates a number of “child chains” to distribute the transaction load. Each child chain has an operator (centralized actor, multisig, or PoS system) that generates a batch of grouped transactions from those received. The operator then uses cryptography to settle the batched transactions to the L1 blockchain. In the case of a disputed transaction, fraud proofs are used (more on this to come). Again, depiction per Finematics.
This system is a step in the right direction but the issue is that per transaction data is not reconciled to L1 (data availability is off-chain). Thus, this architecture does not allow for general-purpose usage.
What does it mean to be “general-purpose” and why is that important?
There is a bifurcation that can be made between general-purpose and application specific blockchains. In regards to L2 scaling on Ethereum, general-purpose allows an Ethereum Virtual Machine (EVM) environment to run (remember, Ethereum is effectively a giant distributed computer that executes smart contracts). Without going into technical details, being general-purpose and being able to run EVM on L2 allows existing Ethereum applications to move to L2 with very little to no new code written.
This is consequential because existing applications are battle tested (new code has higher smart contract risk), already have existing user bases, and can benefit from reduced L2 fees.
The solution to creating a general-purpose L2… enter rollups!
Remember, channels and plasma effectively move everything off-chain and do not settle each individual transaction back to the L1 blockchain. This limits their ability to be general-purpose.
Rollups move computation and state storage off-chain but keep some data per transaction on-chain; thus each transaction is still settled back to L1. The efficiency of a rollup is compressing the data per transaction down before settling to L1. This improves scaling but is still limited by the data availability of L1 (transactions are still settled back to L1 just in a batched and compressed form).
Having data per transaction on-chain (data availability) is important for two reasons.
It means there is consensus on those transactions (utilizes the security and decentralization of L1) and that anyone can process the rollup transaction to ensure there is no fraud.
By having data availability, it allows the rollup to be fully general-purpose. This means that rollups can be EVM compatible and easily port over applications with few code changes.
This is why Ethereum has been focused on rollups as the L2 scaling solution. To reiterate again due to its importance - it effectively allows the same experience with the same applications from the Ethereum L1 blockchain, but on L2 with much cheaper fees. While at the same time, maintaining the decentralization and security of L1.
Example: Uniswap easily porting over to Optimism L2.
Variety of Rollups
There are two prominent forms of rollups - optimistic rollups (which use fraud proofs) and zero knowledge-rollups (which use validity proofs).
With optimistic rollups, L2 transactions are ordered and grouped by validators to be settled on the L1 blockchain. Anyone on the network can participate as a validator and these validators post collateral (ex: Ether) as bond to the network. Any network participant can raise a dispute on an optimistic rollup transaction if they think there is fraud. To arbitrate, the transaction is processed on the L1 blockchain. If there is fraud then the validator who sent the false transaction has their bond slashed (loses Ether). After a batch has been processed there is a 7-day window to bring forth a dispute. Optimistic rollups are referred to as “fraud proofs” because of the innocent until proven guilty philosophy of assuming transactions are true until proven false.
zero knowledge-rollups (zkr) rely on zero knowledge-proof cryptography that allow a prover to prove to a verifier some truth using only the proof itself as evidence. This cryptographic proof (either a ZK-SNARK or ZK-STARK) is included with each batch of L2 transactions and can be quickly verified on the L1 blockchain. These cryptographic proofs are technologically complex and require heavy computation.
There will be much more depth about zkr later on in this adventure. For now, it is important to highlight that in comparison to optimistic rollups, zkr are technologically complex, easier to implement application specific (as opposed to general-purpose), have lower per transaction gas costs, and are more computationally expensive to execute.
Rollups irl:
Optimistic rollup L2 scaling solutions created by Optimism and Arbitrum have been first to market but have struggled to gain significant adoption and attention compared to other new L1 platforms (like Avalanche or Solana). Per DeFiLlama as of 11/30/2021, Arbitrum and Optimism have captured only a small fraction of the Ethereum L1 total value locked (TVL).
At launch, the fees were still high on L2 (Optimism’s “Ethereum Equivalence” upgrade has lowered fees and Abritrum Nitro should do the same), application development has been slow given whitelists, and there has been little incentive for users to onboard (no incentive programs and no native token). This is not an attempt to be negative towards Optimism or Arbitrum; they are both great teams and I use both products actively.
StarkWare and zkSync are the two major players in the zkr space. They are both coming to market with general-purpose zkr platforms earlier than most expected. Further episodes of this adventure will feature deep dives into these platforms.
The next episode of this adventure will dive into zero-knowledge proofs (zkp), which is the cryptographic technology that underlies zkr. Get excited :)
https://cryptoslate.com/avalanche-fees-spike-to-10-as-backers-ironically-criticize-ethereum/
https://vitalik.ca/general/2021/01/05/rollup.html
https://finematics.com/
Good piece