Documentation ¶
Overview ¶
Package plonk implements PLONK Zero Knowledge Proof system.
See also ¶
Index ¶
- func IsSolved(ccs frontend.CompiledConstraintSystem, witness frontend.Circuit, ...) error
- func NewCS(curveID ecc.ID) frontend.CompiledConstraintSystem
- func NewSRS(ccs frontend.CompiledConstraintSystem) (kzg.SRS, error)
- func ReadAndVerify(proof Proof, vk VerifyingKey, witness io.Reader) error
- func Setup(ccs frontend.CompiledConstraintSystem, kzgSRS kzg.SRS) (ProvingKey, VerifyingKey, error)
- func Verify(proof Proof, vk VerifyingKey, publicWitness frontend.Circuit) error
- type Assert
- func (assert *Assert) ProverFailed(ccs frontend.CompiledConstraintSystem, witness frontend.Circuit, ...)
- func (assert *Assert) ProverSucceeded(ccs frontend.CompiledConstraintSystem, witness frontend.Circuit, ...)
- func (assert *Assert) SolvingFailed(ccs frontend.CompiledConstraintSystem, witness frontend.Circuit)
- func (assert *Assert) SolvingSucceeded(ccs frontend.CompiledConstraintSystem, witness frontend.Circuit)
- type Proof
- type ProvingKey
- type VerifyingKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsSolved ¶
func IsSolved(ccs frontend.CompiledConstraintSystem, witness frontend.Circuit, opts ...func(opt *backend.ProverOption) error) error
IsSolved attempts to solve the constraint system with provided witness returns nil if it succeeds, error otherwise.
func NewCS ¶ added in v0.5.0
func NewCS(curveID ecc.ID) frontend.CompiledConstraintSystem
NewCS instantiate a concrete curved-typed SparseR1CS and return a CompiledConstraintSystem interface This method exists for (de)serialization purposes
func NewSRS ¶ added in v0.5.0
func NewSRS(ccs frontend.CompiledConstraintSystem) (kzg.SRS, error)
NewSRS uses ccs nb variables and nb constraints to initialize a kzg srs note that this method is here for convenience only: in production, a SRS generated through MPC should be used.
func ReadAndVerify ¶ added in v0.5.0
func ReadAndVerify(proof Proof, vk VerifyingKey, witness io.Reader) error
ReadAndVerify verifies a PLONK proof from a circuit, associated proving key, and the full witness
func Setup ¶
func Setup(ccs frontend.CompiledConstraintSystem, kzgSRS kzg.SRS) (ProvingKey, VerifyingKey, error)
Setup prepares the public data associated to a circuit + public inputs.
Types ¶
type Assert ¶
type Assert struct {
*require.Assertions
}
Assert is a helper to test circuits
func (*Assert) ProverFailed ¶
func (assert *Assert) ProverFailed(ccs frontend.CompiledConstraintSystem, witness frontend.Circuit, opts ...func(opt *backend.ProverOption) error)
func (*Assert) ProverSucceeded ¶
func (assert *Assert) ProverSucceeded(ccs frontend.CompiledConstraintSystem, witness frontend.Circuit, opts ...func(opt *backend.ProverOption) error)
func (*Assert) SolvingFailed ¶
func (assert *Assert) SolvingFailed(ccs frontend.CompiledConstraintSystem, witness frontend.Circuit)
SolvingFailed Verifies that the cs.PCS is not solved with the given witness, without executing plonk workflow
func (*Assert) SolvingSucceeded ¶
func (assert *Assert) SolvingSucceeded(ccs frontend.CompiledConstraintSystem, witness frontend.Circuit)
SolvingSucceeded Verifies that the sparse constraint system is solved with the given witness, without executing plonk workflow
type Proof ¶
type Proof interface { io.WriterTo io.ReaderFrom }
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 frontend.CompiledConstraintSystem, pk ProvingKey, fullWitness frontend.Circuit, opts ...func(opt *backend.ProverOption) error) (Proof, error)
Prove generates PLONK proof from a circuit, associated preprocessed public data, and the witness if the force flag is set:
will executes 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
func ReadAndProve ¶ added in v0.5.0
func ReadAndProve(ccs frontend.CompiledConstraintSystem, pk ProvingKey, witness io.Reader, opts ...func(opt *backend.ProverOption) error) (Proof, error)
ReadAndProve generates PLONK proof from a circuit, associated proving key, and the full witness
type ProvingKey ¶ added in v0.5.0
type ProvingKey interface { io.WriterTo io.ReaderFrom InitKZG(srs kzg.SRS) error 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 InitKZG(srs kzg.SRS) error NbPublicWitness() int // number of elements expected in the public witness }
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