Follow-up of KZG Polynomial Commitments: details efficient ways to verify multiple KZG proofs at once, and to compute multiple KZG proofs.
Batched KZG
Prove returns the proof of opening of on . Note that we usually give the evaluations with the proof.
- (we compute the euclidian division without the remainder)
Verifies that a pre-image of c evaluates to on .
Roots of unity
Note that we usually use this algorithms when is a root of unity group. This means that has a sparse representation where is a generator.
Correcteness
To prove correctness we need to show that . Notice that both polynomials are of degree less than and have the same evaluations on points .
Security
The security is similar to KZG. We work in the algebraic group model. We try to reduce to the discrete log. Assumes that the adversary gives us a commitment, a proof, and some which are incorrect but passes the verification. We will solve a discrete log. The adversary returns us and computed from the srs. It means that can be identified with the commitment to a polynomial and . If the verification passes then . This means that , where is the interpolation of the given evaluations, or the adversary manages to find a non zero linear combination of srs elements that cancels (which reduces to discrete log). To see that this reduces to the discrete log, notice that if the adversary produces not all zeroes, then implies that the trapdoor of the srs is one of the root of the polynomial whose coefficients are . So we can solve the discrete log of srs.1 with probability . Assumes that the adversary did not produce such linear combination. So the equation is correct on the polynomial, and we have However, the adversary if crafting a proof for a false statement we have which is not the remainder of (by the same reasoning as in the correctness). By construction we also have . This is a contradiction. So the adversary managed to solved a discrete log.
More formally, to prove the evaluation binding, we need to reduce the problem to the -bilinear strong Diffie-Hellman assumption which slightly extends the -SDH assumption:
-bilinear strong Diffie-Hellman assumption
Let be an abelian group and , for any adversary :
, for .
Evaluation binding
By reduction to the -BSDH assumption, suppose an adversary , given a trusted setup , outputs two different valid witness tuples and . Let’s call the interpolated polynomial from the values of . By assumption, , , with and . Let’s set and . By the correctness of the scheme,
and
So that and , which entails . Factoring by we obtain We’re almost there but we can’t compute , so we rewrite the expression using the Euclidean division : With a bit of algebra ()
Hence the need for a pairing to be able to multiply and in . A solution to the -BSDH instance is given by , and for example
Note that in the next proofs, we will assume that everything that is verified in the pairing equations is true for the corresponding polynomial equation. The same reduction to discrete log applies.
Performance
The prover performances are discussed in the Batch opening part. For the verifier, the main cost is to compute a commitment to the remainder. We propose a variation in the next part, to avoid this commimtent on the verifier side.
Verifier efficient variations
We differ from the preceeding algorithm by adding the commitment to the remainder in the proof. We then generate a pseudo random challenge via Fiat-Shamir, and give a KZG proof for evaluation on that pseudo random challenge.
- (Same as preceeding algorithm)
- (Fiat shamir)
Verifies that a pre-image of C evaluates to on
:
- (Fiat Shamir)
- (Get a (pseudo) random number to batch pairings)
Note that line 2 is done using the barycentric evaluation : https://hackmd.io/@vbuterin/barycentric_evaluation
Security
We want to reduce to the security of KZG and the batched version of it. To do that we need to handle the two pseudo random numbers and . Lets start with . Assume that the adversary computes using a random oracle (otherwise his probability of cheating is negligible). We use rewinding. Denote by the pre-image of (given by the algebraic group model) and the pre-image of . We get for multiple , in the realm of polynomials (see preceeding proof): Seeing that as a polynomial in we get that the two terms and are zeros (otherwise the polynomial in of degree one has more than one root). By the security of batched KZG, the first term being zero means that . For the second, let’s rewind again. Again asumes that is computed by calling a random oracle (otherwise his probability of cheating is negligible). We get multiple and st. . Rembember that since the are fixed, the different correspond to the evaluations on the different of the same polynomial, which is the interpolation of the on . We denote by that unique polynomial. By the KZG security, this means that for multiple . Now, since the degree of is bounded (because of the srs size) this means that is equal to on more points than it’s degree, so . This plus contradicts the fact that the statement of the adversary is incorrect to begin with.
Batching verification
We now present an algorithm that checks multiple shards at once. The main idea will be to generate a pseudo random , to commit only once to the remainder, and to put everything in one pairing.
We denote by and a set of and . Verifies that a pre-image of evaluates to (the shards in our context) on (the shifted subgroup on our context) for all . are as before . Denote by the generator of . Denote the size of a subgroup . Note that . Note that to batch, instead of multipying directly , we expand into , as done in the batched version of KZG presented in Plonk (part 3 of https://eprint.iacr.org/2019/953). The second term is denoted as in Plonk.
- (We compute the sum first to avoid doing several EC multiplications)
Security
Again we rewind to reduce to the security of the basic scheme. The algebraic adversary gives us polynomial , which are the pre-images of respectively and . We get multiple st. the following holds in the realm of polynomials (otherwise a d log is solved) . Again the are the same because the are. Same for . The are the chosen by the verifier. Grouping the sums, we get : We see this as a polynomial in , which has more roots than its degree. Therefore all his terms are zeroes. By the security of batched KZG, this is contradictory with the fact that the adversary lied.
Batch opening
Multi-reveals
This feature is described in the KZG extended paper under section 3.4 as batch opening https://link.springer.com/chapter/10.1007/978-3-642-17373-8_11 on arbitrary points. The paper https://github.com/khovratovich/Kate/blob/master/Kate_amortized.pdf shows how to commit and verify quickly when the points form cosets of a group of roots of unity.
For , let be a primitive -th root of unity. For , let be a primitive -th root of unity and .
For , the proof of the evaluations of at the points is the Kate commitment to the quotient of the euclidean division of by the vanishing polynomial whose only roots are . In other words, given the euclidean division , , the proof is . Opening at one point corresponds to the case where .
To verify the proof, we gather the alleged evaluations of at the points . From these possibly correct evaluations, we can construct an alleged remainder by computing the inverse DFT on the domain , as on this domain, and as is determined by its evaluations at distinct points. We then check
Multiple multi-reveals
We now wish to reveal not on the domain , but on several subdomains: its cosets of elements each. The committed polynomial has degree where corresponds to the dimension of the Reed-Solomon code. We present and slightly extend the result from https://eprint.iacr.org/2023/033.pdf, which assumes the size of the domains and of their cosets to be powers of two.
Computing the proofs for all such cosets would cost euclidean divisions and multi-exponentiations. Even though the euclidean division by is linear in the degree of the committed polynomial, as well as the multi-exponentiation thanks to the Pippenger algorithm (See https://cr.yp.to/papers/pippenger.pdf), computing all proofs leads to a complexity . It turns out the proofs for the cosets are related, so all proofs can be computed in time .
Again, for , given the euclidean division , , the proofs to be computed are .
We denote , the next power of 2 of , and set . For our purposes we further assume , .
We don’t require to be a power of two. However should be of the form for a small prime , and should be of the form for the same small prime and . Thus is a power of two.
The floor designates here the truncated polynomial long division, where terms for are dropped.
Letting a primitive -th root of unity:
There is a subtle condition which is not stated in the original paper (but is more apparent with the above derivation) which is . Indeed, if , then the powers of are absent of the quotient:
For this reason, we assume (thus ). We could support the other case () but it is a bit cumbersome, and is sort of an edge case for which there are too few shards.
Thus,
Letting
we obtain
So by definition is the of the vector ().
Now, let’s address the computation of the coefficients of interest for . To this end, https://github.com/khovratovich/Kate/blob/master/Kate_amortized.pdf observe that the computation of the ’s can be decomposed into the computation of the “offset” sums: ,
So the desired coefficients can then be obtained with . This decomposition of the calculation allows the vectors for to be computed with Toeplitz matrix-vector multiplications:
We can extend this Toeplitz matrix to form a circulant matrix whose columns are shifted versions of the vector . We can then compute circulant matrix-vector multiplication with the FFT. See this presentation from Kyle Kloster, student at Purdue University: https://www.youtube.com/watch?v=w0peHpfFVpc.
The length of the following transforms is , which we assume is a power of two, for the reasons mentioned above. Though we could in some instances allow transforms of different size using the Prime Factor Algorithm as we currently do for FFTs operating on vectors of scalars.
Given the euclidean divisions , for :
- Compute EC-FFTs over :
The above calculation can be done once per trusted setup and can thus be cached.
- Compute FFTs over : , with :
where and .
- Then compute with circulant matrix-vector multiplication via FFT:
- The first coefficients is the result of the multiplication by the Toeplitz vector (with a bit of zero padding starting from the -th coefficient): let’s call this vector . The KZG proofs are given by following the observation ().
Complexity of multiple multi-reveals
For the preprocessing part, we count EC-FFTs on , so the asymptotic complexity of the step is .
For the KZG proofs generation part, we count FFTs on and two EC-FFTs on : the runtime complexity is , where and represent the runtime cost of the FFT and EC-FFT. Both have the same complexity, even though the latter hides a bigger constant (log of scalar size in bits, here ) due to the elliptic curve scalar multiplication.