Zero Knowledge Proofs
Zero Knowledge Proof (ZK proof) is a protocol in which the prover proves the truthfulness of a statement to a verifier without actually revealing the information.
What is ZKproof?
Zero Knowledge Proof (ZK proof) is a protocol in which the prover proves the truthfulness of a statement to a verifier without actually revealing the information.
It is like proving that something is true without actually telling what it is.
Any statement can be proved trivially by revealing what it is. For example, one way to prove to a verifier that something is true is by telling the statement itself. However, ZK proofs differ here.
In ZK proofs, the verifier is convinced that something is true without providing any information to the verifier about the statement. Since no knowledge is shared, it is referred to as Zero-Knowledge Proof.
Real-World Example
Suppose there is a person named John (verifier) who is colorblind and cannot distinguish between red and blue colors. There is another person named Tia (prover). Now, there are two balls: one red and one blue. Tia wants to prove to John that the two balls are indeed of different colors. However, to John, both balls are indistinguishable because of his colorblindness.
So, how will Tia prove this to him, and how can John verify that she is not lying about the balls being different colors?
Solution
John can hide the balls behind his back and take out one ball at a time, asking Tia if he exchanged the ball. He can either exchange the balls or not before showing one.
- If the balls were the same color, Tia wouldn’t be able to distinguish between them, and her probability of correctly guessing whether John exchanged the balls would be 50% per turn. Over multiple trials, this probability could be reduced to near zero, exposing her inability to tell.
- If the balls are different colors, Tia can easily tell whether John exchanged them or not.
Thus, this proves to John that there are indeed balls of two different colors without telling him which ball is which color or what colors they are. This is an example of a Zero-Knowledge Proof.
Two balls and the colour blind friendProperties of a Zero-Knowledge Proof
- Zero-Knowledge: If the statement is true, the verifier learns nothing beyond the fact that the statement is indeed true.
- Completeness: If the statement is true, an honest verifier will be convinced of this fact by an honest prover.
- Soundness: If the statement is false, no cheating prover can convince an honest verifier that it is true, except with some small probability.
Zero Knowledge Proofs in Blockchains
There is an inherent transparency in Blockchains but still there are a number of cases in which privacy is needed. A common method of privacy achieved on blockchain networks is using the Zero Knowledge proofs. The only information revealed on-chain by ZKP is that some piece of information is valid and known by the prover with a high degree of certainty.
Types of Zero-Knowledge Proofs
zk-SNARK
- SNARKs stand for “Succinct Non-interactive Arguments of Knowledge”.
- They are small in size and easy to verify.
- They generate cryptographic proof using elliptical curves which are more gas efficient.
- Snarks are used for blockchains which have limited resources.
- They are non-interactive. Prover generates a proof and send it to the verifier, who can check it independently without further communication.
- They are lightweight.
zk-STARK
- STARK stands for “Scalable Transparent Argument of Knowledge”.
- They share similarity with SNARK but emphasize scalability and transparency.
- They require no trusted setup.
- STARKs are also used in blockchains for privacy and data compression.
- For instance, they can compress a large batch of transactions into a single, small proof that the entire batch is valid, improving scalability.
- They are much faster than SNARK.
- There is a minimal interaction between prover and verifier.
- They use hash functions to generate the proof.