Documentation ¶
Overview ¶
Package groth16 implements Groth16 zkSNARK workflow (https://eprint.iacr.org/2016/260.pdf)
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetBN256Proof ¶
func GetBN256Proof(path string) groth16_bn256.Proof
GetBN256Proof returns an empty proof
func Setup ¶
func Setup(r1cs r1cs.R1CS) (ProvingKey, VerifyingKey)
Setup runs groth16.Setup with provided R1CS
func Verify ¶
func Verify(proof Proof, vk VerifyingKey, solution interface{}) error
Verify runs the groth16.Verify algorithm on provided proof with given solution
Types ¶
type Assert ¶
type Assert struct {
*require.Assertions
}
Assert is a helper to test circuits
func (*Assert) ProverFailed ¶
ProverFailed check that a solution does NOT solve a circuit
solution must be map[string]interface{} or must implement frontend.Circuit ( see frontend.ParseWitness )
func (*Assert) ProverSucceeded ¶
ProverSucceeded check that a solution solves a circuit
solution must be map[string]interface{} or must implement frontend.Circuit ( see frontend.ParseWitness )
1. Runs groth16.Setup()
2. Solves the R1CS
3. Runs groth16.Prove()
4. Runs groth16.Verify()
ensure result vectors a*b=c, and check other properties like random sampling
func (*Assert) SolvingFailed ¶
SolvingFailed Verifies that the R1CS is not solved with the given solution, without executing groth16 workflow
solution must be map[string]interface{} or must implement frontend.Circuit ( see frontend.ParseWitness )
func (*Assert) SolvingSucceeded ¶
SolvingSucceeded Verifies that the R1CS is solved with the given solution, without executing groth16 workflow
solution must be map[string]interface{} or must implement frontend.Circuit ( see frontend.ParseWitness )
type Proof ¶
type Proof interface { io.CurveObject }
Proof represents a Groth16 proof generated by groth16.Prove
it's underlying implementation is curve specific (see gnark/internal/backend)
type ProvingKey ¶
type ProvingKey interface { io.CurveObject IsDifferent(interface{}) bool }
ProvingKey represents a Groth16 ProvingKey
it's underlying implementation is curve specific (see gnark/internal/backend)
func DummySetup ¶
func DummySetup(r1cs r1cs.R1CS) ProvingKey
DummySetup create a random ProvingKey with provided R1CS it doesn't return a VerifyingKey and is use for benchmarking or test purposes only.
func ReadProvingKey ¶
func ReadProvingKey(path string) (ProvingKey, error)
ReadProvingKey read file at path and attempt to decode it into a ProvingKey object
note that until v1.X.X serialization (schema-less, disk, network, ..) may change
type VerifyingKey ¶
type VerifyingKey interface { io.CurveObject IsDifferent(interface{}) bool }
VerifyingKey represents a Groth16 VerifyingKey
it's underlying implementation is curve specific (see gnark/internal/backend)
func ReadVerifyingKey ¶
func ReadVerifyingKey(path string) (VerifyingKey, error)
ReadVerifyingKey read file at path and attempt to decode it into a VerifyingKey
note that until v1.X.X serialization (schema-less, disk, network, ..) may change