Processing math: 100%
KZG Polynomial Commitments

KZG Polynomial Commitments #

Overview of Polynomial Commitments #

Polynomial commitment schemes allow one party to prove to another the correct evaluation of a polynomial at some set of points, without revealing any other information about the polynomial. A generalization of scalar commitment schemes such as Pedersen commitments, polynomial commitments are an important building block in zero-knowledge protocols; once the prover has committed to a polynomial, the verifier can query the value of the polynomial at one or many points and be assured that the responses are consistent with some predetermined polynomial which was selected without knowledge of the challenge queries.

Kate et. al.’s polynomial commitment scheme [KZG2010] consists, similarly to Pedersen commitments, of two phases.

  • During the commit phase, Prover generates a commitment to some polynomial f(x) and shares it with Verifier.
  • During the open phase, Prover evaluates f at some point x0 and sends x0,f(x0),w, where w is a proof (or “witness”) such that Verifier can check the correct evaluation of f at x0.

The commitment satisfies certain security properties:

  • Hiding: Given a commitment to an unknown degree-t polynomial f and up to t openings x1,f(x1),w1,,xt,f(xt),wt, one cannot find the value of f at any point not already queried.
  • Binding: It is computationally infeasible to construct a commitment C and two distinct valid openings x0,y,w,x0,y,w at the same point x0.

Applications of Polynomial Commitments #

Polynomial commitments serve as an important component of several modern noninteractive proof systems.

Vector Commitments #

Given a vector v=[v1,v2,,vn] we can create a succinct commitment to the whole vector v by interpolating a degree-(n1) polynomial f such that f(i)=vi. This enables provers to commit to a vector of field elements such that openings prove the value at a specific index. Vector commitments can in turn be used as a building block for Verkle Trees, a variant of Merkle trees with extremely small proof sizes.

zkSNARKs #

Polynomial commitment schemes are a core primitive in zkSNARKs such as [PLONK] and [Groth16] . These general-purpose zero knowledge proofs encode computations as polynomial identity constraints and then use openings of polynomial commitments at random points to verify polynomial equality. The power of polynomial commitments here comes from the fact that two distinct degree-t polynomials over a field of order q>t may intersect in at most t points, and thus agree at a random point with probability at most tq.


The KZG Construction #

Bilinear Pairings #

KZG is a pairing-based protocol, meaning it works over a group with an efficiently computable bilinear pairing.

Let G1, G2 and GT be abelian groups of prime order q. G1 and G2 will be written additively while GT will be multiplicative. A bilinear pairing is an efficiently computable function e:G1×G2GT such that

e(ax,by)=e(x,y)ab for all xG1,yG2. We generally assume that e is non-degenerate, meaning that e is not the trivial function mapping all pairs to 1GT.

The KZG commitment scheme was originally presented in the “type-1” setting, where G1=G2. In practice, and in our presentation here, the scheme is generally implemented in the “type-3” setting, where G1G2 in the sense that there is no efficiently computable isomorphism between the two groups.

Common choices of pairing-friendly groups are the Barreto-Naehrig [BN05] and Barreto-Lynn-Scott curves [BLS12-381] .

Trusted Setup #

KZG requires a setup procedure to be carried out by a trusted third party. In practice this setup is often performed as a distributed multiparty computation, such that as long as one participant is honest the setup is secure.

The public parameters are G1, G2 and GT, with generators g1G1,g2G2 and e:G1×G2GT a nondegenerate bilinear pairing. Let tN also be publicly chosen; t will be the maximum degree of committed polynomials.

The setup procedure then computes

SK=α$ZqPK=g1,αg1,α2g1,,αtg1,g2,αg2 and publishes PK.

This pre-generated PK is sometimes known as a “Structured Reference String”

SK must be kept secret and destroyed.

If a party knows the value α then they can forge openings of a commitment to f at x0 with putative value y by computing

w=(f(α)/(αx0)y)g1

Commit #

A commitment to a polynomial f is simply the group element f(α)g1. Because the prover does not know α and thus cannot compute the value f(α) directly, the evaluation is carried out in the exponent as follows:

Given PK, to form a commitment to fZq[X] with f(X)=ti=0ciXi, compute and publish C=ti=0ci(αig1)

Open #

For any degree-t polynomial f, the polynomial (f(X)f(x0)) has a root at x0 and thus can be factored as f(X)f(x0)=(Xx0)fx0(X) for some degree-(t1) polynomial fx0. The witness to an opening of f at x0 is then w=fx0(α)g1.

More concretely, to open a commitment C to polynomial f at point x0, compute the quotient fx0(X)=f(X)f(x0)Xx0=ti=0ciXi and compute the witness as w=fx0(α)g1=ti=0ci(αig1)

Reveal x0,f(x0),w.

Verify #

Verification of an opening of f at x0 with witness w=fx0(α)g1 amounts to checking in the exponent that f(α)?=(Xx0)(α)fx0(α)+f(x0). Since the prover does not know the value of α, we can think of the check as happening at a random point and thus with high probability succeeds only if the polynomial identity f(X)?=(Xx0)fx0(X)+f(x0) holds at all points.

Concretely, to verify an evaluation x0,f(x0),w on commitment C, check e(C,g2)?=e(w,αg2x0g2)e(g1,g2)f(x0)

To see that the scheme is complete in the sense that every correctly computed opening passes verification, we compute

e(w,αg2x0g2)e(g1,g2)f(x0)=e(fx0(α)g1,(αx0)g2)e(g1,g2)f(x0)=e(g1,g2)fx0(α)(αx0)+f(x0)=e(g1,g2)f(α)f(x0)αx0(αx0)+f(x0)=e(g1,g2)f(α)=e(f(α)g1,g2)=e(C,g2)

Hardness Assumptions #

Discrete Logarithm #

The hiding property of KZG commitments relies on the hardness of the discrete logarithm in the group G1.

t-Strong Diffie Hellman #

The binding property requires the t-Strong Diffie Hellman (t-SDH) assumption: Given g,αg,,αtg it is hard to find a pair c,1α+cg. This is a slightly stronger form of the t-Polynomial Diffie Hellman assumption that, given g,αg,,αtg, it is hard to find αt+1g.

t-SDH implies the computational Diffie Hellman assumption, as well as the hardness of the discrete logarithm problem.


KZG Variants #

Indistinguishable and Unconditionally hiding (“Pedersen”) variants #

The KZG commitment scheme as presented above can be viewed as a generalization of the Discrete Log commitment C(x)=xg. This scheme is binding and is hiding against a computationally-bounded adversary when x is chosen uniformly at random, but lacks indistinguishability: if x is drawn from a small set known to the adversary then the adversary can distinguish which of the elements was committed. For example, if Alice wants to commit to a single bit b{0,1} then she will either publish 0g=0 or 1g=g and Bob can clearly learn which bit was committed. Pedersen commitments solve this problem by adding a random masking value r and an extra random public generator h such that Cr(x)=xg+rh. This commitment is now indistinguishable and unconditionally hiding: for any value y there exists some unique s such that Cr(x)=xg+rh=yg+sh=Cs(y), so even a computationally-unbounded adversary cannot learn x from Cr(x), if r is unknown.

In a similar vein, let f(x) be a degree-t polynomial.

  • An adversary capable of solving the Discrete Log problem can find the discrete log of C(f)=f(α)g1 and acquire α,f(α). Thus the scheme is only computationally hiding.
  • If f(x0) is chosen from a small set, say {0,1}, then given t openings an adversary can “guess and check” the value of f(x0). Thus the scheme does not possess indistinguishability.

There are two common approaches to resolve these issues:

  1. Choose one extra point on f at random: if you want to commit to t “useful” points, instead commit to t+1 points, where the last point is chosen uniformly at random. Then, any subset of the t useful points may be revealed without breaking indistinguishability.
  2. Use the “Pedersen Variant”: let h1 be an agreed-upon random generator of G1. To commit to a degree-t polynomial f, choose a random degree-t polynomial ˆf and publish f(α)g1+ˆf(α)h1. To open at a point x0, let w=f(α)f(x0)αx0g1+ˆf(α)ˆf(x0)αx0h1 reveal f(x0),ˆf(x0),wI

Security note: h1 must be chosen independently from g1, i.e., no one may know the discrete log of h1 with respect to g1. If Alice knows s such that h1=sg1 then the commitment scheme fails to be binding:

If h1=sg1 then Cr(x)=xg1+rh1=xg1+(sr)g1=(x+(yx)+s(ryxs))g1=yg1+(ryxs)h1=Cr(yx)s(y)


Security Pitfalls #

  • Small-order elements: Pairing based cryptography often involves elliptic curve groups of composite order. Any elliptic curve points accepted from untrusted parties must be verified to reside in the proper large prime-order subgroup.
  • Polynomial interpolation: If t+1 points on a degree-t polynomial are revealed, then all further points can be recovered.
  • Trusted setup: If using a trusted setup, SK must be generated with strong randomness and erased immediately after generating PK.

References #