Explained: Roll-up Scaling
Rolling in the future of scaling - How Roll-up solutions are set to revolutionize the way we transact on the blockchain.
Ethereum is arguably the most influential blockchain project ever and has contributed the most to the development and evolution of the DLT space. While Bitcoin kicked off the whole thing, Ethereum has been the driving force behind all significant blockchain and crypto trends of the past few years, including initial coin offerings, DeFi and the NFT boom. Not to mention that the vast majority of crypto tokens today started their life on Ethereum.
However, the success of the Ethereum blockchain has once again demonstrated the need for ways to improve blockchain scalability. This is especially true for a platform like Ethereum, whose utility comes from its ability to run decentralized applications (dApps) powered by smart contracts.
We already know that one solution to the scalability trilemma problem can be to make a system more centralized. This is the approach the Binance Smart Chain has taken, and it has certainly paid dividends in a massive increase in user accounts and activity. But the real challenge lies in increasing scalability while preserving one of blockchain’s most unique characteristics – its decentralized nature. This is what Layer 2 solutions are trying to accomplish.
Today, we’ll zero in on roll-ups and examine some of the most promising projects in that Layer 2 solution category.
Roll-ups are of two types.
Roll-ups are one of the most promising categories of Layer 2 solutions. These solutions move transaction computations off-chain but store transaction data to the Ethereum chain, which means that roll-ups are secured by Layer 1.
All this is accomplished via smart contracts whose primary function is to bundle, or ‘roll up’, transaction data and move it off-chain for processing. Network participants handle this data, referred to as validators, who then submit batches of highly compressed transaction data back to the main chain. Those batches contain the minimum information needed to verify the transactions' validity.
Because roll-ups move computation off-chain but still submit (highly compressed) data to the Ethereum mainnet, they can produce gains in scalability without creating data availability issues which is sometimes the case with other Layer 2 solutions. Some roll-ups also come with the option of off-chain data availability (where no data is posted on Ethereum), which can lead to significant gains in throughput but at the cost of reduced security.
The verification method is the critical distinction between the two types of roll-ups – zero-knowledge (ZK) roll-ups and optimistic roll-ups.
To ensure that validators are incentivized to process only legitimate transaction data, they are required to stake ETH. If the duties are performed diligently, they receive staking rewards, but if a validator submits a fraudulent transaction to the main Ethereum chain, their stake is slashed.
Optimistic roll-ups
Optimistic roll-ups assume that all transactions are valid and submit batches without performing any computation, which can lead to significant improvements in scalability. However, they include a period during which anyone can dispute the legitimacy of the data contained in a batch. If a fraudulent transaction is detected, the roll-up executes a so-called fraud-proof and runs the correct transaction computation using the data available on Layer 1.
One of the biggest strengths of optimistic roll-ups is that they do not perform computation by default, which can lead to significant scalability gains – estimates suggest that optimistic roll-ups can offer up to 10-100x improvements. On the downside, the need to have a dispute period means that withdrawal periods are significantly more extended than ZK roll-ups.
Another significant advantage of optimistic roll-ups is that they can execute smart contracts, whereas ZK roll-ups are mostly limited to simple transactions.
Optimism
In a typical roll-up fashion, Optimism uses a smart contract to relay transaction data from the main Ethereum chain to a Layer 2 network, where a validator can bundle multiple transactions into a batch and then submit that batch back to the main chain via a single transaction.
Validators perform these duties optimistically under the assumption that all transactions are valid. The system has a one-week period during which that assumption can be challenged. If any discrepancies are found, the roll-up generates a fraud-proof. For such proof to be developed, the whole Layer 2 transaction is executed on Layer 1. The advantage of this approach is that it enables high-speed proof generation.
Optimism tries to stick as close as possible to the Ethereum ecosystem. It uses a modified GETH for its Layer 2 node and has a Solidity compiler. However, it does not support any EVM languages apart from Solidity.
Currently, the protocol does not have a native token and uses ETH for payments.
Arbitrum
In essence, Arbitrum is very similar to Optimism, with the main difference between the two projects being how they generate fraud-proof. Unlike Optimism, which executes the whole Layer 2 transaction, Arbitrum takes a multi-round approach, executing small chunks of the L2 transaction until it finds a discrepancy. This approach has the benefit of enabling higher transaction capacity. On the downside, generating fraud-proof this way typically takes a week – and can take up to two weeks in some cases – much longer than with the method used by Optimism.
On the compatibility side, Arbitrum supports all EVM languages, including YUL, Vyper and Solidity. However, it uses a custom L2 node. Arbitrum, too, uses ETH for payments.
The two solutions are very similar, with the main difference being how they generate fraud-proof. There are also differences concerning their compatibility with the Ethereum Virtual Machine (EVM) and Ethereum tooling.
ZK roll-ups
ZK roll-ups generate cryptographic proofs to prove the validity of transactions. Each commerce batch has its own ‘validity proof’ submitted to the main chain.
Whereas optimistic roll-ups assume that everyone acts in good faith, ZK roll-ups seek to ensure that. The roll-up moves bundles of transactions to Layer 2, generating a validity proof for every bundle. The validity proofs are then submitted to Layer 1 as a proxy for their corresponding bundles. This method results in significant data size reduction and, in turn, lowers the time and gas cost for validating a block.
One drawback of ZK roll-ups is that generating a validity proof is complex and time-consuming. Another drawback is the inability to execute smart contracts, although there are some exceptions, as we’ll see below.
On the other hand, ZK roll-ups do not require a dispute period, as the validity proof has already verified the legitimacy of transaction data. That’s why ZK roll-ups allow for swift withdrawal times.
Some promising projects are populating the ZK roll-up corner of the Ethereum ecosystem. Here are some of the most promising ones:
Hermez
Hermez is a ZK roll-up that generates cryptographic proofs called SNARKs (succinct non-interactive argument of knowledge). Developed by Iden3, the team behind the popular Circom and SnarkJS libraries, Hermez can scale Ethereum to 2,000 transactions per second.
Hermez is merging with Polygon in a landmark deal worth $250 million.
The Hermez Network relies on coordinators to process batches to the Hermez roll-up and generate validity proofs for those batches. Coordinators are selected via an auction process that sees registered network nodes placing bids to become the next coordinator. The winning bidder gets to process as many batches as possible during a single ‘slot’ that lasts 40 Ethereum blocks or approximately 10 minutes.
Currently, bids are paid in Hermez’s proprietary token, HEZ. However, this is about to change, as following the Polygon deal, HEZ will cease to exist and be replaced by Polygon’s token, Matic. The exact date of the change is not yet determined, but Hermez has announced plans to publish a smart contract that will allow HEZ holders to swap their HEZ for Matic tokens at a rate of 3.5 Matic per HEZ.
Recently, Hermez also launched an atomic transaction feature, which enables cheap token swaps on the network. Also, the Hermez team recently announced that they are working on a zero-knowledge Ethereum Virtual Machine (ZKEMV) to achieve full opcode compatibility. This means Polygon Hermez will be able to support smart contracts.
ZKSync
Next, we have another SNARK-based roll-up. The team behind ZKSync, Matter Labs, describes their project as a scaling and privacy engine, enabling low-gas transfers of Ether and ERC-20 tokens in the Ethereum network. ZKSync’s motto – “rely on math, not on validators” – certainly seems aptly chosen as currently there are only one validator processing batches and generating validity proofs.
ZKSync also supports token swaps and NFT minting. The platform also launched in alfa its ZKEVM, which allows it to execute smart contracts. ZkSync supports most opcodes in Ethereum.
A big part of the vision for ZKSync 2.0 is an off-chain data availability solution dubbed ZK Porter. The answer is meant to complement the roll-up component of ZKSync 2.0, meaning that roll-up contracts and accounts will be able to interact with ZKPorter accounts and vice versa.
Off-chain data availability in ZKPorter will be secured by ‘guardians’, who stake ZKSync tokens and sign blocks to confirm data availability in ZKPorter accounts. Guardians are motivated to ensure no data availability failures with their stakes on the line. Moreover, Matter Labs claims that ZKSync’s proof of stake is significantly more secure than PoS in alternative scaling solutions like sidechains because guardians cannot steal funds.
Loopring
Loopring focuses solely on decentralized exchanges (DEXs) and payment applications. With Loopring, anyone can become an operator of their own orderbook DEX or automated market maker (AMM) and use its ZK roll-up technology to achieve high throughput at low gas cost.
Loopring claims that its ZK roll-up can reach up to 2,025 per second, while the cost per transaction is 100 lower than the same metric on Ethereum. Exchange operators must post a large bond (stake) in the protocol’s native LRC token.
The Loopring moniker stems from one of the protocol’s most exciting features – order rings. An order ring is a circular trading system that contains up to 16 individual orders. So whereas a buy order typically has to be matched by an opposing sell order, and vice versa, orders in an ordered ring do not need direct matches to be executed. This system can result in better liquidity, price discovery and other benefits.
StarkEX
The most exciting aspect of StarkEx – a Layer 2 scaling and payment protocol developed by StarkWare, is that it uses STARKs (succinct, transparent arguments of knowledge). Unlike SNARKs, which require a trusted setup (or a multiparty ceremony) to produce pre-generated keys that are then used to create and verify the proofs, STARKs utilize a method that removes the need for such a setup.
The method was pioneered by StarkWare, which continues to be the driving force behind STARK-based technology. The critical innovation enabling this is the Turing-complete programming language Cairo. Developed by the StarkWare team, Cairo enables the generation of STARK proofs for general computation. The StarkEx protocol is written in Cairo.
Another difference between these two ZKP types is that while SNARKs are based on elliptic curve cryptography, STARKs rely on hash functions, which offer certain benefits, quantum resistance being among them.
On the downside, STARKs have a significantly bigger proof size and, because of this, are way more expensive to verify.
Nevertheless, the StarkEX protocol has already been utilized to power some exciting projects, including the DeversiFi DEX and the recently launched NFT minting and trading protocol Immutable X.
Conclusion
Layer 2 will play an essential part in making Ethereum more scalable and will complement the effort to solve the scalability problem at the Layer 1 level. The same view is shared by many in the blockchain industry and even by some prominent outsiders.
And when it comes to Layer 2 solutions, roll-ups are up there with the best and might even be a bit better than the alternatives in some respects. Interestingly, Ethereum’s creator, Vitalik Buterin, is quite fond of roll-ups and sees them as a natural fit for PoS and sharding – the two main components of the Ethereum 2.0 project.
If you want to learn more about this exciting technology, Vitalik’s “An Incomplete Guide to Roll-ups” is a great place to start.