kzgmulti

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMinSRSSize = errors.New("minimum srs size is 2")

Functions

func ComputeMultiPointKZGProofs

func ComputeMultiPointKZGProofs(fk20 *fk20.FK20, poly poly.PolynomialCoeff) ([]bls12381.G1Affine, [][]fr.Element, error)

func VerifyMultiPointKZGProofBatch

func VerifyMultiPointKZGProofBatch(deduplicatedCommitments []bls12381.G1Affine, commitmentIndices, cosetIndices []uint64, proofs []bls12381.G1Affine, cosetEvals [][]fr.Element, openKey *OpeningKey) error

Verifies Multiple KZGProofs

Note: `cosetEvals` is mutated in-place, ie it should be treated as a mutable reference

Types

type CommitKey

type CommitKey = kzg.CommitKey

The commit key stays the same between the kzg single opening use case and the multi opening use case

type OpeningKey

type OpeningKey struct {
	// These are the G1 elements in monomial form from the trusted setup
	G1 []bls12381.G1Affine
	// These are the G2 elements in monomial form from the trusted setup
	// Note: the length of this list is the same as the length of the G1 list
	G2 []bls12381.G2Affine
	// Number of points that the prover will open to in a single multi-point proof
	//
	// The points that the prover can open to are not arbitrary sets, but are cosets.
	CosetSize uint64
	// A bound on the polynomial length that we can commit, create and
	// verify proofs about.
	//
	// Note: This is not the degree of the polynomial.
	// One can compute the degree of the polynomial by doing `PolySize-1“
	PolySize uint64
	// The total number of points that the prover will create proofs for.
	//
	// Example, we could have f(x) = x^3 + x^2 + x + 1
	// and a protocol may require that this polynomial which has PolySize = 4
	// to be opened up at 32 points. The number 32 is the NumPointsToOpen constant.
	NumPointsToOpen uint64
	// CosetShiftsPowCosetSize contains precomputed powers of coset shifts.
	// For each coset k, it stores (ω_k)^n where ω_k is the k-th coset shift
	// and n is the coset size. These values are used for verifying multiple
	// multi-point KZG opening proofs.
	CosetShiftsPowCosetSize []fr.Element
	// contains filtered or unexported fields
}

func NewOpeningKey

func NewOpeningKey(g1s []bls12381.G1Affine, g2s []bls12381.G2Affine, polySize, numPointsToOpen, cosetSize uint64) *OpeningKey

func (*OpeningKey) CommitG1

func (ok *OpeningKey) CommitG1(scalars []fr.Element) (*bls12381.G1Affine, error)

func (*OpeningKey) CommitG2

func (ok *OpeningKey) CommitG2(scalars []fr.Element) (*bls12381.G2Affine, error)

type SRS

type SRS struct {
	OpeningKey OpeningKey
	CommitKey  CommitKey
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳