Skip to main content

Plonky2 Framework Support

We have expanded the slate of supported proving frameworks to include Plonky2 from Polygon Zero. Users who have previously utilized Sindri's API for Halo2 circuits, will find the project layout structure familiar. Here is an example sindri.json file that specifies the required fields for the Plonky2 framework.

sindri.json
{
"$schema": "https://sindri.app/api/v1/sindri-manifest-schema.json",
"name": "my-circuit",
"circuitType": "plonky2",
"structName": "my_rust_package::MyCircuit",
"plonky2Version": "0.2.2",
"provingScheme": "plonky2",
"packageName": "my_rust_package"
}

To prove Plonky2 circuits, users must define three configuration parameters and implement the prove method for the MyCircuit struct. The three configuration parameters are:

  • The extension field degree. For the Golidlocks field, this is typically set to 2.
  • The hash function coonfiguration (either PoseidonGoldilocksConfig or KeccakGoldilocksConfig).
  • The prime field.
// Extension field degree
pub const D: usize = 2;

// Hash function configuration
pub type C = PoseidonGoldilocksConfig;

// Prime field
pub type F = <C as GenericConfig<D>>::F;


pub struct MyCircuit{
pub proof: ProofWithPublicInputs<F, C, D>,
pub verifier_only: VerifierOnlyCircuitData<C, D>,
pub common: CommonCircuitData<F, D>,
}

impl MyCircuit {
pub fn prove(path: &str) -> Self {
// Construct the arithmetic circuit using the Plonky2 CircuitBuilder
// Load input data into the circuit using the path argument
// Configure the partial witness and prove the circuit
// Return an instance of the MyCircuit struct
}
}

Users can explore some example circuits in the sindri-resources repository to get started creating Plonky2 proofs.