Optimistic and Zero-Knowlege Proof Rollups: The Future of Scalability and Privacy on Ethereum

Robbie Geoghegan
3 min readDec 10, 2022

--

Optimistic and zero-knowledge proof rollups are two types of layer 2 solutions that have gained traction in the Ethereum community as a way to improve the scalability of the network. These solutions aim to move some transactions off of the main blockchain, known as layer 1, and onto separate, secondary blockchains known as layer 2, in order to reduce congestion and lower fees.

Optimistic rollups use a technique called “optimistic concurrency” to allow transactions to be processed off of the main chain without needing to be confirmed on-chain. This allows for faster and cheaper transactions, as they are not subject to the same fees and confirmation times as on-chain transactions.

For example, an optimistic rollup may allow users to conduct multiple transactions off-chain, and then submit a single on-chain transaction to the main chain that includes the results of all of the off-chain transactions. This reduces the number of on-chain transactions and therefore the amount of congestion on the main chain.

However, this approach relies on the assumption that the off-chain transactions are valid, and therefore requires a mechanism to ensure that invalid transactions are not included in the on-chain transaction. This is typically done through the use of a fraud-proof mechanism, which allows any user to challenge an invalid transaction and have it overturned.

Here’s a code snippet demonstrating how this works:

// create a new optimistic rollup
const rollup = new OptimisticRollup();
// conduct transactions off-chain
rollup.transact(...);
rollup.transact(...);
// submit a single on-chain transaction that includes the results of all off-chain transactions
rollup.submitBatch(...);
// if a transaction is found to be invalid, any user can challenge it and have it overturned
rollup.challengeTransaction(...);

Zero-knowledge proof rollups, on the other hand, use a technique called “zero-knowledge proofs” to allow transactions to be processed off-chain without revealing the details of the transactions to the main chain. This allows for greater privacy, as the main chain is not aware of the specifics of the off-chain transactions.

For example, a zero-knowledge proof rollup may allow users to conduct private transactions off-chain, and then submit a single on-chain transaction to the main chain that includes a proof that the transactions are valid without revealing any details about the transactions themselves. This allows for both scalability and privacy, as the main chain is not burdened with processing the individual transactions and the transactions themselves remain private.

Here’s a code snippet demonstrating how this works:

// create a new zero-knowledge proof rollup
const rollup = new ZKPRollup();
// conduct private transactions off-chain
rollup.transact(...);
rollup.transact(...);
// submit a single on-chain transaction that includes a proof of the validity of the off-chain transactions
rollup.submitBatch(...);

Optimistic and zero-knowledge proof rollups offer significant advantages over traditional on-chain transactions, as they allow for greater scalability and privacy without sacrificing security or decentralization. However, they also come with their own challenges and limitations, and it will be important for the Ethereum community to continue working on these solutions in order to fully realize their potential.

Support me by buying my children’s book: mybook.to/atozofweb3

--

--

Robbie Geoghegan

Data Scientist and Author of “ABCs of Artificial Intelligence” and “A to Z of Web3” available: https://mybook.to/abcsofai & mybook.to/atozofweb3