ipa

package
v0.0.0-...-514ddfb Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2023 License: Apache-2.0, MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckIPAProof

func CheckIPAProof(transcript *common.Transcript, ic *IPAConfig, commitment banderwagon.Element, proof IPAProof, evalPoint fr.Element, result fr.Element) (bool, error)

CheckIPAProof verifies an IPA proof for a committed polynomial in evaluation form. It verifies that `proof` is a valid proof for the polynomial at the evaluation point `evalPoint` with result `result`

func GenerateRandomPoints

func GenerateRandomPoints(numPoints uint64) []banderwagon.Element

GenerateRandomPoints generates numPoints random points on the curve using hardcoded seed.

func InnerProd

func InnerProd(a []fr.Element, b []fr.Element) (fr.Element, error)

InnerProd computes the inner product of a and b.

func MultiScalar

func MultiScalar(points []banderwagon.Element, scalars []fr.Element) (banderwagon.Element, error)

MultiScalar computes the multi scalar multiplication of points and scalars.

Types

type IPAConfig

type IPAConfig struct {
	SRS []banderwagon.Element
	Q   banderwagon.Element

	PrecompMSM         banderwagon.MSMPrecomp
	PrecomputedWeights *PrecomputedWeights
	// contains filtered or unexported fields
}

IPAConfig contains all the necessary information to create an IPA related proofs, such as the SRS, Q, and precomputed weights for the barycentric formula.

func NewIPASettings

func NewIPASettings() (*IPAConfig, error)

NewIPASettings generates the SRS, Q and precomputed weights for the barycentric formula. The SRS is generated as common.VectorLength random points where the relative discrete log is not known between each generator.

func (*IPAConfig) Commit

func (ic *IPAConfig) Commit(polynomial []fr.Element) banderwagon.Element

Commit calculates the Pedersen Commitment of a polynomial polynomial in evaluation form using the SRS.

type IPAProof

type IPAProof struct {
	L        []banderwagon.Element
	R        []banderwagon.Element
	A_scalar fr.Element
}

IPAProof is an inner product argument proof.

func CreateIPAProof

func CreateIPAProof(transcript *common.Transcript, ic *IPAConfig, commitment banderwagon.Element, a []fr.Element, evalPoint fr.Element) (IPAProof, error)

CreateIPAProof creates an IPA proof for a committed polynomial in evaluation form. `a` are the evaluation of the polynomial in the domain, and `evalPoint` represents the evaluation point. The evaluation of the polynomial at such point is computed automatically.

func (IPAProof) Equal

func (ip IPAProof) Equal(other IPAProof) bool

Equal checks if two IPA proofs are equal.

func (*IPAProof) Read

func (ip *IPAProof) Read(r io.Reader) error

Read deserializes the IPA proof from the given reader.

func (*IPAProof) Write

func (ip *IPAProof) Write(w io.Writer) error

Write serializes the IPA proof to the given writer.

type PrecomputedWeights

type PrecomputedWeights struct {
	// contains filtered or unexported fields
}

PrecomputedWeights contains precomputed coefficients for efficient usage of the Barycentric formula.

func NewPrecomputedWeights

func NewPrecomputedWeights() *PrecomputedWeights

NewPrecomputedWeights generates the precomputed weights for the barycentric formula.

func (*PrecomputedWeights) ComputeBarycentricCoefficients

func (preComp *PrecomputedWeights) ComputeBarycentricCoefficients(point fr.Element) []fr.Element

ComputeBarycentricCoefficients, computes the coefficients `bary_coeffs` for a point `z` such that when we have a polynomial `p` in lagrange basis, the inner product of `p` and `bary_coeffs` is equal to p(z) Note that `z` should not be in the domain. This can also be seen as the lagrange coefficients L_i(point)

func (*PrecomputedWeights) DivideOnDomain

func (preComp *PrecomputedWeights) DivideOnDomain(index uint8, f []fr.Element) []fr.Element

DivideOnDomain computes f(x) - f(x_i) / x - x_i where x_i is an element in the domain

Jump to

Keyboard shortcuts

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