Lampros Tech

Understanding zkRollup and zkProofs

What is a Rollup?

In 2018, a GitHub repo titled “roll_up” was present for developers to read and understand the concept. Written under the alias of Barry Whitehat, the repo caught Vitallik’s attention. Shortly after, he produced another repo titled ‘zkRollups’.

Rollups are a scaling solution brought to Web3 to increase the transaction rate and throughput within the blockchain network.

A validator would bundle either data or transactions occurring on the network and send them as one message. The validator wouldn’t need to publish every transaction after verification and validation. They can simply send one message containing the details of multiple transactions that have taken place.

Functioning of Rollup

A “Rollup” works with the help of two things: smart contracts and Merkle Trees.

Here, a smart contract deployed on the chain contains the ‘state root’, i.e. the root of the Merkle tree… or simply put, the root contract contains the address of the Merkle root.

So, even if the computation of the validation and the work on validation are kept off-chain, by accessing the Merkle root (from the smart contract or Rollup contract), one can rework the validation. So, Rollups work such that the data can be recomputed from the on-chain data.

Psst… Don’t know about Merkle Trees yet? Fret not, read up on Merkle Trees here.

Further, one can send a “batch”, a cohort of transactions in a condensed format. The ‘batch’ mentioned is marked with the previous state root and a new state root. 

If the previous state root matches the new state root within the contract, the code updates to the new state root. Now, a question that can arise is, “How do we realize that the post-state roots in the batch are correct?”

Well, we need some proof that says, “The data present is valid”, or “This is not a fraudulent transaction”. To attest to the same, we have two types of rollups that can show proof of validation: validity proofs and fraud proofs.

Types of Rollup

There are two main types of rollups. This difference is based on how the validity proof is posted on layer 1 of the network.

Optimistic Rollup

One can be optimistic and look at the bright side of life when things are low. But when a bundle of transactions is validated as safe or true on the blockchain, by default, you call it an optimistic rollup.

Here, the validity proof doesn’t take place but is published beforehand. And upon challenging the authenticity, the code runs a fraud-proof check to make sure that the transactions present in the smart contract are valid.

This version assumes that all transactions are valid. However, what they post is checkable and verifiable by others in the network.

Further, since it involves money, one assumes that it is safe and valid by default. Consequently, if the transaction turns out to be fraudulent, the transaction data is reverted and the block validator is slashed; i.e., whoever presents false transaction data on the blockchain loses their staked ETH and won’t be able to validate blocks ever again.

A merit of the optimistic rollup is that they can also process smart contracts and transactions with other cryptocurrencies.

Moreover, Vitalik himself has said that better alternatives to optimistic rollups may be available soon.

zkRollups

The “zk” stands for “zero knowledge”, In essence, the protocol allows for the validation of data with minimum proof by running a computation off-chain and submitting a “validity proof” to the execution layer of the blockchain.

The zkProof validator checks a specific part of the data presenting each transaction it receives and then submits it to the blockchain.

The specific part of the data checked is known as the “witness,” and proving the validity of the data with the least amount of information enables security and safety.

It is said that this method of bringing data and transactions off-chain, rolling them up in bundles, and validating the authenticity of transactions and data can increase the throughput to 500+/12 sec, which is as good as 2500+ transactions a minute and 150,000+ transactions in an hour with an exponential calculation. It’s as fast as Visa but in Web3.

More on zkRollups

A Zero-Knowledge Rollup (zkRollup), created by mathematician and computer whiz Vitalik Buterin, is a scaling solution. Carefully understanding that rollups are a great way to scale a blockchain network, he proposed a zk rollup as a measure to deal with the Web3 trilemma.

The Web3 trilemma occurs when focusing on two parts of DLT leads to the susceptibility of another feature of the blockchain network. The three important features are scalability, decentralization, and security.

How Does zkRollups Address the Blockchain Trilemma?

Well, we understand that rollups enable higher throughput on the network, but there is a slight chance for centralization when they occur. With zkRollups, the validators are provided with minimal information to start with. Incapacitating the validators with the least information means they cannot commit wrongs while validating, and the validation process is faster.

Consequently, the privacy of the parties involved in the transaction is not compromised.

Eventually, the validator can send a message to the blockchain containing the relevant information about the transactions verified.

What is zkProofs in Web3?

The protocol is to have zero knowledge (not entirely zero, but minimal knowledge) and prove data transactions enable trust and privacy in a decentralized environment.

Essentially, this allows for third parties to access data for verification and helps verify data or prove the integrity of the data without revealing much information about the transaction/ data worked on.

zkproofs image showing a prover and a verifier working on validation of data within the network

Why use the zkProof method?

Some other reasons why zkProofs are beneficial are as follows:

  1. Privacy: With zkProofs, users can prove ownership or knowledge of data or assets without revealing any information about themselves. This can be useful in scenarios such as voting, where privacy is crucial.
  2. Security: By using zkProofs, users can prove their identity or ownership of assets without revealing their private keys. This can help prevent fraud and hacks.
  3. Scalability: ZkProofs can help improve scalability in Web3 by reducing the computational burden associated with verifying transactions. This can be important when many transactions need to get processed quickly.
  4. Interoperability: ZkProofs can also help facilitate interoperability between different blockchain networks. With zkProofs, users can prove ownership or knowledge of assets across multiple networks without revealing their private keys.

Finally, zkProofs is beneficial to the decentralized web, where one can easily bundle up data and ship it to the network’s block. The validation becomes easier, and this method makes it safer.

Using zkProofs in Web3

Anonymous Payments

zkProofs apply to anonymous payments, thus enabling privacy. Private blockchain networks can adopt this method to allow validation without nodes needing the transaction data.

ID protection

zk proofs enable privacy and ID protection for everyone online. Identity management systems present can borrow the ideology to protect user-sensitive details on the web. This can also extend to a new format of decentralized identity and the ability for users to control their ID data.

Authentication

zkProofs can simplify the verification process for the platform and the user with minimal knowledge by using something analogous to a signature or key to the identity.

Then the party interested in storing such data need not worry about disk space while providing an easier means to authenticate and verify.

Verifiable Computation

Having proof that can be outsourced and verified later saves time and computational energy. The zkProof method allows one to verify the data again by computing it from another entity while maintaining the results.

The result is the computational process that submits proof that the program execution was correct.

Decentralization

That’s the main goal of Web3, and yet when voting occurs in DAOs, there are probable chances for collusion, a state where a cohort of users coordinate and influence voting.

With the onset of zkProofs, due to the minimal viable information present around them, it’s not possible in the smallest amount to aggregate and influences the decisions within the network.

Summary

This blog spoke of zkRollups and zkProofs as a means of maintaining security within the decentralized system while making sure that data is not.

In short, zkRollups is a protocol responsible for bundling transactions and sending them as one message to the network. By doing so, the verifier and the prover work with minimum data and maintain decentralization, and security, and saves on storage space.

Moreover, zkProofs is a great way to collaborate while maintaining anonymity and security.

Want to know more about the security of the blockchain network? Check out our blog on What Is Encryption in Blockchain Technology? and get learning!

Leave a Comment

Your email address will not be published. Required fields are marked *