From Zero to Hero in Zero Knowledge Proofs [Part 4]

This is the third part of the series that takes you from absolute ground zero in ZKPs to a fairly advanced level. We will start from the absolute basics and then move onward and upward. Subscribe to get regular updates!Today, we will try to get an intuitive grasp of zero-knowledge proofs with a few ELI-5 (Explain Like I’m 5) examples.So, without further ado, let’s get going.What is a Zero-knowledge proof (ZKP)?A zero-knowledge proof, simply put, is a method by which one party can prove to another party that something is true. And they do so without revealing any information apart from the fact that this specific statement is true.Actors in a zero-knowledge proof systemAny zero-knowledge proof system has the following actors involved.Creator — optional, the party that creates the zero-knowledge proof setupProver — the party that wants to prove knowledge of somethingVerifier — the party that verifies whatever the prover wants to proveUnderstanding ZKPs through intuitive examplesAlibaba cave exampleLet me tell you a story about two siblings, Peggy and Victor, who found a ring-shaped cave with an entrance on one side and a magic door blocking the opposite side.Peggy, clever as she was, claimed to have uncovered a secret word that could open the magic door, but she didn’t want to share this word with Victor. On hearing this, Victor teased Peggy that she didn’t know the secret word and was just trying to look smart.So, they came up with a game that would prove whether Peggy knows the secret word, without revealing anything about the word either. Peggy and Victor named both paths as paths A and B.The Alibaba cave game setupThen Peggy took a random path without Victor seeing which path Peggy chose.Peggy takes the path B, Victor does not know which path Peggy tookAfter that, Victor entered the cave and shouted the name of the path he wanted her to use to return, either A or B, chosen randomly.Victor challenges Peggy to come back using a specific path that he decidedPeggy returns using the path that Victor selected.Peggy returns from the path Victor selectedThe idea was if Peggy knew the secret word, she would have no problem returning to Victor using the correct path. But if Victor calls her only once, Peggy has a 50% chance of being lucky if Victor calls her to return from the path she entered the cave initially.That’s why Peggy and Victor decided to repeat this activity multiple times. After each repetition, Victor became more confident that Peggy knew the secret word. With each iteration, Victor’s confidence rose towards, but never precisely, 100% since there was always a (negligible) chance that Peggy was lucky in all repetitions.But if in any of those iterations, Peggy returned using the wrong path, Victor would have known that she didn’t know the secret word.We can be 100% certain that Peggy doesn’t know the secret word if she takes the wrong path in any iteration. But we can never be 100% certain that she does know the secret word, because there is always the probability that she was lucky in all iterations and her guess was always correct. The greater the number of iterations, the lesser the probability that she will be lucky in all iterations.If you want to visually see how increasing the iterations will decrease the probability of a prover cheating the system, you can view the link given in the appendix.Where’s Wally exampleNow let’s try to understand how ZKPs work using another example; Where’s Wally?Based on the pictures of crowds where Wally is distinctively dressed, the aim is to find him within a sea of similar people.Find out where’s Wally?The proof proceeds as follows:Imagine that Peggy has found Wally in the picture and wants to prove this fact to Victor. However, if she just shows him where Wally is, Victor will cheat and claim that he found Wally himself. Peggy wants to show Victor how smart she is, without helping him in any way to find out where Wally is.To prove to Victor that she has indeed found Wally, without giving away his location in the picture, Peggy does the following:1. She cuts a hole in a (very) large sheet of paper, the hole is the exact shape of Wally in the underlying picture.2. She places the paper sheet over the original picture so that the location of the picture beneath the paper is obscured.3. Victor can then see through the hole that Wally has indeed been found, but since the alignment with the underlying picture cannot be seen, he doesn’t gain any information about his location of Wally.This is in essence how ZKPs work.With this, we end our ELI-5 examples for ZKPs.Hey there, thanks for reading this far. If you liked this article, don’t forget to follow and leave a clap.Follow me here and on LinkedIn to get the latest blockchain technical content in simple, bite-sized reads.From Zero to Hero in Zero Knowledge Proofs [Part 4] was originally published in Coinmonks on Medium, where people are continuing the conversation by highlighting and responding to this story.

From Zero to Hero in Zero Knowledge Proofs [Part 4]
This is the third part of the series that takes you from absolute ground zero in ZKPs to a fairly advanced level. We will start from the absolute basics and then move onward and upward. Subscribe to get regular updates!

Today, we will try to get an intuitive grasp of zero-knowledge proofs with a few ELI-5 (Explain Like I’m 5) examples.

So, without further ado, let’s get going.

What is a Zero-knowledge proof (ZKP)?

A zero-knowledge proof, simply put, is a method by which one party can prove to another party that something is true. And they do so without revealing any information apart from the fact that this specific statement is true.

Actors in a zero-knowledge proof system

Any zero-knowledge proof system has the following actors involved.

Creator — optional, the party that creates the zero-knowledge proof setup

Prover — the party that wants to prove knowledge of something

Verifier — the party that verifies whatever the prover wants to prove

Understanding ZKPs through intuitive examples

Alibaba cave example

Let me tell you a story about two siblings, Peggy and Victor, who found a ring-shaped cave with an entrance on one side and a magic door blocking the opposite side.

Peggy, clever as she was, claimed to have uncovered a secret word that could open the magic door, but she didn’t want to share this word with Victor. On hearing this, Victor teased Peggy that she didn’t know the secret word and was just trying to look smart.

So, they came up with a game that would prove whether Peggy knows the secret word, without revealing anything about the word either. Peggy and Victor named both paths as paths A and B.

The Alibaba cave game setup

Then Peggy took a random path without Victor seeing which path Peggy chose.

Peggy takes the path B, Victor does not know which path Peggy took

After that, Victor entered the cave and shouted the name of the path he wanted her to use to return, either A or B, chosen randomly.

Victor challenges Peggy to come back using a specific path that he decided

Peggy returns using the path that Victor selected.

Peggy returns from the path Victor selected

The idea was if Peggy knew the secret word, she would have no problem returning to Victor using the correct path. But if Victor calls her only once, Peggy has a 50% chance of being lucky if Victor calls her to return from the path she entered the cave initially.

That’s why Peggy and Victor decided to repeat this activity multiple times. After each repetition, Victor became more confident that Peggy knew the secret word. With each iteration, Victor’s confidence rose towards, but never precisely, 100% since there was always a (negligible) chance that Peggy was lucky in all repetitions.

But if in any of those iterations, Peggy returned using the wrong path, Victor would have known that she didn’t know the secret word.

We can be 100% certain that Peggy doesn’t know the secret word if she takes the wrong path in any iteration. But we can never be 100% certain that she does know the secret word, because there is always the probability that she was lucky in all iterations and her guess was always correct. The greater the number of iterations, the lesser the probability that she will be lucky in all iterations.

If you want to visually see how increasing the iterations will decrease the probability of a prover cheating the system, you can view the link given in the appendix.

Where’s Wally example

Now let’s try to understand how ZKPs work using another example; Where’s Wally?

Based on the pictures of crowds where Wally is distinctively dressed, the aim is to find him within a sea of similar people.

Find out where’s Wally?

The proof proceeds as follows:

Imagine that Peggy has found Wally in the picture and wants to prove this fact to Victor. However, if she just shows him where Wally is, Victor will cheat and claim that he found Wally himself. Peggy wants to show Victor how smart she is, without helping him in any way to find out where Wally is.

To prove to Victor that she has indeed found Wally, without giving away his location in the picture, Peggy does the following:

1. She cuts a hole in a (very) large sheet of paper, the hole is the exact shape of Wally in the underlying picture.

2. She places the paper sheet over the original picture so that the location of the picture beneath the paper is obscured.

3. Victor can then see through the hole that Wally has indeed been found, but since the alignment with the underlying picture cannot be seen, he doesn’t gain any information about his location of Wally.

This is in essence how ZKPs work.

With this, we end our ELI-5 examples for ZKPs.

Hey there, thanks for reading this far. If you liked this article, don’t forget to follow and leave a clap.

Follow me here and on LinkedIn to get the latest blockchain technical content in simple, bite-sized reads.


From Zero to Hero in Zero Knowledge Proofs [Part 4] was originally published in Coinmonks on Medium, where people are continuing the conversation by highlighting and responding to this story.