Trusted Setup
A trusted setup is a mechanism ZK-SNARKs use to evaluate a polynomial at a secret value.
Observe that a polynomial can be evaluated by computing the inner product of the coefficients with successive powers of :
For example, if , then the coefficients are and we can compute the polynomial as
In other words, we typically think of evaluating for the polynomial above as
but we could also evaluate it as
Now suppose that someone picks a secret scalar and computes
then multiplies each of those points with the generator point of a cryptographic elliptic curve group. The result would be as follows:
Now anyone can take the structure reference string (SRS) and evaluate a degree three polynomial (or less) on .
For example, if we have a degree 2 polynomial , we can evaluate by taking the inner product of the structured reference string with the polynomial:
We have now computed without knowing what is!
This is also called a trusted setup because although we don’t know what the discrete log of is, the person who created the structured reference string does. This could lead to leaking information down the line, so we trust that the entity creating the trusted setup deletes and in no way remembers it.
Example in Python
from py_ecc.bn128 import G1, multiply, add
from functools import reduce
def inner_product(points, coeffs):
return reduce(add, map(multiply, points, coeffs))
## Trusted Setup
tau = 88
degree = 3
# tau^3, tau^2, tau, 1
srs = [multiply(G1, tau**i) for i in range(degree,-1,-1)]
## Evaluate
# p(x) = 4x^2 + 7x + 8
coeffs = [0, 4, 7, 8]
poly_at_tau = inner_product(srs, coeffs)
Verifying a Trusted Setup was Generated Properly
Given a structured reference string, how do we even know that they follow the structure and weren’t chosen by the roll of the dice?
If the person doing the trusted setup also provides , we can validate the structured reference string is indeed successive powers of .
where is a bilinear pairing. Intuitively, we are computing on the left side and on the right side…
To validate that and have the same discrete logarithms ( is supposed to be , we can check that
Generating a structured reference string as part of a multiparty computation
It’s not a good trust assumption the person generating the structured reference string actually deleted .
We now describe the algorithm for multiple parties to collaboratively create the structured reference string, and as long as one of them is honest (i.e. deletes ), then the discrete logs of the structured reference string will be unknown.
Alice generates the structured reference string and passes it to Bob.
Bob verifies the SRS is “correct” by using the checks from the earlier section. Then Bob picks his own secret parameter and computes
Note that the discrete logs of the srs are now
If either Alice or Bob delete their or , then the discrete logs of the final srs are not recoverable.
Of course, we don’t need to limit the participants to two, we could have as many participants as we like.
This multiparty computation is often informally referred to as the powers of tau ceremony.
The use of a trusted setup in ZK-SNARKs
Evaluating a polynomial on a structured reference string doesn’t reveal information about the polynomial to the verifier, and the prover doesn’t know what point they are evaluating on. We will see later that this scheme helps prevent the prover from cheating and helps keep their witness zero knowledge.
Ready to Get Started?
Join Thousands of Users Today
Start your free trial now and experience the difference. No credit card required.