|
| 1 | +# Prove Scripts |
| 2 | + |
| 3 | +The prove scripts allow you to manually generate range and aggregation proofs for OP Succinct. These are useful for testing proof generation workflows and debugging. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +There are two main proving binaries: |
| 8 | +- **multi.rs**: Generates range proofs for multiple blocks |
| 9 | +- **agg.rs**: Aggregates multiple range proofs into a single aggregation proof |
| 10 | + |
| 11 | +Both binaries use the SP1 network prover by default. |
| 12 | + |
| 13 | +## Setup |
| 14 | + |
| 15 | +### Environment Configuration |
| 16 | + |
| 17 | +Create a `.env` file in the project root directory: |
| 18 | + |
| 19 | +```bash |
| 20 | +# RPC Endpoints |
| 21 | +L1_RPC=<YOUR_L1_RPC_ENDPOINT> |
| 22 | +L1_BEACON_RPC=<YOUR_L1_BEACON_RPC_ENDPOINT> |
| 23 | +L2_RPC=<YOUR_L2_RPC_ENDPOINT> |
| 24 | +L2_NODE_RPC=<YOUR_L2_NODE_RPC_ENDPOINT> |
| 25 | + |
| 26 | +# Network Prover Configuration |
| 27 | +NETWORK_PRIVATE_KEY=<YOUR_NETWORK_PRIVATE_KEY> |
| 28 | + |
| 29 | +# Proof Strategy Configuration |
| 30 | +RANGE_PROOF_STRATEGY=reserved # Options: reserved, hosted, auction |
| 31 | +AGG_PROOF_STRATEGY=reserved # Options: reserved, hosted, auction |
| 32 | +AGG_PROOF_MODE=plonk # Options: plonk, groth16 |
| 33 | +``` |
| 34 | + |
| 35 | +### Environment Variables |
| 36 | + |
| 37 | +#### Required |
| 38 | + |
| 39 | +| Variable | Description | |
| 40 | +|----------|-------------| |
| 41 | +| `L1_RPC` | L1 Archive Node endpoint | |
| 42 | +| `L1_BEACON_RPC` | L1 Consensus (Beacon) Node endpoint | |
| 43 | +| `L2_RPC` | L2 Execution Node (`op-geth`) endpoint | |
| 44 | +| `L2_NODE_RPC` | L2 Rollup Node (`op-node`) endpoint | |
| 45 | +| `NETWORK_PRIVATE_KEY` | Private key for the Succinct Prover Network. See the [Succinct Prover Network Quickstart](https://docs.succinct.xyz/docs/sp1/prover-network/quickstart) for setup instructions. | |
| 46 | + |
| 47 | +#### Optional |
| 48 | + |
| 49 | +| Variable | Description | Default | |
| 50 | +|----------|-------------|---------| |
| 51 | +| `RANGE_PROOF_STRATEGY` | Proof fulfillment strategy for range proofs | `reserved` | |
| 52 | +| `AGG_PROOF_STRATEGY` | Proof fulfillment strategy for aggregation proofs | `reserved` | |
| 53 | +| `AGG_PROOF_MODE` | Proof mode for aggregation proofs (`plonk` or `groth16`) | `plonk` | |
| 54 | + |
| 55 | +**Proof Strategies:** |
| 56 | +- `reserved`: Uses reserved SP1 network capacity |
| 57 | +- `hosted`: Uses hosted proof generation service |
| 58 | +- `auction`: Uses auction-based proof fulfillment |
| 59 | + |
| 60 | +**Proof Modes:** |
| 61 | +- `plonk`: PLONK proof system (default) |
| 62 | +- `groth16`: Groth16 proof system |
| 63 | + |
| 64 | +### Getting Started with the Prover Network |
| 65 | + |
| 66 | +1. Follow the [Succinct Prover Network Quickstart](https://docs.succinct.xyz/docs/sp1/prover-network/quickstart) to set up your account and obtain a private key. |
| 67 | + |
| 68 | +2. Set the `NETWORK_PRIVATE_KEY` environment variable: |
| 69 | + ```.env |
| 70 | + NETWORK_PRIVATE_KEY=0x... |
| 71 | + ``` |
| 72 | + |
| 73 | +3. Run the prove scripts. The binaries will automatically use the network prover with your configured key. |
| 74 | + |
| 75 | +## Generating Range Proofs |
| 76 | + |
| 77 | +The `multi.rs` binary generates range proofs for a specified block range. |
| 78 | + |
| 79 | +### Usage |
| 80 | + |
| 81 | +```bash |
| 82 | +cargo run --bin multi --release -- \ |
| 83 | + --start <START_BLOCK> \ |
| 84 | + --end <END_BLOCK> \ |
| 85 | + --prove |
| 86 | +``` |
| 87 | + |
| 88 | +### Example |
| 89 | + |
| 90 | +```bash |
| 91 | +# Generate a range proof for blocks 1000-1300 |
| 92 | +cargo run --bin multi --release -- \ |
| 93 | + --start 1000 \ |
| 94 | + --end 1300 \ |
| 95 | + --prove |
| 96 | +``` |
| 97 | + |
| 98 | +### Output |
| 99 | + |
| 100 | +Range proofs are saved to `data/{chain_id}/proofs/{start_block}-{end_block}.bin` |
| 101 | + |
| 102 | +## Generating Aggregation Proofs |
| 103 | + |
| 104 | +The `agg.rs` binary aggregates multiple range proofs into a single aggregation proof. |
| 105 | + |
| 106 | +### Usage |
| 107 | + |
| 108 | +```bash |
| 109 | +cargo run --bin agg --release -- \ |
| 110 | + --proofs <PROOF_1>,<PROOF_2>,<PROOF_N> \ |
| 111 | + --prover <PROVER_ADDRESS> \ |
| 112 | + --prove |
| 113 | +``` |
| 114 | + |
| 115 | +### Example |
| 116 | + |
| 117 | +```bash |
| 118 | +# Aggregate three range proofs |
| 119 | +cargo run --bin agg --release -- \ |
| 120 | + --proofs 1000-1300,1300-1600,1600-1900 \ |
| 121 | + --prover 0x1234567890abcdef1234567890abcdef12345678 \ |
| 122 | + --prove |
| 123 | +``` |
| 124 | + |
| 125 | +### Parameters |
| 126 | + |
| 127 | +| Parameter | Description | Required | |
| 128 | +|-----------|-------------|----------| |
| 129 | +| `--proofs` | Comma-separated list of proof names (without `.bin` extension) | Yes | |
| 130 | +| `--prover` | Prover wallet address | Yes | |
| 131 | +| `--prove` | Generate proof (omit to only execute) | No | |
| 132 | +| `--env-file` | Path to environment file (default: `.env`) | No | |
| 133 | + |
| 134 | +### Requirements |
| 135 | + |
| 136 | +- Proof files must exist in `data/fetched_proofs/` directory |
| 137 | +- Proof names should match the range format: `{start_block}-{end_block}` |
| 138 | +- All range proofs must be verified before aggregation |
| 139 | + |
| 140 | +## Local Development |
| 141 | + |
| 142 | +For local development and testing, omit the `--prove` flag to execute the program without generating proofs. This allows you to verify correctness without incurring proving costs. |
| 143 | + |
| 144 | +```bash |
| 145 | +# Execute without proving |
| 146 | +cargo run --bin multi --release -- \ |
| 147 | + --start 1000 \ |
| 148 | + --end 1300 |
| 149 | +``` |
| 150 | + |
| 151 | +This will run the full execution and report cycle counts without submitting proof requests to the network. |
0 commit comments