Documentation ¶
Overview ¶
Package plonk implements PLONK Zero Knowledge Proof system.
See also ¶
Index ¶
- func NewCS(curveID ecc.ID) constraint.ConstraintSystem
- func SRSSize(ccs constraint.ConstraintSystem) (sizeCanonical, sizeLagrange int)
- func Setup(ccs constraint.ConstraintSystem, srs, srsLagrange kzg.SRS) (ProvingKey, VerifyingKey, error)
- func Verify(proof Proof, vk VerifyingKey, publicWitness witness.Witness, ...) error
- type Proof
- type ProvingKey
- type VerifyingKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCS ¶ added in v0.5.0
func NewCS(curveID ecc.ID) constraint.ConstraintSystem
NewCS instantiate a concrete curved-typed SparseR1CS and return a ConstraintSystem interface This method exists for (de)serialization purposes
func SRSSize ¶ added in v0.10.0
func SRSSize(ccs constraint.ConstraintSystem) (sizeCanonical, sizeLagrange int)
SRSSize returns the required size of the kzg SRS for a given constraint system Note that the SRS size in Lagrange form is a power of 2, and the SRS size in canonical form need few extra elements (3) to account for the blinding factors
func Setup ¶
func Setup(ccs constraint.ConstraintSystem, srs, srsLagrange kzg.SRS) (ProvingKey, VerifyingKey, error)
Setup prepares the public data associated to a circuit + public inputs. The kzg SRS must be provided in canonical and lagrange form. For test purposes, see test/unsafekzg package. With an existing SRS generated through MPC in canonical form, gnark-crypto offers the ToLagrangeG1 method to convert it to lagrange form.
func Verify ¶
func Verify(proof Proof, vk VerifyingKey, publicWitness witness.Witness, opts ...backend.VerifierOption) error
Verify verifies a PLONK proof, from the proof, preprocessed public data, and public witness.
Types ¶
type Proof ¶
type Proof interface { io.WriterTo io.ReaderFrom // Raw methods for faster serialization-deserialization. Does not perform checks on the data. // Only use if you are sure of the data you are reading comes from trusted source. gnarkio.WriterRawTo }
Proof represents a Plonk proof generated by plonk.Prove
it's underlying implementation is curve specific (see gnark/internal/backend)
func NewProof ¶ added in v0.5.0
NewProof instantiates a curve-typed ProvingKey and returns an interface This function exists for serialization purposes
func Prove ¶
func Prove(ccs constraint.ConstraintSystem, pk ProvingKey, fullWitness witness.Witness, opts ...backend.ProverOption) (Proof, error)
Prove generates PLONK proof from a circuit, associated preprocessed public data, and the witness if the force flag is set:
will execute all the prover computations, even if the witness is invalid will produce an invalid proof internally, the solution vector to the SparseR1CS will be filled with random values which may impact benchmarking
type ProvingKey ¶ added in v0.5.0
type ProvingKey interface { io.WriterTo io.ReaderFrom // Raw methods for faster serialization-deserialization. Does not perform checks on the data. // Only use if you are sure of the data you are reading comes from trusted source. gnarkio.WriterRawTo gnarkio.UnsafeReaderFrom // VerifyingKey returns the corresponding VerifyingKey. VerifyingKey() interface{} }
ProvingKey represents a plonk ProvingKey
it's underlying implementation is strongly typed with the curve (see gnark/internal/backend)
func NewProvingKey ¶ added in v0.5.0
func NewProvingKey(curveID ecc.ID) ProvingKey
NewProvingKey instantiates a curve-typed ProvingKey and returns an interface This function exists for serialization purposes
type VerifyingKey ¶ added in v0.5.0
type VerifyingKey interface { io.WriterTo io.ReaderFrom // Raw methods for faster serialization-deserialization. Does not perform checks on the data. // Only use if you are sure of the data you are reading comes from trusted source. gnarkio.WriterRawTo gnarkio.UnsafeReaderFrom // VerifyingKey are the methods required for generating the Solidity // verifier contract from the VerifyingKey. This will return an error if not // supported on the CurveID(). solidity.VerifyingKey }
VerifyingKey represents a plonk VerifyingKey
it's underlying implementation is strongly typed with the curve (see gnark/internal/backend)
func NewVerifyingKey ¶ added in v0.5.0
func NewVerifyingKey(curveID ecc.ID) VerifyingKey
NewVerifyingKey instantiates a curve-typed VerifyingKey and returns an interface This function exists for serialization purposes