How to transform interactive proofs into non-interactive proofs? Fiat-Shamir Heuristic!
By: Frederick Kang, CEO of Fox Tech; Sputnik Meng, Chief Scientist of Fox Tech
Zero-knowledge proof techniques in cryptography have a wide range of applications in the web3 world, including privacy computing, zkRollup, and so on. FOAKS, used by FOX in the Layer2 project, is a zero-knowledge proof algorithm. In the above series of applications, two attributes are extremely important for the zero-knowledge proof algorithm, that is, the efficiency of the algorithm and the interactivity.
The importance of algorithm efficiency is self-evident. Efficient algorithms can significantly reduce system uptime, thereby reducing client latency and significantly improving user experience and efficiency. This is an important reason why FOAKS is committed to achieving linear proof time.
On the other hand, from the perspective of cryptography, the design of zero-knowledge proof systems often relies on multiple rounds of interaction between prover and verifier. For example, in the story of "zero knowledge cave" which is used in many popular science articles introducing zero knowledge proof, the realization of proof depends on multiple rounds of information transmission interaction between Alibaba (prover) and journalists (verifier). But in fact, in many application scenarios, dependent interactions can render the system unusable or increase latency significantly. Like in the zkRollup system, we expect the prover (i.e., the folder in FOX) to be able to compute the correct prover value locally, without relying on interaction with the prover.
From this point of view, how to transform the interactive zero-knowledge proof protocol into non-interactive is a very significant problem. In this article, we introduce FOX's process of using the classic Fiatic-Shamir heuristic to generate challenges in Brakedown to implement non-interactive protocols.
The Challenge in proof of zero knowledge
Zero-knowledge proof algorithm has become extremely popular with the spread of applications. In recent years, a variety of algorithms including FOAKS, Orion, zk-stark, etc. The core logic of these algorithms, as well as early sigma protocols in cryptography, is that the Prover first sends a value to the Verifier, who generates a Challenge through local random numbers and sends the randomly generated challenge value to the proifier. The prover needs to have real knowledge to make a response that passes the prover with high probability. For example, in the cave of zero knowledge, the reporter tossed a coin and told Alibaba to come out from the left side or the right side. The "left and right" here was the challenge to Alibaba. If he really knew the spell, he would be able to come out from the required direction, otherwise there would be half the probability of failure.
Here we note that the generation of the Challenge is a critical step, and it has two requirements, random and unprovable prediction. Number one, randomness guarantees its probabilistic properties. Second, if the prover can predict the challenge value, it means that the security of the agreement is broken, and the prover can pass the verification without knowledge. It can continue the analogy, if Alibaba can predict which side the reporter asks him to come from, he can enter that side in advance even without a spell, and the result shows that he can pass the agreement.
So we need a way for the prover to generate such an unpredictable random number locally, yet be validated by the prover so that a non-interactive protocol can be implemented.
The name of the hash function may be familiar to us, whether in Bitcoin's consensus protocol POW as a mining math problem, to compress the amount of data, the construction of message verification code, and so on, hash functions are used. And in all of these different protocols, you actually use a variety of properties of the hash function.
Specifically, the properties of a secure hash function include the following:
- Compressibility: A certain hash function can compress a message of arbitrary length into a fixed length.
- Validity: Given input x, calculating output h (x) is easy.
- Collision resistance: Given an input x1, it is difficult to find another input x2，x1≠x2，h(x1)= h(x2).
Note that if the hash function satisfies collision resistance, then it must satisfy unidirectivity, that is, given an output y, it is difficult to find x satisfying h (x) = y. In cryptography, it is not possible to construct a function that absolutely satisfies unidirectivity in theory, but the hash function can be regarded as a unidirectional function in practical application.
In this way, it can be found that the above several applications correspond to several different properties of hash function. At the same time, we say that hash function also plays an important role in providing randomness. Although the perfect random number generator required by cryptography theory cannot be constructed at present, hash function can also play this role in practice. This provides the basis for the Fiat-Shamir Heuristic techniques we introduce later.
In fact, the Fiat-Shamir Heuristic uses hash functions to hash previously generated scripts, yielding a value that serves as a challenge value.
Since the hash function H is regarded as a random function, the challenge is to be selected uniformly randomly, independent of the prover's public information and commitment. Security analysis assumes that Alice cannot predict the output of H, and can only treat it as an oracle. In this case, the probability that Alice will respond correctly without following the protocol (especially if she does not know the necessary secrets) is inversely proportional to the size of the range of H.
In this section, we show how the Fiat-Shamir heuristic applies to the FOAKS protocol, primarily to generate the Brakedown portion of the challenge to implement non-interactive FOAKS.
First, we saw that among the Brakedown proof generation steps, the ones to be challenged were the "approximation test" and the Merkle Tree proof section (refer to the previous article "Brakedown, a polynomial Commitment Protocol in FOAKS"). For the first point, the original process is a random vector generated by the prover. The calculation process is shown as follows:
Now let's use the hash function and let the prover generate this random vector.
corresponding to the verification calculation of the verifier, also need to add this step to calculate 0. According to this construction, it can be found that the prover cannot predict the challenge value in advance before the generation of the promise, so it cannot "cheat" according to the challenge value in advance, that is, generate the corresponding false promise value. Meanwhile, according to the randomness of the output of the hash function, the challenge value also satisfies the randomness.
For the second point, let
We use pseudocode to present the proof and verification functions in the modified non-interactive Brakedown polynomial promise, which is also used in the FOAKS system.
Many zero-knowledge proof algorithms rely on the interaction between prover and verifier at the beginning of design, but this interactive proof protocol is not suitable for application scenarios that pursue high efficiency and high network communication cost, such as on-chain data privacy protection and zkRollup. Through the Fiat-Shamir Heuristic, the prover can generate a random number of "Challenge" locally without breaking the security of the protocol, and can be verified by the prover. In this way, FOAKS also implements non-interactive proofs and applies them to the system.
1.Fiat, Amos; Shamir, Adi (1987). "How To Prove Yourself: Practical Solutions to Identification and Signature Problems". Advances in Cryptology — CRYPTO' 86. Lecture Notes in Computer Science. Springer Berlin Heidelberg. 263: 186–194. doi:10.1007/3-540-47721-7_12. ISBN 978-3-540-18047-0.
Zero Knowledge Proofs