DEV Community

Cover image for Zero Knowledge Proofs Series #2
Prince Justice Sena Essiel
Prince Justice Sena Essiel

Posted on

Zero Knowledge Proofs Series #2

Zero Knowledge Proofs Objective: "Prove to someone that you have a piece of data / information that satisfies a claim without showing them the information you want to keep private"

Zero Knowledge in Action: A Movie Scene Analogy

Have you seen Quentin Tarantino's masterpiece, "Inglourious Basterds"? The iconic scene where Shosanna Dreyfus (MΓ©lanie Laurent) tries to bluff her way past the cunning Colonel Hans Landa (Christoph Waltz) is a great example of a zero-knowledge proof in action! Please watch this short video before continuing

https://www.youtube.com/watch?v=2RhaBv3vEao

Shosanna (Prover): Tries to convince Landa (verifier) she's a has written a famouse person without revealing the information on her card.
Challenge (Questions): Landa throws questions related to her knowledge of the cinema (unique characteristics of the truth).
Proof (Answers): Shosanna's answers, without revealing her cards information (keeping information private).

The Building Blocks of Zero-Knowledge Proofs

Just like the game Shosanna plays with Landa, zero-knowledge proofs follow a specific structure:

  1. Setup and Rules:
    Establish a clear protocol for interaction between the prover and verifier.

  2. Challenges:
    The verifier throws challenges to test the prover's knowledge (not directly revealing the truth).

  3. Challenge-Based Questions:
    These questions are linked to the specific information the prover wants to keep hidden.

  4. Verification:
    The prover's responses convince the verifier with a high degree of certainty (not absolute, but very good!).

  5. Probabilistic Confidence:
    There's always a tiny chance a cheater might pass the test, but well-designed protocols minimize this risk.

Real-World Example: Age Verification at the Club

You (the prover) want to prove you're at least 25 without revealing your exact age. Here's how a zero-knowledge proof can be applied:

Age Claim: The bouncer asks you to claim your age (you claim to be 25 or older).

Verification: The bouncer performs calculations based on your claimed age (25) and the chosen modulus (m = 100):

Calculate both possibilities based on the hidden coin flip:
Heads (H): verification_H = (25 - 1) mod 100 = 24

Tails (T): verification_T = (25 + 2) mod 100 = 27

Proof Revelation: The bouncer asks you to reveal the proof value you calculated earlier.

Verification Check: The bouncer compares your revealed proof with the two calculated verification values:

If your revealed proof matches either verification_H (24) or verification_T (27), the proof is considered valid.
This indicates you know a value (x, your age) that satisfies the age requirement (greater than or equal to 25) without revealing the exact value.

Example:

Let's say you actually are 28 years old (x = 28).

You secretly flip the coin, and it lands on tails (T).

Following the prover steps, you calculate your proof: proof = (28 + 2) mod 100 = 30.

You claim to be 25 years old to the bouncer.

The bouncer calculates verification_H = 24 and verification_T = 27.

You reveal your proof (30).

The bouncer sees that 30 matches verification_T (27), confirming the proof is valid.

This protocol demonstrates zero-knowledge proof:

Why Zero-Knowledge Proofs Matter

Zero-knowledge proofs have numerous applications, from secure online transactions to protecting user privacy. They offer a powerful way to verify information without compromising sensitive data.

Next Steps: Diving Deeper

In our next blog post, we'll explore the mathematical concepts behind zero-knowledge proofs, including finite fields, modular arithmetic, and group theory. But fear not, we'll keep it approachable and focus on the core ideas!

Stay tuned for part two, where we'll unravel the mathematical magic behind zero-knowledge proofs

Top comments (0)