What is Zero-Knowledge Proof (ZKP) in Blockchain?

WhiteBIT
Published 25 January 2023
4076
What is Zero-Knowledge Proof (ZKP) in Blockchain?

Content

Transparency of the public blockchains constitutes the lion’s share of their success. However, how do you maintain transparency and ensure privacy simultaneously? It’s possible thanks to the zero-knowledge proof (ZKP) method, which is increasingly used in public blockchains.

Zero-knowledge proof (ZKP) is a method that allows checking the accuracy of a statement without disclosing additional information about the message itself. The concept of ZK Proof was first introduced in 1985 by researchers Shafi Goldwasser, Silvio Micali, and Charles Rakoff and has since been developed and applied in various cryptography and blockchain technology projects.

Within the protocol framework, the prover demonstrates the statement’s validity to the verifier without providing any additional data. The three main characteristics of ZK Proof are integrity, accuracy, and zero knowledge.

  • Completeness refers to the ability of proof to ensure that the test statement is true.
  • Soundness refers to the ability of proof to ensure that a verifiable statement is accurate and not tampered with.
  • Zero-knowledge refers to the ability of proof not to reveal any additional information about the assertion under the test.

There are two main types of zero-knowledge proofs: interactive and non-interactive.

Interactive proofs involve repetitive interactions between the prover and the verifier. The verifier “requires” the prover to repeatedly demonstrate their knowledge of the fact. The process is repeated until the verifier is sure that the prover is not lying.

Non-interactive proof implies that both parties do not need to communicate, and the statement’s authenticity can be proven ex-post.

The most famous examples of ZK Proof are zk-SNARKs and zk-STARKs.

An excellent example of the successful application of ZK Proof is the Zcash cryptocurrency, which uses zk-SNARK to ensure the confidentiality and anonymity of transactions. Another project using ZK Proof is the decentralized derivatives exchange dYdX. The project uses zk-STARK to execute smart contracts.

Ethereum co-founder Vitalik Buterin called ZK Proof “the most important technology” for scaling blockchain platforms.

How does zero-knowledge proof work in blockchain? In simple terms

Imagine that two parties want to exchange some information. One party must confirm the integrity of the other’s statement without knowing enough about it. In this case, you need to develop the mechanics of some actions so that the first party can prove the statement. Hence, the second party (the verifier) will be able to confirm its authenticity.

To illustrate how ZKP works, let’s imagine a situation. You and your friend are standing at the entrance to the house. Entering it, you see a corridor to the left (A) and a corridor to the right (B). Which path you choose is optional, but you need to remember that these corridors are connected at one point by a door with a lock. Only you have a secret password to the door, but a friend doubts it. Your task is to prove that you own the secret code without naming it. To accomplish the task, a friend enters the house at the moment when you are already at the door. He calls the corridor through which you need to go back to him — corridor A or corridor B. You either return along the same hall that went to the door or open the lock with a secret code and get into the desired corridor. By repeating the experiment several times, you will confirm the truth of your statement without providing actual data, i.e., the secret code to the door.

What are the pros and cons of zero-knowledge proofs?

Zero-knowledge proofs’ advantages are:

  • Confidentiality. One of the main advantages of ZK Proof is its ability to preserve the privacy of the data being verified. It verifies the integrity and accuracy of information without revealing additional information about the statement itself.
  • Succinctness. The proofs within the method are rapid to create, meaning the verification process should not require much time.
  • Non-interactivity. ZK proofs are non-interactive, meaning that the prover does not need to communicate with the verifier during the verification process.
  • Verification. ZK proofs are verifiable, meaning anyone can check the evidence and confirm its validity without needing additional information.
  • Compatibility with smart contracts. ZK proof can be used to create smart contracts that are private and verifiable.

Zero-knowledge proofs’ downsides are:

  • Complexity. Creating and implementing ZK Proof can be complex, requiring a high level of mathematical knowledge and computational resources.
  • Off-chain generation. ZK proofs are generated off-chain, which means there is a risk of malicious actors creating fake proofs.
  • Limited applicability. ZK proof is not suitable for all types of data or use cases. It works best with specific types of problems or data.
  • Limited scalability. ZK proof can be computationally intensive and may not scale well for large data sets.
  • Requires trust in the setup. ZK proof requires a setup phase in which a standard reference string (CRS) is generated. This CRS must be kept secret. If the CRS is compromised, the whole system’s security might be in danger.

What is zk-SNARK and zk-STARK?

Zk-SNARK (Zero-knowledge Succinct Non-interactive Argument of Knowledge) is a non-interactive ZKP requiring trust between the verifier and prover. Creating proofs for private transactions involves a set of public parameters or “rules” that are written into the protocol’s code.

One of the most vivid examples of zk-SNARK is the Zcash cryptocurrency. The project uses the zk-SNARK protocol to ensure the confidentiality and anonymity of transactions. The latter are encrypted on the network while being validated using zero-knowledge proofs. Following the rules of consensus, verifiers do not need to know all the information about a transaction to verify it.

An alternative to zk-SNARK is zk-STARK, a faster and cheaper version of the technology. A characteristic feature of zk-STARK is the absence of a trust set-up. Instead, zk-STARK uses more uncomplicated symmetric cryptography that is collision-resistant hash functions. Another hallmark of zk-STARK is its speed of execution. Due to the same number of check cycles, zk-STARK operates on a smaller amount of data, which prevents excessive load on the system and improves scalability. Therefore, zk-STARKs are used in ZK-Rollups, solutions for the second-level blockchains (L2).

Created over 30 years ago, zero-knowledge-proof technology solves the pressing issues of modern public blockchains: privacy and scalability. All in all, ZK Proofs are like the cherry on top of the blockchain sundae, adding an extra layer of privacy and security to the already delicious mix of decentralization and transparency.