Analyzing the combination of the first zk fraud proof system, Optimistic Rollup, and ZKP.

Author: Layer N, RISC Zero Translation: Huohuo/Baihua Blockchain

Layer N is a new second-layer network based on Ethereum, using RISC Zero’s zero-knowledge virtual machine to ensure security through zero-knowledge fraud proofs (ZKFP), avoiding on-chain transaction replays, achieving high performance, instant withdrawals, and decentralized finance, and creating a new scaling method for next-generation financial products and protocols.

1. Introduction

When designing Rollup, a key design consideration is how to ensure security and trust while still improving the scalability of the underlying Layer 1. For Optimistic Rollup, security is guaranteed in the form of fraud proofs: proving evidence that the Rollup-level execution is incorrect and must recover to that state.

Unlike existing OP Rollup, the N-layer does not rely on on-chain transaction replays for fraud proofs. Instead, the N-layer employs a novel approach that utilizes zero-knowledge proofs and RISC Zero’s zero-knowledge virtual machine.

2. Introduction to Replaying

Op Rollup publishes state updates and the corresponding transactions that move the previous state to the updated state to the underlying L1.Suppose we, as validators of the rollup, claim that the final state published to Ethereum is invalid (or in other words, the updated state does not correspond to the transactions published to the DA by the rollup). From here, we submit a fraud proof and, if accepted, we will receive a substantial monetary reward.

The simplest form of fraud proof is to have the smart contract re-execute the transactions on Ethereum (L1) and check if the resulting state is accurate, which we call “simple replay proof”.

This can become quite expensive if the block is large.However, we can make a good observation here: if the transaction did not result in the expected state, then at some point, the instruction was executed incorrectly. “Interactive fraud proof” only needs to find that instruction. To build an interactive fraud proof, the validator performs a binary search of the search space through a series of challenges between the user and the operator, dividing the search space in half at each step. Once the validator points out the first instruction that was executed incorrectly, the smart contract will re-execute it and check if it is executed correctly. This clever technique is what Arbitrum calls dissection, which is essentially an extension of the replay proof we introduced.

However, this raises an important question: how do we ensure that the behavior of on-chain execution and off-chain execution is exactly the same?

3. Difficulties of Replay Proofs

The key constraint of simple replay proof and interactive proof is that the instructions must be able to execute in the same way on both the underlying layer and the Rollup layer.In other words, both implementations need to use the same virtual machine (VM) and ensure that the behavior matches.

For Optimism, their previous implementation was a slightly modified Ethereum virtual machine, which they called the Optimism Virtual Machine (OVM) based on Geth. Recently, they developed an on-chain MIPS instruction simulator in Solidity to run the Minigeth interpreter, allowing them to simulate and verify EVM state transitions. Arbitrum uses a modified version of WASM, which they call WAVM. This design means that Optimism and Arbitrum can respectively support any language targeting MIPS and WASM.

However, for Optimism and Arbitrum, this means that their respective virtual machines need to be implemented in Solidity so that Ethereum can simulate them. Moreover, each implementation needs to have identical behavior. In the case of non-interactive proofs (such as Optimism), gas costs are also significantly higher because we need to replay every transaction in the block.

4. Enter RISC Zero

We don’t need to replay all transactions on-chain, but we need to provide proofs that the state transition is incorrect. This is where RISC Zero zkVM comes in, which is a general-purpose zero-knowledge virtual machine.

With RISC Zero, any validator can generate concise proofs that demonstrate they have taken the correct DA transactions corresponding to a specific block and applied them to the initial state. RISC Zero achieves this by porting N layers of execution environment into its zkVM and generating receipts of correct execution in a trusted manner. If there is a dispute, the validator sends this proof to a Layer N smart contract on Ethereum, which then checks the validity of the proof. If the proof is valid and the claimed output state of the proof does not match the output state published on L1, fraud is present, and we must revert the block.

Instead of using WASM or EVM, we leverage RISC Zero by targeting the RISC-V instruction set, which is a common compilation target and thus supported by many programming languages. This provides broader possibilities for the shape and compatibility of future N-layer virtual machines.

Finally, although zero-knowledge technology has these benefits, full zero-knowledge rollup is currently limited by slow proof times and expensive computations. This is why Layer N adopts a hybrid approach – generating proofs only when fraud is possible. We refer to this approach as Zero-Knowledge Fraud Proofs (ZKFP).

5. Beyond OP Rollup

Imposing the requirement for users to have enough time to notice fraud and submit fraud proofs places a lengthy withdrawal time (typically around 7 days) on current OP Rollup: insufficient for composable financial products. Although ZKFP does not completely solve this problem, they are able to significantly reduce withdrawal time due to their “one-shot” approach. ZKFP is not the lengthy binary protocol on ETH, but allows for single-round transactions to prove/disprove fraud.

Looking ahead, Layer N is committed to using state-of-the-art technology within its Rollup ecosystem. For example, with the help of RISC Zero’s general-purpose zero-knowledge proof network Bonsai, Layer N will be able to fully transition to ZK-rollup, which means providing cryptographic security guarantees and instant withdrawals while maintaining high performance. As Bonsai allows any chain, protocol, or application to access its proof network, it can serve as a secure off-chain execution and computation layer for various use cases.

In conclusion, by collaborating with RISC Zero, Layer N is able to pioneer a new scaling approach with fewer trade-offs. As a result, we can build the next generation of truly usable financial products and protocols.

6. About Layer N

Layer N is a novel Layer 2 network designed to achieve decentralized finance at a massive scale on the Ethereum blockchain. Layer N aims to provide performance and user experience similar to modern financial networks, but completely on-chain and decentralized. Developers can leverage shared liquidity and seamless composability to build high-performance financial applications. Layer N is bringing the global financial system to Ethereum.

Like what you're reading? Subscribe to our top stories.

We will continue to update Gambling Chain; if you have any questions or suggestions, please contact us!

Follow us on Twitter, Facebook, YouTube, and TikTok.


Was this article helpful?

93 out of 132 found this helpful

Gambling Chain Logo
Digital Asset Investment
Real world, Metaverse and Network.
Build Daos that bring Decentralized finance to more and more persons Who love Web3.
Website and other Media Daos

Products used

GC Wallet

Send targeted currencies to the right people at the right time.