Circuit synthesis method, device, medium and data storage proof system

By executing circuit synthesis in parallel, first-order constraint system components are generated and merged, which solves the problem of too long circuit synthesis time in zero-knowledge proofs and significantly improves the efficiency of the proof process.

CN112632888BActive Publication Date: 2024-08-23SHANGHAI ZHIJU INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010830354.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-08-18
Publication Date
2024-08-23
Estimated Expiration
2040-08-18

AI Technical Summary

Technical Problem

Existing zero-knowledge proof methods take too long to generate proofs in the case of large circuits, which affects the implementation of applications. Especially when traditional circuit synthesis algorithms fail to effectively consider the specific conditions of logic circuits, the circuit synthesis time is too long.

Method used

Through the parallel execution of the design constraint system, the parent constraint system is generated and distributed to multiple processing units to generate first-order constraint system components in parallel. After merging, a complete first-order constraint system is constructed, thereby accelerating the generation of the constraint system.

Benefits of technology

It significantly speeds up the generation time of zero-knowledge proofs, enables rapid construction of constraint systems, and improves the efficiency of the entire proof process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112632888B
    Figure CN112632888B
Patent Text Reader

Abstract

The present invention provides a circuit synthesis method, device, computer storage medium and data storage proof system for zero-knowledge proof. The method includes: a proof unit for zero-knowledge proof: generating a parent constraint system for the data to be proved based on a logic circuit of the data to be proved; sending the parent constraint system to multiple processing units; receiving multiple different first-order constraint system components generated in parallel by the multiple processing units, wherein each first-order constraint system component includes the parent constraint system and a child constraint system, and the child constraint system is obtained based on the parent constraint system; merging the multiple different first-order constraint system components to obtain the first-order constraint system; and constructing a zero-knowledge proof for the data to be proved based on the first-order constraint system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of zero-knowledge proof, and more specifically, to a circuit synthesis method, device, computer storage medium and data storage proof system using the method for zero-knowledge proof. Background Art

[0002] Zero-knowledge proof means that the prover can convince the verifier that a certain assertion is correct without revealing any useful information. In a typical zero-knowledge proof process, the prover claims that certain public parameters conform to a certain assertion, and generates a zero-knowledge proof (ZKP) based on these public parameters and certain private parameters using a certain algorithm. The verifier can verify the zero-knowledge proof based on the public parameters according to the corresponding algorithm, and if the verification passes, the prover's assertion is considered true.

[0003] Currently, zero-knowledge proof methods have been widely used in blockchain technology, digital currency, multi-party computing, secure computing and other fields. However, for many zero-knowledge proof methods, such as zk-SNARK (zero knowledge Succinct Non-interactive ARgument of Knowledge), the proof generation time is very long in the case of large circuits, which will seriously affect the implementation of applications that rely on zero-knowledge proofs.

[0004] In particular, when the prover provides a zero-knowledge proof (such as zk-SNARK), the logic to be proved (also called proof logic) needs to be converted into a QAP (Quadratic Assignment Problem). In this process, the logic circuit needs to be synthesized to generate a constraint system (CS). Currently, the traditional circuit synthesis algorithm does not consider the specific situation of the logic circuit, and directly performs circuit synthesis in a serial processing mode, which makes the time required for circuit synthesis too long, which is not conducive to the generation of zero-knowledge proof. Summary of the invention

[0005] In view of the above problems, the inventors of the present invention have studied and proved that by ingeniously designing the constraint system, at least a part of the constraint system can be executed in parallel for circuit synthesis, thereby accelerating the generation of the entire constraint system. In view of this, the present invention provides a circuit synthesis method for zero-knowledge proof and a data storage proof system using the method.

[0006] According to one aspect of the present invention, there is provided a circuit synthesis method for zero-knowledge proof, comprising: a proof unit performing zero-knowledge proof: generating a parent constraint system for the data to be proved based on a logic circuit of the data to be proved; sending the parent constraint system to multiple processing units; receiving multiple different first-order constraint system components generated in parallel by the multiple processing units, wherein each first-order constraint system component includes the parent constraint system and a child constraint system, and the child constraint system is obtained based on the parent constraint system; merging the multiple different first-order constraint system components to obtain the first-order constraint system; and constructing a zero-knowledge proof for the data to be proved based on the first-order constraint system.

[0007] According to another aspect of the present invention, a circuit synthesis device for zero-knowledge proof is provided, which includes: a memory having computer program code stored thereon; and a processor configured to run the computer program code to execute the method as described above.

[0008] According to another aspect of the present invention, a computer-readable storage medium is provided, on which a computer program code is stored. When the computer program code is executed, the method described above is executed.

[0009] According to another aspect of the present invention, a data storage proof system is provided, comprising a proof unit and a plurality of processing units. The proof unit is configured to: perform label calculation, hash calculation and encoding calculation on the original data and construct a Merkle tree for storage; select multiple columns of data from the stored original data, wherein each column of data includes multiple data blocks; construct a general circuit for the multiple columns of data, wherein the general circuit is used to generate a parent constraint system for the multiple columns of data based on the logic circuit of the multiple columns of data; send the parent constraint system to multiple processing units; receive multiple different first-order constraint system components generated in parallel by the multiple processing units, wherein each first-order constraint system component includes the parent constraint system and a child constraint system, wherein the child constraint system is obtained based on the parent constraint system using one of the multiple spot check subcircuits; merge the multiple different first-order constraint system components to obtain the first-order constraint system; and construct a zero-knowledge proof for the multiple columns of data based on the first-order constraint system to prove that the proof unit stores the original data.

[0010] By utilizing the scheme of the present invention, the generation of zero-knowledge proofs is accelerated by performing circuit synthesis in parallel to generate constraint systems. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] Figure 1 A flow chart of a circuit synthesis method for zero-knowledge proof according to an embodiment of the present invention is shown;

[0012] Figure 2 An exemplary flow chart showing the steps of generating a parent constraint system in a circuit synthesis method according to an embodiment of the present invention;

[0013] Figure 3 An exemplary flow chart showing the steps of generating first-order constraint system components in the circuit synthesis method according to an embodiment of the present invention;

[0014] Figure 4 A schematic diagram showing an application system using the circuit synthesis method for zero-knowledge proof of the present invention;

[0015] Figure 5 Shows Figure 4 A schematic diagram of the data processing process in the application system;

[0016] Figure 6 Shows Figure 4 A schematic diagram of the logic circuit structure in the application system; and

[0017] Figure 7 A schematic block diagram of an example device that may be used to implement embodiments of the present invention is shown. DETAILED DESCRIPTION

[0018] The following will be described in detail with reference to the accompanying drawings to provide a clearer understanding of the purpose, features and advantages of the present invention. It should be understood that the embodiments shown in the accompanying drawings are not intended to limit the scope of the present invention, but are only intended to illustrate the essential spirit of the technical solution of the present invention.

[0019] In the following description, certain specific details are set forth for the purpose of illustrating various embodiments of the invention to provide a thorough understanding of the various embodiments of the invention. However, those skilled in the relevant art will recognize that the embodiments may be practiced without one or more of these specific details. In other cases, well-known devices, structures, and techniques associated with the present application may not be shown or described in detail to avoid unnecessarily obscuring the description of the embodiments.

[0020] Unless the context requires otherwise, throughout the specification and claims, the word "comprise" and variations such as "include" and "have" should be construed in an open, inclusive sense, ie, should be interpreted as "including, but not limited to."

[0021] References throughout the specification to "one embodiment" or "an embodiment" indicate that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment. Thus, the appearances of "in one embodiment" or "in an embodiment" in various places throughout the specification are not necessarily all referring to the same embodiment. Furthermore, the particular features, structures, or characteristics may be combined in any manner in one or more embodiments.

[0022] As used in the specification and the appended claims, the singular forms "a", "an", and "the" include plural referents unless the context clearly dictates otherwise. It should be noted that the term "or" is generally employed in its sense including "and / or" unless the context clearly dictates otherwise.

[0023] As mentioned above, there are various existing zero-knowledge proof methods, including interactive proof methods and non-interactive proof methods, among which the non-interactive proof method does not require the interaction between the prover and the verifier to generate the proof, and has significant advantages over the interactive proof method. zk-SNARK is a commonly used type of non-interactive zero-knowledge proof method. Hereinafter, the scheme of the present invention is described by taking the zk-SNARK method such as Groth16 as an example. However, those skilled in the art will appreciate that the idea of ​​the present invention can be easily extended to other zero-knowledge proof methods, as long as the method involves the construction of a constraint system.

[0024] Groth16 is an effective zk-SNARK zero-knowledge proof method designed by Jens Groth. The proofs generated by Groth16 are smaller and faster to verify. The complete Groth16 proof system includes three processes, corresponding to three algorithms: setup, proof, and verification. The setup algorithm creates a proof key and a verification key, and the verification algorithm uses the verification key to check a proof to decide whether to accept or reject the proof. For a QAP instance, the setup algorithm is run only once, and the created proof key and verification key are open to the prover and verifier, while the verification algorithm is very fast. Therefore, the key factor that determines the speed of the entire Groth16 proof system lies in the execution speed of the proof part (proof algorithm). When executing the proof, an important process is to perform circuit synthesis on the logic circuit to generate a constraint system, such as a first-order constraint system (Rank-1 Constraint System, R1CS). Therefore, speeding up the generation of the constraint system will speed up the entire zero-knowledge proof process.

[0025] Figure 1 A flow chart of a circuit synthesis method 100 for zero-knowledge proof according to an embodiment of the present invention is shown.

[0026] In summary, unlike the conventional method of directly building a complete constraint system, Figure 1 In the circuit synthesis method for zero-knowledge proof shown, a complete first-order constraint system is constructed by constructing multiple first-order constraint system components in parallel and merging these components to speed up the construction process of the constraint system, thereby speeding up the entire zero-knowledge proof process.

[0027] like Figure 1 As shown, the method 100 includes step 110, in which the proving unit generates a parent constraint system (Parent CS, hereinafter abbreviated as P) for the data to be proved based on the logic circuit of the data to be proved.

[0028] Here, as is well known to those skilled in the art, in zk-SNARK, the logic to be proved (i.e., proof logic) can be flattened into a logic circuit relationship (referred to as logic circuit in this article) composed of multiple gate circuits (such as addition gate (+), multiplication gate (*), etc., note that subtraction and division can also be represented by addition gates or multiplication gates).

[0029] Figure 2 An exemplary flow chart of step 110 of generating a parent constraint system P in the circuit synthesis method 100 according to an embodiment of the present invention is shown.

[0030] like Figure 2 As shown in , step 110 may include sub-step 111, in which the proving unit determines a plurality of first type variables and a plurality of second type variables of R1CS and the number of constraints of R1CS based on the logic circuit of the data to be proved.

[0031] In the Groth16 algorithm, R1CS is used to describe the constraint system, in which each variable is first-order. The variables of R1CS can be divided into two types, one is called public variables (Public Input), and the other is called private variables or auxiliary variables (Aux Input). Therefore, the total number of variables in R1CS is the sum of the number of public variables and the number of private variables. Depending on the logic circuit, each variable can have different assignments, and these different assignments are called constraints. In other words, variables and constraints (assignments) are the two determining factors for building a constraint system.

[0032] Next, in sub-step 112, the proving unit determines a plurality of constraint coefficient matrices of R1CS based on the logic circuit of the data to be proved.

[0033] In one embodiment, the multiple constraint coefficient matrices include a first constraint coefficient matrix A, a second constraint coefficient matrix B and a third constraint coefficient matrix C, the first constraint coefficient matrix A indicates multiple first constraints a, the second constraint coefficient matrix B indicates multiple second constraints b, and the third constraint coefficient matrix C indicates multiple third constraints c, wherein for the multiple constraint coefficient matrices, the product of the first constraint and the second constraint is equal to the third constraint, that is, a*b=c.

[0034] The constraint coefficient matrix can be stored according to variables. For example, each constraint coefficient matrix can be expressed in the form of Table 1 below, which can be sparsely represented according to variables to reduce memory consumption:

[0035] Table 1 Constraint coefficient matrix

[0036]

[0037]

[0038] Among them, c0, c1, ..., c4 indicate the constraints in the constraint coefficient matrix (for example, Table 1 assumes that there are 5 constraints in total), i0, i1 indicate first type variables (for example, Table 1 assumes that there are 2 first type variables in total), aux0 ... aux6 indicate second type variables (for example, Table 1 assumes that there are 7 second type variables in total), and the values ​​in the table indicate the values ​​of the corresponding variables under the corresponding constraints. For example, the value "-1" in the square corresponding to i0 and c1 indicates the value of the variable i0 under the constraint c1. As described above, the first type variable can be a public variable that can be known by multiple nodes or units in the system, and the second type variable can be an auxiliary variable that is only known by a certain node or unit itself.

[0039] Next, in sub-step 113, the proof unit determines a parent constraint system P based on the common circuit part of the logic circuit of the data to be proved, wherein the parent constraint system P corresponds to at least one constraint (hereinafter also referred to as a parent constraint) in a constraint coefficient matrix (for example, the constraint coefficient matrix A as shown in Table 1 above) and a first number of variables under the at least one parent constraint, wherein the first number of variables is at least a part of a plurality of first type variables i0, i1 and a plurality of second type variables aux0...aux6.

[0040] For example, assuming that the parent constraint system P determined by the proof unit according to the common circuit part of the logic circuit of the data to be proved corresponds to the constraint c0 shown in Table 1, then the parent constraint system P includes four variables under the constraint c0, namely, two first type variables i0 and i1 and two second type variables aux0 and aux1. The values ​​of the four variables are the corresponding values ​​of 0 (empty by default in the figure), -1, 1 and 2 of the variables i0, i1, aux0 and aux1 under constraint c0.

[0041] Here, those skilled in the art can understand that the parent constraint system P may not be unique, and it can be constructed based on all common circuit parts or part of common circuit parts of the logic circuit of the data to be proved. In one embodiment, the size of the parent constraint system P affects the generation speed of the entire constraint system. As described below, when the parent constraint system P is small enough, the generation of the entire constraint system can achieve approximately linear acceleration.

[0042] Next, in step 120, the proof unit sends the generated parent constraint system P to multiple processing units.

[0043] In step 130, multiple processing units generate multiple different R1CS components in parallel based on the received parent constraint system P and the constraint coefficient matrix as shown in Table 1, wherein each R1CS component includes the parent constraint system P and a child constraint system subCS, and the child constraint system subCS is obtained based on the parent constraint system P and the constraint coefficient matrix.

[0044] Figure 3 An exemplary flow chart of step 130 of generating the R1CS component in the circuit synthesis method 100 according to an embodiment of the present invention is shown.

[0045] like Figure 3 As shown in , step 130 includes sub-step 131, in which a processing unit receives a parent constraint system P from a proof unit. As described above, it is assumed that the parent constraint system P corresponds to four variables i0, i1, aux0 and aux1 under constraint c0, and the values ​​of the four variables are 0, -1, 1 and 2 respectively.

[0046] Next, in sub-step 132, the processing unit determines at least one sub-constraint that is different from at least one parent constraint in the parent constraint system P based on the constraint coefficient matrix (for example, the constraint coefficient matrix A shown in Table 1 above), and assigns a value to the at least one sub-constraint based on the values ​​of the first number of variables under the at least one sub-constraint to generate a first sub-matrix P1 of a sub-constraint system subCS1.

[0047] As mentioned above, assuming that the parent constraint system P corresponds to the four variables i0, i1, aux0 and aux1 under constraint c0, and the values ​​of the four variables are 0, -1, 1 and 2 respectively, then constraints c1 and c2 can be selected as sub-constraints of the first sub-matrix P1, and the sub-constraints of the first sub-matrix P1 are assigned based on the values ​​of the four variables i0, i1, aux0 and aux1 under constraints c1 and c2, that is, P1 contains four variables i0, i1, aux0 and aux1 under two constraints c1 and c2, and the values ​​of the four variables are -1, 2, 0, 0 and 28, 0, 0, 0 respectively.

[0048] In sub-step 133, the processing unit selects a second number of variables different from the first number of variables in the parent constraint system P from a plurality of first type variables (i0, i1) and a plurality of second type variables (aux0...aux6), and assigns values ​​to the second number of variables based on the constraint coefficient matrix (e.g., the above-mentioned matrix A) to generate a second sub-matrix C1 of the sub-constraint system subCS1. Here, the second number may be the same as the first number or different from the first number.

[0049] As described above, assuming that the first number of variables of the parent constraint system P includes four variables i0, i1, aux0 and aux1 under constraint c0, and the values ​​of the four variables are 0, -1, 1 and 2 respectively, and the first sub-matrix P1 of the sub-constraint system subCS1 determined in sub-step 131 contains four variables i0, i1, aux0 and aux1 under two sub-constraints c1 and c2, and the values ​​of the four variables are -1, 2, 0, 0 and 28, 0, 0, 0 respectively. Then in sub-step 133, the processing unit can select any some of the variables other than i0, i1, aux0 and aux1 from all the variables (for example, select aux2 and aux3), and assign values ​​to the selected variables aux2 and aux3 according to the constraint coefficient matrix, and the values ​​of the two variables are 5, 13 and 3, 17 respectively.

[0050] Next, in sub-step 134, the processing unit constructs an R1CS component based on the parent constraint system P, the first sub-matrix P1 and the second sub-matrix C1 of the sub-constraint system subCS1.

[0051] In one embodiment, the processing unit forms a lower triangular matrix with the parent constraint system P, the first sub-matrix P1 and the second sub-matrix C1 of the sub-constraint system subCS1, and the all-zero matrix 0 as the first-order constraint system component. In this case, the R1CS component A1 can be expressed as:

[0052]

[0053] In the same way, multiple processing units (such as the following combined Figure 4 The processing unit 460 1 ,460 2 ,460 3 ) can obtain multiple different R1CS components A1, A2, A3 in parallel as shown below:

[0054]

[0055] Among them, P1, P2 and P3 respectively indicate the first sub-matrices of the sub-constraint systems subCS1, subCS2 and subCS3 of multiple processing units, C1, C2 and C3 respectively indicate the second sub-matrices of the sub-constraint systems subCS1, subCS2 and subCS3 of multiple processing units, and P1, P2 and P3 contain different constraints and the same variables from each other, and C1, C2 and C3 respectively contain the same constraints and different variables as P1, P2 and P3.

[0056] return Figure 1 , Next, in step 140, the proof unit receives multiple different R1CS components (such as R1CS components A1, A2, A3) from multiple processing units, and merges them to obtain a complete R1CS.

[0057] In one embodiment, the proof unit uses the parent constraint system P as the first sub-matrix element of R1CS, uses the first sub-matrices (such as the first sub-matrices P1, P2, P3) of multiple sub-constraint systems subCS (such as sub-constraint systems subCS1, subCS2, subCS3) as column elements of R1CS, uses the second sub-matrices (such as the second sub-matrices C1, C2, C3) of multiple sub-constraint systems subCS as diagonal elements of R1CS, and sets the other elements of R1CS to 0 to construct the R1CS. In this case, the constructed R1CS can be expressed as:

[0058]

[0059] It can be seen that in the above circuit synthesis method 100, the construction process of the constraint system is accelerated by obtaining each R1CS component in parallel. In particular, if the parent constraint system P is constructed to be small enough and each child constraint system is constructed to be substantially the same size, a nearly linear acceleration can be achieved.

[0060] Next, in step 150, the proving unit performs zero-knowledge proof on the stored data to be proved based on the R1CS obtained in step 140.

[0061] Specifically, when constructing the proof, it is necessary to calculate the corresponding value of each constraint, that is, the calculation result after each variable in the constraint is assigned a value.

[0062] Taking the sub-constraint system subCS1 as an example, since it is only related to the variables in the parent constraint system P and its own variables, the following formula can be used to calculate the corresponding constraint coefficient matrix:

[0063] P1*v 0 +C1*v 1 ,

[0064] Where P1 is the first submatrix of subCS1, C1 is the second submatrix of subCS1 (as described above), and v 0 is the assignment to the parent constraint system P, v 1 It is the assignment of the second sub-matrix C1 of subCS1. It can be expressed as a function:

[0065]

[0066] After obtaining multiple sub-constraint systems subCS1, subCS2, and subCS3, the results of these sub-constraint systems can be combined, which can be expressed by the function:

[0067]

[0068]

[0069]

[0070] Where P2 is the first submatrix of subCS2, C2 is the second submatrix of subCS2 (as described above), and v 0 is the assignment to the parent constraint system P, v 2 is the assignment of the second sub-matrix C2 of subCS2; P3 is the first sub-matrix of subCS3, C3 is the second sub-matrix of subCS3 (as described above), v 0 is the assignment to the parent constraint system P, v 3 is the assignment of the second sub-matrix C3 of subCS3. Thus, merging multiple R1CS components A1, A2, A3 into R1CS can be expressed as:

[0071]

[0072] As mentioned above, the circuit synthesis method 100 for zero-knowledge proof according to the present invention can be used in multiple application fields and various application scenarios that require zero-knowledge proof, such as blockchain, multi-party computing, secure computing, etc. Figure 4 A schematic diagram of an application system 400 for performing data storage proof in a blockchain using the circuit synthesis method 100 for zero-knowledge proof of the present invention is shown. Figure 5 Shows Figure 4 Schematic diagram of the data processing process in the application system 400. The application system 400 is, for example, a mining project Filecoin blockchain. Figure 6 Shows Figure 4 A schematic diagram of the logic circuit structure in the application system 400. Figures 4 to 6 The process of using method 100 to prove data storage in the Filecoin blockchain is described.

[0073] Note that in this article, Figure 4 The circuit synthesis method 100 for zero-knowledge proof is described with the background of the system 400 for performing data storage proof in the blockchain, but those skilled in the art will appreciate that Figure 1 The circuit synthesis method 100 for zero-knowledge proof shown can be easily applied to any scenario requiring the provision of zero-knowledge proof.

[0074] The Filecoin project uses the PoRep and PoSt protocols to ensure that the storage nodes correctly store user data. PoRep stands for Proof of Replicate. PoSt stands for Proof of Space time. The calculations of these two parts of the protocol need to be generated by zero-knowledge proof calculation and submitted to the blockchain. Therefore, the parallel circuit synthesis method of the present invention can be used to speed up the generation of the constraint system, thereby speeding up the generation of zero-knowledge proof. Figure 4 and Figure 5 The system 400 is described. For the sake of brevity, the description mainly focuses on the zero-knowledge proof process of data storage of the PoRep protocol. It can be understood by those skilled in the art that the description can also be easily applied to the case of the PoSt protocol.

[0075] like Figure 4 As shown in , the system 400 includes a blockchain logic module 410, a storage processing and certification module 430, an interface module 420 as an interface between the blockchain logic module 410 and the storage processing and certification module 430, and a zero-knowledge certification module 440. In addition, the system 400 physically includes multiple blockchain nodes, such as Figure 4The proof unit 450 and the verification unit 470 shown in . The blockchain logic module 410 is a code module or hardware module for implementing the underlying logic of the blockchain. In one embodiment, the blockchain logic module 410 is at the code level and can be deployed on multiple blockchain nodes including the proof unit 450 and the verification unit 470. For example, for the Filecoin blockchain, the module 410 can be a Filecoin Blockchain code module implemented in the go language. The storage processing and proof module 430 is a code module or hardware module for storing and managing the data and proofs of the blockchain. In one embodiment, for example, for the Filecoin blockchain, the storage processing and proof module 430 can be a Rust-fil-proofs code module implemented in the rust language, which is used to store data in the form of a Merkle tree. The interface module 420 is an interface between modules 410 and 430. In one embodiment, for example, for the Filecoin blockchain, the interface module 420 can be an FFI code module implemented in the go language. The zero-knowledge proof module 440 is a code base for performing zero-knowledge proof or a hardware module that carries the code base, which can be called by the proof unit 450 and the verification unit 470. For example, for the Filecoin blockchain, it is an implementation of the proof system of Groth16, which can be implemented in the rust language and is called Bellman.

[0076] System 400 also includes a proof unit 450 and a verification unit 470. Proof unit 450 is used to call zero-knowledge proof module 440 to provide zero-knowledge proof of the data stored therein, and the code thereon can be implemented using the rust language. Verification unit 470 is used to call zero-knowledge proof module 440 to verify the zero-knowledge proof provided by proof unit 450. In some embodiments, multiple processing units 460 1 ,460 2 ,460 3 ... (hereinafter collectively referred to as processing unit 460) may also be a blockchain node in system 400, or, in some other embodiments, processing unit 460 is an external processor that communicates only with proof unit 450 or a plurality of processors included in proof node 450. Similarly, proof unit 450 and / or verification unit 470 may also be a blockchain node in system 400 or a proof processing unit and / or verification processing unit located on the blockchain node.

[0077] refer to Figure 5, the storage processing and proof module 430 divides the data into multiple sectors (single storage units), and each sector performs independent processing and storage. For Filecoin applications, the default size of the sector is 32G. The following description takes a single sector as an example.

[0078] The data of a sector is called original data 500, which is divided into multiple data blocks, each of which can contain 32 bytes. The storage processing and proof module 430 performs labeling calculations on the original data 500 to generate multi-layer label data 51, 52, ..., 5L (collectively referred to as 5i, 1≤i≤L), and each layer of label data 5i includes multiple data blocks 5i1, 5i2, ... 5iN. Here, L is a positive integer greater than 1. In a typical Filecoin application, L = 11. In the case where a sector contains 32G data and each data block contains 32 bytes, the number of data blocks in each layer is N = 32G / 32 = 1G. The calculation of each data block in each layer of label data depends on the corresponding previous layer of label data and the first two data blocks of this layer, as shown by the dotted line in the figure. In addition, the multi-layer label data 51, 52, ..., 5L also undergoes hash calculations (Hash), encoding calculations, and construction of Merkle trees to generate the final storage data and store it on each blockchain node. Here, the specific methods of hash calculation, encoding calculation and Merkle tree construction can be found in the Filecoin white paper, and will not be described in detail here.

[0079] After a blockchain node stores the above information, it should submit a zero-knowledge proof to prove that it has indeed stored the corresponding original data. At this time, the node is called a proof unit (such as Figure 4 However, since the processed data is large (for example, usually more than 32G), it is logically impossible to generate logic circuits for all data processing processes. In this regard, a current solution is to provide the zero-knowledge proof by spot-checking several columns (for example, 18 columns) in the original data 500.

[0080] Specifically, the proving unit 450 can randomly select multiple columns of data (such as the columns composed of data blocks 51i, 52i, ..., 5Li as shown in the figure) in the original data 500 stored therein, and generate zero-knowledge proofs for the multiple columns of data through parallel processing, thereby proving that it stores the original data 500 to be proved. The proving unit 450 can send the generated zero-knowledge proof to the verification unit 470 for verification. When generating the zero-knowledge proof, the proving unit 450 and the multiple processing units 460 can perform parallel operations using the method 100 described above to perform circuit synthesis, thereby generating a zero-knowledge proof for the original data 500.

[0081] As described above, the proving unit 450 performs label calculation, hash calculation, and encoding calculation on the original data 500 and constructs a Merkle tree for storage.

[0082] Then, the proof unit 450 selects multiple columns of data from the stored original data 500, wherein each column of data includes multiple data blocks. For example, the selected multiple columns of data include Figure 5 As shown in the figure, the columns composed of data blocks 511, 521, ..., 5L1, the columns composed of data blocks 512, 522, ..., 5L2, ..., the columns composed of data blocks 51i, 52i, ..., 5Li, and the columns composed of data blocks 51N, 52N, ..., 5LN, etc., preferably 18 columns of data can be selected.

[0083] The proof unit 450 constructs a general circuit 610 for the selected multiple columns of data, and the general circuit 610 is used to generate a parent constraint system P for the multiple columns of data based on the common circuit parts of the logic circuits of the multiple columns of data.

[0084] In one embodiment, the proof unit 450 may determine a plurality of first type variables and a plurality of second type variables of the first-order constraint system R1CS and the number of constraints of R1CS based on the logic circuit of the plurality of columns of data, as described in the above sub-step 111.

[0085] The proof unit 450 determines multiple constraint coefficient matrices of R1CS based on the logic circuit of the multiple columns of data, as described in the above sub-step 112.

[0086] The proof unit 450 determines a parent constraint system P based on the common circuit part of the logic circuit of the multiple columns of data, and the parent constraint system P corresponds to at least one parent constraint in a constraint coefficient matrix and a first number of variables under the at least one parent constraint, wherein the first number of variables is at least a part of the multiple first type variables and the multiple second type variables, as described in the above sub-step 113.

[0087] The proof unit 450 sends the parent constraint system P to multiple processing units 460.

[0088] Each processing unit 460 (such as processing unit 460 1 ) receives the parent constraint system P from the proof unit 450, and determines multiple constraint coefficient matrices of R1CS based on the logic circuit of the multiple columns of data, as shown in Table 1 above and described in the above sub-step 132.

[0089] Specifically, the processing unit 460 1 A spot check subcircuit 620 (such as Figure 6 The spot check subcircuit 620 is shown1 ), and using the spot check sub-circuit 620 1 At least one sub-constraint different from at least one parent constraint in the parent constraint system P is selected, and the at least one sub-constraint is assigned a value based on the value of the first number of variables under the at least one sub-constraint to generate a first sub-matrix P1 of a sub-constraint system subCS1, as described in the above sub-step 132. For example, Figure 6 As shown in FIG. 1 , assuming that M processing units 460 participate in circuit synthesis, M spot check sub-circuits 620 can be constructed. 1 , 620 2 ,……,620 M In one example, M=18.

[0090] Processing unit 460 1 A second number of variables different from the first number of variables in the parent constraint system P is selected from multiple first type variables and multiple second type variables, and the second number of variables are assigned values ​​based on the constraint coefficient matrix to generate a second sub-matrix C1 of the sub-constraint system subCS1, as described in the above sub-step 133.

[0091] Processing unit 460 1 An R1CS component is constructed based on the parent constraint system P, the first sub-matrix P1 and the second sub-matrix C1 of the sub-constraint system subCS1.

[0092] The proof unit 450 receives a plurality of different R1CS components from the plurality of processing units 460 , wherein each R1CS component includes a parent restraint system P and a sub-restraint system subCS. As described above, the sub-restraint system subCS is obtained based on the parent restraint system P using a spot check subcircuit dedicated to each processing unit 460 .

[0093] The proving unit 450 merges the multiple different R1CS components to obtain R1CS, and constructs a zero-knowledge proof for the multiple columns of data based on the R1CS to prove that the proving unit 450 stores the original data 500 .

[0094] Figure 7A schematic block diagram of an example device 700 that can be used to implement an embodiment of the present invention is shown. The device 700 can be, for example, the above-mentioned certification unit 450 or verification unit 470, which includes multiple processors 710, or can be the above-mentioned processing unit 460. As shown in the figure, the device 700 may include one or more central processing units (CPU) 710 (only one is schematically shown in the figure), which can perform various appropriate actions and processes according to computer program instructions stored in a read-only memory (ROM) 720 or computer program instructions loaded from a storage unit 780 to a random access memory (RAM) 730. For example, the computer program instructions may also include program codes for implementing the above-mentioned method 100 and / or program codes for implementing modules 410 to 440 in the above-mentioned system 400. In the RAM 730, various programs and data required for the operation of the device 700 may also be stored. The CPU 710, the ROM 720, and the RAM 730 are connected to each other via a bus 740. An input / output (I / O) interface 750 is also connected to the bus 740.

[0095] A number of components in the device 700 are connected to the I / O interface 750, including: an input unit 760, such as a keyboard, a mouse, etc.; an output unit 770, such as various types of displays, speakers, etc.; a storage unit 780, such as a disk, an optical disk, etc.; and a communication unit 790, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 790 allows the device 700 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0096] The method 100 described above may be executed, for example, by the processor 710 of the device 700. For example, in some embodiments, the method 100 may be implemented as a computer software program, which is tangibly included in a machine-readable medium, such as a storage unit 780. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 700 via the ROM 720 and / or the communication unit 790. When the computer program is loaded into the RAM 730 and executed by the CPU 710, one or more operations of the method 100 described above may be performed. In addition, the communication unit 790 may support wired or wireless communication functions.

[0097] Combination of the above Figures 1 to 7 The circuit synthesis method 100 for zero-knowledge proof according to the present invention and the data storage proof system 400 using the method are described. However, those skilled in the art will appreciate that the circuit synthesis method 100 for zero-knowledge proof described herein is not limited to Figure 4The method 100 is not limited to the scenario shown in the figure, but can be used in various application fields and scenarios where zero-knowledge proof is required, such as multi-party computing, secure computing, etc. In addition, those skilled in the art can understand that the execution of the steps of the method 100 is not limited to the order shown in the figure and described above, but can be executed in any other reasonable order. The device 700 does not necessarily include Figure 7 All components shown in the figure may only include some of the components necessary to perform the functions described in the present invention, and the connection method of these components is not limited to the form shown in the figure. For example, in the case where the device 700 is a portable device such as a mobile phone, the device 700 may have Figure 7 Compared with different structures.

[0098] The present invention may be implemented as a method, an apparatus, a system and / or a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for executing various aspects of the present invention.

[0099] A computer-readable storage medium may be a tangible device that can hold and store instructions used by an instruction execution device. A computer-readable storage medium may be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. More specific examples of computer-readable storage media (a non-exhaustive list) include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disk read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, such as a punch card or a raised structure in a groove on which instructions are stored, and any suitable combination of the foregoing. As used herein, a computer-readable storage medium is not to be interpreted as a transient signal per se, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagating through a waveguide or other transmission medium (e.g., a light pulse through a fiber optic cable), or an electrical signal transmitted through a wire.

[0100] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, optical fiber transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in the computer-readable storage medium in each computing / processing device.

[0101] The computer program instructions for performing the operation of the present invention can be assembler instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages-such as Smalltalk, C++, etc., and conventional procedural programming languages-such as "C" language or similar programming languages. Computer-readable program instructions can be executed completely on the user's computer, partially on the user's computer, executed as an independent software package, partially on the user's computer and partially on the remote computer, or completely on the remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network-including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (for example, using an Internet service provider to connect through the Internet). In some embodiments, by using the state information of computer-readable program instructions to customize electronic circuits, such as programmable logic circuits, field programmable gate arrays (FPGAs) or programmable logic arrays (PLAs), the electronic circuits can execute computer-readable program instructions, thereby realizing various aspects of the present invention.

[0102] Various aspects of the present invention are described herein with reference to the flow charts and / or block diagrams of the methods, devices (systems) and computer program products according to embodiments of the present invention. It should be understood that each box of the flow chart and / or block diagram and the combination of each box in the flow chart and / or block diagram can be implemented by computer-readable program instructions.

[0103] These computer-readable program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processing unit of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.

[0104] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operating steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.

[0105] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to multiple embodiments of the present invention. In this regard, each square box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and the part of the module, program segment or instruction includes one or more executable instructions for realizing the logical function of the specification. In some alternative implementations, the function marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous square boxes can actually be executed substantially in parallel, and they can also be executed in the opposite order sometimes, depending on the function involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be realized by a special hardware-based system that performs the function or action of the specification, or can be realized by a combination of special hardware and computer instructions.

[0106] The embodiments of the present invention have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The terms used herein are selected to best explain the principles of the embodiments, practical applications, or technical improvements to the technology in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.

Claims

1. A circuit synthesis method for zero-knowledge proof, comprising: The proof unit for zero-knowledge proof is: The method generates a parent constraint system for the data to be proved based on a logic circuit of the data to be proved, comprising: determining a plurality of first-type variables and a plurality of second-type variables of the first-order constraint system and the number of constraints of the first-order constraint system based on the logic circuit of the data to be proved; determining a plurality of constraint coefficient matrices of the first-order constraint system based on the logic circuit of the data to be proved; and determining the parent constraint system based on a common circuit portion of the logic circuit of the data to be proved, wherein the parent constraint system corresponds to at least one parent constraint in the constraint coefficient matrix and a first number of variables under the at least one parent constraint, wherein the first number of variables is at least a part of the plurality of first-type variables and the plurality of second-type variables; sending the parent constraint system to a plurality of processing units; receiving a plurality of different first-order constraint system components generated in parallel by the plurality of processing units, wherein each first-order constraint system component comprises the parent constraint system and a child constraint system, and the child constraint system is obtained based on the parent constraint system; combining the plurality of different first-order constraint system components to obtain the first-order constraint system; and Constructing a zero-knowledge proof for the data to be proved based on the first-order constraint system; wherein each of the plurality of processing units: receives the parent constraint system from the attestation unit; Selecting at least one sub-constraint different from at least one parent constraint in the parent constraint system based on the constraint coefficient matrix, and assigning values ​​to the at least one sub-constraint based on the values ​​of the first number of variables under the at least one sub-constraint to generate a first sub-matrix of a sub-constraint system; selecting a second number of variables different from the first number of variables in the parent constraint system from the plurality of first type variables and the plurality of second type variables, and assigning values ​​to the second number of variables based on the constraint coefficient matrix to generate a second sub-matrix of the child constraint system; and A first-order constraint system component is constructed based on the parent constraint system, the first sub-matrix and the second sub-matrix of the child constraint system.

2. The circuit synthesis method as described in claim 1, wherein the multiple constraint coefficient matrices include a first constraint coefficient matrix, a second constraint coefficient matrix and a third constraint coefficient matrix, the first constraint coefficient matrix indicates multiple first constraints, the second constraint coefficient matrix indicates multiple second constraints, and the third constraint coefficient matrix indicates multiple third constraints, wherein for the multiple constraint coefficient matrices, the product of the first constraint and the second constraint is equal to the third constraint.

3. The circuit synthesis method according to claim 1, wherein the processing unit forms a first-order constraint system component based on the parent constraint system, the first sub-matrix and the second sub-matrix of the child constraint system, comprising: The processing unit forms a lower triangular matrix from the parent constraint system, the first sub-matrix and the second sub-matrix of the child constraint system, and an all-zero matrix as the first-order constraint system component.

4. The circuit synthesis method according to claim 2, wherein the proof unit combines the plurality of different first-order constraint system components to obtain the first-order constraint system comprises: The first-order constraint system is constructed by taking the parent constraint system as the first submatrix element of the first-order constraint system, taking the first submatrices of the multiple sub-constraint systems as column elements of the first-order constraint system, taking the second submatrices of the multiple sub-constraint systems as diagonal elements of the first-order constraint system, and setting other elements of the first-order constraint system to 0.

5. A circuit synthesis device for zero-knowledge proof, comprising: a memory having computer program code stored thereon; as well as A processor configured to run the computer program code to perform the method according to any one of claims 1 to 4.

6. A computer-readable storage medium having a computer program code stored thereon, wherein the computer program code executes the method according to any one of claims 1 to 4 when executed.

7. A data storage certification system, comprising a certification unit and a plurality of processing units, wherein the certification unit is configured to: Perform label calculation, hash calculation and encoding calculation on the original data and construct a Merkle tree for storage; Selecting a plurality of columns of data from the stored original data, wherein each column of data includes a plurality of data blocks; constructing a common circuit for the plurality of columns of data, the common circuit being used to generate a parent constraint system for the plurality of columns of data based on a common circuit portion of a logic circuit of the plurality of columns of data; sending the parent constraint system to a plurality of processing units; Receiving a plurality of different first-order restraint system components generated in parallel by the plurality of processing units, wherein each first-order restraint system component includes the parent restraint system and a child restraint system, the child restraint system being obtained by the processing unit using one of a plurality of spot check subcircuits based on the parent restraint system; Combining the plurality of different first-order constraint system components to obtain the first-order constraint system; as well as Based on the first-order constraint system, a zero-knowledge proof for the multiple columns of data is constructed to prove that the proof unit stores the original data; wherein the proof unit is further configured to: Determine, based on the logic circuit of the plurality of columns of data, a plurality of first type variables and a plurality of second type variables of the first order constraint system and the number of constraints of the first order constraint system; Determining a plurality of constraint coefficient matrices of the first-order constraint system based on the logic circuit of the plurality of columns of data; and Determine a parent constraint system based on the common circuit portion of the logic circuit of the plurality of columns of data, wherein the parent constraint system corresponds to at least one parent constraint in the constraint coefficient matrix and a first number of variables under the at least one parent constraint, wherein the first number of variables are at least a portion of the plurality of first type variables and the plurality of second type variables; Each processing unit of the plurality of processing units is configured to: receive the parent constraint system from the attestation unit; Determine a plurality of constraint coefficient matrices of the first-order constraint system based on the logic circuit of the plurality of columns of data; Constructing a spot check subcircuit based on the constraint coefficient matrix, and selecting at least one sub-constraint different from at least one parent constraint in the parent constraint system by using the spot check subcircuit, and assigning values ​​to the at least one sub-constraint based on the values ​​of the first number of variables under the at least one sub-constraint to generate a first sub-matrix of a sub-constraint system; selecting a second number of variables different from the first number of variables in the parent constraint system from the plurality of first type variables and the plurality of second type variables, and assigning values ​​to the second number of variables based on the constraint coefficient matrix to generate a second sub-matrix of the child constraint system; and A first-order constraint system component is constructed based on the parent constraint system, the first sub-matrix and the second sub-matrix of the child constraint system.