Zero-Knowledge Proof (ZKP): Proving It Without Revealing It

Romain
Coinmonks
6 min readJun 20, 2022

--

Photo: EXBASE, all right reserved.

Web3 developers have a wide range of alternatives when it comes to Ethereum scaling solutions. You have layer 1 enhancements, such as Ethereum 2.0, layer 2 chains, such as Optimism and Arbitrum, and sidechains, like Polygon or xDai. I wrote another Medium post about the types of layer 2 that you can find here.

Web3 developers have the choice between state channels, optimistic rollups, or zero-knowledge (ZK) rollups under the category of layer 2 Ethereum scaling options. ZK-rollups are becoming increasingly popular as a scaling option for Ethereum, with the potential to substantially cut transaction costs and time. ZK-rollups use zero-knowledge proof which we will dive into in this post.

What is Zero-Knowledge Proof?

Photo: Golden, all right reserved.

A zero-knowledge proof is a cryptographic method for proving that something is acknowledged without explicitly exposing the known information. It enables private data to be kept private throughout a transaction. Zero-knowledge proofs are indirect proofs that allow you to demonstrate that you know a secret without ever telling anybody else. You merely have to demonstrate that you are telling the truth.

The prover and verifier are the two most important roles in zero-knowledge proofs.

The prover must demonstrate that he or she is aware of the secret. The verifier must be able to determine whether or not the prover is lying. It works because the verifier asks the prover to perform actions that can only be done if the prover is certain that he or she is aware of the secret. If the prover is guessing, the verifier’s tests will finally prove him or her wrong. If the secret is known, the prover will pass the verifiers’ exam every time. Let’s see an example to illustrate this concept.

Alibaba Cave Example

The most prominent zero-knowledge proof example that demonstrates the reasoning utilized in the zero-knowledge proof cryptography technique is the Alibaba Cave. You must assume two characters in this example, Jessica and Owen. They are each on a quest and end themselves in a cave. They come upon two separate entrances to two different routes, A and B. Inside the cave, there is another door that connects the two paths. On one hand, Jessica knows the secret code to unlock the door and is thus assuming the position of ‘prover’. On the other hand, Owen wants to buy the code and plays the ‘verifier’. Owen wants to be sure Jessica is telling the truth about knowing the secret code to open the door. For this, Jessica must prove to Owen that she knows the code without actually revealing the contents in the code.

At this point, it is important to wonder how a zero-knowledge proof example would work here. First and foremost, Owen must wait outside the cave while Jessica enters by either way A or B.

After that, Owen approaches the cave’s mouth after Jessica enters the cave and cries out to her, begging her to exit down one of the trails.

If Jessica knows the secret code to open the door, then she would open the door and return through a path requested by Owen. When Jessica does not know the secret code, she might have to return back to the same path she selected to go inside. On the other hand, if Jessica exits the cave through the other side, then Owen can be sure that Jessica knows the code.

Owen may believe that Jessica passed the test due to her luck. In this case, it is obvious that the transaction has a 50% probability of both sides choosing the same course. Nonetheless, if the same transaction is repeated several times, the chances of Jessica departing by the same path as Owen without the secret code are greatly reduced. As a result, Jessica’s chances of exiting the cave via Owen’s chosen path are little to none if she does not know the code. Finally, this ZKP example indicates that Jessica could prove the veracity of her statement to Owen by repeatedly escaping the cave by the path she chose.

Zero knowledge traits are visible in the example as Owen cannot learn anything about the code. Owen stays out of the cave, thereby making it impossible for him to learn about the code. Therefore, Jessica could prove to Owen that she knows the code to the door without revealing it to him.

Properties of Zero-Knowledge Proof

Photo: Blockgeni, all right reserved.
  • Zero-Knowledge
    If the statement is true, the verifier will not know that the statement or was. Here statement can be an absolute value or an algorithm.
  • Completeness
    If the statement is true then an honest verifier can be convinced eventually.
  • Soundness
    If the prover is dishonest, they cannot convince the verifier of the integrity of the proof.

The different types of zero-knowledge proofs

There are two main types of zero-knowledge proofs (ZKPs):

  • Interactive zero-knowledge proofs: In this type of ZKPs, the prover and verifier interact several times. The verifier challenges the prover who provides replies to these challenges until the verifier is convinced.
  • Non-interactive zero-knowledge proofs: Here, the proof delivered by the prover can be verified by the verifier only once at any time. This type of ZKPs requires more computational power than interactive ZKPs.

Applications and use cases of zero-knowledge proofs

Zero-knowledge proofs can be used to protect data privacy in a diverse set of use cases, such as:

  • Blockchain: Zero-knowledge proofs can introduce more privacy to public blockchains. For instance, the cryptocurrency Zcash is based on Zero-Knowledge Succinct Non-Interactive Argument of Knowledge (Zk-SNARKs), a type of zero-knowledge cryptographic method that I will tackle in a future Medium article.
  • Online voting: ZKPs can allow voters to vote anonymously and to verify that their vote was included in the final tally.
  • Authentication: ZKPs can be used to authenticate users without exchanging secret information such as passwords.

Why Do We Need Zero-knowledge Proofs (ZKPs)?

Every day, we are pushed into circumstances where we must give up our privacy as most websites demand that we expose our personal information. Even though we all freely participate in these activities, many of these services have become indispensable, leaving us with no option in how we tackle privacy issues. As a culture, we have been virtually stripped of any decision-making control over how our data is used.

The lack of privacy has sparked a debate in recent years about what can be done to ensure that the sharing of information between two or more parties is kept to a minimum. The use of ZKPs opens up the possibility of greater independence.

References

What are Zero Knowledge Proofs? — May 12, 2020 — Matt Hussey — (https://decrypt.co/resources/zero-knowledge-proofs-explained-learn-guide)

ZERO-KNOWLEDGE ROLLUPS — May 23, 2022 — Corwin Smith — (https://ethereum.org/en/developers/docs/scaling/zk-rollups/)

Zero-Knowledge Proofs: STARKs vs SNARKs — Mattison Asher, Coogan Brennan — May 18, 2021 — (https://consensys.net/blog/blockchain-explained/zero-knowledge-proofs-starks-vs-snarks/)

Zero-Knowledge Proof: How it Works & Applications in 2022 — April 10, 2022 — Cem Dilmegani — (https://research.aimultiple.com/zero-knowledge-proofs/)

Zero Knowledge Proof — May 11, 2022 — GeeksForGeeks — (https://www.geeksforgeeks.org/zero-knowledge-proof/)

Fundamentals: What Are Zero-knowledge Proofs? — March 08, 2022 — Alex Bączkowski — (https://alephzero.org/blog/fundamentals-zero-knowledge-proofs/)

Join Coinmonks Telegram Channel and Youtube Channel learn about crypto trading and investing

Also, Read

--

--

Romain
Coinmonks

Blockchain Enthusiast | Instagram: decryptofr