Running Prover and Verifier
Running the Prover
The prover generates a zero-knowledge proof for a given WASM program.
Command
./webgpu_prover '<JSON configuration>'
JSON Configuration
The configuration is a JSON object with the following fields:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
program | string | ✓ | Path to the WASM file | |
shader-path | string | "./shader" | Path to GPU shader directory | |
gpu-threads | int | packing | Number of GPU threads | |
packing | int | 8192 | FFT packing size (doubled for codeword) | |
private-indices | [int] | [] | Indices of private arguments (1-indexed) | |
args | [object] | [] | Program arguments |
Argument Types
Arguments are specified as objects with type and value:
{"str": "value"}: String argument{"i64": 12345}: 64-bit integer{"hex": "0x1234..."}: Hexadecimal data
Example
./webgpu_prover '{
"program": "../sdk/cpp/build/examples/edit.wasm",
"shader-path": "../shader",
"packing": 8192,
"private-indices": [1],
"args": [
{"str": "abcdeabcdeabcde"},
{"str": "bcdefabcdeabcde"},
{"i64": 15},
{"i64": 15}
]
}'
This generates a proof that the edit distance between the two strings is less than 5, with the first string marked as private.
Output
The prover generates:
- Proof file: Contains the cryptographic proof
- Public parameters: Shared with the verifier
- Performance metrics: Proof generation time
Running the Verifier
The verifier checks the validity of a proof without re-executing the program.
Command
./webgpu_verifier '<JSON configuration>'
Configuration
Use the same JSON configuration as the prover, but private arguments can be replaced with placeholder values of the same type and length.
Example
./webgpu_verifier '{
"program": "../sdk/cpp/build/examples/edit.wasm",
"shader-path": "../shader",
"packing": 8192,
"private-indices": [1],
"args": [
{"str": "xxxxxxxxxxxxxxx"},
{"str": "bcdefabcdeabcde"},
{"i64": 15},
{"i64": 15}
]
}'
Notice the first string is replaced with x characters; the verifier doesn't need the witness.
Output
The verifier returns:
- Valid: Proof is correct
- Invalid: Proof verification failed
- Performance metrics: Verification time