Documentation
¶
Index ¶
- Variables
- func CPUProver(curve ecc.ID, ccs constraint.ConstraintSystem, pk groth16.ProvingKey, ...) (groth16.Proof, error)
- func CPUProverWithWitness(curve ecc.ID, ccs constraint.ConstraintSystem, pk groth16.ProvingKey, ...) (groth16.Proof, error)
- func GPUProver(curve ecc.ID, ccs constraint.ConstraintSystem, pk groth16.ProvingKey, ...) (groth16.Proof, error)
- func GPUProverWithWitness(curve ecc.ID, ccs constraint.ConstraintSystem, pk groth16.ProvingKey, ...) (groth16.Proof, error)
- func Prove(curve ecc.ID, ccs constraint.ConstraintSystem, pk groth16.ProvingKey, ...) (groth16.Proof, error)
- func ProveWithWitness(curve ecc.ID, ccs constraint.ConstraintSystem, pk groth16.ProvingKey, ...) (groth16.Proof, error)
- func SetProver(p ProverFunc)
- func Setup(ccs constraint.ConstraintSystem) (pk groth16.ProvingKey, vk groth16.VerifyingKey, err error)
- type ProverFunc
- type ProverWithWitnessFunc
Constants ¶
This section is empty.
Variables ¶
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 ¶
func Setup(ccs constraint.ConstraintSystem) (pk groth16.ProvingKey, vk groth16.VerifyingKey, err error)
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.