Home > web3.0 > Hard-core science popularization: Taking the zoo as an example to analyze the working principle of zkSync circuit

Hard-core science popularization: Taking the zoo as an example to analyze the working principle of zkSync circuit

王林
Release: 2024-03-05 21:40:02
forward
1119 people have browsed it

硬核科普:以动物园为例,剖析 zkSync 电路工作原理

Author: Haotian

Many people were confused after seeing @zkSync’s newly published zoo science pictures and text, comparing the zoo to The circuit regards animals with special skills as "logic gates" and the happy group photos of the animals as "proof". In this way, the data input to the circuit goes through a series of complex calculations without revealing the specific content. Generating a Proof completes a zero-knowledge proof process. Come on, let me try to popularize some hardcore science:

1) 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 all animal abilities, it is also the basic element of computers. Therefore, the "data" passed into the circuit must be incorporated into various formulas and performed calculations.

In the layer2 network, the stored data is usually transaction hash value, account information, data balance, etc. These data can be calculated by converting them into formulas. Before the circuit can perform processing, it must be ensured that the data can be formulated. If the data cannot be converted directly into formulas, additional encoding conversions are required so that the raw data can be processed and calculated. The premise of this data processing is to ensure the compatibility of data formats so that data operations and calculations can be performed smoothly in the layer2 environment. Therefore, proper encoding and transformation of data are critical steps to ensure the proper functioning of the system and the effectiveness of data processing.

In the zoo mode, various animals have specific symbols corresponding to the logic gates in the circuit: the wooden box represents a number that is not publicly displayed, which is the so-called "variable"; the glass box symbolizes public display numbers, as "public input"; and the stones represent those immovable numbers, considered "constants". This analogy setting establishes a wonderful connection between logic gates and animals, adding fun and visual imagery to the understanding and learning of circuits.

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". The crocodile will be happy only if the number on the right is less than the number on the left; the spider represents more complexity Multi-selection gate, if you input 0, it will return true, if you input 1, it will return false; in addition, you can also let beavers represent division, squirrels represent percentages, caterpillars represent addition, etc. Different animals represent different formulas for addition, subtraction, multiplication and division. The happy or sad animals represent the structure of formula operations.

Many boxes of different types of animals are combined into a circuit. For example: to calculate a formula 2 x 3 = Y, x represents the wooden box, Y represents the stone, 2 wooden boxes and caterpillars, zebras, etc. Come to work and finally verify whether the formula holds. 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 2x 3 =Y just entered is established, which is equivalent to zebra caterpillars and other animals being happy, and then a "Proof" will be generated for the formula, and a character needs to be able to recognize this Proof depends on whether it is accurate. Therefore, in order to ensure the credibility of the proof, the zookeeper, the builder of the circuit, simulated a special animal called Zeek. Zeek can see whether other animals are happy and is equivalent to a Verifier in the layer2 system.

Zeek The process of observing whether animals are happy is actually the verification process of the Prover system. If they are all 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 Zeek's own clones is happy. This process is called Recursive Proof.

4) The process of taking pictures is equivalent to the process of generating SNARK proof or KZG commitment, and the printed negative is equivalent to the STARK\SNARK proof itself. Visitors to the zoo are equivalent to the Transaction transactions that enter one by one. Only the animals are happy The photo will be completed and the Proof will be generated. Finally, the visitor will leave the zoo with the photo and leave a proof before it can be uploaded and finalized.

There are many animals in a zoo, and it is impossible for them all to be happy at the same time and work according to predetermined rules. 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.

The above is the detailed content of Hard-core science popularization: Taking the zoo as an example to analyze the working principle of zkSync circuit. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:chaincatcher.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template