Graphical Zero-Knowledge Proof (ZKP)

区块链大本营
本文约2626字,阅读全文需要约11分钟
Read the basics of cryptography "Zero-Knowledge Proof" in one article.

Editor's Note: This article comes fromBlockchain Camp (ID: blockchain_camp)Editor's Note: This article comes from

Blockchain Camp (ID: blockchain_camp)

, Author: Oscar W, Compiler: Huohuojiang, reproduced by Odaily with authorization.

Zero-Knowledge Proof (Zero-Knowledge Proof or Zero-Knowledge Protocol) is a probability-based verification method that includes "statements similar to facts" and "statements about personal knowledge".

Nowadays, zero-knowledge proof has been regarded as one of the best privacy protection schemes by many blockchain projects. It can prove the authenticity of the data without revealing the data.

In this article, we will explain the mysterious Zero-Knowledge Proof and its current applications.

secondary title

Why are ZKPs so important?

In the age of technology, we are creating unprecedented amounts of data, and we are constantly creating lootable data about ourselves.

Big corporations like Google and Facebook have harnessed our data to become the tech giants of today's world. However, recent breakthroughs in cryptography and the rise of the blockchain offer new ways to protect our data and identities. Zero-knowledge proofs may be the answer.

secondary title

The principle of zero-knowledge proof

Zero-knowledge proof is an encryption scheme proposed by researchers at MIT in the 1980s. A zero-knowledge proof protocol is one in which one party (the prover) can prove that something is true to another party (the verifier). No other information will be disclosed other than that this particular statement is true.

Zero-knowledge proof can protect user accounts from being leaked. If zero-knowledge proofs can be implemented, then the client password is unknown to anyone, but client logins can still be authenticated. When the server is attacked, the user's account remains safe because the password is not stored on the web server.

Zero-knowledge proofs can be divided into two types: "interactive" and "non-interactive". Next, let's take a look at the differences between these two proof methods one by one.

secondary title

Interactive zero-knowledge proof

The basis of the zero-knowledge proof protocol is interactive. It requires the verifier to continually ask a series of questions about the "knowledge" the prover has.

For example, if someone claims to know the answer to a Sudoku game, the process of zero-knowledge proof is that the verifier needs to randomly specify whether to verify by column, row or nine squares.

Each round of the test does not need to know the specific answer, but only needs to check whether the numbers 1~9 are included. As long as the number of verifications is large enough, there is reason to believe that the prover knows the answer to the Sudoku question.

If they want to convince a third party, the verifier must also prove that the verification process is random and that he will not leak the answer to the prover.

Therefore, it is difficult for third parties to verify the results of interactive zero-knowledge proofs, and it requires extra effort and cost to prove something to multiple people.

secondary title

As the name suggests, non-interactive zero-knowledge proofs do not require an interactive process, avoiding the possibility of collusion, but may require additional machines and programs to determine the sequence of experiments.

For example, in the case of Sudoku, it is up to the program to decide which column or row to verify. The verification sequence must be kept secret, otherwise the verifier may pass the verification without knowing the real "knowledge".

secondary title

Zero-knowledge proofs on the blockchain

Both Bitcoin and Ethereum use public addresses to replace the real identities of the parties involved, making transactions partially anonymous, and the public only knows the sending and receiving addresses and the amount of the transaction. However, the real identity of the address can be found out through various information available on the blockchain (such as interaction records), so there is a possibility of exposing privacy.

Zero-knowledge proofs guarantee that a transaction is valid while the sender, receiver, and other transaction details remain anonymous.

ZCash is probably one of the most famous blockchain projects to successfully implement zero-knowledge proofs. Zcash implements a modified version of ZKP, called zk-SNARKS, which stands for Zero-Knowledge Succinct Non-Interactive Argument of Knowledge (Zero-Knowledge Concise Non-Interactive Argument of Knowledge)

zk-SNARK technology reduces the size of proofs and the amount of computation required for verification. It is able to prove that the conditions of a valid transaction have been met without revealing any critical information about the address and related value.

  • zk-SNARK converts the transaction content that needs to be verified into a proof that the product of two polynomials is equal, and combines homomorphic encryption and other advanced technologies to protect the hidden transaction amount when performing transaction verification.

  • The process can be simply described as:

  • Split the code into verifiable logical verification steps, and then split those steps into an arithmetic circuit consisting of addition, subtraction, multiplication, and division;

  • Perform a series of transformations to convert the code to be verified into a polynomial equation, such as t(x)h(x)=w(x)v(x);

  • To make the proof more concise, the verifier randomly selects several checkpoints s in advance to check whether the equations of these points are true;

Through homomorphic encoding/encryption, the verifier does not know the actual input value when calculating the equation, but it can still be verified;

On both the left and right sides of the equation, multiply by a secret value k that is not equal to zero. When verifying that (t(s)h(s)k) is equal to (w(s)v(s)k), concrete t(s), h(s), w(s) and v(s) are not available Known, so as to achieve the purpose of protecting information.

But zk-SNARKs are not perfect. A flaw in the current zk-SNARK implementation is the need to set parameters in advance. If these parameters are leaked, the entire network will face a devastating blow. Therefore, when using these networks, users must firmly trust that parameters will not be leaked.

Possible solutions include using modern "Trusted Execution Environments" such as Intel SGX and ARM TrustZone. With Intel's SGX technology, even if the application, operating system, BIOS or VMM is compromised, the private key is safe.

Additionally, a recent white paper revealed its innovation in zero-knowledge cryptography: ZK-STARKs (Zero-Knowledge Scalable Transparent ARguments of Knowledge).

According to the zk-STARK white paper, zk-STARK is the first system to achieve blockchain verification without relying on any trust settings, and the calculation speed increases exponentially as the calculation data increases.