Proposing and Challenging

This guide explains how to participate in Facet's ZK Fault Proof system by running a proposer or challenger.

Overview

Facet's proof system allows:

  • Validity proofs: Anyone can submit direct ZK proofs (permissionless)

  • Fault proofs: Whitelisted proposers submit optimistic proposals

  • Challenges: Anyone can challenge incorrect proposals

  • Single-round resolution: ZK proofs resolve disputes instantly

The system uses optimistic proposals by default, with a fallback window where anyone can propose if whitelisted proposers are silent.

How It Works

Propose → Challenge? → Prove? → Resolve
  1. Proposer submits a state root with ETH bond

  2. Anyone can challenge within the window

  3. ZK proof resolves the dispute in one transaction

  4. Winner takes both bonds

Prerequisites

Clone the Repository

git clone https://github.com/0xFacet/zk-fault-proofs
cd zk-fault-proofs

Succinct Prover Network

The system uses Succinct's Prover Network to generate ZK proofs. You'll need:

  • An account funded on the Prover Network

  • The private key for this account in your configuration

Running a Proposer

1. Create Configuration

Create .env.proposer file in the root of the repository:

# OP Succinct Proposer Service Configuration
# Copy this file to .env.proposer and fill in your actual values

# ===== RPC ENDPOINTS =====
# L1 RPC endpoint for reading Ethereum mainnet/testnet data
L1_RPC=https://your-l1-rpc-endpoint.com

# L2 RPC endpoint for reading OP Stack rollup data
L2_RPC=https://mainnet.facet.org

# L2 node RPC endpoint for accessing op-node specific APIs
L2_NODE_RPC=https://your-l2-node-rpc-endpoint.com

# L1 beacon chain RPC for accessing consensus layer data
L1_BEACON_RPC=https://your-beacon-rpc-endpoint.com

# ===== CONTRACT ADDRESSES =====
# Address of the deployed Rollup.sol contract on L1
ROLLUP_ADDRESS=0x0000000000000000000000000000000000000000

# ===== PRIVATE KEYS =====
# Private key for the proposer account (must be whitelisted on Rollup.sol)
# WARNING: Never commit real private keys to version control
PRIVATE_KEY=0x0000000000000000000000000000000000000000000000000000000000000001

# Private key for SP1 network operations (proof generation)
NETWORK_PRIVATE_KEY=0x0000000000000000000000000000000000000000000000000000000000000002

# Interval for generating range proofs (in L2 blocks)
# Smaller values = more frequent proofs but higher costs
RANGE_PROOF_INTERVAL=1000

# Enable safe database fallback for better reliability
# Recommended: true for production
SAFE_DB_FALLBACK=true

# Mock mode for testing - uses mock proofs instead of real SP1 proofs
# MUST be false for production
MOCK_MODE=false

# ===== SP1 PROOF GENERATION =====
# Maximum cycles allowed for SP1 proof generation
# Higher values allow larger proofs but cost more
SP1_CYCLE_LIMIT=40000000000

# Timeout for SP1 proof generation (in seconds)
# Increase if experiencing timeouts on large proofs
SP1_TIMEOUT=48000

To run an L2_NODE_RPC:

git clone https://github.com/0xFacet/facet-optimism
cd facet-optimism
./init_node.sh

Repo: https://github.com/0xFacet/facet-optimism — This is a read-only fork of op-node used to expose auxiliary RPCs (e.g., sync status, output-at-clock) that aren’t yet implemented in facet-node. It’s generally only required for proposers/challengers, not for normal users.

You will need the following in your env:

OP_NODE_L2_ENGINE_RPC
OP_NODE_L1_ETH_RPC

2. Start the Proposer Service

cargo run --bin proposer --release

3. How Proposing Works

The proposer service:

  1. Monitors the anchor block on Rollup.sol

  2. Runs Facet node to compute new state

  3. Submits proposal with bond when needed

  4. Uses Prover Network to generate ZK proof if challenged

Running a Challenger

1. Create Configuration

Create .env.challenger file in the root of the repository:

# Ethereum RPC endpoints
L1_RPC="https://eth-mainnet.g.alchemy.com/v2/YOUR-KEY"
L2_RPC="http://localhost:9545"  # Your Facet node

# Contract address
ROLLUP_ADDRESS="0x..."

# Challenger account
CHALLENGER_PRIVATE_KEY="0x..."

2. Start the Challenger Service

cargo run --bin challenger --release

3. How Challenging Works

The challenger service:

  1. Monitors new proposals on-chain

  2. Validates each proposal independently

  3. Challenges incorrect proposals

  4. Claims bonds when successful

Manual Interaction

Query System Configuration

All parameters are immutable and can be queried from the contract.

Timing parameters:

  • MAX_CHALLENGE_SECS - Challenge window duration

  • MAX_PROVE_SECS - Proof deadline after challenge

  • FALLBACK_TIMEOUT_SECS - When anyone can propose

Bond requirements:

  • PROPOSER_BOND - ETH required to propose

  • CHALLENGER_BOND - ETH required to challenge

L2 configuration:

  • PROPOSAL_INTERVAL - Blocks between proposals

  • L2_BLOCK_TIME - Seconds per L2 block

  • L2_START_TIMESTAMP - L2 genesis timestamp

Proof system:

  • VERIFIER - SP1 verifier contract

  • ROLLUP_CONFIG_HASH - Chain configuration

  • AGG_VKEY - Aggregation verification key

  • RANGE_VKEY_COMMITMENT - Range proof commitment

Example query:

cast call $ROLLUP_ADDRESS "PROPOSER_BOND()"

Submit a Proposal

# Get required bond amount first
BOND=$(cast call $ROLLUP_ADDRESS "PROPOSER_BOND()")

# Submit proposal
cast send $ROLLUP_ADDRESS "submitProposal(bytes32,uint128,uint32)" \
  $STATE_ROOT $BLOCK_NUMBER $PARENT_ID \
  --value $BOND \
  --private-key $PROPOSER_PRIVATE_KEY

Challenge a Proposal

# Get required bond amount
BOND=$(cast call $ROLLUP_ADDRESS "CHALLENGER_BOND()")

# Challenge
cast send $ROLLUP_ADDRESS "challengeProposal(uint256)" \
  $PROPOSAL_ID \
  --value $BOND \
  --private-key $CHALLENGER_PRIVATE_KEY

Submit a Validity Proof (Permissionless)

Anyone can submit a validity proof directly:

cast send $ROLLUP_ADDRESS "proveBlock(uint128,bytes32,uint256,bytes)" \
  $L2_BLOCK_NUMBER $STATE_ROOT $L1_BLOCK_NUMBER $PROOF_BYTES

Monitoring Your Activity

Check Proposal Status

cast call $ROLLUP_ADDRESS "getProposal(uint256)" $PROPOSAL_ID

View Credit Balance

cast call $ROLLUP_ADDRESS "credit(address)" $YOUR_ADDRESS

Claim Credits

cast send $ROLLUP_ADDRESS "claimCredit(address)" $YOUR_ADDRESS

Economic Model

Bonds

  • Check current bond amounts using the contract

  • Both proposer and challenger post equal bonds

  • Bonds are returned to the winner

Resolution Rules

  • Valid proposal: Proposer gets both bonds

  • Successful challenge: Challenger gets both bonds

  • Invalid parent: Proposal automatically fails

Profitability Considerations

  • L1 gas costs for transactions

  • Proof generation costs on Prover Network

  • Competition from other participants

  • Risk assessment for challenges

Summary

To participate in Facet's proof system:

  1. Clone the repository and set up your environment

  2. Configure services with .env.proposer or .env.challenger

  3. Fund accounts on both Ethereum and Prover Network

  4. Run services to automatically propose or challenge

  5. Monitor and claim rewards from successful participation

The system ensures honest participation is profitable while maintaining complete immutability - no admin keys can interfere with the propose-challenge-prove cycle.

Last updated