Skip to main content
Version: dev

Recursive Proofs

Noir supports recursively verifying proofs, meaning you verify the proof of a Noir program in another Noir program. This enables creating proofs of arbitrary size by doing step-wise verification of smaller components of a large proof.

Read the explainer on recursion to know more about this function and the guide on how to use it.

Verifying Recursive Proofs

#[foreign(recursive_aggregation)]
pub fn verify_proof(verification_key: [Field], proof: [Field], public_inputs: [Field], key_hash: Field) {}

This is a black box function. Read this section to learn more about black box functions in Noir.

Example usage


fn main(
verification_key : [Field; 114],
proof : [Field; 93],
public_inputs : [Field; 1],
key_hash : Field,
proof_b : [Field; 93],
) {
std::verify_proof(
verification_key,
proof,
public_inputs,
key_hash
);

std::verify_proof(
verification_key,
proof_b,
public_inputs,
key_hash
);
}

You can see a full example of recursive proofs in this example recursion demo repo.

Parameters

verification_key

The verification key for the zk program that is being verified.

proof

The proof for the zk program that is being verified.

public_inputs

These represent the public inputs of the proof we are verifying.

key_hash

A key hash is used to check the validity of the verification key. The circuit implementing this opcode can use this hash to ensure that the key provided to the circuit matches the key produced by the circuit creator.