📢 Gate Square Exclusive: #WXTM Creative Contest# Is Now Live!
Celebrate CandyDrop Round 59 featuring MinoTari (WXTM) — compete for a 70,000 WXTM prize pool!
🎯 About MinoTari (WXTM)
Tari is a Rust-based blockchain protocol centered around digital assets.
It empowers creators to build new types of digital experiences and narratives.
With Tari, digitally scarce assets—like collectibles or in-game items—unlock new business opportunities for creators.
🎨 Event Period:
Aug 7, 2025, 09:00 – Aug 12, 2025, 16:00 (UTC)
📌 How to Participate:
Post original content on Gate Square related to WXTM or its
The construction and case of zk-SNARK
TL;DR
Problems to be Proved-Arithmetic Circuits-R1CS-Polynomials
Because of the characteristics of polynomials, the verification time is effectively shortened, and simplicity is achieved.
To put it simply, in the process of deriving the polynomial, two more random numbers are selected, so that the derived polynomial can prevent the verifier from obtaining the coefficients of the original polynomial, that is, the secret input of the prover, so as to realize ZK.
Before the proof begins, a third party is introduced, that is, a trusted setting, which assigns the original verifier the task of picking random numbers to the trusted setting, thereby realizing non-interaction between the verifier and the prover.
ZK technology has attracted much attention in the Web3 field in the past two years. Starting from Rollup, more and more projects on different tracks are trying to use ZK technology. Among them, SNARK and STARK are the two most commonly heard terms. In order to better understand the application of ZK technology in the later stage, **this article will simplify the proof logic of SNARK from a non-technical perspective, and then use * * Scroll's zk Rollup ** is used as an example to illustrate the operation of the zk proof system. **
The purpose of the article is to explain the basic logic, which is easy to read. It will try to avoid the use of terminology, and will not go into details such as mathematical transformations. Please forgive me for any omissions.
In January 2012, Alessandro Chiesa, a professor at the University of California, Berkeley, co-authored a paper on SNARK and proposed the term zk-SNARK.
zk-SNARK, full name Zero-Knowledge-Succinct Non-Interactive Argument of Knowledge, is a proof system using ZK technology. **It should be noted that SNARK is the name of a class of schemes, and there are many different combination methods that can implement SNARK. **
What zk-SNARK needs to solve is the "calculation verification problem", that is, whether the verifier can efficiently verify the calculation results without knowing the privacy of the prover.
The following will use the simplified construction process of zk-SNARK to illustrate how the system combines zero knowledge to achieve efficient verification. **
Zk-SNARK Construction
Transform the problem to be proved into a polynomial
To put it simply, the idea of SNARK is to convert the proof of whether the statement is true or not into the proof of whether the polynomial equality is true or not.
The whole conversion process: problems to be verified ➡ arithmetic circuit ➡ R1CS ➡ polynomial ➡ conversion between polynomials
Question to be verified➡Arithmetic circuit
To prove whether a question is true through calculation, the question to be proved must first be transformed into a calculation problem, and any calculation can be described as an arithmetic circuit.
Arithmetic circuits are usually composed of constants, "addition gates", and "multiplication gates". Through the superposition of gates, we can construct complex polynomials.
The polynomial constructed by the arithmetic circuit in the figure above is: (Inp1+Inp2)*(-1) = Output
The problem in reality is extremely complicated to turn into an arithmetic circuit. We can simply understand it as: input some content, the content is transformed by the circuit, and finally output a result. Right now:
Based on the concept of arithmetic circuits, we construct an arithmetic circuit for generating proofs, namely:
The circuit contains two sets of inputs, the public input x and the secret input w. The public input x means that the content is a fixed value of the problem to be proved, which is known to both the verifier and the prover, and the secret input w means that the content is known only to the prover.
The arithmetic circuit we built is C( x, w ) = 0, that is, input x and w through the circuit, and the final output result is 0. When the prover and verifier know that the output of the circuit is 0 and the public input is x, the prover needs to prove that he knows the secret input w.
Arithmetic circuit ➡R1CS
We finally need a polynomial, but the arithmetic circuit cannot be directly converted into a polynomial, and R1CS is needed as an intermediary between the two, so the arithmetic circuit is converted into R1CS first.
R1CS, full name Rank-1 Constraints (first-order constraint system), is a language for describing circuits, which is essentially a matrix-vector equation. Specifically, R1CS is a sequence of three vectors (a,b,c), and the solution to R1CS is a vector s, where s must satisfy the equation:
Among them. represents the inner product operation.
The specific mathematical conversion here can be found in Vatalik: Quadratic Arithmetic Programs: from Zero to Hero
We only need to know that the role of **R1CS is to limit the description of each gate in the arithmetic circuit, so that the vectors between each gate satisfy the above relationship. **
R1CS➡Polynomial
After getting the medium of R1CS, we can convert it into a polynomial equivalent.
Equivalent conversions between matrices and polynomials can be performed as shown in the following figure:
polynomial
convert to matrix
According to the nature of the above equivalent transformation, for a matrix that satisfies R1CS, we can use Lagrange interpolation method to restore each coefficient of the polynomial. Based on this relationship, we can derive the R1CS matrix as a polynomial relationship, namely:
Note: A, B, C represent a polynomial respectively
A polynomial corresponds to an R1CS matrix constraint corresponding to the problem we want to prove. Through the above conversion, we can know that if the polynomials satisfy the above relationship, it means that our R1CS matrix is correct, thus indicating that the prover is in the arithmetic circuit. The secret input for is also correct.
Up to this point, our problem is simplified to: the verifier randomly selects a number x, and asks the certifier to prove that A(x) * B(x)=C(x) is established. If it is established, it means that the certifier's secret input is correct.
Conversion between polynomials
In complex arithmetic circuits, there are tens of thousands of gates, and we need to verify whether each gate satisfies the R1CS constraint. In other words, we need to verify the equality of A(x) * B(x)=C(x) several times, but the efficiency of separate verification one by one is too low. How can we verify the correctness of all gate constraints at one time? sex?
For the convenience of understanding, we introduce a P(x), let P(x) = A(x) * B(x) – C(x)
We know that any polynomial can be decomposed into linear polynomials as long as it has a solution. So we split P(x) into F(x) and H(x), namely:
Then F(x) is public, which means that there is a H(x) = P(x)/F(x), so the polynomial we want to verify finally turns into:
A(x) * B(x) – C(x): Contains the coefficients of the polynomial, known only to the prover, that is, the secret input.
F(x) : A public polynomial known to both the verifier and the prover, i.e. public input.
H(x): The prover knows it through calculation, but the verifier is unknowable.
**The final problem to be proved is: the polynomial equation A(x) * B(x) – C(x) = F(x) * H(x), holds true on all x. **
Now it is only necessary to verify the polynomial once to verify that all constraints satisfy the matrix relations.
**Here we have completed the transformation of the problem to be proved into a polynomial that only needs to be verified once, realizing the simplicity of the system. **
But the simplicity of this implementation is to shorten the verification time of the verifier, so what about the proof size?
**Simply speaking, in the proof protocol, the Merkle tree structure is used, which effectively reduces the size of the proof. **
After the entire conversion process is completed, two problems will naturally arise:
Because polynomials enable the simplicity of the proof. The problem of zero-knowledge proof is to verify that calculations satisfy multiple constraints, and polynomials can verify multiple constraints at one point. In other words, the verifier has to verify n times to confirm the problem, but now only needs to verify once to confirm the correctness of the proof with a high probability.
This is determined by the characteristics of polynomials, that is, the calculation result of a polynomial at any point can be regarded as the representation of its unique identity. For two polynomials, they will only intersect at a finite number of points.
For the above two polynomials of degree d: A(x) * B(x) – C(x) and F(x) * H(x), if they are not equal, they will only be at most d points Intersect, that is, the solutions at d points are the same.
After completing the polynomial conversion, we will enter the polynomial proof stage.
Prove that the polynomial holds
For the sake of illustration, we use the polynomial P(x) = F(x) * H(x).
Now, the problem that the prover wants to prove is: on all x, P(x) = F(x) * H(x).
The verification process of the above polynomial by the prover and the verifier is as follows:
But if we think carefully, we will find that there are some problems in the above process:
To solve the above problems, we make the following optimizations:
After optimization, we found that the proof system still requires interaction between the verifier and the prover. How can we achieve non-interaction?
Implement non-interactive
**In order to achieve non-interaction, SNARK introduces trusted settings (Setup). **
In other words, before the start of the proof, the verifier's right to choose random challenge points is handed over to a trusted third party. After the third party chooses the random parameter λ, it puts the encrypted λ in the R1CS circuit. In this way, CRS (Common Reference String, public reference string) is generated. The verifier can obtain its own Sv from the CRS, and the prover can obtain its own Sp from the CRS.
It should be noted that λ needs to be destroyed after generating Sv and Sp. If λ is leaked, it may be used to forge transactions through false verification.
zk-SNARK Workflow
After understanding the construction process of SNARK, based on the arithmetic circuit we constructed that can generate proofs, the proof process of zk-SNARK is as follows:
Through the circuit C and the random parameter λ, the random parameters Sv and Sp used by the subsequent prover and verifier are generated.
The prover calculates the proof Π through the random parameter Sp, the public input x, and the secret input w.
The verifier verifies whether C(x,w)=0 exists through random parameter Sv, public input x and proof Π. At the same time, verify whether the proof is calculated by circuit C or not.
At this point, we have completed the explanation of the entire zk-SNARK. Let's take a look at the actual application case.
Case: Take Scroll's zk Rollup as an example
The role of the proof system is to allow the prover to convince the verifier to believe one thing;
For the zk proof system, it is necessary for the verifier to believe that the Zero-Knowledge Proof (zero-knowledge proof) calculated by the zk algorithm is true.
We take Scroll's zk Rollup as an example to illustrate the operation of the zk proof system.
Rollup refers to off-chain calculation and on-chain verification. For zk Rollup, after the transaction is executed off-chain, the prover needs to generate a zk certificate for the new state root generated after the transaction is executed, and then pass the certificate to the L1 Rollup contract for on-chain verification.
It should be noted that there are two types of blocks in zk Rollup:
The following is the workflow of Scroll's zk Rollup:
As can be seen from the above process, Roller is the prover in the system, and the Rollup contract is the verifier. Roller generates a zk proof for transactions executed off-chain; the Rollup contract verifies the proof, and if the verification passes, the Rollup contract will directly adopt the submitted state root as its new state root.