A Zero-knowledge proof (ZKP) is an interaction between two parties, in which one (the prover) proves that they possess a piece of information to another party (the verifier) without having to actually reveal what the information is. This has many applications in crypto especially in the realm of privacy.
ZKPs allow for the private retention of data on the blockchain. Currently most major blockchains like Ethereum and Bitcoin keep a public record of every transaction ever executed on them. With ZK proofs, information such as how much you hold in your wallet, or the exact details of all your transactions no longer need to be public knowledge.
The Ali Baba Cave
Let’s explore how zero-proof knowledge works using the Ali Baba Cave analogy. Say there is a ring-shaped cave with a door on the far side that requires you to say a magic word to open it. John (the prover) tells Kelly (the verifier) that he possesses the magic word, but he has to prove it without sharing the secret with her. In order to do this, they both go to the entrance of the cave.
Kelly waits there with her eyes closed, unable to see which side John went through. She then opens her eyes and calls out either A or B. If John knows the magic word, he will be able to open the door and come out of the correct side. They try this a few times to make sure that it wasn’t just by luck, or until Kelly is satisfied that John really does know the magic word. If Bob comes out of the wrong side, it means that Bob can’t actually open the door and was lying about possessing the secret.
The non-interactive version of this would require a secret cryptographic key to be generated to help John prove that he knows the magic word without Kelly. Think of it kind of like a computer that randomly calls out for John to come out of side A or B, without needing Kelly to do that for him. A user can then publicly prove that they responded correctly to the randomly generated commands without the need to interact with a human verifier.
Characteristics of a ZKP
For a ZKP to work it needs to satisfy certain parameters:
- Completeness: A true statement should be provable to an honest verifier by an honest prover
- Soundness: If the prover is dishonest, they won’t be able to trick the verifier by convincing them that they possess information that they do not.
- Zero-Knowledge: The secret does not need to be shared with the verifier in order for the prover to confirm that they possess it
ZKPs allow for security and efficiency while providing privacy for users. They increase efficiency because every transaction doesn’t have to be fully verified multiple times. Users simply need to provide proof that it has been verified already.
As an example, one application for this technology could be applying for a loan. ZKPs would allow you to verify to a lender that your credit score is above a certain threshold, without revealing the exact number to them. This would greatly improve privacy and security for users of DeFi.
An example of an application of ZKP technology is the Zcash token. It gives privacy to users when they make a transaction, and does not reveal publicly which wallets were involved or how much was sent.
ZK rollups are a new method for utilizing ZKPs that lower the transaction cost of using Ethereum L1. ZK rollups bundle transactions together and process them off of the main ETH L1 chain. Then a single transaction is made back to L1 which transmits the proof that the bundle has been processed. This saves on gas fees by reducing the number of transactions that need to be processed on the main chain. One popular protocol that uses ZK rollup technology is zkSync, which acts as an Ethereum L2.