Post · 21 min read· pp. 79–89

Aggregatable Subvector Commitments for Stateless Cryptocurrencies from Lagrange Polynomials

tl;dr: We build a vector commitment (VC) scheme from KZG commitments to Lagrange polynomials that has (1) constant-sized, aggregatable proofs, which can all be precomputed in O(nlog⁡n)O(n\log{n}) time, and (2) linear public parameters, which can be derived from any “powers-of-tau” CRS in O(nlog⁡n)O(n\log{n}) time. Importantly, the auxiliary information needed to update proofs (a.k.a. the “update key”) is O(1)O(1)-sized. Our scheme is compatible with recent techniques to aggregate subvector proofs across different commitments [^GRWZ20].

This is joint work with Ittai Abraham, Vitalik Buterin, Justin Drake, Dankrad Feist and Dmitry Khovratovich. Our full paper is available online here, has been recently accepted to SCN’20, and has been presented here (25 minutes) and here (1 hour). You can find the slides in this GitHub repo.

A little backstory: I’ve been interested in vector commitments (VCs) ever since Madars Virza first showed me how KZG and roots of unity gives rise to a simple VC scheme. In 2018, I was trying to figure out if VC proofs can be updated fast in such a construction. I came up with a KZG-based scheme that could update a proof for viv_i given a change to any $v_j $. Unfortunately, it required an O(n)O(n)-sized, static, update key to do the update. Since each player ii in a stateless cryptocurrency has to update their proof for viv_i, this O(n)O(n)-sized update key is an annoying storage burden for that user.

Then, I saw Vitalik Buterin’s post on using partial fraction decomposition to aggregate KZG proofs. This was great, since it immediately implied VC proofs can be aggregated. However, after conversations with Ittai Abraham and the Ethereum Research team, it became clear this can also be used to reduce the update key size. The key ingredient was turning two commitments to A(X)/(X−i)A(X)/(X-i) and A(X)/(X−j)A(X)/(X-j) into a commitment to A(X)/((X−i)(X−j))A(X)/\left((X-i)(X-j)\right) (see here). This post explains this technique and how to make it work by taking care of all details (e.g., making update keys verifiable, computing them from the KZG public params efficiently, etc.).

\newcommand{\vect}[1]{\boldsymbol{\mathrm{#1}}} \newcommand{\prk}{\mathsf{prk}} \newcommand{\vrk}{\mathsf{vrk}} \newcommand{\upk}{\mathsf{upk}}

Preliminaries

Let [i,j]={i,i+1,i+2,…,j−1,j}[i,j]=\{i,i+1,i+2,\dots,j-1,j\} and [0,n)=[0,n−1][0, n) = [0,n-1]. Let pp be a sufficiently large prime that denotes the order of our groups.

In this post, beyond basic group theory for cryptographers [^KL15] and basic polynomial arithmetic, I will assume you are familiar with a few concepts:

  • Bilinear maps[^GPS08]. Specifically, ∃\exists a bilinear map e:\Gr1×\Gr2→\GrTe : \Gr_1 \times \Gr_2 \rightarrow \Gr_T such that:
    • ∀u∈\Gr1,v∈\Gr2,a∈\Zp,b∈\Zp,e(ua,vb)=e(u,v)ab\forall u\in \Gr_1,v\in \Gr_2, a\in \Zp, b\in \Zp, e(u^a, v^b) = e(u,v)^{ab}
    • e(g1,g2)≠1Te(g_1,g_2)\ne 1_T where g1,g2g_1,g_2 are the generators of \Gr1\Gr_1 and \Gr2\Gr_2 respectively and 1T1_T is the identity of \GrT\Gr_T
  • KZG[^KZG10] polynomial commitments (see here),
  • The Fast Fourier Transform (FFT)[^CLRS09] applied to polynomials. Specifically,
    • Suppose \Zp\Zp admits a primitive root of unity ω\omega of order nn (i.e., n∣p−1n \mid p-1)
    • Let H={1,ω,ω2,ω3,…,ωn−1}H=\{1, \omega, \omega^2, \omega^3, \dots, \omega^{n-1}\} denote the set of all nn nnth roots of unity
    • Then, FFT can be used to efficiently evaluate any polynomial ϕ(X)\phi(X) at all X∈HX\in H in Θ(nlog⁡n)\Theta(n\log{n}) time
      • i.e., compute all {ϕ(ωi−1)}i∈[n]\{\phi(\omega^{i-1})\}_{i\in[n]}

VCs from Lagrange polynomials

We build upon a previous line of work on VCs from Lagrange polynomials [^CDHK15],[^KZG10],[^Tome20].

Recall that given a vector \vectv=[v0,v1,…,vn−1]\vect{v} = [v_0, v_1, \dots, v_{n-1}], we can interpolate a polynomial ϕ(X)\phi(X) such that ϕ(i)=vi\phi(i)=v_i as follows:

ϕ(X)=∑i=0n−1vi⋅\lagri(X), where \lagri(X)=∏j∈[0,n)j≠iX−ji−j\begin{align} \phi(X)=\sum_{i=0}^{n-1} v_i \cdot \lagr_i(X),\ \text{where}\ \lagr_i(X) = \prod_{\substack{j\in [0,n)\\j\ne i}}\frac{X-j}{i-j} \end{align}

It is well-known that this Lagrange representation of \vectv\vect{v} naturally gives rise to a vector commitment (VC) scheme [^CF13]. The key idea is to commit to \vectv\vect{v} by committing to ϕ(X)\phi(X) using KZG polynomial commitments (see here). Then, proving ϕ(i)=vi\phi(i) = v_i proves that viv_i is the iith element in the vector. Next, we describe how this scheme works in more detail and what features it has.

Trusted setup

To set up the VC scheme for committing to any vector of size nn, use an MPC protocol [^BGM17] to generate public parameters (gτi)i∈[0,n]\left(g^{\tau^i}\right)_{i\in [0,n]}. Then, either:

  1. Spend O(n2)O(n^2) time to compute commitments ℓi=g\lagri(τ)\ell_i = g^{\lagr_i(\tau)} to all nn Lagrange polynomials \lagri(X)\lagr_i(X).
  2. Or, “shift” the computation of these commitments into the MPC protocol, losing some efficiency.

We will fix this later by storing viv_i at ϕ(ωni)\phi(\omega_n^i), which will allow us to compute all ℓi\ell_i’s in O(nlog⁡n)O(n\log{n}) time.

Either way, the proving key is \prk=(gτi,ℓi)i∈[0,n)\prk=\left(g^{\tau^i},\ell_i\right)_{i\in[0,n)} and will be used to commit to a vector and create proofs. The verification key is \vrk=(g,gτ)\vrk=(g,g^{\tau}) and will be used to verify proofs.

Committing to a vector

The commitment to a vector \vectv\vect{v} is just a KZG commitment c=gϕ(τ)c=g^{\phi(\tau)} to its polynomial ϕ(X)\phi(X). This can be computed very fast, in O(n)O(n) time, given the proving key \prk\prk:

c=∑i=0n−1ℓivi=∑i=0n−1gvi⋅\lagri(τ)=g∏i=0n−1vi⋅\lagri(τ)=gϕ(τ)\begin{align} c &= \sum_{i=0}^{n-1} \ell_i^{v_i}\\ &= \sum_{i=0}^{n-1} g^{v_i \cdot \lagr_i(\tau)}\\ &= g^{\prod_{i=0}^{n-1} v_i \cdot \lagr_i(\tau)}\\ &= g^{\phi(\tau)} \end{align}

Updating the commitment

KZG commitments and thus vector commitments are homomorphic: given commitments cc and c’c’ to \vectv\vect{v} and \vectv’\vect{v’}, we can get a commitment C=c⋅c’C=c \cdot c’ to \vectv+\vectv’\vect{v} + \vect{v’}.

A consequence of this is that we can easily update a commitment cc to c’c’, given a change δ\delta to viv_i as:

c’=c⋅ℓiδ\begin{align} c’ = c \cdot \ell_i^{\delta} \end{align}

Constant-sized proofs

To prove that viv_i is the iith element in \vectv\vect{v}, we have to prove that ϕ(i)=vi\phi(i)=v_i. For this, we need to:

  1. Interpolate ϕ(X)\phi(X) in O(nlog⁡2n)O(n\log^2{n}) field operations and get its coefficients.
  2. Divide ϕ(X)\phi(X) by X−iX-i in O(n)O(n) field operations and get a quotient qi(X)q_i(X) such that ϕ(X)=qi(X)(X−i)+vi\phi(X)=q_i(X)(X-i) + v_i (see the polynomial remainder theorem).
  3. Compute a KZG commitment πi=gqi(τ)\pi_i=g^{q_i(\tau)} to qi(X)q_i(X) using an O(n)O(n) time multi-exponentiation

The proof will be:

πi=gqi(τ)=gϕ(τ)−viτ−i\begin{align} \pi_i=g^{q_i(\tau)}=g^\frac{\phi(\tau)-v_i}{\tau-i} \end{align}

In Appendix D.7 in our paper, we show how to compute πi\pi_i in O(n)O(n) time, without interpolating ϕ(X)\phi(X) by carefully crafting our public parameters.

To verify the proof, we can check with a pairing that:

e(c/gvi,g)=e(πi,gτ/gi)\begin{align} e(c/g^{v_i}, g)=e(\pi_i, g^{\tau}/g^i) \end{align}

This is equivalent to checking that the polynomial remainder theorem holds for ϕ(i)\phi(i) at X=τX=\tau.

Constant-sized II-subvector proofs

To prove multiple positions (vi)i∈I(v_i)_{i\in I}, an II-subvector proof πI\pi_I can be computed using a KZG batch proof as:

πI=gqI(τ)=gϕ(τ)−RI(τ)AI(τ)\begin{align} \pi_I &= g^{q_I(\tau)}=g^\frac{\phi(\tau)-R_I(\tau)}{A_I(\tau)} \end{align}

For this, the prover has to interpolate the following polynomials in O(∣I∣log⁡2∣I∣)O(\vert I\vert \log^2{\vert I\vert}) time:

AI(X)=∏i∈I(X−i)RI(X)=∑i∈Ivi∏j∈I,j≠iX−ji−j s.t. RI(i)=vi,∀i∈I\begin{align} A_I(X) &=\prod_{i\in I} (X - i)\\ R_I(X) &=\sum_{i\in I} v_i \prod_{j\in I,j\ne i}\frac{X - j}{i - j}\ \text{s.t.}\ R_I(i) = v_i,\forall i\in I \end{align}

Verifying the proof can also be done with two pairings:

e(c/gRI(τ),g)=e(πI,gAI(τ))\begin{align} e(c/g^{R_I(\tau)}, g)=e(\pi_I, g^{A_I(\tau)}) \end{align}

Note that the verifier has to spend O(∣I∣log⁡2∣I∣)O(\vert I\vert \log^2{\vert I\vert}) time to interpolate and commit to AI(X)A_I(X) and RI(X)R_I(X).

Later on, we show how to aggregate an II-subvector proof πI\pi_I from all individual proofs πi,i∈I\pi_i, i\in I in O(∣I∣log⁡2∣I∣)O(\vert I\vert \log^2{\vert I\vert}) time.

Enhancing Lagrange-based VCs

The VC scheme presented so far has several nice features:

  • O(1)O(1)-sized commitments
  • O(n)O(n)-sized proving key and O(1)O(1)-sized verification key
  • O(1)O(1)-sized proofs and O(1)O(1)-sized II-subvector proofs

It also has additional features, which we didn’t explain:

  • Homomorphic proofs: Suppose we are given (1) a proof πi\pi_i for viv_i w.r.t. a commitment cc for \vectv\vect{v} and (2) a proof πi’\pi_i’ for vi’v_i’ w.r.t. to c’c’ for vector \vectv’\vect{v’}. Then, can obtain a proof Λi=πi⋅πi’\Lambda_i=\pi_i \cdot \pi_i’ for vi+vi’v_i + v_i’ w.r.t. C=c⋅c’C=c\cdot c’, which is a commitment to \vectv+\vectv’\vect{v}+\vect{v’}.
  • Hiding: can commit to a vector as gϕ(τ)hr(τ)g^{\phi(\tau)} h^{r(\tau)} to get a commitment that hides all information about \vectv\vect{v}.
    • Here, will need extra hτih^{\tau^i}’s.
    • Also, r(X)r(X) is a random, degree n−1n-1 polynomial.

Nonetheless, applications such as stateless cryptocurrencies[^CPZ18], require extra features:

  1. Aggregatable proofs: Blocks can be made smaller by aggregating all users’ proofs in a block into a single subvector proof.
  2. Updatable proofs: In a stateless cryptocurrency, each user ii has a proof of her balance stored at position ii in the vector. However, since the vector changes after each transaction in the currency, the user must be able to update her proof so it verifies w.r.t. the updated vector commitment.
  3. Precompute all proofs fast: Proof serving nodes in stateless cryptocurrencies can operate faster if they periodically precompute all proofs rather than updating all O(n)O(n) proof after each new block.
  4. Updatable public parameters: Since many gτig^{\tau^i}’s are already publicly available from previous trusted setup ceremonies implemented via MPC, it would be nice to use them safely by “refreshing” them with additional trusted randomness.

Our paper adds all these features by carefully making use of roots of unity [^vG13ModernCh8], Fast Fourier Transforms (FFTs)[^CLRS09] and partial fraction decomposition [^Buterin20UsingPoly].

Aggregating proofs into subvector profs

Drake and Buterin [^Buterin20UsingPoly] observe that partial fraction decomposition can be used to aggregate KZG proofs.

Let’s first take a quick look at how partial fraction decomposition works.

Partial fraction decomposition

Any accumulator polynomial fraction can be decomposed as:

1∏i∈I(X−i)=∑i∈Ici⋅1X−i\begin{align} \frac{1}{\prod_{i\in I} (X-i)} = \sum_{i\in I} c_i \cdot \frac{1}{X-i} \end{align}

The key question is “What are the cic_i’s?” Surprisingly, the answer is given by a slightly tweaked Lagrange interpolation formula on a set of points II [^BT04]:

\lagri(X)=∏j∈I,j≠iX−ji−j=AI(X)AI’(i)(X−i), where AI(X)=∏i∈I(X−i)\begin{align} \lagr_i(X)=\prod_{j\in I, j\ne i} \frac{X-j}{i - j}=\frac{A_I(X)}{A_I’(i) (X-i)},\ \text{where}\ A_I(X)=\prod_{i\in I} (X-i) \end{align}

Here, AI’(X)A_I’(X) is the derivative of AI(X)A_I(X) and has the (non-obvious) property that AI’(i)=∏j∈I,j≠i(i−j)A_I’(i)=\prod_{j\in I,j\ne i} (i-j). (Check out this post for some intuition on why this tweaked Lagrange formula works.)

Now, let us interpolate the polynomial ϕ(X)=1\phi(X)=1 using this new Lagrange formula from a set of ∣I∣|I| points (vi,ϕ(vi)=1)i∈I(v_i, \phi(v_i)=1)_{i\in I}.

ϕ(X)=∑i∈Ivi\lagri(X)⇔ 1=AI(X)∑i∈[0,n)viAI’(i)(X−i)⇔1AI(X)=∑i∈I1AI’(i)(X−i)⇔1AI(X)=∑i∈I1AI’(i)⋅1(X−i)⇒ci=1AI’(i)\begin{align} \phi(X) &= \sum_{i\in I} v_i \lagr_i(X)\Leftrightarrow\\\ 1 &= A_I(X)\sum_{i\in[0,n)} \frac{v_i}{A_I’(i)(X-i)}\Leftrightarrow\\ \frac{1}{A_I(X)} &= \sum_{i\in I} \frac{1}{A_I’(i)(X-i)}\Leftrightarrow\\ \frac{1}{A_I(X)} &= \sum_{i\in I} \frac{1}{A_I’(i)}\cdot\frac{1}{(X-i)}\Rightarrow\\ c_i &= \frac{1}{A_I’(i)} \end{align}

Thus, to compute all cic_i’s needed to decompose, we need to evaluate A’(X)A’(X) at all i∈Ii\in I. Fortunately, this can be done in O(∣I∣log⁡2∣I∣)O(\vert I\vert \log^2{\vert I\vert}) field operations using a polynomial multipoint evaluation [^vG13ModernCh10].

Applying partial fraction decomposition to VC proofs

Recall that an II-subvector proof is just a commitment to the following quotient polynomial:

qI(X)=ϕ(X)1AI(X)−RI(X)1AI(X)\begin{align} q_I(X) &= \phi(X)\frac{1}{A_I(X)}- R_I(X)\frac{1}{A_I(X)}\\ \end{align}

Next, we replace 1AI(X)\frac{1}{A_I(X)} with its partial fraction decomposition ∑i∈I1AI’(i)(X−i)\sum_{i\in I} \frac{1}{A_I’(i)(X-i)}.

qI(X)=ϕ(X)∑i∈I1AI’(i)(X−i)−(AI(X)∑i∈IviAI’(i)(X−i))⋅1AI(X)=∑i∈Iϕ(X)AI’(i)(X−i)−∑i∈IviAI’(i)(X−i)=∑i∈I1AI’(i)⋅ϕ(X)−viX−i=∑i∈I1AI’(i)⋅qi(X)\begin{align} q_I(X) &= \phi(X)\sum_{i\in I} \frac{1}{A_I’(i)(X-i)} - \left(A_I(X)\sum_{i\in I} \frac{v_i}{A_I’(i)(X-i)}\right)\cdot \frac{1}{A_I(X)} \\ &= \sum_{i\in I} \frac{\phi(X)}{A_I’(i)(X-i)} - \sum_{i\in I} \frac{v_i}{A_I’(i)(X-i)}\\ &= \sum_{i\in I} \frac{1}{A_I’(i)}\cdot \frac{\phi(X) - v_i}{X-i}\\ &= \sum_{i\in I} \frac{1}{A_I’(i)}\cdot q_i(X) \end{align}

So in the end, we were able to express qI(X)q_I(X) as a linear combination of qi(X)q_i(X)’s, which are exactly the quotients committed to in the proofs of the viv_i’s (see here).

Thus, given a set of proofs (πi)i∈I(\pi_i)_{i\in I} for a bunch of viv_i’s, we can aggregate them into an II-subvector proof πI\pi_I as:

πI=∏i∈Iπi1AI’(i)\begin{align} \pi_I &= \prod_{i\in I} \pi_i^{\frac{1}{A_I’(i)}} \end{align}

This takes O(∣I∣log⁡2∣I∣)O(\vert I\vert \log^2{\vert I\vert}) field operations to compute all the cic_i’s, as explained in the previous subsection.

Updating proofs

First, recall that a proof πi\pi_i for viv_i is a KZG commitment to:

qi(X)=ϕ(X)−viX−i\begin{align} q_i(X)=\frac{\phi(X)-v_i}{X-i} \end{align}

Suppose that vjv_j changes to vj+δv_j+\delta, thus changing the vector commitment and invalidating any proof πi\pi_i. Thus, we want to be able to update any proof πi\pi_i to a new proof πi’\pi_i’ that verifies w.r.t. the updated commitment. Note that we must consider two cases:

  1. i=ji=j
  2. i≠ji\ne j.

We refer to the party updating their proof πi\pi_i as the proof updater.

The i=ji=j case

Let’s see how the quotient polynomial qi’(X)q_i’(X) in the updated proof πi’\pi_i’ relates to the original quotient qi(X)q_i(X):

qi’(X)=ϕ’(X)−(vi+δ)X−i=(ϕ(X)+δ\lagri(X))−vi−δX−i=ϕ(X)−viX−i−δ(\lagri(X)−1)X−i=qi(X)+δ(\lagri(X)−1X−i)\begin{align} q_i’(X) &=\frac{\phi’(X)-(v_i+\delta)}{X-i}\\ & =\frac{\left(\phi(X) + \delta\lagr_i(X)\right) - v_i -\delta}{X-i}\\ &=\frac{\phi(X) - v_i}{X-i}-\frac{\delta(\lagr_i(X)-1)}{X-i}\\ &= q_i(X) + \delta\left(\frac{\lagr_i(X)-1}{X-i}\right) \end{align}

Observe that if we include KZG commitments uiu_i to \lagri(X)−1X−i\frac{\lagr_i(X)-1}{X-i} in our public parameters, then we can update πi\pi_i to πi’\pi_i’ as:

πi’=πi⋅(ui)δ\begin{align} \pi_i’ = \pi_i \cdot \left(u_i\right)^{\delta} \end{align}

We include a commitment uiu_i as part of each user ii’s update key \upki=ui=g\lagri(τ)−1τ−i\upk_i = u_i = g^\frac{\lagr_i(\tau)-1}{\tau-i}. This way, each user ii can update her proof after a change to their own viv_i. This leaves us with handling updates to vjv_j for j≠ij\ne i. We handle this next by including additional information in \upki\upk_i.

The i≠ji\ne j case

Again, let’s see how qi’(X)q_i’(X) relates to the original qi(X)q_i(X), but after a change δ\delta at position j≠ij\ne i:

qi’(X)=ϕ’(X)−viX−i=(ϕ(X)+δ\lagrj(X))−viX−i=ϕ(X)−viX−i−δ\lagrj(X)X−i=qi(X)+δ(\lagrj(X)X−i)\begin{align} q_i’(X) &=\frac{\phi’(X)-v_i}{X-i}\\ &=\frac{\left(\phi(X) + \delta\lagr_j(X)\right) - v_i}{X-i}\\ &=\frac{\phi(X) - v_i}{X-i}-\frac{\delta\lagr_j(X)}{X-i}\\ &= q_i(X) + \delta\left(\frac{\lagr_j(X)}{X-i}\right) \end{align}

This time we are in a bit of pickle because there are O(n2)O(n^2) possible polynomials Ui,j(X)=\lagrj(X)X−iU_{i,j}(X) = \frac{\lagr_j(X)}{X-i} Let, ui,j=gUi,j(τ)u_{i,j}=g^{U_{i,j}(\tau)} denote their commitments. This would mean we’d need each user ii to have n−1n-1 ui,ju_{i,j}’s: one for each j∈[0,n),j≠ij\in[0,n),j\ne i. Then, for any change δ\delta to vjv_j, user ii could update its πi\pi_i to πi’\pi_i’ as:

πi’=πi⋅(ui,j)δ\begin{align} \pi_i’ = \pi_i \cdot \left(u_{i,j}\right)^{\delta} \end{align}

However, this would mean each user ii’s update key is \upki=(ui,(ui,j)j∈[0,n),j≠i)\upk_i = (u_i, (u_{i,j})_{j\in [0,n),j\ne i}) and is O(n)O(n)-sized. This makes it impractical for use in applications such as stateless cryptocurrencies, where each user ii has to include their \upki\upk_i in every transaction they issue.

Re-constructing ui,ju_{i,j} fast

Fortunately, by putting additional information in \upki\upk_i and \upkj\upk_j, we can help user ii reconstruct ui,ju_{i,j} in O(1)O(1) time. Let A(X)=∏i∈[0,n)(X−i)A(X)=\prod_{i\in [0,n)} (X-i) be the accumulator polynomial over all ii’s. Let A’(X)A’(X) be its derivative and store the evaluation A’(i)A’(i) in each user’s \upki\upk_i. Additionally, store ai=gA(τ)τ−ia_i = g^\frac{A(\tau)}{\tau-i} in each user’s \upki\upk_i. (Note that aia_i is just a KZG proof for A(i)=0A(i) = 0.)

Computing all aia_i’s takes O(n2)O(n^2) time, but we improve this to O(nlog⁡n)O(n\log{n}) time later using roots of unity.

Next, using the tweaked Lagrange formula from before, rewrite Ui,j(X)U_{i,j}(X) as:

Ui,j(X)=\lagrj(X)X−i=A(X)A’(j)(X−j)(X−i)=1A’(j)⋅A(X)⋅1(X−j)(X−i)\begin{align} U_{i,j}(X) &=\frac{\lagr_j(X)}{X-i}\\ &= \frac{A(X)}{A’(j)(X-j)(X-i)}\\ &= \frac{1}{A’(j)}\cdot A(X) \cdot \frac{1}{(X-j)(X-i)} \end{align}

Next, notice that we can decompose 1(X−j)(X−i)\frac{1}{(X-j)(X-i)}:

Ui,j(X)=1A’(j)⋅A(X)⋅1(X−j)(X−i)=1A’(j)⋅A(X)⋅(cj1X−j+ci1X−i)=1A’(j)⋅(cjA(X)X−j+ciA(X)X−i)\begin{align} U_{i,j}(X) &= \frac{1}{A’(j)}\cdot A(X) \cdot \frac{1}{(X-j)(X-i)}\\ &= \frac{1}{A’(j)}\cdot A(X) \cdot \left(c_j \frac{1}{X-j}+ c_i\frac{1}{X-i}\right) &= \frac{1}{A’(j)}\cdot \left(c_j \frac{A(X)}{X-j}+ c_i\frac{A(X)}{X-i}\right) \end{align}

Now, notice that this implies the commitment ui,ju_{i,j} can be computed in O(1)O(1) time as:

ui,j=(ajcj⋅aici)1A’(j)\begin{align} u_{i,j} &= \left(a_j^{c_j} \cdot a_i^{c_i}\right)^\frac{1}{A’(j)} \end{align}

What are cic_i and cjc_j? Just define Ai,j(X)=(X−i)(X−j)A_{i,j}(X) = (X-i)(X-j), take its derivative Ai,j’(X)=(X−i)+(X−j)A_{i,j}’(X)=(X-i)+(X-j) and, as mentioned before, you have ci=1/Ai,j’(i)=1/(i−j)c_i=1/A_{i,j}’(i)=1/(i-j) and cj=1/Ai,j’(j)=1/(j−i)c_j=1/A_{i,j}’(j)=1/(j-i)

Thus, it is sufficient to set each user’s \upki=(ui,ai,A’(i))\upk_i=(u_i, a_i, A’(i)).

Note that for user ii to update their proof, they need not just their own \upki\upk_i but also the \upkj\upk_j corresponding to the changed position jj. This is fine in settings such as stateless cryptocurrencies, where \upkj\upk_j is part of the transaction that sends money from user ii to user jj.

Verifiable update keys

In the stateless cryptocurrency setting, it is very important that user ii be able verify \upkj\upk_j before using it to update her proof. Similarly, miners should verify the update keys they use for updating the commitment cc. (We did not discuss it, but \upki\upk_i can also be used to derive a commitment to \lagri(X)\lagr_i(X) needed to update cc after a change to viv_i.)

To verify \upki\upk_i, we need to include a commitment a=gA(τ)a=g^{A(\tau)} to A(X)A(X) in the \vrk\vrk. This way, each aia_i in \upki\upk_i can be verified as a normal KZG proof w.r.t. aa. Then, each uiu_i can also be verified by noticing two things:

  1. uiu_i is just a KZG proof that \lagri(i)=1\lagr_i(i) = 1
  2. aia_i can be transformed into ℓi=g\lagri(τ)\ell_i=g^{\lagr_i(\tau)} in O(1)O(1) time by exponentiating it with $1/A’(i)$, which is part of \upki\upk_i

As a result, uiu_i can now be verified as a KZG proof that \lagri(i)=1\lagr_i(i) = 1 against ℓi\ell_i.

Precomputing all proofs fast

Computing all nn constant-sized proofs for vi=ϕ(i)v_i=\phi(i) in less than quadratic time seems very difficult. Fortunately, Feist and Khovratovich [^FK20] give a beautiful technique that can do this, subject to the restriction that the evaluation points are roots of unity, rather than [0,1,…,n−1][0,1,\dots, n-1]. Thus, if we change our scheme to store viv_i at ϕ(ωi)\phi(\omega^i) where ω\omega is an nnth primitive root of unity, we can use this technique to compute all VC proofs (πi)i∈[0,n)(\pi_i)_{i\in [0,n)} in O(nlog⁡n)O(n\log{n}) time.

Furthermore, we can use this same technique to compute all the aia_i’s from each \upki\upk_i in O(nlog⁡n)O(n\log{n}) time.

Efficiently-computable and updatable public parameters

Our scheme’s public parameters, consisting of the proving key, verification key and update keys, need to be generated via an MPC protocol [^BGM17], to guarantee nobody learns the trapdoor τ\tau. Unfortunately, the most efficient MPC protocols only output gτig^{\tau^i}’s. This means we should (ideally) find a way to derive the remaining public parameters from these gτig^{\tau^i}’s.

First, when using roots of unity, we have A(X)=∏i∈[0,n)(X−ωi)=Xn−1A(X)=\prod_{i\in [0,n)} (X-\omega^i) = X^n - 1. Thus, the commitment a=gA(τ)a=g^{A(\tau)} to A(X)=Xn−1A(X)=X^{n} - 1 can be computed in O(1)O(1) time via an exponentiation.

Second, the commitments ℓi=g\lagri(τ)\ell_i=g^{\lagr_i(\tau)} to Lagrange polynomials can be computed via a single DFT on the (gτi)(g^{\tau^i})’s. (See Sec 3.12.3, pg. 97 in Madars Virza’s PhD thesis [^Virza17]).

Third, each ai=gA(τ)/(τ−ωi)a_i = g^{A(\tau)/(\tau -\omega^i)} is just a bilinear accumulator membership proof for ωi\omega^i w.r.t. A(X)A(X). Thus, all aia_i’s can be computed in O(nlog⁡n)O(n\log{n}) time via the Feist-Khovratovich technique [^FK20].

Lastly, we need a way to compute all ui=g\lagri(τ)−1X−ωiu_i = g^{\frac{\lagr_i(\tau)-1}{X-\omega^i}}. It turns out this is also doable in O(nlog⁡n)O(n\log{n}) time using an FFT on a carefully-crafted input (see Sec 3.4.5 in our paper).

As a last benefit, since our parameters can be derived from gτig^{\tau^i}’s which are updatable, our parameters are updatable. This is very useful as it allows safe reuse of existing parameters generated for other schemes.

Parting thoughts

Please see our paper for more goodies, including:

  • A formalization of our primitive (in Sec 3.1)
  • The full algorithms of our VC (in Sec 3.4.4)
  • A new security definition for KZG batch proofs with a reduction to nn-SBDH (in Appendix C)
  • The efficient algorithm for computing the uiu_i’s (in Sec 3.4.5)
  • A comparison to other VCs (in Table 2)
  • An survey of existing VC schemes over prime-order groups, with a time complexity analysis (in Appendix D)
  • A smaller, incomplete survey of existing VC schemes over hidden-order groups (in Appendix D)

Are roots of unity necessary?

Babis Papamanthou asked me a very good question: “What functionality requires the use of roots of unity?” I hope the last two sections answered that clearly:

  • Can precompute all nn VC proofs in quasilinear time
  • Can derive our public parameters efficiently from the gτig^{\tau^i}’s
    • This includes all uiu_i’s and aia_i’s needed to update proofs efficiently
  • Can have (efficiently) updatable public parameters
  • Can remove A’(i)A’(i) from \upki\upk_i, since A’(i)=nω−iA’(i)=n\omega^{-i} (see Appendix A in our paper)

Future work

It would be very exciting to see by how much this new VC scheme improves the performance of stateless cryptocurrencies such as Edrax [^CPZ18].

Acknowledgements

Special thanks goes to Madars Virza who first introduced me to Lagrange-based VCs in 2017 and helped me with some of the related work.

References

[^GRWZ20]: Pointproofs: Aggregating Proofs for Multiple Vector Commitments, by Sergey Gorbunov and Leonid Reyzin and Hoeteck Wee and Zhenfei Zhang, in Cryptology ePrint Archive, Report 2020/419, 2020, [URL] [^KL15]: Introduction to Modern Cryptography, by Jonathan Katz and Yehuda Lindell, 2007 [^GPS08]: Pairings for cryptographers, by Steven D. Galbraith and Kenneth G. Paterson and Nigel P. Smart, in Discrete Applied Mathematics, 2008 [^KZG10]: Constant-Size Commitments to Polynomials and Their Applications, by Kate, Aniket and Zaverucha, Gregory M. and Goldberg, Ian, in ASIACRYPT ‘10, 2010 [^CLRS09]: Introduction to Algorithms, Third Edition, by Cormen, Thomas H. and Leiserson, Charles E. and Rivest, Ronald L. and Stein, Clifford, 2009 [^CDHK15]: Composable and Modular Anonymous Credentials: Definitions and Practical Constructions, by Camenisch, Jan and Dubovitskaya, Maria and Haralambiev, Kristiyan and Kohlweiss, Markulf, in Advances in Cryptology – ASIACRYPT 2015, 2015 [^Tome20]: How to Keep a Secret and Share a Public Key (Using Polynomial Commitments), by Tomescu, Alin, 2020 [^CF13]: Vector Commitments and Their Applications, by Catalano, Dario and Fiore, Dario, in Public-Key Cryptography – PKC 2013, 2013 [^BGM17]: Scalable Multi-party Computation for zk-SNARK Parameters in the Random Beacon Model, by Sean Bowe and Ariel Gabizon and Ian Miers, in Cryptology ePrint Archive, Report 2017/1050, 2017, [URL] [^CPZ18]: Edrax: A Cryptocurrency with Stateless Transaction Validation, by Alexander Chepurnoy and Charalampos Papamanthou and Yupeng Zhang, in Cryptology ePrint Archive, Report 2018/968, 2018 [^vG13ModernCh8]: Fast Multiplication, by von zur Gathen, Joachim and Gerhard, Jurgen, in Modern Computer Algebra, 2013 [^Buterin20UsingPoly]: Using polynomial commitments to replace state roots, by Vitalik Buterin, in \url{https://ethresear.ch/t/using-polynomial-commitments-to-replace-state-roots/7095}, 2020, [URL] [^BT04]: Barycentric Lagrange Interpolation, by Berrut, J. and Trefethen, L., in SIAM Review, 2004 [^vG13ModernCh10]: Fast polynomial evaluation and interpolation, by von zur Gathen, Joachim and Gerhard, Jurgen, in Modern Computer Algebra, 2013 [^FK20]: Fast amortized Kate proofs, by Dankrad Feist and Dmitry Khovratovich, 2020, [pdf] [^Virza17]: On Deploying Succinct Zero-Knowledge Proofs, by Virza, Madars, 2017