This repository hosts a library that provides a VectorCommitment and several vector commitment scheme implementations, and a library for a verkle tree implementation that will become compatible with Ethereum's spec.
The verkle tree is similar to a merkle tree in that it is a tree structure that commits to its children, but instead of using hashes to provide binding, it uses a vector commitment scheme. The verkle tree itself is also a vector commitment scheme.
A Vector Commitment Scheme (VCS) enables one to commit to a vector of elements and then generate proofs of inclusion in regard to that commitment. The security of these schemes binds the vector of elements being proven to the initial commitment, so verifiers can be sure that proofs indeed prove that an element was contained in the commitment.
Many (and the ones in this repository) of VCS are built on Polynomial Commitment Schemes (PCS), utilizing the properties of polynomials to achieve the above goals.
Polynomials are usually presented in coefficient form
A note on polynomial division: A polynomial is divisible by
This repository contains two implementations of base vector commitments: IPA and KZG. Here is a nice comparison of their tradeoffs, taken from Dankrad [1].
Pedersen+IPA | KZG | |
---|---|---|
Assumption | Discrete log | Bilinear group |
Trusted Setup | No | Yes |
Commitment size | 1 Group element | 1 Group Element |
Proof Size |
|
1 Group Element |
Verification |
|
1 Pairing |
The Commom Reference String (CRS) of the IPA scheme is a set of ECC points in which the discrete log relation between them is unknown
Note that as the table above mentions, this not a trusted setup, as there must be no structure between these points (unlike KZG). For example, we could use a hash function that continously hashes its own output, and serialize each output to a ECC point. Given a sufficiently large curve, it should be probabilisticaly impossible to find
Let
When working in evaluation form, we create a commitment to the dataset in the form of
Now, we want to prove that the element low_level_ipa()
function. In order to prevent attackers from crafting their commitment to commit to false data, we utilize the Fiat-Shamir heuristic [5] to create a non-interactive protocol that produces a challenge
Dankrad's article [1] does a much better job explaining the actual inner product argument than I can. Just note that because we are working in evaluation form, there is no commitment to
- When we are proving a point inside of our domain (dataset), it is simply the vector of $0$s except for the index of
$z$ set to one (as we only want the evaluation of that point).$\overrightarrow{a} \cdot \overrightarrow{b} = y$ . - When we are proving outside of the domain, in the case of multiproofs, we utilize the barycentric coefficients from [2]. These coefficients can be thought of as interpolating our domain of all
$1$ values. When this is inner producted with our actual dataset, it produces what would be the output of the lagrange polynomial that interpolates our dataset. In otherwords, we can evaluate outside of our domain without actually interpolating a polynomial in coefficient form (which is computationally expensive)!
Let
The CRS of the KZG scheme is of the form of a structured reference string (SRS), a set of ECC points in which they have the structure of a polynomial, i.e for some
With the SRS being structured in the form of a polynomial evaluation, what this enables us to do is to evaluate our data (which remember, is a polynomial, just in its evaluation form) at a random, unknown point. Because this point
For efficiency reasons, instead of committing to
The proof of inclusion for KZG is simple: we just need to prove the following:
Why? Remember the note on polynomial division above, a polynomial is only divisble by
Again, refer to Dankrad [6] for a better explanation, but the crux of verifying this proof is that the following must hold:
Writing this out in terms of the pairing group, it becomes:
What this is proving is that the following equation holds, evaluated at the secret
[1] https://dankradfeist.de/ethereum/2021/07/27/inner-product-arguments.html
[2] https://en.wikipedia.org/wiki/Lagrange_polynomial
[3] https://en.wikipedia.org/wiki/Root_of_unity
[4] https://en.wikipedia.org/wiki/Fast_Fourier_transform
[5] https://en.wikipedia.org/wiki/Fiat%E2%80%93Shamir_heuristic
[6] https://ethereum.org/en/roadmap/danksharding/
[7] https://dankradfeist.de/ethereum/2020/06/16/kate-polynomial-commitments.html
[8] https://dankradfeist.de/ethereum/2021/06/18/pcs-multiproofs.html