Skip to content
Home » Blockchain » The Beginner’s Guide to Zero Knowledge Proof

The Beginner’s Guide to Zero Knowledge Proof

zero knowledge proof

A zero knowledge proof (ZKP) is a cryptographic technique that allows one party (the prover) to prove to another party (the verifier) that they know a certain piece of information, without revealing the actual information itself.

The concept of a zero knowledge protocol was first described in a 1985 MIT paper, published by Shafi Goldwasser, Silvio Micali & Charles Rackoff.

What is ZKP and how does it work?

In a ZKP, the prover and verifier engage in a series of interactions in which the prover provides evidence of their knowledge, and the verifier checks the validity of the evidence. If the verifier is satisfied that the evidence is valid, they can be convinced that the prover knows the information in question, without actually learning the information itself.

One of the key features of ZKP is that it allows the prover to prove knowledge of a statement without revealing any additional information beyond the fact that the statement is true. This makes it a useful tool for enabling secure communication and transactions in various settings.

The term ‘zero knowledge’ originates from the fact that ‘zero’ information (knowledge) about the secret is revealed, but the second party i.e. the ‘verifier’ is convinced that the first party ‘prover’ knows the secret in question.

An example of zero knowledge proof

This simple example of how zero knowledge proofs (ZKP) can be used to prove knowledge of a secret value will really help you understand the concept. Give it a try. 👇🏼

Imagine that Alice wants to prove to Bob that she knows the secret value “x”, but she doesn’t want to reveal the actual value of x to Bob. Alice and Bob agree on a publicly known function “f” that takes a secret value as input and returns a publicly known output.

Alice can use a ZKP to prove to Bob that she knows the secret value “x” by doing the following:

Imagine that Alice and Bob agree on the following function: f(x) = x^2 + 1.

Bob selects the challenge “c” = 3 and sends it to Alice. Alice knows the secret value “x” = 2, so she computes the response “r” = f(x) = 2^2 + 1 = 5. She sends the response “r” back to Bob. Bob verifies that the response “r” is consistent with the challenge “c” and the function “f” by checking that r = f(c) = 3^2 + 1 = 10. Since the response is not consistent, Bob knows that Alice does not know the secret value “x”.

This is a very simple example of a zero knowledge proof, but it illustrates the basic idea of how a prover can prove knowledge of a secret value without revealing the value itself.

Typically, the zero knowledge protocol has these 4 properties 🫡

1. Completeness

If the claim is genuine, the truthful prover will persuade the truthful verifier.

This property states that if the statement being proven is true, then the verifier will be convinced of this fact by a valid proof. For example, if Alice wants to prove to Bob that she knows the secret value “x” using the function “f(x) = x^2 + 1”, then Bob should be convinced that Alice knows “x” if Alice provides a valid proof.

2. Soundness

If the claim is untrue, the prover cannot, except with a tiny probability, persuade the verifier that it is true.

This property states that if the statement being proven is false, then the verifier will not be convinced by any proof. For example, if Alice wants to prove to Bob that she knows the secret value “x” using the function “f(x) = x^2 + 1”, but Alice does not actually know “x”, then no matter how convincing the proof may seem, Bob should not be convinced that Alice knows “x”.

3. Zero-knowledge

If the assertion is accurate, the only thing the cheating verifier knows is this.

This property states that the proof does not reveal any information about the statement being proven beyond the fact that it is true. For example, if Alice wants to prove to Bob that she knows the secret value “x” using the function “f(x) = x^2 + 1”, then the proof should not reveal the actual value of “x” to Bob.

4. Succinctness

If proof is as short as possible, it would be efficient to generate and verify

This property states that the proof should be as short and efficient as possible. This is important in cases where the proof needs to be transmitted or stored, as it reduces the overhead associated with the proof. For example, if Alice wants to prove to Bob that she knows the secret value “x” using the function “f(x) = x^2 + 1”, then the proof should be as short and efficient as possible, so as to minimize the amount of data that needs to be transmitted or stored.

It’s worth noting that these properties are not always achieved simultaneously, and trade-offs may need to be made depending on the specific application and requirements of the ZKP.

Types of zero knowledge proofs (ZKPs)

1. Interactive zero knowledge proof

here the prover and verifier interact many times.

These are ZKPs in which the prover and verifier engage in a back-and-forth interaction in order to prove and verify the statement being made.

Examples of interactive ZKPs include:

Sigma protocols

These are ZKPs that involve the prover and verifier exchanging a series of messages in order to prove that a statement is true. A common example of a sigma protocol is the Fiat-Shamir heuristic, which allows the prover to prove knowledge of a secret value by generating a series of responses based on the value and a randomly chosen challenge from the verifier.

Three-move protocols

These are ZKPs that involve the prover and verifier exchanging three rounds of messages in order to prove that a statement is true. A common example of a three-move protocol is the classic ZKP invented by Goldwasser, Micali, and Rackoff, in which the prover and verifier exchange a challenge and a response in order to prove that the prover knows the preimage of a hash function

2. Non-interactive zero knowledge proof

here proof delivered by the prover can be verified by the verifier only once at any time.

These are ZKPs in which the prover and verifier do not need to engage in any back-and-forth interaction. Instead, the prover generates a single proof that can be independently verified by the verifier.

Examples of non-interactive ZKPs include:

Succinct non-interactive arguments of knowledge (SNARKs)

These are ZKPs that allow the prover to generate a compact proof of knowledge that can be verified by the verifier using a publicly available verification key. SNARKs are often used in applications that require highly efficient proof generation and verification, such as blockchain systems.

Proofs of knowledge from uniform random functions (PoKURFs)

These are ZKPs that involve the prover and verifier sampling from a uniform random function and exchanging samples in order to prove that the prover knows the preimage of a hash function. PoKURFs can be used to prove knowledge of a wide range of statements, including statements about discrete logarithms, quadratic residues, and more.

It’s worth noting that these categories are not mutually exclusive, and many ZKPs may fall into multiple categories depending on their specific construction and use.

Applications of zero knowledge proof (ZKP) in the real world

Zero knowledge proofs work as a series of different cryptographic algorithms to enable the verification of a computational statement. By using ZKP’s methods, a receiver of payment can verify that the payer has sufficient balance in their bank account without being able to know any other information.

This has a number of applications in the real world, including:

1. Identity verification

ZKP can be used to verify the identity of an individual without revealing their personal information, such as their name, address, or date of birth. This can be useful for protecting privacy in online transactions or for enabling secure communication between parties.

2. Financial transactions

ZKP can be used to enable secure financial transactions without revealing the details of the transaction itself. For example, a bank might use ZKP to prove that a customer has sufficient funds to make a purchase without revealing the actual amount of the customer’s balance.

3. Supply chain management

ZKP can be used to verify the authenticity of goods or the provenance of materials in a supply chain. For example, a company might use ZKP to prove that a product was made with sustainably sourced materials without revealing the specific suppliers or materials used.

4. Data privacy

ZKP can be used to protect the privacy of data in various applications, such as medical records, census data, or online surveys. By using ZKP, it is possible to prove that data meets certain criteria (e.g., that it is complete or accurate) without revealing the actual data itself.

5. Voting

ZKP can be used to enable secure and private voting systems. By using ZKP, voters can prove that they have cast their vote without revealing their actual vote to anyone else.

How zero knowedge proof enables blockchain

The use of ZKP in blockchain technology has the potential to enable more private, scalable, interoperable, and secure systems. Here’s how:

1. Privacy

ZKP be used to enable private transactions on a public blockchain. For example, a ZKP could be used to prove that a transaction is valid without revealing the specific details of the transaction (e.g., the amounts involved or the parties involved).

2. Scalability

ZKP can be used to enable more efficient and scalable blockchain systems. By allowing transactions to be verified without revealing all of the underlying data, ZKP can reduce the amount of data that needs to be stored on the blockchain, making it more efficient to operate.

3. Interoperability

ZKP can be used to enable cross-chain communication and interoperability between different blockchain systems. By allowing one blockchain to verify the validity of transactions on another blockchain without revealing the underlying data, ZKP can facilitate the exchange of information and value between different blockchain networks.

4. Security

ZKP can be used to improve the security of blockchain systems by enabling secure communication and transactions without revealing sensitive information. For example, ZKP could be used to verify the authenticity of a transaction or the identity of a user without revealing the actual information being verified.

That’s it for this guide, fren. Did it help you out? *fingers crossed* IF it did, do share this with a friend and help them