BTC
ETH
HTX
SOL
BNB
View Market
简中
繁中
English
日本語
한국어
ภาษาไทย
Tiếng Việt

Taking the zoo as an example, the working principle of zkSync circuit is explained

星球君的朋友们
Odaily资深作者
This article is about 1217 words, reading the full article takes about 2 minutes
A complex circuit is constructed by a variety of logic gates and rules.
AI Summary
A complex circuit is constructed by a variety of logic gates and rules.

Original author: Haotian (X: @tme l0 211)

Many people were confused after seeing @zkSync’s new zoo science pictures and texts. They compared the zoo to a circuit, regarded animals with special skills as logic gates, and regarded the group photo of all the animals happily as proof Proof, in this way, the data input into the circuit will go through a series of complex calculations to generate a Proof without revealing the specific content, thus completing a zero-knowledge proof process. Come, let me try to popularize hardcore science:

1) The zoo corresponds to circuit. A circuit is actually an aggregation of a series of logic gate constraints (addition, subtraction, multiplication, division, etc. formulas), which is equivalent to a concentrated expression of the abilities of all animals. It is also the basic element that constitutes a computer. . Therefore, the data passed into the circuit must be incorporated into various formulas and performed calculations.

In the layer 2 environment, there are some data such as transaction hash values, accounts, and data balances. These data can be converted into formulas for calculation. If they cannot be formulated, other coding conversion is required so that the original data can be turned into formulas. This is The prerequisite for circuit execution processing.

2) The logic gates in the circuit corresponding to various animals, in the zoo mode, are: wooden box - represents the number that is not publicly displayed, called a variable; glass box - represents the number that is publicly displayed, is Public input; stone - represents an immovable number and is considered a constant;

The zebra has the ability to compare whether two numbers are equal. If the result is equal, the zebra will be happy; the crocodile means less than, and the crocodile will be happy only if the number on the right is less than the number on the left; the spider represents a more complex multi-choice gate, input If 0 is entered, the return value must be true, and if 1 is entered, the return value is false; in addition, beavers can also be used to represent division, squirrels can represent percentages, caterpillars can represent addition, and so on. Different animals represent different formulas for addition, subtraction, multiplication and division. The happy or sad animals represent the structure of formula operations.

Many animals + boxes of different types are combined to form a circuit. For example: to calculate a formula 2 x + 3 = Y, x represents the wooden box, Y represents the stone, 2 wooden boxes, caterpillars, zebras, etc. come to work, Finally, verify whether the formula is established. Note that there is no need to worry about why different animals have different abilities. This is the basic principle of working of circuit elements and the basic rules for computers to perform calculations.

A complex circuit is constructed from a variety of animals (logic gates) and boxes (rules).

3) Assume that the formula 2 x+ 3 =Y just entered is established, which means that animals such as zebra caterpillars are happy, and then a Proof will be generated for the formula. A character needs to be able to identify whether this Proof is accurate. . Therefore, in order to ensure the credibility of the proof, the zookeeper, who is the builder of the circuit, simulated a special animal called Zeek. Zeek can see whether other animals are happy and is equivalent to the Verifier in the layer 2 system.

The process of Zeek observing whether animals are happy is actually the verification process of the Prover system. If all animals are happy, the verification is passed. Only then will the Proof be uploaded to the main network and finally confirmed. Of course, thousands of animals in the zoo produce a large number of proofs, and it is impossible for Zeek to look at them one by one. Therefore, Zeek can also observe whether the status of thousands of Zeeks own clones is happy. This process is called Recursive Proof.

4) The process of taking photos is equivalent to the process of generating SNARK certificates or KZG commitments, while the printed negatives are equivalent to the STARK\SNARK certificate itself. Visitors to the zoo are equivalent to the Transaction transactions that enter one by one. Only happy photos of animals will be completed and generated. Proof proves that the final visitor takes the photo and leaves the zoo to leave a proof before it can be chained and finalized.

There are many animals in a zoo, and it is impossible for them all to be happy and work according to predetermined rules at the same time. There are many logic gates, and it is inevitable that there will be disconnections and other situations. In this way, there will be some congestion, lags and error reports, which will result in invalid state transitions, Under-Constrained, and will not pass the final verification.

Original link

Layer 2
zkSync
Welcome to Join Odaily Official Community