Post · 6 min read· pp. 90–93

Kate-Zaverucha-Goldberg (KZG) Constant-Sized Polynomial Commitments

Kate, Zaverucha and Goldberg introduced a constant-sized polynomial commitment scheme in 2010 [^KZG10e]. We refer to this scheme as KZG and quickly introduce it below.

Prerequisites:

  • Cyclic groups of prime order and finite fields \Zp\Zp
  • Pairings (or bilinear maps)
  • Polynomials

Trusted setup

To commit to degree ≤ℓ\le \ell polynomials, need ℓ\ell-SDH public parameters: (g,gτ,gτ2,…,gτℓ)=(gτi)i∈[0,ℓ](g,g^\tau,g^{\tau^2},\dots,g^{\tau^\ell}) = (g^{\tau^i})_{i\in[0,\ell]}

Here, τ\tau is called the trapdoor. These parameters should be generated via a distributed protocol [^BCGplus15],^,[^BGG18],^,[^BGM17] that outputs just the gτig^{\tau^i}’s and forgets the trapdoor τ\tau.

The public parameters are updatable: given gτig^{\tau^i}’s, anyone can update them to gαig^{\alpha^i}’s where α=τΔ\alpha = \tau \Delta by picking a random Δ\Delta and computing: gαi=(gτi)Δig^{\alpha^i} = \left(g^{\tau^i}\right)^{\Delta^i}

This is useful when you want to safely re-use a pre-generated set of public parameters, without trusting that nobody knows the trapdoor.

Commitments

Commitment to ϕ(X)=∑i∈[0,d]ϕiXi\phi(X)=\sum_{i\in[0,d]} \phi_i X^i is c=gϕ(τ)c=g^{\phi(\tau)} computed as:

c=∏i∈[0,deg⁡ϕ](gτi)ϕic=\prod_{i\in[0,\deg{\phi}]} \left(g^{\tau^i}\right)^{\phi_i}

Since it is just one group element, the commitment is constant-sized.

Evaluation proofs

To prove an evaluation ϕ(a)=y\phi(a) = y, a quotient polynomial is computed in O(d)O(d) time:

q(X)=ϕ(X)−yX−aq(X) = \frac{\phi(X) - y}{X - a}

Then, the constant-sized evaluation proof is:

π=gq(τ)\pi = g^{q(\tau)}

Note that this leverages the polynomial remainder theorem.

Verifying an evaluation proof

A verifier who has the commitment c=gϕ(τ)c=g^{\phi(\tau)}, the evaluation y=ϕ(a)y=\phi(a) and the proof π=gq(τ)\pi=g^{q(\tau)} can verify the evaluation in constant-time using two pairings:

e(c/gy,g)=e(π,gτ/ga)⇔e(gϕ(τ)−y,g)=e(gq(τ),gτ−a)⇔e(g,g)ϕ(τ)−y=e(g,g)q(τ)(τ−a)ϕ(τ)−y=q(τ)(τ−a)\begin{align} e(c / g^y, g) &= e(\pi, g^\tau / g^a) \Leftrightarrow\\ e(g^{\phi(\tau)-y}, g) &= e(g^{q(\tau)}, g^{\tau-a}) \Leftrightarrow\\ e(g,g)^{\phi(\tau)-y} &= e(g,g)^{q(\tau)(\tau-a)}\\ \phi(\tau)-y &= q(\tau)(\tau-a) \end{align}

This effectively checks that q(X)=ϕ(X)−yX−aq(X) = \frac{\phi(X) - y}{X-a} by checking this equality holds for X=τX=\tau. In other words, it checks that the polynomial remainder theorem holds at X=τX=\tau.

Batch proofs

One can prove multiple evaluations (ϕ(ei)=yi)i∈I(\phi(e_i) = y_i)_{i\in I} for arbitrary points eie_i using a constant-sized KZG batch proof πI=gqI(τ)\pi_I = g^{q_I(\tau)}, where:

\labeleq:batch−proof−relqI(X)=ϕ(X)−RI(X)AI(X)AI(X)=∏i∈I(X−ei)RI(ei)=yi,∀i∈I\begin{align} \label{eq:batch-proof-rel} q_I(X) &=\frac{\phi(X)-R_I(X)}{A_I(X)}\\ A_I(X) &=\prod_{i\in I} (X - e_i)\\ R_I(e_i) &= y_i,\forall i\in I\\ \end{align}

RI(X)R_I(X) can be interpolated via Lagrange interpolation in O(∣I∣log⁡2∣I∣)O(\vert I\vert\log^2{\vert I\vert}) time [^vG13ModernCh10] as:

RI(X)=∑i∈Iyi∏j∈I,j≠iX−ejei−ej\begin{align} R_I(X)=\sum_{i\in I} y_i \prod_{j\in I,j\ne i}\frac{X - e_j}{e_i - e_j} \end{align}

AI(X)A_I(X) can be computed in O(∣I∣log⁡2∣I∣)O(\vert I \vert \log^2{\vert I \vert}) time via a subproduct tree in O(∣I∣log⁡2∣I∣)O(\vert I\vert\log^2{\vert I\vert}) time [^vG13ModernCh10], as depicted below (for ∣I∣=8\vert I \vert = 8). The computation proceeds downwards, in the direction of the arrows, with the (X−ei)(X-e_i) monomials being computed first.

Each node in the subproduct tree multiplies the polynomials stored in its two children nodes. This way, the root polynomial will be exactly AI(X)A_I(X). If FFT-based multiplication is used, the time to compute a subproduct tree of size nn is:

T(n)=2T(n/2)+O(nlog⁡n)=O(nlog⁡2n)\begin{align} T(n) &= 2T(n/2) + O(n\log{n})\\ &= O(n\log^2{n}) \end{align}

Observation 1: I believe computing AI(X)A_I(X) faster for arbitrary points eie_i is not possible, but I would be happy to be contradicted!

Observation 2: In practice, the algorithms for computing RI(X)R_I(X) and AI(X)A_I(X) efficiently would require FFT-based techniques for polynomial division and multiplication, and FFTs are fastest when the finite field \Zp\Zp is endowed with ddth roots of unity for sufficiently high dd, on the order of the degrees of RI(X)R_I(X) and AI(X)A_I(X).

Verifying a batch proof

The verifier who has the commitment cc, the evaluations (ei,yi)i∈I(e_i, y_i)_{i\in I} and a batch proof πI=gqI(τ)\pi_I=g^{q_I(\tau)} can verify them as follows.

  1. First, he interpolates the accumulator polynomial AI(X)=∏i∈I(X−ei)A_I(X)=\prod_{i\in I} (X-e_i) as discussed above. Then, commits to in O(∣I∣)O(\vert I \vert) time:
    a=gAI(τ)\begin{align} a &= g^{A_I(\tau)} \end{align}
  2. Second, he interpolates RI(X)R_I(X) s.t. RI(ei)=yi,∀i∈IR_I(e_i)=y_i,\forall i \in I as discussed above. Then, commits to in O(∣I∣)O(\vert I \vert) time:
    r=gRI(τ)\begin{align} r &= g^{R_I(\tau)} \end{align}
  3. Third, he checks Equation \refeq:batch−proof−rel\ref{eq:batch-proof-rel} holds at X=τX=\tau using two pairings: e(c/r,g)=e(πI,a)e(c / r, g) = e(\pi_I, a).

Note that:

e(gϕ(τ)/gRI(τ),g)=e(gqI(τ),gAI(τ))⇔e(gϕ(τ)−RI(τ),g)=e(g,g)qI(τ)AI(τ)⇔ϕ(τ)−RI(τ)=qI(τ)AI(τ)\begin{align} e(g^{\phi(\tau)} / g^{R_I(\tau)}, g) &= e(g^{q_I(\tau)}, g^{A_I(\tau)})\Leftrightarrow\\ e(g^{\phi(\tau) - R_I(\tau)}, g) &= e(g,g)^{q_I(\tau) A_I(\tau)}\Leftrightarrow\\ \phi(\tau) - R_I(\tau) &= q_I(\tau) A_I(\tau) \end{align}

Aggregation of proofs

For now, we discuss proof aggregation in a different blog post on building vector commitments (VCs) from KZG.

Applications

There are many cryptographic tools one can build using polynomial commitment schemes such as KZG.

Here’s a few we’ve blogged about in the past:

Appendix

Recently, Cohen et al.[^CDKS22e] showed that an MPC ceremony for generating g1,g1τ,…,g1τqg_1, g_1^\tau, \ldots, g_1^{\tau^q} “powers-of-τ\tau” tolerates bias and so does not need a final random beacon contribution.

Acknowledgements

Many thanks to Shravan Srinivasan and Philipp Jovanovic for really helping improve this post.

[^KZG10e]: Polynomial commitments, by Kate, Aniket and Zaverucha, Gregory M and Goldberg, Ian, 2010, [URL] [^BCGplus15]: Secure Sampling of Public Parameters for Succinct Zero Knowledge Proofs, by E. Ben-Sasson and A. Chiesa and M. Green and E. Tromer and M. Virza, in 2015 IEEE Symposium on Security and Privacy, 2015 [^BGG18]: A Multi-party Protocol for Constructing the Public Parameters of the Pinocchio zk-SNARK, by Bowe, Sean and Gabizon, Ariel and Green, Matthew D., in Financial Cryptography and Data Security, 2019 [^BGM17]: Scalable Multi-party Computation for zk-SNARK Parameters in the Random Beacon Model, by Sean Bowe and Ariel Gabizon and Ian Miers, 2017, [URL] [^vG13ModernCh10]: Fast polynomial evaluation and interpolation, by von zur Gathen, Joachim and Gerhard, Jurgen, in Modern Computer Algebra, 2013 [^CDKS22e]: Guaranteed Output in O(n)O(\sqrt{n}) Rounds for Round-Robin Sampling Protocols, by Ran Cohen and Jack Doerner and Yashvanth Kondi and abhi shelat, in Cryptology {ePrint} Archive, Paper 2022/257, 2022, [URL]