Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addition of KZG commitment scheme (issue #38) #48

Merged
merged 13 commits into from
May 11, 2021
Merged

Addition of KZG commitment scheme (issue #38) #48

merged 13 commits into from
May 11, 2021

Conversation

ThomasPiellard
Copy link
Contributor

@ThomasPiellard ThomasPiellard commented May 7, 2021

This PR fixes #38 .

KZG

The KZG stucture stores the SRS (2 G2 points, and a slice of G1 points) and the fft domain needed for the polyomial division. Each field is serialised when the KZG structure is read from/written to a reader/writer.

API breaking changes

  • The interface that an additively homomorphic commitment scheme should implement has been modified and consists of the following methods:
Commit(p Polynomial) Digest
Open(point interface{}, p Polynomial) OpeningProof
Verify(commitment Digest, proof OpeningProof) error
BatchOpenSinglePoint(point interface{}, digests []Digest, polynomials []Polynomial) BatchOpeningProofSinglePoint
BatchVerifySinglePoint(digests []Digest, batchOpeningProof BatchOpeningProofSinglePoint) error
  • The claimed values are now in the proof structure instead of separate objects.
    Example for KZG:
type Proof struct {

	// Point at which the polynomial is evaluated
	Point fr.Element

	// ClaimedValue purported value
	ClaimedValue fr.Element

	// H quotient polynomial (f - f(z))/(x-z)
	H bn254.G1Affine
}
  • The interface that a Polynomial should implement has been enhanced to fit the needs of KZG, but is still minimalist:
type Polynomial interface {
	Degree() uint64
	Eval(v interface{}) interface{}
	Clone() Polynomial
	Add(p1, p2 Polynomial) Polynomial
	AddConstantInPlace(c interface{})
	SubConstantInPlace(c interface{})
	ScaleInPlace(c interface{})
	Equal(p1 Polynomial) bool
}

Status

All tests pass.

@CLAassistant
Copy link

CLAassistant commented May 7, 2021

CLA assistant check
All committers have signed the CLA.

@gbotrel gbotrel merged commit f7850bb into develop May 11, 2021
@gbotrel gbotrel deleted the feat/kzg branch May 11, 2021 22:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants