zkproof

package
v0.0.0-...-84e837c Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateProofForRecords

func CreateProofForRecords(records []*records.CreditScoreRecord) ([]byte, []byte, int, error)

CreateProofForRecords creates a proof for the given records Returns the proof, the verifying key and the final score

func VerifyProof

func VerifyProof(rawProof []byte, rawVk []byte, hashes [][]byte, score int) (bool, error)

VerifyProof verifies the given proof with the given verifying key and the final score Returns true if the proof is valid, false otherwise

Types

type Circuit

type Circuit struct {
	// Private inputs
	Scores [batchSize]frontend.Variable
	Nonces [batchSize]frontend.Variable
	// Public inputs
	Hashes [batchSize]frontend.Variable `gnark:",public"`
	Score  frontend.Variable            `gnark:",public"`
}

The zk Proof Circuit

func (*Circuit) Define

func (circuit *Circuit) Define(curveID ecc.ID, cs *frontend.ConstraintSystem) error

Calculate the sum of all the scores and proove that the sum is equal to the score

Jump to

Keyboard shortcuts

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