A method and system for optimizing lookup tables in smart contract proof generation
By classifying and merging lookup table operations in smart contracts, the problem of high computational overhead in zero-knowledge proof circuits is solved, achieving higher computational efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING MICROCHIP EDGE COMPUTING RES INST
- Filing Date
- 2023-12-19
- Publication Date
- 2026-05-19
AI Technical Summary
In existing technologies, the computational overhead of lookup table operations in the zero-knowledge proof circuit of smart contracts is too high, especially in the EVM virtual machine, where the large number of instructions leads to a huge number of lookup table operations, affecting computational efficiency.
By classifying and merging lookup table operations in smart contracts, classifying and replacing them according to source and destination codes, the number of lookup table operations of the same category is reduced, and they are merged into the same operation. A selector is added to the proof circuit to control the enabling or disabling of constraints.
This reduces the overall computational overhead of zero-knowledge proof circuits, decreases the number of lookup table operations, and improves computational efficiency.
Smart Images

Figure CN117519692B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of blockchain technology, and in particular to a method and system for optimizing lookup tables in smart contract proof generation. Background Technology
[0002] Generating a proof of a smart contract refers to using a certain technology to generate a verifiable proof that demonstrates the correctness of the smart contract's execution process and results. The purpose of generating a proof of a smart contract is to allow verifiers to verify the correctness of the smart contract's execution process and results without having to re-execute the smart contract.
[0003] For generating proofs for smart contracts, the most common proof technique currently is zero-knowledge proof. Zero-knowledge proof requires constructing a zero-knowledge proof circuit for the problem to be proven, which includes variables and constraints. Variables represent program variables used in contract execution, and are expressed in columns. Different rows of the same column represent the state of that variable at different steps. Generally, one row of variables represents one instruction executed by the smart contract. Some variables come from publicly available inputs, some are fixed (also called static), and others are variables internal to the circuit. Constraints represent the operational logic of instructions during contract execution, in the form of "expression = 0", where the expression is obtained by adding, subtracting, and multiplying variables. The circuit's constraints are applied to all rows simultaneously.
[0004] Lookup tables are a tool that has emerged in the field of zero-knowledge proofs in recent years. Their function is to prove the existence of arrays A0, A1...A2 consisting of n variables in a circuit. n-1 The lookup table exists in a row of a "table". The "table" refers to the n columns of variables in the circuit. If it exists, a proof of the lookup table can be generated. If it does not exist in the "table", a proof of the lookup table cannot be generated, which in turn prevents the proof of the entire zero-knowledge proof circuit from being generated. Using a selector as a conditional expression added to an array allows the lookup table to be enabled in specific rows and disabled in others. Array A0, A1...A n-1 One column is called the source, and the other n columns of variables are called the destinations.
[0005] The existing technology has the following problems: In zero-knowledge proof circuits, lookup table operations incur significant computational overhead. A common approach for all instructions in a smart contract and their required lookup table operations is to use separate lookup table operations for each instruction, adding selectors as conditional expressions to these operations. This results in a number of lookup table operations comparable to the number of instructions. For a virtual machine like the EVM (Entity Virtual Machine) for smart contracts, with hundreds of instructions, the number of lookup table operations becomes extremely large, meaning the overall computational overhead of the zero-knowledge proof is very high. To reduce computational overhead, zero-knowledge proof circuits should minimize the use of lookup tables.
[0006] Therefore, how to provide a method and system for optimizing the lookup table in smart contract proof generation to reduce the number of lookup table operations is a technical problem that urgently needs to be solved by those skilled in the art. Summary of the Invention
[0007] In response to the aforementioned research status and existing problems, this invention provides a method and system for optimizing lookup tables in smart contract proof generation. It categorizes the lookup table operations required for different instructions in a smart contract according to their source and destination, merging lookup table operations within the same category to reduce the number of lookup table operations and thus lower overall computational overhead.
[0008] This invention provides a method for optimizing the lookup table in smart contract proof generation. The smart contract proof includes a proof circuit for the lookup table. In the proof circuit of the lookup table, an array of n elements exists in one row of a table consisting of another n columns of elements, where n ≥ 1. The array of n elements is the source, and a row of the table consisting of the other n columns is the destination. The method includes the following steps:
[0009] S1: List all lookup table operations required by all instructions in the smart contract, and obtain the source code and destination code of each lookup table operation;
[0010] S2: Classify all equivalent codes contained in the source code, replace the equivalent codes according to a unique encoding method, and obtain several replaced source codes; classify all equivalent codes contained in the destination code, replace the equivalent codes according to a unique encoding method, and obtain several replaced destination codes;
[0011] S3: Based on the correspondence between the source code and the destination code in the lookup table operation, make the order of the several replaced destination codes correspond to the order of the replaced source codes;
[0012] S4: Categorize all lookup table operations, and group lookup table operations in which the source code and destination code after replacement are the same;
[0013] S5: Merge lookup table operations of the same class into a single lookup table operation and add it to the proof circuit.
[0014] Preferably, the elements of the source encoding / destination encoding include: an expression formed by adding, subtracting, and multiplying multiple variables; or
[0015] The elements of the source encoding / destination encoding include: variables.
[0016] Preferably, S2 includes:
[0017] S21: For each column in the table, specify a unique column name;
[0018] S22: For each source and destination element in a lookup table operation, combine the column name, addition, subtraction, multiplication symbols, and parentheses into an expression that encodes the source and destination elements;
[0019] S23: Swap the variables on both sides of the operator in the element encoding to obtain the equivalent encoding, wherein the operator includes addition and multiplication; search all equivalent encodings, and determine a unique equivalent expression in the equivalent encoding according to the lexicographical order of the encoding;
[0020] S24: For the elements in the source array, first obtain the element code, then sort the elements in the array according to the lexicographical order of the element codes, and then form the source code by separating them by symbols;
[0021] S25: For the elements in the destination array, maintain the original correspondence with the elements in the source array, arrange them according to the arrangement of each element in the source code, and then separate them by symbols to form the destination code.
[0022] Preferably, the proof circuit includes a selector that, when added as a conditional expression to a constraint, enables the constraint in a specified row and disables it in other rows; the expression for adding the constraint is multiplication; it records the source code and destination code of each lookup table operation, as well as the selector corresponding to its instruction; S2 includes:
[0023] For selectors, specify a unique selector name;
[0024] For each source and destination element in a lookup table operation, the selector name and column name, addition, subtraction, multiplication symbols, and parentheses are combined into an expression that encodes the source and destination elements.
[0025] Preferably, step S5 includes summing the values of the multiplicands corresponding to the same multiplicands in the source code / destination code recorded in the same type of lookup table operation, multiplying them by the multiplicands, and using this sum as the merged conditional expression.
[0026] Preferably, step S5 includes summing the values corresponding to the same selector in the source code / destination code recorded in the same type of lookup table operation, and using the sum as the merged selector condition expression.
[0027] Preferably, after step S5, the method further includes: the proof circuit performs proof generation calculations according to the merged lookup table and the zero-knowledge proof algorithm to generate the proof.
[0028] This invention also provides a system for optimizing the lookup table in smart contract proof generation according to the aforementioned method, comprising:
[0029] The lookup table operation module is configured to: list all lookup table operations required by all instructions in the smart contract, and obtain the source code and destination code of each lookup table operation;
[0030] The equivalence conversion module is configured to: classify all equivalent codes contained in the source code, replace the equivalent codes according to a unique encoding method, and obtain several replaced source codes; classify all equivalent codes contained in the destination code, replace the equivalent codes according to a unique encoding method, and obtain several replaced destination codes.
[0031] The sorting module is configured to: make the order of the several replaced destination codes correspond to the order of the replaced source codes according to the correspondence between the source codes and destination codes in the lookup table operation;
[0032] The classification module is configured to classify all lookup table operations, and lookup table operations with the same source code and destination code after replacement are classified into the same category.
[0033] A proof module is added, which is configured to merge lookup table operations of the same class into a single lookup table operation and add it to the proof circuit.
[0034] Preferably, it also includes: a proof generation module, which is configured such that: the proof circuit performs proof generation calculations according to the merged lookup table operation and the zero-knowledge proof algorithm to generate a proof.
[0035] The present invention also provides an electronic device, including a memory and a processor, and computer instructions stored in the memory and running on the processor, wherein the computer instructions, when executed by the processor, complete the steps of the method for optimizing the lookup table in smart contract proof generation.
[0036] The method and system for optimizing the lookup table in smart contract proof generation proposed in this invention have the following advantages compared to existing technologies:
[0037] The zero-knowledge proof circuit constructed according to the method steps of this invention classifies the lookup table operations required for different instructions in smart contracts according to the source and destination of the lookup table operations, and merges the lookup table operations in the same category. It has the advantage of fewer lookup table operations and can reduce the overall computational overhead. Attached Figure Description
[0038] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are merely embodiments of the present invention, and those skilled in the art can obtain other drawings based on the provided drawings without creative effort.
[0039] Figure 1 This is a flowchart of the method for optimizing the lookup table in smart contract proof generation provided in an embodiment of the present invention;
[0040] Figure 2 This is a circuit construction diagram provided in an embodiment of the present invention. Detailed Implementation
[0041] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0042] The technical concepts involved in the embodiments provided by this invention are explained as follows:
[0043] Smart contract: A program in the blockchain that executes the instructions pointed to by the program counter in sequence.
[0044] Instructions: The basic unit of computation for smart contract execution. Each instruction has a name, ID, and its operation. The EVM contains approximately 140 instructions that can perform various operations, enabling the Ethereum network to handle complex logic and data manipulation. EVM instructions mainly include stack operation instructions, memory read / write instructions, storage read / write instructions, program control instructions, arithmetic instructions, cryptographic computation instructions, and so on. Instructions vary in complexity. Simple instructions include addition instructions, while complex instructions include contract invocation instructions.
[0045] Zero-knowledge proofs are a class of cryptographic algorithms that allow the prover to assure the verifier of the proof's validity without revealing any information other than its correctness. The most crucial step in generating a proof is constructing a zero-knowledge proof circuit, including variables and constraints, for the problem to be proven. Generating a proof requires computation based on this circuit, and the computational complexity is directly proportional to the circuit size.
[0046] Variables are used to represent program variables used in contract execution. They are organized in columns, with different rows of the same column representing the state of that variable at different steps. Generally, a single row of variables represents one instruction executed by the smart contract. Some variables come from publicly available inputs, some are fixed (also called static), and others are internal variables of the circuit. Constraints are used to represent the operational logic of instructions during contract execution, in the form of "expression = 0", where the expression is obtained by adding, subtracting, multiplying, or arithmetic operations on the variables.
[0047] The constraints of a circuit are applied to all rows simultaneously. For example, the constraint "variable A + variable B = 0" means "variable A in row 1 + variable B in row 1 = 0", "variable A in row 2 + variable B in row 2 = 0", and so on.
[0048] Selectors: Components in circuits that output values of 0 or 1. Input values are typically fixed variables that need to be set during circuit construction. Selectors choose the input value for each row based on the desired output value. Selectors are commonly used to enable or disable a constraint in a row. For example, selector X can be specifically used to enable or disable constraint Y. In a given row, an output value of 1 indicates the constraint is enabled, and 0 indicates the constraint is disabled.
[0049] Lookup table: A tool used in zero-knowledge proof circuits. Its function is to prove the existence of an array A0, A1...A1 of n variables in a circuit. n-1 The lookup table exists in a row of a table consisting of n other columns of variables. If it does exist, the proof for the lookup table can be generated. Otherwise, the proof cannot be generated, which in turn prevents the proof for the entire zero-knowledge proof circuit from being generated. The lookup table operation is performed on each row of the array of n variables, that is, it requires that "the first row of variables A0, A1...A..." exists in a row of a table consisting of n other columns of variables. n-1 The array formed exists in the table; "the second row contains variables A0, A1...A..." n-1 The arrays formed exist in the table, and so on.
[0050] When you add a selector as a conditional expression to an array, you can enable the lookup table on specific rows and disable it on others. For example, adding "selector A" to arrays A0, A1...A... n-1 Above, the lookup table becomes "selector A*A0, selector A*A1...selector A*An-1 The arrays exist within the table. The lookup table is enabled when the selector is enabled in some rows (i.e., "selector A = 1"), and disabled when it is disabled in some rows (i.e., "selector A = 0"). Arrays A0, A1...A n-1 One column is called the source, and the other n columns of variables are called the destinations.
[0051] The following example illustrates table lookup operations:
[0052] Table 1 Example of constraint "Variable A + Variable B = 0"
[0053] VariableA Variable B 1 -1 -2 2
[0054] Each row in Table 1 must satisfy the constraints.
[0055] Table 2 Example of constraint "Selector A*(Variable A+Variable B)=0"
[0056] Selector A VariableA Variable B 1 1 -1 1 -2 2 0 3 1 0 -5 2
[0057] In Table 2, the row where selector A = 1 satisfies the constraint "variable A + variable B = 0".
[0058] Table 3 Example of looking up table "Variable A, Variable B exist in table 'Variable C, Variable D'"
[0059] VariableA Variable B Variable C (column 1 of the table) Variable D (column 2 of the table) 0 0 0 0 0 0 0 1 1 0 1 0 0 1 2 2
[0060] In Table 3, the array variables A and B in each row can be found in the table, thus a proof can be generated.
[0061] Table 4 Example of looking up table "Variable A, Variable B exist in table 'Variable C, Variable D'"
[0062] VariableA Variable B Variable C (column 1 of the table) Variable D (column 2 of the table) -1 0 0 0 0 0 0 1 1 0 1 0 2 1 2 2
[0063] The array variables A and B in the first and fourth rows of Table 4 cannot be found in the table, therefore a proof cannot be generated.
[0064] Table 5 Example of looking up the table "Selector A * Variable A, Selector A * Variable B exists in table 'Variable C, Variable D'"
[0065] Selector A VariableA Variable B Variable C (column 1 of the table) Variable D (column 2 of the table) 0 -1 0 0 0 1 0 0 0 1 1 1 0 1 0 0 2 1 2 2
[0066] The selectors in the first and fourth rows of Table 5 are 0. Therefore, even if array variables A and B cannot be found in the table, the table lookup is still successful, and a proof can be generated.
[0067] The first aspect of this invention provides a method for optimizing the lookup table in smart contract proof generation. The smart contract proof includes a proof circuit for the lookup table. In the proof circuit of the lookup table, an array of n elements exists in one row of a table consisting of another n columns of elements, where n ≥ 1. The array of n elements is the source, and a certain row of the table consisting of the other n columns is the destination. The method includes the following steps:
[0068] S1: List all lookup table operations required by all instructions in the smart contract. For each listed lookup table operation, it needs to be encoded for categorization. Obtain the source and destination codes for each lookup table operation;
[0069] S2: Classify all equivalent codes contained in the source code, replace the equivalent codes according to a unique encoding method, and obtain several replaced source codes; classify all equivalent codes contained in the destination code, replace the equivalent codes according to a unique encoding method, and obtain several replaced destination codes;
[0070] S3: Based on the correspondence between source codes and destination codes in the lookup table operation, make the order of several replaced destination codes correspond to the order of replaced source codes;
[0071] S4: Categorize all lookup table operations, and group lookup table operations in which the source code and destination code after replacement are the same;
[0072] S5: Merge lookup table operations of the same class into a single lookup table operation and add it to the proof circuit.
[0073] In one embodiment, the elements of the source encoding / destination encoding include: an expression formed by adding, subtracting, and multiplying multiple variables, such as "selector A * variable A, selector A * variable B" as the source and "variable C, variable D" as the destination in Table 5; or
[0074] The elements of the source / destination coding include: variables, such as “variable A, variable B” in Table 3 which are the sources, and “variable C, variable D” which are the destinations.
[0075] In one embodiment, for the source and destination of lookup table operations, since it is an array, there are multiple equivalent arrangements. Furthermore, each element in the array may be an expression obtained by adding, subtracting, and multiplying multiple variables, and these addition and multiplication operations are commutative (a+b and b+a are equivalent). Therefore, an encoding method is needed to represent all equivalent sources and destinations. S2 provides the encoding method of this embodiment, including:
[0076] S21: For each column in the table, specify a unique column name, such as A, B, etc.;
[0077] S22: For each source and destination element in a lookup table operation, combine the column name, plus, minus, multiplication signs, and parentheses into an expression that encodes the source and destination elements, such as “C*(A+B)”.
[0078] S23: Swap the variables on both sides of the operator in the element encoding to obtain the equivalent encoding. The operator includes addition and multiplication. For example, the equivalent expression of "C*(A+B)" is "(A+B)*C". Search all equivalent encodings and determine the unique equivalent expression in the equivalent encoding according to the lexicographical order of the encoding. For example, the smallest lexicographical order is used as the unique equivalent expression. "(A+B)*C" has a smaller lexicographical order than "C*(A+B)", so "(A+B)*C" is used as the unique equivalent expression.
[0079] S24: For each element in the source array, first obtain its encoding, then sort the elements in the array according to the lexicographical order of their encodings, and finally separate them with commas to form the source encoding. This includes sorting the elements in ascending order according to their encodings, and then separating them with commas to form the encoding. For example, if there are two elements "(A+B)*C" and "D" in the array, then the encoding of the array is "(A+B)*C,D".
[0080] S25: For elements in the destination array, maintain the original correspondence with the elements in the source array, arrange them according to the arrangement of elements in the source encoding, and then separate them by symbols.
[0081] The destination code consists of comma-separated characters.
[0082] In one embodiment, the proof circuit includes a selector that, when added as a conditional expression to a constraint, enables the constraint in a specified row and disables it in other rows; the expression for adding the constraint is multiplication; the source code and destination code of each lookup table operation are recorded, along with the selector corresponding to its instruction; S2 includes:
[0083] For selectors, specify a unique selector name;
[0084] For each source and destination element in a lookup table operation, the selector name, column name, addition, subtraction, multiplication symbols, and parentheses are combined into an expression encoding the source and destination elements. The execution process of subsequent steps is the same as S23-S25.
[0085] In one embodiment, S5 includes summing the values of the multiplicands corresponding to the same multiplicands in the source code / destination code recorded in the same type of lookup table operation, multiplying them by the multiplicands, and using the sum as the merged conditional expression.
[0086] In one embodiment, S5 includes, in the proof circuit containing the selector, summing the values corresponding to the same selector in the source code / destination code recorded in the same type of lookup table operation, and using the sum as the merged selector condition expression.
[0087] In one embodiment, after S5, the method further includes: the proof circuit performs proof generation calculations according to the merged lookup table operation and the zero-knowledge proof algorithm to generate the proof. The zero-knowledge proof circuit constructed according to the above steps has the advantage of fewer lookup table operations and lower computational overhead.
[0088] A second aspect of the present invention also provides a system for optimizing the lookup table in smart contract proof generation according to the first aspect, comprising:
[0089] The lookup table operation module is configured to: list all lookup table operations required by all instructions in the smart contract, and obtain the source code and destination code of each lookup table operation;
[0090] The equivalence conversion module is configured to: classify all equivalent codes contained in the source code, replace the equivalent codes according to a unique encoding method, and obtain several replaced source codes; classify all equivalent codes contained in the destination code, replace the equivalent codes according to a unique encoding method, and obtain several replaced destination codes.
[0091] The sorting module is configured to: based on the correspondence between source codes and destination codes in the lookup table operation, make the order of several replaced destination codes correspond to the order of replaced source codes;
[0092] The classification module is configured to classify all lookup table operations, and lookup table operations with the same source code and destination code after replacement are classified into the same category.
[0093] A proof module is added, which is configured to merge lookup table operations of the same class into a single lookup table operation and add it to the proof circuit.
[0094] In one embodiment, the system further includes a proof generation module, which is configured such that the proof circuit performs proof generation calculations according to a zero-knowledge proof algorithm based on the merged lookup table operation, and generates a proof.
[0095] A third aspect of the present invention also provides an electronic device, including a memory and a processor, and computer instructions stored in the memory and running on the processor, wherein the computer instructions, when executed by the processor, perform the steps of the method provided in the first aspect.
[0096] The above provides a detailed description of the method and system for optimizing the lookup table in smart contract proof generation provided by the present invention. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
[0097] In this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, without necessarily requiring or implying any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
Claims
1. A method for optimizing lookup tables in smart contract proof generation, characterized in that: The smart contract proof includes a lookup table proof circuit, in which an array of n elements exists in one row of a table consisting of another n columns of elements, where n≥1; the array of n elements is the source, and a row of the table consisting of the other n columns is the destination; it includes the following steps: S1: List all lookup table operations required by all instructions in the smart contract, and obtain the source code and destination code of each lookup table operation; S2: Classify all equivalent codes contained in the source code, replace the equivalent codes according to a unique encoding method, and obtain several replaced source codes; classify all equivalent codes contained in the destination code, replace the equivalent codes according to a unique encoding method, and obtain several replaced destination codes; S3: Based on the correspondence between the source code and the destination code in the lookup table operation, make the order of the several replaced destination codes correspond to the order of the replaced source codes; S4: Categorize all lookup table operations, and group lookup table operations in which the source code and destination code after replacement are the same; S5: Merge lookup table operations of the same class into a single lookup table operation and add it to the proof circuit.
2. The method for optimizing the lookup table in smart contract proof generation according to claim 1, characterized in that, The elements of the source encoding / destination encoding include: an expression formed by adding, subtracting, and multiplying multiple variables; or The elements of the source encoding / destination encoding include: variables.
3. The method for optimizing the lookup table in smart contract proof generation according to claim 1, characterized in that, S2 includes: S21: For each column in the table, specify a unique column name; S22: For each source and destination element in a lookup table operation, combine the column name, addition, subtraction, multiplication symbols, and parentheses into an expression that encodes the source and destination elements; S23: Swap the variables on both sides of the operator in the element encoding to obtain the equivalent encoding, wherein the operator includes addition and multiplication; search all equivalent encodings, and determine a unique equivalent expression in the equivalent encoding according to the lexicographical order of the encoding; S24: For the elements in the source array, first obtain the element code, then sort the elements in the array according to the lexicographical order of the element codes, and then form the source code by separating them by symbols; S25: For the elements in the destination array, maintain the original correspondence with the elements in the source array, arrange them according to the arrangement of each element in the source code, and then separate them by symbols to form the destination code.
4. The method for optimizing the lookup table in smart contract proof generation according to claim 3, characterized in that, The circuit includes a selector that, when added as a conditional expression to a constraint, enables the constraint on a specified row and disables it on other rows. The expression used to add the constraint is a multiplication. While recording the source code and destination code of each lookup table operation, the selector corresponding to its instruction is also recorded; S2 includes: For selectors, specify a unique selector name; For each source and destination element in a lookup table operation, the selector name and column name, addition, subtraction, multiplication symbols, and parentheses are combined into an expression that encodes the source and destination elements.
5. The method for optimizing the lookup table in smart contract proof generation according to claim 3, characterized in that, S5 includes summing the values of the multiplicands corresponding to the same multiplicands in the source code / destination code recorded in the same type of lookup table operation, multiplying them by the multiplicands, and using the sum as the merged conditional expression.
6. The method for optimizing the lookup table in smart contract proof generation according to claim 4, characterized in that, S5 includes summing the values corresponding to the same selector in the source code / destination code recorded in the same type of lookup table operation, and using the sum as the merged selector condition expression.
7. The method for optimizing the lookup table in smart contract proof generation according to claim 1, characterized in that, The step after S5 further includes: the proof circuit performs proof generation calculations according to the merged lookup table operation and the zero-knowledge proof algorithm to generate the proof.
8. A system for optimizing the lookup table in smart contract proof generation according to any one of claims 1-7, characterized in that, include: The lookup table operation module is configured to: list all lookup table operations required by all instructions in the smart contract, and obtain the source code and destination code of each lookup table operation; The equivalence conversion module is configured to: classify all equivalent codes contained in the source code, replace the equivalent codes according to a unique encoding method, and obtain several replaced source codes; classify all equivalent codes contained in the destination code, replace the equivalent codes according to a unique encoding method, and obtain several replaced destination codes. The sorting module is configured to: make the order of the several replaced destination codes correspond to the order of the replaced source codes according to the correspondence between the source codes and destination codes in the lookup table operation; The classification module is configured to classify all lookup table operations, and lookup table operations with the same source code and destination code after replacement are classified into the same category. A proof module is added, which is configured to merge lookup table operations of the same class into a single lookup table operation and add it to the proof circuit.
9. A system for optimizing lookup tables in smart contract proof generation according to claim 8, characterized in that, Also includes: The proof generation module is configured such that the proof circuit performs proof generation calculations according to the merged lookup table operation and the zero-knowledge proof algorithm, thereby generating the proof.
10. An electronic device, characterized in that, The method includes a memory and a processor, as well as computer instructions stored in the memory and running on the processor, which, when executed by the processor, complete the steps of a method for optimizing a lookup table in smart contract proof generation as described in any one of claims 1-7.