Contents

Lately, Iβve been diving a little into the world of Zero-Knowledge Proofs. The idea is to prove that you know something without revealing what you know. More specifically, a Zero-Knowledge Proof is a cryptographic protocol that allows a prover to convince a verifier that a statement is true without revealing any information beyond the validity of the statement. In essence, by the end of the protocol, the verifier is convinced that the prover knows the secret, and the verifier hasnβt learned anything (zero-knowledge) about the secret.
Zero-Knowledge Proofs (ZKPs) are kinda hot right now, since a lot of new Bitcoin innovations are being built on top of them. It allows for a higher level of privacy and potential scalability improvements in the Bitcoin network.
Zero-knowledge proofs are advantageous in a myriad of application, including (refer to [1]):
Proving statement on private data:
- Person has more than in his bank account
- In the last year, a bank did not transact with an entity
- Matching DNA without revealing full DNA
- One has a credit score higher than
Anonymous authorization:
- Proving that requester has right to access web-siteβs restricted area without revealing its identity (e.g., login, password)
- Prove that one is from the list of allowed countries/states without revealing from which one exactly
- Prove that one owns a monthly pass to a subway/metro without revealing cardβs id
Anonymous payments:
- Payment with full detachment from any kind of identity
- Paying taxes without revealing oneβs earnings
Outsourcing computation:
- Outsource an expensive computation and validate that the result is correct without redoing the execution; it opens up a category of trustless computing
- Changing a blockchain model from everyone computes the same to one party computes and everyone verifies
The idea behind this post is to give a general overview of Zero-Knowledge Proofs, while providing further resources, especially which papers to read, to dive deeper into the subject. As always, Iβll try to keep it simple and intuitive. However, as you might guess, the subject is quite complex, and Iβll try to simplify it as much as possible; but some mathematical background is necessary.
What are ZKPs?
Letβs formalize the concept of Zero-Knowledge Proofs. A formal definition of zero-knowledge has to use some computational model, and without loss of generality, we can use the Turing Machine model. So letβs create three Turing machines:
- (the prover),
- (the verifier),
- and (the simulator).
Letβs also spicy things up a bit and introduce an adversary , and assume that it is also a Turing machine. The secret we want to prove knowledge without revealing is .
The prover wants to prove to the verifier that it knows the secret . They both share a common simulator . The adversary is trying to fool the verifier into believing that it knows the secret , without actually knowing it.
The prover generates a proof , and sends it to the verifier . The verifier then checks the proof , and decides whether to accept or reject it.
The tuple is a Zero-Knowledge Proof if the following properties hold:
Completeness: If the statement is true, the verifier will accept the proof.
Here denotes the probability that the verifier accepts the proof given a simulator and a proof .
Soundness: If the statement is false, no cheating prover can convince an honest verifier that it is true, except with some negligible probability1.
Here denotes the probability that the verifier accepts the proof given an adversary , a simulator , and a proof .
Zero-Knowledge: If the statement is true, the verifier learns nothing about the secret . A proof is zero-knowledge if there exists a simulator that can simulate the verifierβs view without knowing the secret .
Here is the view of the verifier , and denotes the interaction between the prover and the verifier.
If you come up from a scheme that satisfies these properties, congratulations, you have a Zero-Knowledge Proof scheme and you can name it whatever you want, just like a Pokemon!
ZKPs Taxonomy
We can classify Zero-Knowledge Proofs into two broad categories:
Interactive Zero-Knowledge Proofs: In this case, the prover and the verifier interact multiple times. The prover sends a proof to the verifier, and the verifier sends a challenge to the prover, and this interaction continues until the verifier is convinced. The Fiat-Shamir Heuristic can transform an interactive ZKP into a non-interactive ZKP.
Non-Interactive Zero-Knowledge Proofs: In this case, the prover sends a proof to the verifier, and the verifier accepts or rejects the proof. No further interaction is needed.
Additionally, the setup of the simulator with respect to the data it uses can be further classified into three categories. Generally speaking, the data used by is some random bits. In trusted setups, if the data is compromised, the security of the proof is also compromised. In other words, anyone with the hold of the data can prove anything to anyone. This is bad, and we want to avoid it.
- Trusted Setup: uses data that must be kept secret.
- Trusted but Universal Setup: uses data that must be kept private, but it only uses for the initial setup. Future proofs can be verified without the need for the initial data, and can be considered transparent.
- Transparent Setup: uses no data at all. This is the best setup, as it doesnβt require any data to be used by .
Some of the most popular Zero-Knowledge Proof systems are:
- zk-SNARKs: Zero-Knowledge Succinct Non-Interactive Argument of Knowledge. This is a non-interactive ZKP system with a trusted setup.
- Bulletproofs: A non-interactive ZKP system with a transparent setup.
- zk-STARKs: Zero-Knowledge Scalable Transparent Argument of Knowledge. This is a non-interactive ZKP system with a transparent setup, with an additional property of being (plausibly) post-quantum secure.
zk-SNARKs
zk-SNARKs are the most popular Zero-Knowledge Proof system. They are used in the Zcash protocol, and the defunct Tornado Cash smart contract. Ethereum also uses zk-SNARKs in its Layer 2 scaling solution, the zk-Rollups. BitVM also uses a SNARK-based VM to run smart contracts on top of Bitcoin.
Letβs go over the concepts behind zk-SNARKs2.
The first idea: Proving Knowledge of a Polynomial
First some polynomial primer. A polynomial is a function that can be written as:
where are the coefficients of the polynomial, and is the degree of the polynomial.
Now, the Fundamental Theorem of Algebra states that a polynomial of degree can have at most (real-valued-only) roots3.
This can be extended to the concept that two non-equal polynomials of degree can have at most points of intersection.
The idea of proving knowledge of a polynomial is to show that you know the polynomial, without revealing the polynomial itself.
This simple protocol can be done in four steps, note that both the prover and the verifier have knowledge of the polynomial:
- Verifier chooses a random value for and evaluates his polynomial locally
- Verifier gives to the prover and asks to evaluate the polynomial in question
- Prover evaluates his polynomial at and gives the result to the verifier
- Verifier checks if the local result is equal to the proverβs result, and if so then the statement is proven with a high confidence
How much is βhigh confidenceβ? Suppose that the verifier chooses an at random from a set of values, that is a 256-bit number. According to Wolfram Alpha, the decimal approximation is . This is almost the number of atoms in the observable universe! The number of points where evaluations are different is , where is the degree of the polynomial. Therefore, we can assume with overwhelming probability that the prover knows the polynomial. This is due to the fact that an adversary has chance of guessing the polynomial4, which we can safely consider negligible.
The second idea: Proving Knowledge of a Polynomial without Revealing the Polynomial
The protocol above has some implications, mainly that the protocol works only for a certain polynomial, and the verifier has to know the polynomial in advance. Which is not practical at all since we want to prove knowledge of a secret without revealing the secret itself.
We can do better, we can use the fact, also stated in the Fundamental Theorem of Algebra, that any polynomial can be factored into linear polynomials, i.e.Β a set of degree-1 polynomials representing a line. We can represent any valid polynomial as a product of its linear-polynomial factors:
where are the roots of the polynomial. If you wanna prove knowledge of a polynomial, it is just a matter of proving knowledge of its roots. But how do we do that without disclosing the polynomial itself? This can be accomplished by proving that a polynomial is the multiplication of the factors , called the target polynomial, and some arbitrary polynomial , called the residual polynomial:
The prover can show that exists some polynomial such that can be made equal to . You can find by simply dividing by :
Now we can create a protocol that can work for any polynomial with only three steps:
- Verifier samples a random value , calculates and gives to the prover
- Prover calculates and evaluates and ; the resulting values , are provided to the verifier
- Verifier then checks that , if so those polynomials are equal, meaning that has as a cofactor.
Note that the verifier has no clue about the polynomial , and can be convinced that the prover knows the polynomial .
For example, letβs consider two polynomials and of degree :
An example protocol interaction in this case could be:
- Verifier samples a random value , calculates and gives to the prover
- Prover calculates , evaluates and and provides , to the verifier
- Verifier then checks that , i.e.Β , which is true, and therefore the statement is proven
Great! We can prove stuff without revealing the stuff itself! Noice! We know only need to find a trick to represent any sort of computation as a polynomial.
The third idea: Representing Computations as Polynomials
We can represent any computation as a polynomial by using Arithmetic Circuits. An arithmetic circuit is a directed acyclic graph (DAG) where:
- Every indegree-zero node is an input gate that represents a variable
Every node with indegree is either:
- an addition gate, , that represents the sum of its parents
- a multiplication gate, , that represents the product of its parents
Hereβs an example of an arithmetic circuit that represents the polynomial :
In the circuit above, the input gates compute (from left to right) and , the sum gates compute and , and the product gate computes which evaluates to .
The idea is to prove that the output of the circuit is equal to some target polynomial . This can be done by proving that the output of the circuit is equal to the target polynomial multiplied by some arbitrary polynomial , as we did in the previous section.
Remarks
This is a very high-level overview of Zero-Knowledge Proofs. The subject is quite complex and requires a lot of mathematical background. I tried to simplify it as much as possible, to give a general intuition of how Zero-Knowledge Proofs work. Please check the resources below for more in-depth information.
Resources
5The whole idea of ZKPs as discussed above in three properties (Completeness, Soundness, and Zero-Knowledge) was first conceived by [3]. Later [4] showed that some of the propertiesβ assumptions can be relaxed, more specifically using computational soundness instead of statistical soundness. [5] applied the Fiat-Shamir Heuristic to [4] contributions to show that you can create any non-interactive ZKP system into a non-interactive ZKP system using the Random Oracle Model.
Going to the zk-SNARKs side, the term was introduced by [6] and the first protocol, the Pinocchio protocol, was introduced by [7] and [8] The Bulletproofs protocol was introduced by [9], followed by the Bulletproofs++ protocol by [10].
zk-STARKs were introduced by [11].
Finally, if you want an intuitive but very comprehensive explanation of zk-SNARKs, then you should read [1].
The Blockchain Web3 MOOC from Berkeley University provides a good introduction to Zero-Knowledge Proofs, while being quite accessible to beginners.
This video from YouTube explains the math behind the Arithmetic Circuits and how to encode them as polynomials.
Bibliography
- [1] M. Petkus, βWhy and How zk-SNARK Works.β [Online]. Available: https://arxiv.org/abs/1906.07221
- [2] J. Katz and Y. Lindell, Introduction to Modern Cryptography, 3rd ed. Chapman, Hall/CRC, 2020. doi: 10.1201/9781351133036.
- [3] S. Goldwasser, S. Micali, and C. Rackoff, βThe Knowledge Complexity of Interactive Proof Systems,β SIAM Journal on Computing, vol. 18, no. 1, pp. 186β208, 1989, doi: 10.1137/0218012.
- [4] J. Kilian, βA note on efficient zero-knowledge proofs and arguments (extended abstract),β in Proceedings of the Twenty-Fourth Annual ACM Symposium on Theory of Computing, in STOC '92. Victoria, British Columbia, Canada: Association for Computing Machinery, 1992, pp. 723β732. doi: 10.1145/129712.129782.
- [5] S. Micali, βCS proofs,β in Proceedings 35th Annual Symposium on Foundations of Computer Science, 1994, pp. 436β453. doi: 10.1109/SFCS.1994.365746.
- [6] N. Bitansky, R. Canetti, A. Chiesa, and E. Tromer, βFrom Extractable Collision Resistance to Succinct Non-Interactive Arguments of Knowledge, and Back Again.β [Online]. Available: https://eprint.iacr.org/2011/443
- [7] R. Gennaro, C. Gentry, B. Parno, and M. Raykova, βQuadratic Span Programs and Succinct NIZKs without PCPs.β [Online]. Available: https://eprint.iacr.org/2012/215
- [8] B. Parno, C. Gentry, J. Howell, and M. Raykova, βPinocchio: Nearly Practical Verifiable Computation.β [Online]. Available: https://eprint.iacr.org/2013/279
- [9] B. BΓΌnz, J. Bootle, D. Boneh, A. Poelstra, P. Wuille, and G. Maxwell, βBulletproofs: Short Proofs for Confidential Transactions and More,β in 2018 IEEE Symposium on Security and Privacy (SP), 2018, pp. 315β334. doi: 10.1109/SP.2018.00020.
- [10] L. Eagen, S. Kanjalkar, T. Ruffing, and J. Nick, βBulletproofs++: Next Generation Confidential Transactions via Reciprocal Set Membership Arguments,β in Advances in Cryptology β EUROCRYPT 2024, M. Joye and G. Leander, Eds., Cham: Springer Nature Switzerland, 2024, pp. 249β279.
- [11] E. Ben-Sasson, I. Bentov, Y. Horesh, and M. Riabzev, βScalable Zero Knowledge with No Trusted Setup,β in Advances in Cryptology β CRYPTO 2019, A. Boldyreva and D. Micciancio, Eds., Cham: Springer International Publishing, 2019, pp. 701β732.