Overview
Theprove_<function_name> function generates a zero-knowledge proof that a computation was executed correctly. It is automatically generated by the #[jolt::provable] macro for each provable function.
Function Signature
Parameters
program- The compiled guest program (obtained fromcompile_<function_name>)preprocessing- Prover preprocessing data (obtained frompreprocess_prover_<function_name>)- Function arguments in order:
- Public inputs - Regular function parameters that become part of the proof statement
- Untrusted advice - Parameters marked with
jolt::UntrustedAdvice<T>wrapper - Trusted advice - Parameters marked with
jolt::TrustedAdvice<T>wrapper
trusted_advice_commitment(optional) - Commitment to trusted advice, if function has trusted advice parameterstrusted_advice_hint(optional) - Opening proof hint for trusted advice commitment
Return Value
Returns a tuple containing:- Return value - The function’s output (or
()if no return value) - Proof - The generated zero-knowledge proof (
jolt::RV64IMACProof) - Program I/O - I/O device state including inputs, outputs, and panic flag (
jolt::JoltDevice)
Two-Pass Proving Strategy
The prove function uses a two-pass strategy for programs with advice:- First pass (if
compute_adviceELF exists): Runs the compute_advice version to populate the advice tape - Second pass: Runs the normal version with the populated advice tape to generate the proof
Usage Example
Basic Usage
With Build Prover (Recommended)
For repeated proving with the same preprocessing:With Trusted Advice
For functions that use trusted advice, you must first commit to the advice:Generated From
For a function annotated with#[jolt::provable]:
prove_fib with the signature shown above.
Related Functions
verify- Verifies a generated proofpreprocess- Generates preprocessing data required for provinganalyze- Analyzes execution without generating a proof