Zk-Rollup

BYqe...FixS
2 Mar 2024
59

What is rollup?

Rollups allow blockchains to aggregate transaction data and process it off-chain. After processing the data, the final result is transferred to the underlying chain as required. Processing so many transactions simultaneously eliminates the possibility of congestion on the blockchain and allows calculations to be faster and cheaper. Rollups fall into two categories: Optimistic and Zk-rollups.

  • Optimistic rollups : Optimistic rollups operate on the assumption that all transactions combined are legitimate. These transactions go through a waiting period before being sent to the blockchain. During this waiting period, the network may object to suspicious transactions. Optimism, Arbitrum and opBNB are examples of optimistic rollups.
  • Zk rollups : Unlike optimistic rollups, zk-rollups verify all transactions through zero-knowledge backed validity proofs. Although more complex to implement, zk-rollups are designed to eliminate the dispute resolution time associated with optimistic rollups and theoretically process transactions faster.

Now, let's examine zero knowledge proofs.

What is a zero knowledge proof?

Zero-knowledge proof (ZKP) is a cryptographic tool that allows one party (the prover) to prove to another party (the verifier) ​​that a statement is true without sharing any information about its content.
A ZKP must have three features:

  1. Completeness : If the statement is true and both parties are sincere, the proof will always confirm the truth of that statement.
  2. Robustness : A dishonest verifier should not be able to convince an honest verifier that a false statement is valid, except in very rare cases.
  3. Zero Knowledge : It is the most defining feature. At the end of the process, the verifier only learns that the statement is valid, without having any insight into the content of the statement.

So, how does a ZKP serve? ZKP's servicing process can be divided into three stages:

  • Witness : In the first stage, the prover presents the verifier with a piece of confidential information, or in other words, a "witness". The idea is to prove to the verifier that the prover has access to certain data without explicitly sharing that data. The witness prepares a series of questions about the information that can only be answered by a legitimate prover.
  • Challenge : In this phase, the verifier challenges the prover by randomly selecting questions from the question set.
  • Answer : The prover successfully answers the verifier's questions to prove that he or she is trustworthy. 

Now we know what rollups and ZKPs are. Let's bring these together under one umbrella and examine how zk-rollups serve.

How Are Zk-Rollups Served?

Zk rollups have two basic components:

  • On-chain contracts : Smart contracts define the rules that the zk-rollup protocol will follow when operating. It consists of the main contract and the verifier contract. The master contract stores blocks of rollups, tracks deposits, and makes important updates. The verification contract verifies the created ZCPs.
  • Off-chain virtual machines : These machines process transactions at Layer 2, away from the underlying Ethereum blockchain. Off-chain virtual machines operate independently of the Ethereum chain.

Although zk-rollups are on a unique layer, they are intertwined with the Ethereum blockchain. They do not populate Ethereum with all the details of transactions. Instead, they provide cleverly put together summaries, ensuring that the base layer doesn't get cluttered with too much detail and remains efficient.

Pros and Cons of Using Zk-Rollup

So, what are the advantages of using zk rollup? Advantages include:

Pros of Zk rollups

  • High transaction rate : Zk-rollups transfer the transaction processing load from the base layer to a more efficient computational environment. Since transactions are not processed separately on the chain, the overall transaction rate increases.
  • Congestion reduction : Zk-rollups reduce congestion on the blockchain, ensuring efficient Layer 1 operations. Moreover, full nodes only need to store zero-knowledge proofs rather than the entire data.
  • Decrease in fees : As a result of the decrease in congestion, zk-rollups generally reduce the fees.
  • Security measures : Zk-rollups include security measures that allow users to withdraw their funds even if there are problems with the rollup network. This is a distinct advantage over sidechains, which can compromise funds during network errors.
  • Shorter transaction objection period : With zk-rollups, only the validity proofs in the rollups need to be verified, which shortens the transaction objection period.

Cons of Zk rollups

  • Complexity : The biggest drawback of zk-rollups has to be complex in nature. They are much more complicated to execute compared to optimistic rollups.
  • Restriction by the base layer : Zk-rollups, for all their efficiency, are still subject to the limitations of the underlying base layer.
  • Dispersion of liquidity : All Layer 2s lead to dispersion of liquidity throughout the ecosystem. Low liquidity in base layer protocols can create potential problems.
Scalability is often touted as the “holy grail” of blockchain technologies. If a system is not working optimally, there is no point in using it. Both optimistic and zk rollups have offered an elegant solution to this long-standing problem. Zk-Rollups promise higher speeds, less traffic and superior safety thanks to their unique approach. Yes, this type of rollup is complex, but its potential is huge. Anyone interested in the future of digital currencies needs to know what zk-rollups are. As we strive for better blockchain performance, it will be very useful to learn about zk-rollups and what these solutions promise for the future. 
  • Blockchain ölçeklenebilirliğinin düşük olması düşük hızlara, yüksek işlem ücretlerine ve kötü bir kullanıcı deneyimine yol açar. Bu sorun, Katman 1 (örn. bölümleme) ve Katman 2 (örn. rollup'lar) çözümlerle düzeltilebilir.
  • Katman 1 çözümler blockchain'in kendisini yükseltmeyi amaçlarken Katman 2 çözümler ise mevcut zincirin üzerinde bir çerçeve oluşturur.
  • Rollup'lar popüler bir Katman 2 çözümüdür. Daha hızlı hesaplama için işlemleri zincir dışında bir araya getirirler. 
  • Zk-rollup'lar, sıfır bilgi ispatı adındaki kriptografik bir tekniği kullanan bir tür rollup uygulamasıdır
  • Sıfır bilgi ispatları, dayanak verileri paylaşmadan bu verilerin doğrulanmasına imkan tanıyarak işlem gizliliği ve güvenliği sağlar.

What is ZkEVM and How Can It Improve the Ethereum Ecosystem?

Ethereum's developers did not intend to use ZKP technology when they started developing the network in 2014 . However, ZKP, which has started to attract more attention in recent years, is expected to play a much more important role in the blockchain world. Therefore, efforts to combine ZKP technology with Ethereum's virtual machine have increased. 
To understand what zkEVM is, let's first briefly touch on the two basic concepts it is based on: zk-rollup and EVM. 

What is Zk-Rollup? 

Rollup is a scaling solution that compiles multiple executing transactions off the main chain and sends the data back to the main network as a single transaction. This process increases the transaction rate while reducing the cost of executing these transactions.
In Ethereum, transactions within a rollup are compressed and sent to the Ethereum mainnet for the cost of verifying a single transaction. The Ethereum mainnet maintains consensus and verifies the transaction data contained in the rollup.
Zk-rollup is a type of rollup that uses ZKP technology, a cryptographic technology that allows the validity of a piece of information to be confirmed without sharing the information itself. Zk-rollups do not need to broadcast all transaction data to the Ethereum mainnet. They only need status differences, such as changes to user account status, and proof of validity. In this way, gas fees decrease.
The security of zk-rollups comes from ZKP cryptography, where cryptographic tools are used to verify the proof and ensure trustlessness. This differs from other rollups, such as optimistic rollups, which derive their security from economic game theory, where bad actors are deterred by potential losses and challengers are motivated by incentives.

What is EVM?

EVM is a state machine on which the Ethereum accounting system and smart contracts run. Each time a smart contract is executed, the EVM is triggered to change from the old state to the new state. When moving from one block to another, the rule for calculating new and valid states is determined by EVM.
State is an important concept for Ethereum. It is a Merkle Patricia Trie data structure that represents the current state of Ethereum and allows anyone to track transaction information from the current block to the genesis block.
The aim of all nodes participating in the operation of Ethereum is to ensure continuity and consensus. This allows all nodes to see exactly what the current status is. EVM plays a crucial role in maintaining this consistency.

How Does ZkEVM Work? 

EVM does not support ZKPs by default. zkEVM aims to ensure the continuity of the Ethereum state as well as providing proof that all information is correct. In this way, various factors involved in the calculation of these processes are verified and security and confidentiality are protected. 
zkEVM does this by replicating the Ethereum environment in the form of zk-rollups. It takes the initial state, calculates all operations, and then outputs a new, updated state along with the ZKP. This proof is sent to a validator smart contract, which checks the accuracy of the output of both the initial and new state without having to validate all transactions separately. 
Since zkEVMs are EVM-based, developers can easily connect their Ethereum DApps and smart contracts to zkEVMs without having to do ZKP development work. In other words, zkEVMs enable zk-rollups to execute smart contracts as well as token swaps and payments that were previously supported without zkEVMs.   
Thanks to the compatibility feature of EVM, developers can create new products using existing EVM tools and the programming language Solidity, as well as benefit from the high security offered by zkEVMs. The same benefits apply to users. They can continue to use the same dApps and familiar tools with increased security and privacy.

Difference between EVM Compatibility and EVM Equivalence 

When a blockchain is referred to as EVM compatible, it means that it offers an environment that can deploy DApps written in the Solidity programming language. Solidity is designed to develop smart contracts that run on the Ethereum network. 
In fact, Ethereum developers can copy and paste the code of existing DApps from Ethereum and deploy it on other EVM-compatible chains with minimal changes. For users, any EVM-compatible chain address is identical to their Ethereum address . 
This means the addresses are compatible with popular wallets such as Metamask and Trust Wallet. Major EVM-compatible chains today include BNB Chain, Avalanche C-Chain and Polygon. 
EVM compatibility should not be confused with EVM equivalence. Equivalence means that, from the perspective of DApp developers, Layer 2 rollups are almost exactly the same as Layer 1 Ethereum. 
To use an operating system analogy, EVM parity is like a user restoring their files and settings via Apple Cloud if both their old computer and their new computer run on Apple's operating system.
In contrast, EVM compatibility means that in case of switching to Windows system on the new computer, the original files must be downloaded and converted from cloud storage to recover the preferred settings and old files. 

Different ZkEVM Types

Generating and verifying ZKPs directly using EVM is extremely slow because Ethereum was not designed to support ZKP technology in the first place. In some cases, this process can even take several hours. However, it is essential to strike a balance between EVM compatibility and ZKP efficiency.
Ethereum founder Vitalik Buterin has grouped zkEVMs into the following four types. Similar to the Blockchain impasse, each of the types needs to strike a different balance between ZKP performance efficiency and EVM compatibility.    

Type 1: Consensus-level parity: A zkEVM fully equivalent to Ethereum

A Type 1 zkEVM, also called enshrined rollup, is equivalent to Ethereum at the consensus level, and the zkEVM chain state and transactions are the same as those on Ethereum. They can jointly verify blocks and be used directly with Ethereum execution clients.
Type 1 zkEVMs make Ethereum more scalable and can be added directly to the Ethereum mainnet. The disadvantage is that ZKP efficiency is extremely poor and requires a large amount of calculations for verification. The solution is to use dedicated integrated circuits or large-scale parallel verifiers for zk-SNARKs in the future.
Type 1 zkEVMs with high ZK efficiency would be the most ideal form of zkEVM. Nowadays, many projects are developing or researching this type of zkEVM.

Type 2: Bytecode level equivalence: Fully equivalent to EVM

Type 2 is fully equivalent to EVM, but not equivalent to Ethereum. It differs from Ethereum in terms of data structures (such as block structure and state tree) and deletes some stack operations that are not ZK friendly. 
It is fully compatible with Ethereum's existing DApps, debugging tools, and developer infrastructure. Equivalence at the bytecode level can slightly reduce proof times. The most obvious disadvantages of type 2 are that it is expensive, not synergistic with ToM, and low efficiency. 

Type 2.5: Similar to Type 2, but with modified gas fees

Type 2.5 has the same advantages and disadvantages as Type 2, but gas fees are slightly lower.

Type 3: Equivalence at bytecode level: Nearly equivalent to EVM

Building on Type 2, Type 3 further compromises compliance to increase ToM efficiency. Deletes functions that are difficult to implement in zkEVM, such as pre-compiles. Therefore, some code used in DApps that require this functionality needs to be rewritten.

Type 4: Equivalence at development language level: High-level language equivalent to EVM

Type 4 EVMs have the highest ToM performance, but their compatibility is relatively below average.

Differences between Optimistic and Zero Knowledge Rollups


With the increasing demand for crypto, the capabilities of some blockchains are being tested to their limits. This can lead to network congestion and expensive transaction costs. To solve this problem, scaling solutions are being developed and tested to increase transaction rate and speed. Such solutions can be divided into two groups: Layer 1 and Layer 2.
Layer 1 scaling solutions, such as partitioning, make changes directly to the main blockchain (also called the base or Layer 1 blockchain). Layer 2 scaling solutions run on top of the Layer 1 blockchain. Examples of Layer 2 scaling solutions include state channels, sidechains, and blockchain rollups.
Blockchain rollups are protocols designed to enable high transaction rate and lower costs. They aim to solve this problem faced by many popular blockchains by reducing data size and aggregating transactions for more efficient transaction processing and storage.

What is Blockchain Rollup?

Rollups are a Layer 2 solution that aggregates transaction data and transfers it from the main chain (or Layer 1 blockchain) . Transactions are then executed off-chain , while assets are held in an on-chain smart contract. Upon completion of the transaction, the transaction data is sent back to the main blockchain .
In theory, any Tier 1 solution can implement rollups to increase transaction efficiency in terms of transaction rate. A blockchain can increase the number of transactions processed and recorded within a given time period with rollups.
There are currently two types of rollups – optimistic rollups and zero knowledge (zk) rollups.

What is Optimistic Rollup?

Optimistic rollups are protocols that increase transaction rate by combining multiple transactions into batches for later processing off-chain. The transaction data is then recorded on the main chain with data compression techniques that help reduce cost and increase speed . According to Ethereum , optimistic rollups can increase scalability by 10 to 100 times.

How do optimistic rollups verify transactions?

Transactions are valid by default to increase efficiency. You may be wondering whether this compromises security to increase transaction processing speeds. However, optimistic rollups use a scheme that includes a dispute resolution period, also called a 'challenge period', and is based on proving fraud. During this period, anyone monitoring the rollup may be challenged with proof of fraud to verify whether the transaction was processed correctly .
If errors are found in this batch, the rollup protocol fixes the errors by reexecuting the incorrect transactions and updating the block. Parties who approve the execution of erroneous transactions are punished.

Limitations of Optimistic Rollups

While there is no transaction verification process, there is a challenge period that increases the time it takes for transactions to settle and is not available in zk rollups.
Chains using optimistic rollups also have lower finality than zk rollups. Finality is the measure of how long a user must wait for a reasonable assurance that transactions will not be reversed or altered. Withdrawals are delayed on optimistic rollups because the challenge period must end before the funds can be released. In contrast, withdrawals from zk rollups can occur as soon as the zk rollup smart contract verifies the proof of validity.
Some people also consider optimistic rollups to be less efficient than zk rollups. In optimistic rollups, all transaction data must be published on-chain before transactions can be finalized. In Zk rollups, only validity proofs need to be on-chain.

What is Zero Knowledge (zk) Rollup?

Zero-knowledge rollups are protocols that bundle transactions into batches to be executed outside of the main chain. A zk rollup operator sends a summary of the required changes for each batch following the execution of transactions in a batch. Operators have an additional role in producing validity evidence to prove that changes are correct. These proofs are significantly smaller than transaction data, so it is faster and cheaper to verify the proofs.
In Ethereum , zk rollups reduce transaction data through compression techniques when writing transactions as call data to Ethereum, thus reducing user fees.

How do zk rollups verify transactions?

Zk rollups use zero-knowledge proofs ( ZKP ) to verify transactions. ZKPs are used by a person, called a prover, who wants to convince another party, called a validator, that he or she has information, thus validating a transaction.
How does it work:

  1. The prover presents a mathematical proof that only he or she can create.
  2. The validator uses this mathematical proof to verify the validity of the transaction.
  3. Information can receive proof of validity without having to share the content with the verifier.

Pros of Zk rollups

Zk rollups can offer a high level of security for users if implemented properly. One important feature that contributes to this security is the use of zero-knowledge validity proofs. This ensures that the network can only operate in a valid state and that operators cannot steal user funds or disrupt the system in any way.
Another plus of Zk rollups is that users do not need to monitor the network. Zk rollups store all data on-chain and require proofs of validity. Therefore, an operator cannot cheat and users do not need to worry about errors in the network. In addition, zk rollups prove token ownership through data availability, allowing users to withdraw their funds to the mainnet without having to cooperate with operators .
Similar to optimistic rollups, zk rollups implement an off-chain execution mechanism to increase transaction execution speeds.

Differences Between Zk Rollups and Optimistic Rollups

Below is a summary of the differences between optimistic and zk rollups.

What is the Future of Zero Knowledge and Optimistic Rollups?

The future of zero knowledge and optimistic rollups is still a question mark. As crypto and blockchain become adopted by more people, rollups can play a vital role in increasing blockchain efficiency. Blockchains will likely continue to test various scaling solutions such as partitioning, rollup, and layer 0. We may also see new solutions being created and implemented alongside or instead of rollups.

As the demand for crypto increases and the limits of existing blockchains are pushed, many different scaling solutions have been introduced. In this article, we examined the inherent differences between two different types of rollups: optimistic and zero-knowledge. As application testing of rollups continues, we may see more variations that could eventually help us achieve scalability for widespread adoption.




https://www.bulbapp.io/u/BYqeEQZZWzQn7MVpopges4zH3qe3yeNDunPVY9f3FixS/erendurden


https://www.bulbapp.io/p/db515842-9028-4ac1-a80e-d8112f000844/ethereum?s_id=74b5b9ba-253c-4634-b86f-c79e1b57b220


https://www.bulbapp.io/p/02d32e24-fe40-41a3-8ef8-1e141a4157dc/10-nfts-that-sold-for-the-highest-prices-ever?s_id=2143dede-db57-4d14-9d6a-c1c168c5324c


https://www.bulbapp.io/p/6cf832a8-b0c4-4898-9e31-f6e4848e3c00/what-is-ido-initial-dex-offering?s_id=c8b8eb1d-4cc0-40b7-b9fa-1b1aa568412b

Write & Read to Earn with BULB

Learn More

Enjoy this blog? Subscribe to erendurden

5 Comments

B
No comments yet.
Most relevant comments are displayed, so some may have been filtered out.