Blockchains have sped into our world on distributed ledger technology, but the speed of these ledgers is not distributed evenly. Ethereum, the world’s oldest smart-contract blockchain, is still hovering at around 20 transactions per second (TPS) at the time of writing – and this is post-Merge.
While there are a number of native upgrades in the pipeline for Ethereum that will see its TPS boosted – namely shard chains – one of the sometimes overlooked ways of increasing this capacity is through layer-2 scaling solutions such as rollups.
In this article, we’ll take a look at both kinds of rollups and assess their respective merits.
What are Ethereum layer-2 rollups?
The purpose of rollups is to take some of the burdens off layer-1 chains like Ethereum by processing transactions on a separate layer-2 chain that runs much faster. The data is then batched and compressed before it is carried over to the layer-1, saving on costs. The solution allows users to speed up their transactions while still taking advantage of the security and stability of the layer-1 chain.
Rollup technology is part of a group of other scaling solutions being used to help speed up transactions on blockchains. Popular applications using rollups include Arbitrum, Metis and Optimism on the Optimistic side, while zkSync and Loopring use zero-knowledge proofs. (Our flagship product, the cold-storage Web3 wallet CoolWallet Pro, now supports both Arbitrum and Optimism, as well as Polygon.) Beyond rollups, other scaling solutions exist too, such as state channels and sidechains.
What are the differences between Optimistic and ZK rollups?
The two competing kinds of rollups each have their use cases, and neither is a clear winner at this time in all respects. Let’s dive into the comparisons.
What are Optimistic rollups?
Optimistic rollups get their name from the fact that they optimistically presume the transactions they roll up are unproblematic and will be validated. They function by giving about a week for people to dispute the transactions contained in any batch before they are ported onto the layer-1 chain. If no transactions are contested during that time, the rollup is completed.
Potentially fraudulent transactions are contested through a dispute resolution mechanism. When an invalid transaction is noticed, the entity behind it is penalized and the transaction is canceled. The dispute resolution mechanism has the capacity to validate fraud proofs as well as detect suspicious transactions.
Since the party that sends the batch has typically put up a bond as collateral, there is a deterrent to bad actors. It’s worth pointing out that the deterrent works two ways: both the party supplying the batch as well as the one calling out the fraud have put up a bond.
When the dispute resolution mechanism goes into effect, the transaction is executed again on the layer-1 network, where it is resolved and one party’s bonded ETH is penalized. There is also a manager contract that replaces the specific function calls with rollup chain states to make sure the transaction is redone just as it was the first time.
The system is able to function well with just one trustworthy party monitoring the rollup.
What are ZK rollups?
ZK rollups function similarly to Optimistic rollups in that they also batch, or “roll up,” many transactions on a layer-2 before sending them to the Ethereum mainnet. They differ from Optimistic rollups in that instead of waiting a week for validation, they use something called a ZK-SNARK (short non-interactive argument of knowledge) to validate the transactions.
SNARKs use mathematical calculations to allow the transaction to proceed without disclosing the underlying data. It’s a little like being able to check if a password is correct without actually seeing the password. This makes ZK rollups especially well-suited for privacy needs.
The built-in verification method allows ZK rollups to process transactions rapidly and without a dispute settlement period, as occurs with Optimistic rollups. Any fraudulent batches are detected immediately with ZK rollups and rejected.
Optimistic vs ZK rollups comparison
The primary selling point for ZK rollups is their speed, which beats out Optimistic rollups because there is no period for contesting the transactions. This means that ZK rollups can be recorded on the ledger of the layer-1 chain very quickly.
The main downside of ZK-rollups is that they use a lot of hash power to handle their cryptographic proofs. This increases their cost, and high-end computing power is required to create the proofs. This may make ZK-rollups a less appealing choice for smaller projects.
Optimistic rollups are currently easier to scale, as they are more immune to the challenges of a surge in transactions, which could slow ZK rollups considerably.
The two also differ in how they handle smart contracts on the Ethereum mainnet. Optimistic rollups are able to run them right on-chain, while ZK rollups cannot directly do so.
Optimistic rollups have another advantage in that they leverage financial incentives to promote honest transacting, discouraging people from submitting false claims about fraud as well as bad batches due to the bonded ETH requirements.
Downsides of rollups
While the technology is able to piggyback on the security offered by the Ethereum mainnet, the smart contracts of the rollups themselves can still hold bugs. Audits can decrease this risk, but it’s still worth keeping the risk in mind when selecting a provider of these services.
Since these layer-2 scaling solutions are both fairly new, there are still issues with centralization and developers retaining significant amounts of power over the networks they have built. It’s theoretically possible that this power could be exercised to temporarily halt or even switch off the networks.
Many companies in the rollup space, such as Optimism, have plans for decentralization and aim to switch over to some form of user governance in the future.
While the last year has seen various solutions battle for supremacy within each technology (such as Arbitrum vs Optimism), the war for overall domination is just starting, much like a general election, with supporters on both sides, with the likes of Vitalik Buterin stating that ZK rollups will beat Optimism chains in the long run, while his mom is actually a team member at Metis, an Optimism scaling protocol. Of course, it’s never as simple as that, and factors like network effect, industry support and use cases will always play a deciding role.
Is it maybe just possible that both types of solutions can thrive in the long run? Or will they be rendered obsolete when Ethereum rolls out sharding? Only time will tell.