backend

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: May 13, 2026 License: Apache-2.0 Imports: 4 Imported by: 113

Documentation

Overview

Package backend implements Zero Knowledge Proof systems: it consumes circuit compiled with gnark/frontend.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ID added in v0.4.0

type ID uint16

ID represent a unique ID for a proving scheme

const (
	UNKNOWN ID = iota
	GROTH16
	PLONK
)

func IDFromString added in v0.12.0

func IDFromString(s string) ID

IDFromString returns the ID of a proof system from its string representation

func Implemented added in v0.5.0

func Implemented() []ID

Implemented return the list of proof systems implemented in gnark

func (ID) String added in v0.5.0

func (id ID) String() string

String returns the string representation of a proof system

type ProverConfig added in v0.6.1

type ProverConfig struct {
	SolverOpts     []solver.Option
	HashToFieldFn  hash.Hash
	ChallengeHash  hash.Hash
	KZGFoldingHash hash.Hash
	StatisticalZK  bool
}

ProverConfig is the configuration for the prover with the options applied.

func NewProverConfig added in v0.6.1

func NewProverConfig(opts ...ProverOption) (ProverConfig, error)

NewProverConfig returns a default ProverConfig with given prover options opts applied.

type ProverOption added in v0.5.1

type ProverOption func(*ProverConfig) error

ProverOption defines option for altering the behavior of the prover in Prove, ReadAndProve and IsSolved methods. See the descriptions of functions returning instances of this type for implemented options.

func WithIcicleAcceleration added in v0.10.0

func WithIcicleAcceleration() ProverOption

WithIcicleAcceleration requests to use ICICLE GPU proving backend.

DEPRECATED: we don't switch to ICICLE automatically anymore, the user has to explicitly use methods in the github.com/consensys/gnark/backend/accelerated/icicle package to use ICICLE acceleration. This option will be removed in a future release, but kept for now for API backward compatibility. It will error at runtime instead.

func WithProverChallengeHashFunction added in v0.10.0

func WithProverChallengeHashFunction(hFunc hash.Hash) ProverOption

WithProverChallengeHashFunction sets the hash function used for computing non-interactive challenges in Fiat-Shamir heuristic. If not set then by default SHA2-256 is used. Used mainly for compatibility between different systems and efficient recursion.

func WithProverHashToFieldFunction added in v0.10.0

func WithProverHashToFieldFunction(hFunc hash.Hash) ProverOption

WithProverHashToFieldFunction changes the hash function used for hashing bytes to field. If not set then the default hash function based on RFC 9380 is used. Used mainly for compatibility between different systems and efficient recursion.

func WithProverKZGFoldingHashFunction added in v0.10.0

func WithProverKZGFoldingHashFunction(hFunc hash.Hash) ProverOption

WithProverKZGFoldingHashFunction sets the hash function used for computing the challenge when folding the KZG opening proofs. If not set then by default SHA2-256 is used. Used mainly for compatibility between different systems and efficient recursion.

func WithSolverOptions added in v0.9.0

func WithSolverOptions(solverOpts ...solver.Option) ProverOption

WithSolverOptions specifies the constraint system solver options.

func WithStatisticalZeroKnowledge added in v0.11.0

func WithStatisticalZeroKnowledge() ProverOption

WithStatisticalZeroKnowledge ensures that statistical zero knowledgeness is achieved. This option makes the prover more memory costly, as there are 3 more size n (size of the circuit) allocations.

type VerifierConfig added in v0.10.0

type VerifierConfig struct {
	HashToFieldFn  hash.Hash
	ChallengeHash  hash.Hash
	KZGFoldingHash hash.Hash
}

VerifierConfig is the configuration for the verifier with the options applied.

func NewVerifierConfig added in v0.10.0

func NewVerifierConfig(opts ...VerifierOption) (VerifierConfig, error)

NewVerifierConfig returns a default VerifierConfig with given verifier options applied.

type VerifierOption added in v0.10.0

type VerifierOption func(*VerifierConfig) error

VerifierOption defines option for altering the behavior of the verifier. See the descriptions of functions returning instances of this type for implemented options.

func WithVerifierChallengeHashFunction added in v0.10.0

func WithVerifierChallengeHashFunction(hFunc hash.Hash) VerifierOption

WithVerifierChallengeHashFunction sets the hash function used for computing non-interactive challenges in Fiat-Shamir heuristic. If not set then by default SHA2-256 is used. Used mainly for compatibility between different systems and efficient recursion.

func WithVerifierHashToFieldFunction added in v0.10.0

func WithVerifierHashToFieldFunction(hFunc hash.Hash) VerifierOption

WithVerifierHashToFieldFunction changes the hash function used for hashing bytes to field. If not set then the default hash function based on RFC 9380 is used. Used mainly for compatibility between different systems and efficient recursion.

func WithVerifierKZGFoldingHashFunction added in v0.10.0

func WithVerifierKZGFoldingHashFunction(hFunc hash.Hash) VerifierOption

WithVerifierKZGFoldingHashFunction sets the hash function used for computing the challenge when folding the KZG opening proofs. If not set then by default SHA2-256 is used. Used mainly for compatibility between different systems and efficient recursion.

Directories

Path Synopsis
accelerated
icicle
Package icicle implements backends using ICICLE library.
Package icicle implements backends using ICICLE library.
icicle/groth16
Package groth16 implements Groth16 proof system with ICICLE acceleration.
Package groth16 implements Groth16 proof system with ICICLE acceleration.
icicle/groth16/bls12-377
Package bls12377 implements ICICLE acceleration for BLS12-377 Groth16 backend.
Package bls12377 implements ICICLE acceleration for BLS12-377 Groth16 backend.
icicle/groth16/bls12-381
Package bls12381 implements ICICLE acceleration for BLS12-381 Groth16 backend.
Package bls12381 implements ICICLE acceleration for BLS12-381 Groth16 backend.
icicle/groth16/bn254
Package bn254 implements ICICLE acceleration for BN254 Groth16 backend.
Package bn254 implements ICICLE acceleration for BN254 Groth16 backend.
icicle/groth16/bw6-761
Package bw6761 implements ICICLE acceleration for BW6-761 Groth16 backend.
Package bw6761 implements ICICLE acceleration for BW6-761 Groth16 backend.
Package groth16 implements Groth16 Zero Knowledge Proof system (aka zkSNARK).
Package groth16 implements Groth16 Zero Knowledge Proof system (aka zkSNARK).
Package plonk implements PLONK Zero Knowledge Proof system.
Package plonk implements PLONK Zero Knowledge Proof system.
Package witness provides serialization helpers to encode a witness into a []byte.
Package witness provides serialization helpers to encode a witness into a []byte.

Jump to

Keyboard shortcuts

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