Skip to main content

Overview

The prove_<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 from compile_<function_name>)
  • preprocessing - Prover preprocessing data (obtained from preprocess_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 parameters
  • trusted_advice_hint (optional) - Opening proof hint for trusted advice commitment

Return Value

Returns a tuple containing:
  1. Return value - The function’s output (or () if no return value)
  2. Proof - The generated zero-knowledge proof (jolt::RV64IMACProof)
  3. 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:
  1. First pass (if compute_advice ELF exists): Runs the compute_advice version to populate the advice tape
  2. Second pass: Runs the normal version with the populated advice tape to generate the proof
This allows complex computations to be performed off-circuit while maintaining zero-knowledge properties.

Usage Example

Basic Usage

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]:
The macro generates prove_fib with the signature shown above.
  • verify - Verifies a generated proof
  • preprocess - Generates preprocessing data required for proving
  • analyze - Analyzes execution without generating a proof