Ethereum is currently the most popular blockchain development platform, hosting the largest number of decentralized apps (DApps) in the blockchain space. However, due to its popularity, the network struggles with congestion in times of increased demand.
This increased load on the network leads to increased gas fees and slower transaction times, which greatly impacts the network’s scalability. Layer 2 scalability protocols are one of the many solutions that have been brought up to solve Ethereum’s scalability issue.
Layer 2 (L2) solutions usually work by running transactions off the main chain, and in this post we’ll be looking at ZK-Rollups in particular.
What is a Rollup?
Rollups process transactions off-chain, primarily on a rollup-specific chain, and then batches, compresses, and delivers the transaction data to the main Ethereum chain; this lessens the strain on the main Ethereum network by actually executing those transactions.
In simple terms, Rollups are a scaling solution for Ethereum that work by taking transactions off the main blockchain where they are processed. SNARKS are then sent back to the main blockchain as verification.
What is a ZK Rollup?
ZK Rollups (Zero Knowledge Rollups) are Ethereum smart contracts that expand the network by executing numerous transactions off the main blockchain.
ZK Rollups function by aggregating or “rolling up” hundreds of off-chain transfers into a single transaction. It then returns to the main chain with a SNARK (short non-interactive argument of knowledge) as evidence of validity.
This ensures that instead of hefty transaction data, only the validity proof has to be kept on the main Ethereum network, making ZK Rollups a faster and cheaper way to confirm transactions.
Zero-knowledge techniques are mathematical approaches for verifying things without disclosing or sharing the underlying facts.
Consider a payment app that checks if you have sufficient funds in your bank account to perform a transaction without learning anything more about your account balance.
Or a programme that verifies the authenticity of a password without having to process it. In this approach, zero-knowledge proofs can assist in the more private and secure brokering of a variety of important agreements, transactions, and interactions.
What is an Optimistic Rollup?
Optimistic rollups presume that the transaction data sent to the Ethereum network is true and legitimate, as the name implies.
When an invalid transaction is spotted, the network should cancel the transaction and penalize the party responsible. Optimistic rollups do this by implementing a dispute resolution mechanism that can validate fraud proofs, detect fraudulent transactions, and dissuade bad actors from submitting more invalid transactions or wrong fraud proofs.
The party that is able to send batches of transactions to layer 1 in most optimistic rollup implementations is required to offer a bond, which is generally in the form of ETH.
Both parties have risked their ETH in this transaction, the one supplying the transaction data batch and the one presenting the fraud evidence.
This implies that if any party engages in any wrongdoing, their ETH will be forfeited. The suspicious transaction is completed again, this time on the main Ethereum network, whenever fraud evidence is presented.
If another network participant notices an improper transaction, they can file a fraud proof. The system enters dispute resolution mode when a fraud-proof is presented.
The suspicious transaction is re-executed in this manner, but this time on the main Ethereum chain. If the execution reveals that the transaction was fraudulent, the party that submitted it is penalized, generally by having their bonded ETH reduced.
To prevent unscrupulous actors from flooding the network with false fraud proofs, parties desiring to submit fraud proofs are normally required to down a bond, which may be slashed.
A manager contract is built that substitutes specific function calls with a state from the rollup chain to ensure that the transaction is replayed with the identical state it had when it was first executed on the rollup chain.
This is one of the more difficult aspects of optimistic rollups, and it’s generally accomplished by writing a separate manager contract that substitutes specific function calls with the rollup’s state.
It’s worth emphasizing that the system can function normally and identify fraud even if there is just one trustworthy entity monitoring the rollup’s progress and submitting fraud evidence as needed.
Rather than being a recurring event, entering the dispute resolution procedure should only be a one-time process. When it comes to ZK rollups, there is no dispute settlement. ZK rollups are possible thanks to a powerful encryption technique known as Zero-Knowledge proofs. In this technique, a ZK-SNARK cryptographic proof is included in every batch delivered to layer 1.
When a transaction batch is submitted, the layer 1 contract may check the proof straight away, rejecting any batches that are inaccurate.
Optimistic Rollups vs ZK Rollups: The Differences Explained
The speed of on-chain processing is a fundamental benefit of zero-knowledge rollups over optimistic ones. Zero-knowledge rollups are recorded to the underlying blockchain ledger faster than optimistic rollup transactions since there is no waiting period during which the transaction’s legitimacy might be questioned.
The cryptographic validity proofs utilized by zero-knowledge rollups, on the other hand, need a lot of hash power to compute. As a result, optimistic rollup solutions may be more helpful for projects with less on-chain activity.
Due to the absence of the validity proof calculation, optimistic rollups are now more scalable. A programme that uses optimistic rollups is unlikely to be affected by a large surge in transactions, while a zero-knowledge rollup solution may be severely slowed.
The way optimistic rollups and ZK Rollups interact with smart contracts on the Ethereum network is another distinction. Optimistic rollups can run smart contracts on the main blockchain directly. On the other side, ZK Rollups are unable to execute smart contracts on the main chain.
Layer 2 rollups are one of the many solutions that are being developed to solve Ethereum’s scalability. ZK Rollups seem to be the more popular option at this point, however, we cannot count out Optimistic Rollups which are also a very promising solution for scaling Ethereum.