What are Zero-Knowledge Proofs (ZKPs)?

Introduction

In most democratic countries around the world, privacy is a fundamental right. But as we progress in our capitalist world, with consumerism fever spreading wider by the day, companies are becoming hungrier for our data.

This puts the modern world at crossroads — on one side, our data should be transparent to progress and improve personalization. At the same time, we require privacy to protect ourselves against malicious attacks like IP or ID theft.

Let’s take examples from recent events; in 2019, two sets of data from Facebook were exposed to the public internet. Because their Facebook IDs and phone numbers were included, this data breach affected almost 533 million users directly or indirectly. 

In web3, the term “Zero-Knowledge Proof,” or “ZKP”, is used quite frequently, but what does it actually mean? In this article, we will look at the concept of Zero Knowledge Proof, its applications, and its implications.

What is Zero Knowledge Proof?

Zero Knowledge Proof allows one party (the prover) to prove to another party (the verifier) that they know something without conveying any additional information other than the fact that they know it.

The classic example used to explain Zero Knowledge Proof is the “color of the ball” test.

In this test, there are three boxes: one contains a red ball, one has a green ball, and one is empty. The aim of the game is for the prover to pick the box containing the green ball without opening it and showing the ball to the verifier.

The game can be played in two ways; In the first method, the prover can open all three boxes and show the green ball to the verifier. The problem with this method is that it also reveals the other balls which were not needed for the proof. This defeats the purpose of Zero Knowledge Proof.

In the second method, the prover could open one box at a time and only show the empty box to the verifier. The verifier will then check if this is indeed an empty box. The problem with this method is that it requires multiple rounds and is not very efficient.

The third and final method is the most efficient way to play the game; The prover would pick a random box and show it to the verifier. The verifier would then check whether the box is empty or not. If it is empty, the verifier knows the green ball must be in one of the other two boxes. If it is not empty, the verifier knows that the green ball is in that particular box. In both cases, the verifier can be sure that the prover knows which box contains the green ball without revealing any other information.

This is the zero-knowledge proof or ZKP in a nutshell.

Pillars of Zero Knowledge Proofs

Zero-knowledge proofs should have the following four critical properties: 

  • Completeness: It should convince the verifier that the prover is credible in their claims.
  • Soundness: A computationally limited prover cannot lose proof that persuades an honest verifier.
  • Succinctness: In comparison to the circuit size (i.e., the amount of computing) of the assertion, the proof size is constant or logarithmic.
  • Zero-Knowledge-ness: Other than the evidence itself, no information is revealed by the proof.

How Does ZKP Work In A Blockchain?

In blockchains, every transaction is verified by multiple nodes on the network before it is appended into a block. This verification process takes up a lot of time and resources.

With Zero-Knowledge Proof, the verification process can be done more efficiently as transactions are verified by using cryptographic algorithms.

In a ZKP system, a “verifier” and a “prover” exist for every transaction. 

The prover tries to convince the verifier of something without disclosing any information about the transaction.

By supplying the result, the prover demonstrates their ability to compute something without disclosing the input or the methodology. The verifier, meanwhile, gains knowledge of the output.

The prover and verifier can be thought of as two nodes on a network. The prover is the node that creates the transaction, and the verifier is the node that verifies the transaction.

Zero-Knowledge Proof can be used to verify transactions without revealing any information about the transaction itself. This means that transactions can be verified more quickly and efficiently.

Types of Zero-Knowledge Proofs

There are two types of zero-knowledge proofs: 

1. Non-interactive zero-knowledge proof (NIZKP)

2. Interactive zero-knowledge proof (IZKP)

Non-Interactive Zero-Knowledge Proofs

Non-interactive zero-knowledge proof is the simplest type of ZKP. In this type of ZKP, the prover sends a single message to the verifier. The verifier then checks the validity of the proof without any interaction with the prover.

Non-interactive zero-knowledge proof is used in some blockchains, such as Zcash, to verify transactions.

Interactive Zero Knowledge Proofs

In an interactive zero-knowledge proof, the prover and verifier interact with each other to prove the validity of the transaction. The advantage of this type of ZKP is that it is more secure than non-interactive zero-knowledge proof.

However, the disadvantage of interactive zero-knowledge proof is that it is slower and more resource intensive than non-interactive zero-knowledge proof.

Applications of Zero Knowledge Proofs in Blockchain

Zero-knowledge proofs can be used to verify transactions without revealing any information about the transaction itself. This means that transactions can be verified more quickly and efficiently.

Zero-knowledge proofs can also be used to build privacy-focused blockchains.

Applications of Zero-Knowledge Proofs

zkSNARKs

zkSNARK stands for Zero-Knowledge Succinct Non-Interactive Argument of Knowledge. It is a type of zero-knowledge proof used to verify a transaction’s validity without revealing any information about the transaction itself.

zkSNARK was first proposed by researchers at the Massachusetts Institute of Technology (MIT) in 2005.

It works by allowing the prover to generate proof that can be verified by the verifier without revealing any information about the transaction. 

The prover and verifier each have a public key and a private key. The public key is used to generate the proof, and the private key is used to verify the proof.

The prover generates a random number, called a “nonce,” and uses it to generate the proof. The verifier then checks the validity of the proof without revealing the nonce.

If the proof is valid, the verifier knows that the transaction is valid without knowing any information about it.

zkSNARKs are more secure than traditional zero-knowledge proofs and can be used to build more efficient private blockchains.

Decentralized Identities

Another application of zero-knowledge proofs is in decentralized identities. A decentralized identity is an online identity that is not controlled by any central authority.

A user’s decentralized identity is verified by a network of nodes rather than by a single central authority. This makes it more secure and private than a traditional online identity.

Zero-knowledge proofs are incredibly useful in this case because they can be used to verify a user’s identity without revealing any personal information about the user. This makes it more difficult for someone to steal a user’s identity or impersonate a user.

ZK-rollups

A ZK-rollup is a cryptographic technique that allows a party to prove that a given document is included in a larger document without revealing the contents of the document.

The basic idea is that if you can encrypt a document such that it can only be decrypted by someone who knows the key, and you can also encrypt the key so that it can only be solved by someone who knows the document’s contents, then you can prove that the document is included in the larger document without revealing its contents. This is done by generating a random number, encrypting it with both the key and the document’s content, and then including both the encrypted number and the encrypted key in the larger composition.

The advantage of this technique is that it allows for a much more efficient verification process, as the entire contents of the document do not need to be revealed to prove that it is included in the larger document.

ZK-rollups can be used to improve the efficiency of private transactions, as the entire transaction does not need to be revealed in order to prove its validity.

Conclusion

Zero-knowledge proofs are a powerful tool that can be used to build more efficient and private blockchains. They can also be used to verify transactions without revealing any information about the transaction itself.

Such traits make zero-knowledge proofs an important tool in building privacy-focused blockchains.