# Fraud Proof

Rooch Network uses the Fraud Proof based on Optimistic Rollup (opens in a new tab) mechanism to ensure the security of Rooch DApps.

Rooch will also support Hybrid Security enabled by ZK Proof.

## flexEmu - A General Purpose Emulator with Per-Step Proof

Generating Fraud Proof is a critical piece for ensuring security of the off-chain system in an Optimistic Rollup system. For this purpose, we have designed flexEmu (opens in a new tab).

Find the specifications of flexEmu on GitHub (opens in a new tab).

### Multi-Round Interactive Arbitration

The Fraud Proof generation is based on a multi-round interactive proving process. The objective is to find the exact step of instructions that caused the divergent state between the Challenger and the Defender.

Here's a detailed explanation of how it works:

Assuming that a block contains `N`

steps to execute. The challenger and defender first send proofs of their respective states after the final execution (i.e., step `N`

) to the arbitration contract, and if the arbitration contract finds that the results are inconsistent, it will ask both sides to provide the proof of the state of step `N/2`

.

- If the results are consistent at this point, the disagreement must have happened between steps
`N/2`

and`N`

, and the arbitration contract will require both parties to provide the proof of the step`(N/2 + N) / 2`

. - If the results are inconsistent, the disagreement is between step
`0`

and step`N/2`

, and the arbitration contract will take the proof from both sides for step`(N/2) / 2`

.

All parties will keep on having multiple rounds of proving process like this, until the arbitration contract identifies the exact step of instructions that caused the divergent state.

At this point, the challenger and defender have already agreed on the intermediate state proof of the previous step (`m-1`

), and the arbitratioin contract only needs to perform the `m`

step based on the state of the `m-1`

step, and then compare the generated state proof with the proofs provided by the challenger and defender to determine which side has provided the correct state.

The side that provides the fault state will be slashed with economics mechanisms.

Tokenomics will be published in 2023 Q4

### flexEmu Advantages

flexEmu is designed to be a general purpose bytecode emulator with per-step state proof. Its general purpose provides 2 advantages to Rooch's implementation:

**Compatibility with Arbitrary Layer1**Any Layer1 that supports MIPS operation code set will be able to arbitrate proofs generated by flexEmu. This enables Rooch to be Layer2 for arbitrary Layer1s.**Easy for Maintenance, Debugging and Upgrades**If there are any major upgrades to MoveVM in the future, flexEmu can quickly accommodate them.