Zero-knowledge proofs are a technique used in cryptography to prove that a statement is true without having to reveal the statement itself. The method allows one individual to provide another individual with enough evidence to believe that the information is true even with zero knowledge of what the information contains.
Zero-Knowledge proofs help increase privacy and security in a system. They allow individuals and organizations to share information without revealing the details, like what data was sent, who it is about, or who sent it.
For example, when you type in your password, zero-knowledge proofs can check if it’s accurate without letting anyone know what the password is. ZK-proofs are used to protect sensitive data like digital signatures and personal information, thereby reducing the risk of data theft and fraud.
A prover has to prove to a verifier that he knows certain secret information (like a password) by responding in a way that only someone who knows the information can respond.
There are two main types:
Interactive proofs require the prover and verifier to communicate back and forth until the verifier is convinced that the prover is telling the truth.
For example:
You need to prove that you are an employee of an establishment. Instead of revealing personal information, you are asked a series of questions such as "Are you between 20-25 years old?" or "Did you graduate from a state college with an accounting degree?" The verifier checks the accuracy of each response before asking the next question. You need to answer all questions correctly to convince the verifier of your identity.
Non-interactive proofs require the prover to share secret information with an algorithm which generates a single proof and sends it to the verifier. The verifier then checks the proof using another algorithm. Non-interactive proofs are increasingly being used in blockchain technology.
For example:
You need to prove that you know a secret code. The protocol asks you to scramble a word using the code. Without sharing how the code works, you provide the scrambled version of the word. Based on your answer, the protocol verifies that you indeed know the secret code.
A ZK-SNARK (Zero-Knowledge Succinct Non-Interactive Argument of Knowledge) requires the provers and verifiers to generate a set of secret shared keys that they will use for creating and verifying the proof. This setup must be done in a secure environment, because if any individuals who generated the shared keys are compromised, the proofs will be vulnerable to security threats. Blockchain projects that use ZK-SNARKS include Zcash and zkSync.
A ZK-STARK (Zero-Knowledge Scalable Transparent Arguments of Knowledge) does not require a trusted setup for it to work. ZK-STARKs are also more transparent, since they allow anyone to verify the proof even without knowing the secret information. ZK-STARKS are used in projects like Starkware and ImmutableX.
In general, ZK-SNARKs generate smaller and more efficient proofs than ZK-STARKs, while ZK-STARKs are larger but are more scalable and less vulnerable to attack. Zero-knowledge proofs are often used to implement ZK-rollups, which help make blockchain transactions faster, cheaper, and more secure.