prover

package
v0.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 4, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var UseGPUProver = false

UseGPUProver indicates whether to use the GPU-accelerated prover, using Icicle.

Functions

func CPUProver

func CPUProver(curve ecc.ID, ccs constraint.ConstraintSystem, pk groth16.ProvingKey, assignment frontend.Circuit, opts ...backend.ProverOption,
) (groth16.Proof, error)

CPUProver is the standard implementation that simply calls groth16.Prove directly. This is used in production environments.

func CPUProverWithWitness

func CPUProverWithWitness(curve ecc.ID, ccs constraint.ConstraintSystem, pk groth16.ProvingKey, w witness.Witness, opts ...backend.ProverOption,
) (groth16.Proof, error)

CPUProverWithWitness proves using CPU with an already-created witness.

func GPUProver

func GPUProver(curve ecc.ID, ccs constraint.ConstraintSystem, pk groth16.ProvingKey, assignment frontend.Circuit, opts ...backend.ProverOption,
) (groth16.Proof, error)

GPUProver is an implementation that uses GPU acceleration for proving.

func GPUProverWithWitness

func GPUProverWithWitness(curve ecc.ID, ccs constraint.ConstraintSystem, pk groth16.ProvingKey, w witness.Witness, opts ...backend.ProverOption,
) (groth16.Proof, error)

GPUProverWithWitness proves using GPU with an already-created witness.

func Prove added in v0.0.4

func Prove(curve ecc.ID, ccs constraint.ConstraintSystem, pk groth16.ProvingKey, assignment frontend.Circuit, opts ...backend.ProverOption,
) (groth16.Proof, error)

Prove runs the groth16.Prove algorithm. When built with GPU support (icicle), this will use the GPU prover if UseGPUProver is true. otherwise it uses the CPU prover. If GPU proving fails, it falls back to CPU proving.

func ProveWithWitness

func ProveWithWitness(curve ecc.ID, ccs constraint.ConstraintSystem, pk groth16.ProvingKey, w witness.Witness, opts ...backend.ProverOption,
) (groth16.Proof, error)

ProveWithWitness generates a proof from an already-created witness. It automatically uses GPU acceleration if UseGPUProver is true. If GPU proving fails, it falls back to CPU proving.

func SetProver added in v0.0.4

func SetProver(p ProverFunc)

SetProver sets a custom prover function. This is particularly useful for tests that need to debug circuit execution.

func Setup

Setup wraps groth16.Setup and switches to the ICICLE-aware setup when the GPU prover is enabled. This guarantees that the resulting proving key has the extra device metadata required by gpugroth16.Prove.

Types

type ProverFunc added in v0.0.4

type ProverFunc func(
	curve ecc.ID,
	ccs constraint.ConstraintSystem,
	pk groth16.ProvingKey,
	assignment frontend.Circuit,
	opts ...backend.ProverOption,
) (groth16.Proof, error)

ProverFunc defines a function type that matches the signature needed for zkSNARK proving. The function is generic enough to handle all circuit types. This type is used for dependency injection, particularly in the Sequencer.

type ProverWithWitnessFunc added in v0.0.4

type ProverWithWitnessFunc func(
	curve ecc.ID,
	ccs constraint.ConstraintSystem,
	pk groth16.ProvingKey,
	w witness.Witness,
	opts ...backend.ProverOption,
) (groth16.Proof, error)

ProverWithWitnessFunc defines a function type for proving with an already-created witness. This is primarily used in test code where witnesses are already created.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL