prover

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2023 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TableNamePrefix = "proof"
)

Variables

This section is empty.

Functions

func GenerateAndVerifyProof

func GenerateAndVerifyProof(r1cs constraint.ConstraintSystem,
	provingKey []groth16.ProvingKey,
	verifyingKey groth16.VerifyingKey,
	batchWitness *utils.BatchCreateUserWitness,
	zkKeyName string,
	batchNumber int64,
) (proof groth16.Proof, err error)

func LoadProvingKey

func LoadProvingKey(filepath string) (pks []groth16.ProvingKey, err error)

func LoadR1CSLen added in v1.0.2

func LoadR1CSLen(filename string) (nbConstraints int, err error)

func LoadVerifyingKey

func LoadVerifyingKey(filepath string) (verifyingKey groth16.VerifyingKey, err error)

func WithRedis

func WithRedis(redisType string, redisPass string) redis.Option

Types

type Proof

type Proof struct {
	gorm.Model
	ProofInfo               string
	CexAssetListCommitments string
	AccountTreeRoots        string
	BatchCommitment         string
	BatchNumber             int64 `gorm:"index:idx_number,unique"`
}

type ProofModel

type ProofModel interface {
	CreateProofTable() error
	DropProofTable() error
	CreateProof(row *Proof) error
	GetProofsBetween(start int64, end int64) (proofs []*Proof, err error)
	GetLatestProof() (p *Proof, err error)
	GetLatestConfirmedProof() (p *Proof, err error)
	GetProofByBatchNumber(height int64) (p *Proof, err error)
	GetProofNumber() (count int64)
	GetRowCounts() (count int64, err error)
}

func NewProofModel

func NewProofModel(db *gorm.DB, suffix string) ProofModel

type Prover

type Prover struct {
	VerifyingKeys groth16.VerifyingKey
	ProvingKeys   []groth16.ProvingKey
	SessionName   string
	R1cs          constraint.ConstraintSystem
	// contains filtered or unexported fields
}

func NewProver

func NewProver(config *config.Config) *Prover

func (*Prover) Run

func (p *Prover) Run(flag bool)

Jump to

Keyboard shortcuts

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