Beginner’s Guide To Understanding Zero Knowledge Proofs

Darlington Nnam
6 min readAug 20, 2022

--

The phrase “Zero Knowledge Proofs”, has become a more frequently used term in the web3 ecosystem, as most persons, consider it to be the future of layer 1 blockchains scaling and privacy. I’m sure you stumbled upon this article, in a bid to understand this increasingly used terminology, but before we dive right into it, i want to clarify one thing.

Zero Knowledge Proofs are not a one size fit all type of solution.

I see a lot of persons mention Zk like this, magic solution that fixes everything, with literally no context to its limitations but to understand its limitations, we’d need to understand, what it is right? so let’s dive right in.

What the heck is a zero knowledge proof?

Zero knowledge proofs simply defined, is a means by which a prover convinces a verifier that some particular statement holds true, without revealing any sensitive information as regards to the proof to the verifier.

When i first heard about zero knowledge proofs, the whole idea seemed funny and impossible, because when we talk about proof in the literal sense, it refers to the establishment of a fact or truth of a statement using a substantial evidence or argument. So how in the whole wide world could one make a substantial proof which provides no evidence (knowledge)?

There are different concepts or examples people usually use when explaining ZKPs (short for zero knowledge proofs). Some of them includes:

  1. Where is Waldo?
  2. Map colouring
  3. Alibaba cave
  4. Coloured balls and a colour-blind friend

For this article we will be going through just 1 and 4.

Where is Waldo?

Waldo, created by illustrator Martin Handford in 1987, is the figure present in the kid’s puzzle book, where each page is a crowd of different characters. The idea is to find Waldo, wherever he is hidden.

So let’s assume for a moment, Bob and Alice were playing the game, and Bob finds Waldo first, and informs Alice he has found Waldo, but Alice doubts its true. Can Bob find a way to convince Alice, that he truly knows where Waldo is, without revealing Waldo’s position to Alice?

Well this is a difficult one, but not impossible. Remember he can’t point at Waldo directly, or he would give out Waldo’s location to Alice. So rather, what he can do, is find a carbon paper probably twice the size of the original, and use it to cover the original picture. He could then make a little hole in it, which he can use to point out Waldo’s location.

Once, Bob takes away the carbon, he would have successfully convinced Alice that he truly knows Waldo’s location, but at the same time, Alice won’t still be able to decipher Waldo’s location, as the hole which Bob created in the second paper, could have covered any part of the original picture.

Properties of a zero knowledge proof

For a method to qualify as a ZKP, it must satisfy the following conditions:

  1. Completeness: This condition simply means that if Bob (the prover) was honest and not lying, he should be able to totally convince Alice (the verifier), that he is saying the truth.
  2. Soundness: This condition means that if Bob was a cheat, he should never be able to deceive Alice into believing his lies.
  3. Zero-Knowledge: This condition simply means that Bob should be able to totally convince Alice, that he knows Waldo’s location, without revealing it.

Coloured balls and a colour-blind friend

Peradventure, the first concept, was not so clear, this should make things a little clearer.

Bob has a friend, Alice who is colour-blind. Bob has two balls: one red and one green, but otherwise identical. To Alice, they seem completely identical and she is skeptical that they are actually distinguishable. Let’s say Bob, wants to prove to her that they are in fact differently-coloured, but does not want to reveal which one is the red and which is the green. How can he do this?

Bob gives the two balls to Alice, then asks her to switch the balls behind her back, and each time, he’d guess correctly if the balls were switched or not.

Alice will then switch the ball, and ask Bob, “Did I switch the ball?” This whole procedure is then repeated as often as necessary. By looking at their colours, Bob can easily say with certainty whether or not Alice switched them. On the other hand, if they were the same colour and hence indistinguishable, there is no way he could guess correctly with probability higher than 50%. If this “proof” is repeated multiple times, Alice should become convinced (“completeness”) that the balls are indeed differently coloured; otherwise, the probability that Bob would have randomly succeeded at identifying all the switch/non-switches is close to zero (“soundness”), meanwhile Alice still do not know which ball is red or green (“zero knowledge”).

Classifications of Zero Knowledge Proofs

  1. Interactive Zero Knowledge Proofs: All the concepts we’ve discussed thus far, falls into this class of ZKPs. They require multiple interactions between the prover and the verifier, in order for the prover to successfully convince the verifier. While this class of ZKPs work, they are difficult to implement on a blockchain, as each interaction between the prover and the verifier will cost gas, and is thus, generally not scalable.
  2. Non-Interactive Zero Knowledge Proofs: This class of zero knowledge proofs, have seen the most adoption due to the fact that, it only requires a single interaction between the prover and the verifier, in order for the prover to completely convince the verifier. An easy way to explain how this is possible, is that the prover simulates the necessary interactions between him and the verifier, and sends a copy of this simulation to the verifier. The verifier in turn, just needs to verify that the simulation was correctly done, in order to be completely convinced. The cryptography behind these proof systems are quite complex, and will be left for a future article. The most common types of these are Zero knowledge Succinct Non-interactive Argument of Knowledge (ZK-Snarks) and Zero Knowledge Scalable Transparent Argument of ZK-Starks.

Applications of Zero Knowledge Proofs

Zero Knowledge proofs have a wide range of application, but amongst them, here are a few popular ones.

  1. Privacy in Blockchains: The transparency of Blockchains, though has a lot of advantages, as we could publicly verify transactions, but it also implies little privacy. With zero knowledge proofs we could shield transactions on the blockchain, thereby making it possible to carry out private transactions, messaging etc. Examples of private blockchains or protocols are Zcash, Mina and Monero.
  2. Blockchain Scalability: The Ethereum Blockchain, uses a Proof of Work model which although increases security in decentralized protocols, is very resource-intensive, and requires a great deal of computational power to function. With the advent of Zk-rollups, rather than process or compute each transaction that is made directly to the blockchain, we can now batch hundreds and thousands of transactions into one, with a validity proof to verify the correctness of transactions and get them recorded on Ethereum in one go.
  3. Authentication: Zero knowledge proofs, are seeing massive adoptions in authentication protocols, as it provides a medium of authenticating users without the need for private informations such as passwords, IDs etc.
  4. Machine Learning: Zero knowledge proofs are also seeing alot of adoptions in machine learning, as it can allow the owner of an algorithm, to convince others about the results of their models, without revealing any information about the machine learning model itself.

The world of zero knowledge proofs is a quite vast one, but one with a lot of potentials to change the web as we currently know it. Here are some further resources to check out.

  1. Zcash — the world’s first private blokckchain
  2. Why and how ZK-Snarks work
  3. Zero Knowledge Proofs with Avi Widgerson
  4. Ethereum Scaling- Zk Rollups and complexity theory

Let’s connect

LinkedIn: https://www.linkedin.com/in/nnamdarlington

Twitter: https://twitter.com/0xdarlington

Github: https://github.com/Darlington02

--

--