Explanation of SNARKs. Knowledge of the adopted coefficient and reliable blind calculation of polynomials (translation)
Hi, Habr! I present to your attention the translation of ZCash blog articles, which describe the mechanism of the evidence system with zero disclosure of SNARKs used in the ZCash cryptocurrency (and not only).
In this article, we will look at the test for the adopted coefficient and the blind computation of verifiable polynomials. Go… In the previous article, we saw how Alice can blindly calculate hiding its polynomial P is of order d , at the point s belonging to Bob. We called this a “blind” calculation, since Alice does not get the value s in the calculation process. ')
However, there is something missing in this protocol. The fact that Alice can calculate does not guarantee that she will really send Bob, and not some other value.
Thus, we need a way to “get” Alice to correctly follow the protocol. In the article we will explain in detail how to achieve this. Let's first consider and explain the principle of operation of the main tool needed for this. We call it the “Knowledge of Coefficient (KC) Test).
As before, we denote by g the generator of the group G of order where discrete logarithm is a hard task. For convenience, starting from this place we will work with our group additively, and not multiplicatively. That is, for $ inline $ α ∈ F_p, α⋅g $ inline $ denotes the addition of α times the copy of g .
Coefficient knowledge test
For will call a couple of elements at " - pair "if and .
denotes nonzero elements . This is the same as described in the previous article .
Testing is as follows.
Bob picks a random number and number . It calculates
He sends Alice a "request" in the form of a pair . notice, that is an α-pair.
Now Alice must respond to the request with another pair. . This is also an α-pair.
Bob accepts Alice’s answer only if is really an α-pair (since he knows α, he can verify that ).
Now let's think about when Alice can successfully answer the call? Suppose she knows α . In this case, she can simply choose any a ' from G and calculate and then return the new α-pair .
However, since the only information about α is contained in the expression and the group G has a complex discrete logarithm problem, we believe that Alice will not be able to find .
So, how can she successfully answer a query without knowing α ?
The easy way to do this is this: Alice just chooses some and responds with a pair $ inline $ (a ', b') = (γ⋅ a, γ⋅ b) $ inline $
In this case, we have:
$ inline $ b '= γ⋅ b = γα ⋅ a = α (γ⋅ a) = α ⋅ a' $ inline $
So a couple is α- pair, as required.
Note that if Alice responded using this option, she knows what the ratio of a to a ' is equal to. That is, she knows such a coefficient so that .
Knowledge of the accepted coefficient (ZPK - The Knowledge of Coefficient Assumption (KCA)) states that this is always the case:
ZPK: If Alice returns the correct answer to Bob's request it is more likely regardless of the choice of bob She knows the coefficient so that .
In the literature, this is usually called “knowledge about the accepted exponent,” since it has traditionally been used for multiplicative groups .
The Knowledge Test and Adopted Factor will be important tools in the next part of the article.
What does Alice know mean?
You may wonder how we can formulate a ZPK in a specific mathematical expression? In particular, how do we formulate the notion that "Alice knows" in mathematical definition?
This is done something like this: we say that besides Alice, we have another side, which we call Alice Extractor. Alice’s extractor has access to Alice’s inner state.
Now we can formulate the ZPK as follows: every time Alice successfully responds -pair Alice Extractor returns such that .
The complete formal definition of a PEL is determined by the Extractor "somewhat weaker" and instead it signals the likelihood of a successful response from Alice, rather than deducing which is insignificant in this case
How to make a blind calculation of verifiable polynomials
Further, based on the previous material, we will develop a protocol for reliable blind calculation of polynomials, which will be defined below. The following sections (and articles) will show how this protocol can be used to build SNARKs, so have some more patience to learn SNARKs :).
Suppose that Alice has a polynomial P of order d , and Bob has a point which he chose randomly. We want to create a protocol that would allow Bob to learn i.e. Hiding P at s , with two additional properties:
Confidentiality: Alice does not recognize s , and Bob does not recognize P.
Credibility: The probability that Alice sends a value not for a polynomial P of order d , which is known to her, and at the same time Bob accepts it - is negligible.
This is called a blind calculation of a polynomial. The protocol in the previous article gave us only the first paragraph, but not the second. To obtain validity, we need an extended version of the knowledge about the adopted coefficient (ZPK).
The validity and confidentiality properties are useful together, because they make Alice decide which polynom P to use without seeing the value s . This, in a sense, obliges Alice to "answer with a polynomial", without seeing the "point query" s . This logic will become clearer later.
In full formal proof, some things are described more subtly. For example, the fact that Alice does get some information about s before deciding on her polynomial P. For example, she gets a hide
Advanced ZPK
ZPK, in the form that we defined above, sounds like this: if Bob gives Alice some -pair and then Alice generates another -pair , then she knows the value of c to . In other words, Alice knows the relationship between a ' and a .
Now suppose that instead of one, Bob sends several to Alice -pair (for the same ). And now again, Alice, having received these pairs, must generate other others. -pairs . It is important that Alice should do this, and she does not know the meaning .
As described above, Alice can create -pair in a simple way. To do this, take one of the pairs. received from bob and multiply both elements by some . If a was - pair, then will also -pair But can Alice generate -pairs for more received -pair? And is it possible to get a new one? -pair using several received at once -pair?
Answer: Yes. For example, Alice can choose two values. and calculate a pair $ inline $ (a ', b') = (c_1⋅ a_1 + c_2⋅ a_2, c_1⋅ b_1 + c_2⋅ b_2) $ inline $ . Simple transformations show that for any , non-zero, this is also - pair:
In the more general case, Alice can take any linear combination of the received d pairs. To do this, select any and determine .
Note that if Alice uses this strategy to generate her -pair, she will know some linear relationship between and . I mean, she knows such that .
Extended ZPK claims, in essence, that this is the only way Alice can generate -pair That way, when it is successfully generated, Alice will know a linear relationship between and . More formally, assume that G is a group of size p with generator g , described additively at the beginning of the article. Knowledge of the accepted coefficient of order d (d-) in G can be written as follows:
d-ZPK: Suppose that Bob chooses random and and sends to Alice -pairs $ inline $ (g, α ⋅ g), (s g, α s g), ..., (s ^ d⋅ g, αs ^ d⋅ g) $ inline $ . Suppose then that Alice answers another -pair . Then, with high probability, Alice knows such that .
D-KCA (d-ZPK) was presented in the journal Jens Groth.
Note that in Bob does not send a random set -pair, and sends a set with a certain "polynomial structure". We will see the benefit of this in the protocol below.
Valid blind calculation protocol
Suppose our HS (homomorphic hiding) is a mapping for generator g of G , described above.
For simplicity, we present the protocol for this particular E :
Bob picks a random and sends Alice to hide (for ), and also hide $ inline $ α ⋅ g, α s ⋅ g, ..., α s ^ d⋅ g $ inline $ (for ).
Alice calculates and using the items sent in the first stage, and sends them to Bob.
Bob checks that and accepts the answer if and only if this equality holds.
First, note that the coefficients obtained , are a linear combination and , but is a linear combination $ inline $ α ⋅ g, α s ⋅ g, ..., α s ^ d⋅ g $ inline $ . Thus, similar to the protocol in the previous article, Alice can actually calculate these values from Bob's messages for the P polynomial she knows.
Secondly, according to d-ZPK, if Alice sends such that , she almost certainly knows such , what . In this case for polynomial famous Alice. In other words, the probability that Bob will accept the answer in step 3 and at the same time Alice does not know such a polynomial P is negligible.
Summarizing all this, using d-ZPK, we developed a protocol for reliable blind calculation of polynomials. In the following articles we will see how this mechanism is used in the construction of SNARK.