This write-up follows this following paper.
In this write-up, we will discuss the practical implementation of a pairing based (bls12-381) dynamic universal accumulator. This basically means the ability to succinctly commit to a set of unique elements onchain, and prove (non)-membership (making it universal), while maintaining the ability to add and remove elements (making it dynamic). This all in the trustless setting of a plutus script (this design does use a trusted setup, which can be generated via an MPC). The nice thing about this approach is that the homomorphic property of the pairing, naturally allows for the batching of either membership or non-membership proofs, while keeping the proof size constant.
The fundamental property of the pairing that allows us to do interesting stuff is the possibility to multiply polynomials and compare them in a hidden way that ensures correctness. For this, we need a trusted setup of a secret value
We can then evaluate it in
Since
Now, besides this, there is a canonical way of multiplying polynomials and equating them to others via a pairing. In math notation, this means that if we have the three polynomials
via the
To prove that
And it checks that the constructed commitments over the CRS are equal in
Now this last line is of course true if indeed
So to reiterate and conclude, via the pairing we can commit to polynomials without providing the full polynomial, this while maintaining the ability to multiply them and equating them.
The basic idea of this accumulator is to represent the set of members as a polynomial with zero-point matching the set. So for a set of
making each
So
here
Say now we want to prove for a set
where
then the polynomial remainder theorem gives us that there exist another unique polynomial
And given the definition of
because clearly,
And since our subset is indeed a proper subset,
and verify that for the coefficients
Note that if you do this onchain, you need to perform
Say now we want to prove for a set
Now if there is no overlap in zero points, the gcd is one, which is something we can verify succinctly via the pairing check! This
Here
The above two ways of proving (non)-membership can be combined to make a dynamic onchain accumulator. For removal of a set a membership proof has to be provided, and since the proof is precisely the remainder of the accumulated set without the subset that is being proved, this proof can be used as the new accumulator.
For adding a set of elements, one first has to prove that the elements were not a member, after which the found commitment to the disjoint set can be multiplied with the old accumulator. This effectively is a membership proof of the new state with as proof the old accumulator (the reverse of removal).
We see that in the removal case, this method is highly efficient as there is no overhead since the proof is the new state. For the addition, this unfortunately requires both kind proofs.