Universal zk-SNARK zero-knowledge proof optimization system and method
The zk-SNARK optimization system addresses inefficiencies in zero-knowledge proof systems by splitting multi-scalar multiplication into subtasks and optimizing resource allocation, enhancing computational efficiency and reducing proof generation time in large-scale distributed systems.
Patent Information
- Application Number
- CN202410967056.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-18
- Publication Date
- 2024-12-03
- Estimated Expiration
- 2044-07-18
AI Technical Summary
Existing zero-knowledge proof systems, particularly zk-SNARK and zk-STARK, face challenges such as high computational and storage overhead, long verification times, and complex mathematical foundations, which hinder their scalability and efficiency in large-scale distributed systems like blockchain networks, especially under poor network conditions or asynchronous environments.
A universal zk-SNARK zero-knowledge proof optimization system that employs a bucket algorithm to split multi-scalar multiplication into subtasks, dynamically adjusts window sizes based on Montgomery modular multiplication calculations, and optimizes resource allocation using GPU cores, memory, and bandwidth to improve computational efficiency.
The system significantly reduces proof generation time, optimizes resource utilization, and enhances the efficiency of zero-knowledge proof systems, making them more suitable for large-scale distributed systems by leveraging GPU parallel computing capabilities.
Smart Images

Figure CN119070995A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and more specifically, to a universal zk-SNARK zero-knowledge proof optimization system and method. Background Art
[0002] Zero Knowledge Proof (ZKP) is a cryptographic protocol based on the consensus of two or more parties. Its main function is to make the prover (Prover) believe that a statement made by the prover is correct without exposing any useful information to the verifier (Verifier).
[0003] An interactive zero-knowledge proof system is one in which the verifier asks the prover a question. If the prover knows the information, the probability of the correct answer is 1; if the prover does not know the information, the probability of the correct answer is 1 / 2. The verifier can infer whether the prover knows the information by asking enough questions, and at the same time, it is necessary to ensure that these questions and their corresponding answers do not leak relevant useful information. This technology allows an NP problem to be verified in polynomial time without revealing any data related to the detailed information of the solution.
[0004] A non-interactive zero-knowledge proof system is a cryptographic protocol that allows a prover to prove to a verifier that a statement is true without multiple rounds of interaction. In this system, the prover can show the proof to the verifier through a one-time message transfer without revealing any information other than that the statement is true. Unlike an interactive zero-knowledge proof system, the prover in a non-interactive zero-knowledge proof system does not need to wait for the verifier's challenge, and only needs to send the proof once to complete the entire proof process. The implementation of a non-interactive zero-knowledge proof system relies on some complex cryptographic techniques, such as the construction of zero-knowledge proofs and the application of difficult problems such as discrete logarithms. Currently, the two most widely used non-interactive zero-knowledge proof implementations are zk-STARK (Zero-Knowledge Scalable Transparent ARguments of Knowledge) and zk-SNARK (Zero-Knowledge Succinct Non-interractive Argument of Knowledge) technologies.
[0005] zk-STARK is a state-of-the-art zero-knowledge proof system designed to efficiently, scalably and transparently verify the correctness of large-scale computations without leaking specific information. It is based on error correction codes and low-rank coding, and provides a powerful cryptographic solution to ensure the reliability of the computation process by constructing verifiable polynomials.
[0006] zk-SNARK is a recognized and reliable choice among the current zero-knowledge proof protocols, which aims to optimize the limitations of previous interactive proofs. It achieves zero-knowledge in a concise non-interactive way, avoids multiple interactive communications between the prover and the verifier, and significantly reduces communication costs, providing important technological advances in the field of information security. The main advantage of zk-SNARK is that the fixed proof size reduces the verification complexity and communication complexity, and this advantage becomes more obvious when the number of transactions increases. However, it requires additional verification keys. Although the keys can be generated in advance, when the number of transactions increases, it will inevitably bring corresponding storage and computing pressures.
[0007] In existing interactive zero-knowledge proof systems, the prover and the verifier need to conduct multiple challenge-response communications during the proof process, which limits the efficiency and applicability of the proof because each round of communication can only transmit a small amount of proof information and increases the overall computing and communication costs. This high-frequency communication often results in significant delays and bandwidth consumption, especially when a large number of proofs are required or under poor network conditions. In addition, since multiple rounds of interaction are required, the prover and the verifier must be online at the same time and able to complete real-time communication. This is a significant limitation for distributed systems or asynchronous environments (such as asynchronous networks or offline devices). The synchronization requirement increases the complexity and inconvenience of protocol implementation.
[0008] Although zk-STARK has significant advantages in terms of security and transparency, it also has some significant disadvantages, including high computational and storage overhead, large generated proofs, and long verification time. These factors may cause zk-STARK to be less efficient when processing complex computing tasks. In addition, zk-STARK has high requirements for mathematical foundations, which increases the complexity of implementation and deployment. Due to these limitations, the application of zk-STARK in large-scale zero-knowledge proof systems faces challenges, especially in large-scale distributed systems or blockchain networks that require efficient processing and fast verification. These shortcomings may become performance bottlenecks, affecting the overall scalability and practicality of the system.
[0009] zk-SNARK is outstanding in reducing proof size and verification time, but it has many limitations, such as trusted setup problems, computational complexity, high hardware requirements, and lack of transparency, which limit its application in large-scale zero-knowledge proof systems. In particular, the trusted setup stage is prone to attack targets, and generating proofs requires a lot of computing resources and high hardware requirements, making its application in large-scale systems challenging.
[0010] Despite some shortcomings, zk-SNARK is still the mainstream zero-knowledge proof technology. This is mainly due to its significant advantages in proof size and verification time, which makes it perform well and efficient in many practical applications. In contrast, although zk-STARK has higher transparency and lower trusted setup requirements, it is generally inferior to zk-SNARK in terms of computational complexity and operating efficiency. By continuously optimizing the computational complexity and operating efficiency of zk-SNARK, it can further consolidate its position as the leading technology in the field of zero-knowledge proof and promote the widespread application and development of this technology.
[0011] The proof generation process of zk-SNARK mainly relies on Number Theoretic Transformation (NTT) and Multi-Scalar Multiplication (MSM). According to existing research, multi-scalar multiplication is the main computational bottleneck in the zk-SNARK proof generation process. In the zk-SNARK open source library Bellman, the execution time of MSM usually accounts for more than 70% of the total proof generation time. Therefore, how to effectively shorten the zk-SNARK proof generation process based on MSM is a crucial improvement direction.
[0012] Multi-scalar multiplication is a mathematical operation that refers to the process of calculating the multiplication and addition of these points and the corresponding scalars for a given set of points and scalars on an elliptic curve. The mathematical definition is:
[0013]
[0014] Where N is the size of the MSM, G i is a point on the finite field of elliptic curves, k i is a λ-bit scalar, k i G i Represents scalar multiplication of points on elliptic curves (PMULT). The main calculations in PMULT are point addition (PADD) and point doubling (PDBL). Figure 1As shown, the point addition operation on the elliptic curve can be implemented by the following steps: Given two points F and G, first draw a straight line connecting them and find the third intersection point -H of the curve. Then, with -H as the axisymmetric center, reflect it about the X-axis to get point H, which is the sum of F and Q. For the point doubling operation, when adding point G to itself (i.e. 2G), it is necessary to find the tangent of the elliptic curve at point G, determine the third intersection point of the tangent and the curve, and then use this point as the axisymmetric center for X-axis reflection. The point obtained by reflection is 2G. This method can effectively calculate the addition between points on the elliptic curve. Therefore, it can be seen that the point addition operation on the elliptic curve involves complex operations such as elliptic curve slope calculation and intersection solution in the elliptic curve equation, which consumes a lot of computing resources. Therefore, in order to improve the generation efficiency of zero-knowledge proofs, it is necessary to start with reducing the amount of calculation of elliptic curves and improving computing efficiency.
[0015] In the actual scalar multiplication operation, the scalar value is scanned bit by bit starting from the low bit, and the current result is doubled each time. If the bit encountered is 1, the corresponding point value is added; if the bit encountered is 0, it is ignored. Continue to iterate until the highest bit is processed. This bit-by-bit operation method can efficiently calculate scalar multiplication on elliptic curves. Figure 2 It is an elliptic curve addition with a scalar of 23. It can be seen that the larger the bit width of the scalar, the more times the doubling and addition of points are calculated, and the more computational complexity of the scalar multiplication of points. Taking the blockchain project Filecoin as an example, a proof will contain millions of scalars and point sets, where the scalar bit width is 256 bits. If the result of the scalar multiplication of each point is calculated, and then the total result is obtained by adding the points together, it will cause a huge computational delay.
[0016] In addition, existing zero-knowledge proof systems have problems such as resource management and scheduling difficulties and load imbalance. In a multi-task environment, efficiently managing and scheduling GPU resources is a challenging task. In the process of generating zero-knowledge proofs, task allocation and resource scheduling need to be finely controlled to avoid resource waste and performance degradation. In terms of resource management, it is necessary to consider how to balance the demand for GPU resources from different tasks.
[0017] In summary, the core advantage of zero-knowledge proof technology is that it can prove the authenticity of information to others without leaking private data. However, the main problems faced by existing zero-knowledge proof technology include long proof generation time, large amount of calculation, and high cost. These problems seriously restrict the popularization and application of zero-knowledge proof technology in fields such as blockchain systems. Especially in scenarios with high real-time requirements such as the financial field, the delay in the generation and verification of zero-knowledge proofs may have an adverse effect on the security and reliability of transactions, leading to negative consequences. In addition, long proof generation will also increase the cost of using computing resources and reduce the economic benefits of the system. Summary of the invention
[0018] The purpose of the present invention is to overcome the defects of the above-mentioned prior art and provide a universal zk-SNARK zero-knowledge proof optimization system and method.
[0019] According to a first aspect of the present invention, a general zk-SNARK zero-knowledge proof optimization system is provided. The system comprises: a trusted device, a prover and a verifier, wherein:
[0020] The trusted device is used to generate and manage security parameters required by the system, and to generate and manage keys in the system;
[0021] The prover uses the bucket algorithm to implement multi-scalar multiplication to generate proof. The multi-scalar multiplication is a process of multiplying and adding the calculated points and the corresponding scalars for a given set of points and scalars on the elliptic curve.
[0022] The verifier is used to compare the key sent by the trusted device with the certificate generated by the prover to confirm the validity of the certificate;
[0023] Among them, the prover includes a split window unit, an intra-bucket point reduction unit, an intra-window reduction unit and a window aggregation unit. The split window unit is used to split the multi-scalar multiplication operation into multiple subtasks based on the set window, and the size of the window is dynamically set according to the Montgomery modular multiplication calculation amount; the intra-bucket point reduction unit is used to reduce the points on each elliptic curve finite field to a bucket to obtain the result of each subtask; the intra-window reduction unit is used to multiply the bucket number by the reduced bucket, and accumulate and reduce the buckets in the same window into one bucket to obtain the window value of each window; the window aggregation unit is used to obtain the calculation result of the multi-scalar multiplication based on the window value of each window obtained.
[0024] According to a second aspect of the present invention, a general zk-SNARK zero-knowledge proof optimization method is provided. The method comprises the following steps:
[0025] Generate and manage security parameters and keys for zero-knowledge proofs;
[0026] Use the bucket algorithm to implement multi-scalar multiplication to generate proofs. The multi-scalar multiplication is the process of multiplying and adding the points and the corresponding scalars for a given set of points and scalars on an elliptic curve.
[0027] Comparing the generated certificate with the key to confirm the validity of the certificate;
[0028] The multi-scalar multiplication operation is implemented according to the following steps:
[0029] Splitting the multi-scalar multiplication operation into multiple subtasks based on a set window, wherein the size of the window is dynamically set according to the amount of Montgomery modular multiplication calculation;
[0030] Reduce each point on the finite field of the elliptic curve to a bucket and obtain the result of each subtask;
[0031] Multiply the bucket number by the reduced bucket, and add up the buckets in the same window and reduce them into one bucket to obtain the window value of each window.
[0032] Based on the obtained window value of each window, a calculation result of the multi-scalar multiplication is obtained.
[0033] Compared with the prior art, the advantage of the present invention is that, by focusing on the development and generation process of zero-knowledge proof, the performance of zero-knowledge proof is improved by designing optimization algorithms and improving calculations, while ensuring that other processes of proof generation are not affected, thereby shortening the time of proof generation. For example, the number of calculations of multi-scalar multiplication is reduced, the computational efficiency of multi-scalar multiplication is improved, and a mechanism for dynamic resource allocation and priority scheduling is designed, which can reasonably allocate resources such as GPU cores, memory, and bandwidth according to the characteristics and priorities of the tasks, ensure that each task obtains the right amount of resources, and minimize the idleness and waste of resources. The present invention can effectively optimize the execution efficiency of multi-scalar multiplication, and explore other optimization strategies as much as possible, so as to achieve efficient operation of the zk-SNARK proof generation process.
[0034] Further features and advantages of the present invention will become apparent from the following detailed description of exemplary embodiments of the present invention with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate embodiments of the invention and, together with the description, serve to explain the principles of the invention.
[0036] Figure 1 It is a schematic diagram of the operation of elliptic curve in the prior art;
[0037] Figure 2It is a schematic diagram of the calculation process of scalar multiplication in the prior art;
[0038] Figure 3 is a zero-knowledge proof system architecture diagram according to an embodiment of the present invention;
[0039] Figure 4 is a schematic diagram of executing the Pippenger algorithm according to an embodiment of the present invention;
[0040] Figure 5 is a schematic diagram of a dynamic window partitioning execution process according to an embodiment of the present invention;
[0041] Figure 6 2 is a schematic diagram of an intra-bucket parallel architecture according to an embodiment of the present invention. DETAILED DESCRIPTION
[0042] Various exemplary embodiments of the present invention will now be described in detail with reference to the accompanying drawings. It should be noted that the relative arrangement of components and steps, numerical expressions and numerical values set forth in these embodiments do not limit the scope of the present invention unless otherwise specifically stated.
[0043] The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the invention, its application, or uses.
[0044] Technologies, methods, and equipment known to ordinary technicians in the relevant art may not be discussed in detail, but where appropriate, the technologies, methods, and equipment should be considered as part of the specification.
[0045] In all examples shown and discussed herein, any specific values should be interpreted as merely exemplary and not as limiting. Therefore, other examples of the exemplary embodiments may have different values.
[0046] It should be noted that like reference numerals and letters refer to similar items in the following figures, and therefore, once an item is defined in one figure, it need not be further discussed in subsequent figures.
[0047] Taking the application in the blockchain field as an example, zero-knowledge proof technology effectively solves the contradiction between openness and transparency and personal privacy, allowing users to conduct transactions and data transmission under the characteristics of blockchain information disclosure without worrying about leaking specific transaction details or personal identity information. By proving that one complies with transaction rules or owns specific assets, zero-knowledge proof technology ensures data privacy and transaction security. Zero-knowledge proof technology can be applied to blockchain privacy protection, data privacy protection, identity authentication, and digital copyright protection, providing an efficient solution for protecting personal privacy and ensuring data security.
[0048] Figure 3 It is the overall architecture diagram of the zero-knowledge proof system. The system mainly includes a trusted device, a verifier (or a verifier module) and a prover (or a prover module). The present invention mainly optimizes the function of the prover.
[0049] Trusted devices are responsible for generating and managing the security parameters required for zero-knowledge proof systems, such as elliptic curve parameters, prime numbers, group orders, etc. These parameters must be sufficiently random and secure to ensure the security of the system and resist attacks. In addition, trusted devices are also used to generate and manage encryption and signing keys in the system. These keys play an important role in the generation and verification of proofs, ensuring the integrity and security of proofs. In general, trusted devices generate circuit constraints for the problem to be calculated, and then convert them into constraint vectors, such as R1CS (Rank-1 Constraint System).
[0050] The main role of the verifier is to compare the key sent by the trusted device with the proof generated by the prover. First, a zero-knowledge proof generated by the prover is received. This proof usually contains the validity of certain statements or operations claimed by the prover, such as possession of a certain key or satisfaction of certain conditions. Secondly, using the public parameters of the system and the proof provided by the prover, a verification algorithm is executed to confirm the validity of the proof. This process usually involves using the security parameters and public key of the zero-knowledge proof system to ensure that the proof has not been forged or tampered with. The verifier implements the process of verifying the proof and gives a result of verification passed or verification failed.
[0051] The role of the prover is to generate a proof that he has certain information or meets certain conditions without revealing any specific details about the information or conditions. This proof can be used by the verifier, who can confirm the validity of the proof by using public parameters and verification algorithms without knowing the specific content behind the proof. In general, the prover constructs a polynomial problem by performing multiple rounds of NTT (number theoretic transformation) calculations, and then generates a proof through multiple rounds of MSM calculations.
[0052] In the development of zero-knowledge proof systems, one of the main problems affecting their application is that the prover takes too long to generate proofs, resulting in a certain lag in the proofs, which affects the stability and real-time performance of the system. Therefore, the present invention focuses on optimizing the prover part in the zero-knowledge system. Specifically, by improving the multi-scalar multiplication (MSM) operation, which takes the longest time in the proof generation process, the performance bottleneck of proof generation is solved, thereby significantly improving the efficiency and response speed of proof generation.
[0053] In one embodiment, the Pippenger algorithm (also called bucket algorithm) is used to perform multi-scalar multiplication operations. The core idea of the Pippenger algorithm is to decompose a high-bitwidth MSM into multiple low-bitwidth MSMs by fine-grained disassembly of the scalars to reduce the overall multiplication operations, thereby improving the computational efficiency. The improvement proposed in the present invention is based on the original Pippenger algorithm and aims to further optimize its performance. Specifically, see Figure 4 As shown, for the multi-scalar multiplication operations involved in the prover, the Pippenger algorithm framework is divided into split window units, intra-bucket point reduction units, intra-window reduction units, and window aggregation units according to their functions, respectively realizing the corresponding functions.
[0054] 1. Split window unit
[0055] The split window unit is used to split a binary scalar into windows of a certain number of bits, such as Figure 4 , divided into 4-bit windows.
[0056] The purpose of splitting the window is to split the original large-scale multi-scalar multiplication operation into multiple subtasks, which is convenient for parallel computing using GPU. First, a fixed window c (c < λ) is selected according to the size of the original MSM, and the original scalar k with a size of λ-bit is split into multiple subtasks. i Divide into Parts, that is, an MSM with a scale of λ-bit is decomposed into L MSMs with a scale of c-bit (i.e., L subtasks), and the calculation formula is expressed as:
[0057]
[0058] Among them, Q represents the calculation result of multi-scalar multiplication, G i is the i-th scalar point on the finite field of elliptic curves, Y j represents the MSM of the jth c-bit, k i,j represents the jth part of the i-th scalar, i∈[1,N], j∈[1,L].
[0059] In practical applications, the optimal window size can be dynamically selected based on the specific GPU model, its computing power, and the scale of the initial multi-scalar multiplication to achieve effective subtask division. Traditional methods usually evaluate the workload based on the number of simple point additions to determine the optimal window size. Considering that Montgomery modular multiplication is the main calculation step in point addition operations, its calculation amount directly affects the execution time of subtasks. In one embodiment of the present invention, a more sophisticated mechanism is introduced, that is, the window size is dynamically adjusted according to the amount of Montgomery modular multiplication calculations required in the window. The dynamic window division process is as follows: Figure 5As shown, the overall process includes determining the initialization window, task division, estimating the amount of calculation, monitoring and feedback, and adjusting the window in real time according to the monitoring and feedback results.
[0060] Specifically, the process of dynamically adjusting the window size mainly includes: estimating the amount of Montgomery modular multiplication calculations required before each subtask starts, and selecting the optimal window size based on this estimate to optimize the execution efficiency. By monitoring the actual amount of calculation of each subtask in real time, analyzing the data collected during the actual execution process, and evaluating whether it is necessary to adjust the window size of the next subtask. For example, if the actual amount of calculation is lower than the estimated value, you can try to increase the window size to improve the execution efficiency and reduce idle resources. Through optimization strategies and real-time adjustments, the system can dynamically adapt to different workloads and hardware environment changes, ensure that computing resources can be effectively allocated in various situations, and improve the efficiency of point addition operations and overall system performance. Certain pre-processing tests and verifications can be performed before application to ensure that the selected window size selection strategy can show the best performance and efficiency in actual scenarios. In this way, the execution efficiency of point addition operations and the overall system performance can be optimized, providing a more accurate and efficient processing method, which is particularly suitable for application scenarios of complex computing tasks.
[0061] In another embodiment, the window size can be adjusted dynamically based on statistical analysis and machine learning models to further improve computing efficiency. For example, the trained machine learning model reflects the correspondence between the amount of Montgomery modular multiplication calculations, one or more of the GPU resources, and the window size. In this way, the window size can be predicted and adjusted more accurately, and the GPU resources can be used to the maximum extent, thereby improving the efficiency of computing operations to adapt to different workloads and hardware environments.
[0062] In summary, compared with the fixed window size of the original Pippenger algorithm, by adopting a finer-grained mechanism in the split window stage and adjusting the window size according to actual computing needs, the workload can be distributed more accurately, avoiding performance loss or resource waste caused by too large or too small windows. In addition, since the selection of window size is based on specific computing needs, it can be flexibly adjusted according to different application scenarios and hardware configurations, so that the best operating state can be achieved under various conditions.
[0063] 2. Bucket point reduction unit
[0064] The point reduction unit in the bucket is used to classify the points on each elliptic curve finite field into buckets. For example, when the window size is c, that is, each c bit is a window, and each window corresponds to a size of 2 c -1 array, that is, bucket. For example, combined with Figure 4As shown in the figure, after decomposing the scalar into 4-bit windows, each point on the elliptic curve finite field can be classified into buckets covering the range of 1 to 15. It should be noted that since the result of multiplying the bucket number 0 by the reduced bucket is zero, it can be regarded that bucket 0 is not calculated.
[0065] For the point reduction in the bucket, after selecting the appropriate window size, initialize 2 c -1 bucket, and then G i Add to its coefficient k i,j In the corresponding bucket, the result of each sub-MSM is calculated, and the point reduction in the bucket can be used to achieve parallel execution in the bucket. However, the traditional Pippenger algorithm often fails to use GPU threads reasonably, causing some threads in the bucket to be idle for a long time, while threads in other buckets are overly busy, which reduces the overall throughput and efficiency of the system.
[0066] In one embodiment of the present invention, for the in-bucket point reduction part of the Pippenger algorithm, a load balancing scheduling mechanism and a parallelization structure are designed according to the number of points in the bucket to ensure reasonable scheduling of resources during the execution of the algorithm.
[0067] When considering the thread allocation, traditional algorithms usually evenly allocate the number of GPU threads according to a fixed window size, but since the number of points in each bucket may vary greatly, this leads to the problem of uneven distribution of work tasks. In order to solve this challenge, in one embodiment of the present invention, the number of points in each bucket is first counted, and after all points are placed, the thread allocation is dynamically adjusted according to the proportion of points in each bucket. In addition, during the calculation process, the system monitors the number of points in each bucket and the calculation progress in real time. Once the calculation task in a bucket is completed, the system collects data about the current status of all buckets. Based on the collected data, the system re-evaluates the dynamic thread allocation. For example, more threads are allocated to buckets that are still processing a large number of points, or resources are reduced to buckets that have completed calculations. The above process is repeated periodically until all calculation tasks are completed. This cyclic iteration ensures that the system can dynamically adjust resource allocation when processing complex data distribution to improve overall computing efficiency and performance utilization.
[0068] This method can effectively optimize the utilization of GPU and improve the overall computing efficiency. In addition, a new parallel structure is further introduced in the actual execution of tasks, see Figure 6 The parallel architecture diagram in the bucket shown uses a tree structure for pairing to support the reduced parallel operation of points in the bucket. This structure can not only effectively process large-scale data sets, but also achieve efficient data communication and collaboration between different buckets, thereby further improving the parallel performance of the algorithm.
[0069] In summary, the design of the parallel structure enables the calculation of the point reduction stage in the bucket to be performed more efficiently. Through the tree-structured pairwise parallel operation, the dependencies between the calculation tasks can be effectively reduced, reducing the overall calculation delay. This optimization is particularly important for the requirement of quickly generating proofs during the zero-knowledge proof generation process, and can significantly shorten the time required to generate proofs.
[0070] 3. Window specification unit
[0071] For a given window, once each point has been classified into a bucket, all the points can be added up to get one point per bucket. For each window, all the bucket values are multiplied by their bucket number and then added together to get a window value.
[0072] Specifically, still combined with Figure 4 As shown, multiply the bucket number (u) by the reduced bucket (B j ), and then the buckets in the same window are accumulated and reduced into one bucket. For the operation of reduction within the window, the present invention uses the prefix sum idea for optimization. When a bucket is reduced, the reduction result can be incrementally updated to the cumulative sum of the previous window. This method avoids recalculating the cumulative sum of the previous window from scratch every time, and achieves more efficient calculation through incremental update. This method reduces the amount of calculation for reduction within the window to the original amount of calculation. The specific algorithm is as follows: by starting recording from the last bucket, when processing the reduction within the window, you only need to simply add the cumulative sum of the previous window to get the cumulative result within the current window, which significantly improves the calculation efficiency and reduces the complexity.
[0073] For example, the calculation process of the window specification is expressed as:
[0074]
[0075] Where u represents the bucket number, [B j ] indicates that it is Y j The buckets in which Y j Represents the MSM of the j-th c-bit that is split.
[0076] 4. Window Aggregation Unit
[0077] The window aggregation unit (or window reduction unit) is used to: after calculating the window value of each window, all of them can be added together to obtain the final output of the MSM.
[0078] For example, still combined with Figure 4 As shown, in the window aggregation unit, the algorithm flow is optimized by multiplication distribution rate, using 2 cDot product of the last window Y L , then accumulated to the second to last window, and then used 2 c The window after dot product merging is repeated recursively until the final window Y0 is merged. Specifically, the window specification is expressed as:
[0079]
[0080] Among them, Q represents the window reduction result, Y L Represents the Lth window value.
[0081] For the sake of clarity, we still combine Figure 3 As shown, the role of the present invention in ensuring the security and efficiency of blockchain transactions is described. In the process of generating zero-knowledge proofs, a trusted setup phase is essential, which defines the public parameters of the entire zero-knowledge system framework, including the selection of elliptic curves, generators, and other problem parameters, which ensure network consistency and security. The main responsibility of the trusted device is to convert circuit constraints for specific problems, that is, to convert smart contracts or business logic into the R1CS format suitable for zero-knowledge proofs. R1CS is a linear algebra model for expressing constraints, which allows complex computational logic to be converted into a set of linear constraints. Optimizing this conversion process, such as reducing the number of unnecessary constraints, can significantly reduce the complexity of the proof, thereby reducing the time and resource consumption required to generate the proof.
[0082] In the proof generation part, the prover first converts the R1CS constraint into a polynomial form through number theoretic transformation (NTT), and then solves it, that is, performs multiple rounds of multi-scalar multiplication calculations. This part is also the part with the largest amount of calculations for the prover, often accounting for about 75% of the entire proof generation process. In view of the importance of MSM, the present invention is particularly optimized for it. The optimization strategy is to decompose MSM so as to utilize the parallel processing capability of GPU and improve the computing efficiency. Specifically, the optimization scheme first subdivides the large-bit-width MSM into multiple small-bit-width MSMs in the split window unit to facilitate GPU parallel processing; and through dynamic adjustment of the window size, according to the calculation amount estimation of Montgomery modular multiplication, ensures the optimal division of subtasks, and uses real-time monitoring and feedback mechanisms to dynamically adjust the window size to adapt to different workloads and hardware environments. In the bucket point reduction unit, a load-balanced scheduling mechanism is implemented, and the GPU thread allocation is dynamically adjusted according to the number of points in the bucket. The tree structure is combined to support the reduction parallel operation of the points in the bucket, and the GPU utilization and overall computing efficiency are optimized. The in-window reduction unit is optimized by using the prefix sum idea, which reduces the amount of calculation and complexity through incremental updates, and improves the computational efficiency of the in-window reduction. Finally, the window aggregation unit uses the multiplication distribution law to optimize the algorithm flow, recursively merges the window values until the final MSM output is obtained, and significantly accelerates the proof generation process. Through these comprehensive optimization measures, the prover can greatly improve the speed of proof generation, especially when dealing with large-scale data sets and complex computing tasks, ensuring that the zero-knowledge proof system is more stable, real-time and efficient in practical applications. The final proof is submitted to the blockchain network, which contains encrypted information that proves the validity of the transaction, but does not disclose any substantial personal or financial details. Other nodes in the blockchain network act as verifiers, using the same public parameter key and verification algorithm to check the validity of the proof and confirm the legitimacy of the transaction without knowing the specific value of the transaction. Once the proof is verified, the transaction is officially confirmed and permanently recorded on the blockchain, forming a fast and secure transaction confirmation process, which greatly improves the feasibility and privacy protection level of blockchain technology in practical applications.
[0083] It should be noted that although the system provided by the present invention is described in the form of functional units, in actual applications, these units can also be integrated into hardware accelerators or acceleration devices and embedded in blockchain nodes to improve the computational efficiency of generating proofs.
[0084] In summary, the present invention analyzes and optimizes the Pippenger algorithm, which is conducive to giving full play to the advantages of GPU parallel computing, especially when processing large-scale multi-scalar multiplication operations. The Pippenger algorithm reduces the complexity of multi-scalar multiplication by reducing the number of multiplication operations, which is particularly effective for the case where there are more points in each bucket. First, through a reasonable workload distribution mechanism, it is ensured that each thread on the GPU can be fully utilized to avoid thread idleness, thereby maximizing parallelism. Secondly, algorithm-level optimization such as using shared memory and reducing data transmission measures further improves computing efficiency. These optimization measures not only reduce the overall complexity of the algorithm, but also significantly shorten the calculation time. By parallelizing the computing tasks, the GPU can process multiple multiplication operations at the same time, which significantly improves the execution speed of multi-scalar multiplication compared to traditional CPU calculations. This specialized optimization is not only applicable to scientific computing and data processing fields, but also particularly important for application scenarios that require real-time response and high-performance computing.
[0085] In summary, compared with the prior art, the present invention has the following advantages:
[0086] 1) The present invention provides a set of optimization solutions for the proof generation speed of the zero-knowledge proof system, ensuring that the speed of proof generation is significantly improved while maintaining the security, integrity and confidentiality of the zero-knowledge proof. It is applicable to the current system using zk-SNARK technology without modifying the existing proof generation process and steps. In addition, an optimization solution that is compatible with the existing zk-SNARK technology system is designed, which specifically improves the efficiency of multi-scalar multiplication calculations.
[0087] 2) The present invention provides a set of analysis mechanisms for the Pippenger algorithm, and improves its algorithm flow, thereby fully utilizing GPU performance and accelerating the calculation of multi-scalar multiplication modules. First, a dynamic window selection algorithm is designed to optimize the split window stage of the Pippenger algorithm, reasonably allocate large-scale multi-scalar multiplication operations, and achieve significant performance improvement. Further, the resource allocation strategy of the Pippenger algorithm in the bucket point reduction stage is improved to ensure the effective utilization of GPU resources, and an optimized calculation structure is designed to enable efficient parallel execution, thereby accelerating the calculation speed of the multi-scalar multiplication module. In addition, by reconstructing the process of bucket reduction and window reduction in the window, an efficient prefix sum algorithm is introduced, which significantly improves the operating efficiency of the calculation. These improvements effectively reduce the time and resource consumption required for calculation while maintaining the correctness of the calculation.
[0088] 3) Based on the common Pippenger algorithm, the present invention divides the definition of multi-scalar multiplication into four parts, performs modular decomposition and optimizes them separately. Through scalar decoupling and taking advantage of the parallelization of GPU, multi-scalar multiplication can perform parallel operations, thereby reducing the waiting time required for the operation and improving the efficiency of proof generation.
[0089] 4) The traditional Pippenger algorithm often cannot fully utilize the parallel computing capabilities of the GPU in the bucket point reduction stage, resulting in a large number of threads being idle or waiting for excessive load. The present invention can maximize the use of GPU thread resources and avoid thread idleness by designing a workload scheduling mechanism and dynamically allocating threads according to the number of points in each bucket, thereby significantly improving the computational efficiency of the multi-scalar multiplication module.
[0090] 5) After multiple tests and verifications, the present invention can meet the expected design indicators, and there is no need to consider the specific zero-knowledge proof scheme and form, and can be adapted to the zk-SNARK zero-knowledge proof generation system in any current situation.
[0091] The present invention may be a system, a method and / or a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for causing a processor to implement various aspects of the present invention.
[0092] Computer readable storage medium can be a tangible device that can hold and store instructions used by an instruction execution device. Computer readable storage medium can 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 thereof. More specific examples (non-exhaustive list) of computer readable storage medium 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, for example, a punch card or a convex structure in a groove on which instructions are stored, and any suitable combination thereof. The computer readable storage medium used here is not interpreted as a transient signal itself, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagated by a waveguide or other transmission medium (for example, a light pulse by an optical fiber cable), or an electrical signal transmitted by a wire.
[0093] 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.
[0094] The computer program instructions for performing the operation of the present invention may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent 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++, Python, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. Computer-readable program instructions may be executed entirely on a user's computer, partially on a user's computer, as an independent software package, partially on a user's computer, partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., using an Internet service provider to connect via the Internet). In some embodiments, an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), may be personalized by utilizing the state information of the computer-readable program instructions, and the electronic circuit may execute the computer-readable program instructions, thereby realizing various aspects of the present invention.
[0095] 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.
[0096] These computer-readable program instructions can be provided to a processor 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 processor 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.
[0097] 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.
[0098] The flow charts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the systems, methods and computer program products according to multiple embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a part of a module, a program segment or an instruction, and a part of the module, a program segment or an instruction contains one or more executable instructions for realizing the specified logical function. In some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented by a dedicated hardware-based system that performs the specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions. It is well known to those skilled in the art that it is equivalent to implement it by hardware, implement it by software, and implement it by combining software and hardware.
[0099] 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 selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or technical improvements in the marketplace, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein. The scope of the present invention is defined by the appended claims.
Claims
1. A universal zk-SNARK zero-knowledge proof optimization system, include: Trusted devices, provers and verifiers, where: The trusted device is used to generate and manage security parameters required by the system, and to generate and manage keys in the system; The prover uses the bucket algorithm to implement multi-scalar multiplication to generate proof. The multi-scalar multiplication is a process of multiplying and adding the calculated points and the corresponding scalars for a given set of points and scalars on the elliptic curve. The verifier is used to compare the key sent by the trusted device with the certificate generated by the prover to confirm the validity of the certificate; Among them, the prover includes a split window unit, an intra-bucket point reduction unit, an intra-window reduction unit and a window aggregation unit. The split window unit is used to split the multi-scalar multiplication operation into multiple subtasks based on the set window, and the size of the window is dynamically set according to the Montgomery modular multiplication calculation amount; the intra-bucket point reduction unit is used to reduce the points on each elliptic curve finite field to a bucket to obtain the result of each subtask; the intra-window reduction unit is used to multiply the bucket number by the reduced bucket, and accumulate and reduce the buckets in the same window into one bucket to obtain the window value of each window; the window aggregation unit is used to obtain the calculation result of the multi-scalar multiplication based on the window value of each window obtained.
2. The system according to claim 1, It is characterized in that The split window unit splits the multi-scalar multiplication operation of size λ-bit into multiple subtasks according to the following formula: Where N represents the multi-scalar multiplication scale, c is the setting window, c<λ, Y j represents the multi-scalar multiplication of the j-th c-bit, k i,j represents the jth part of the i-th scalar, i∈[1,N], j∈[1,L].
3. The system according to claim 2, It is characterized in that The split window unit sets the window according to the following steps: Before each subtask starts, estimate the amount of Montgomery modular multiplication calculations required to obtain an estimated amount; Selecting a corresponding window size to execute a subtask according to the estimated amount; The actual computation amount of each subtask is monitored in real time, and the difference between the actual computation amount and the estimated amount is compared to determine whether to adjust the window size of the next subtask.
4. The system according to claim 2, It is characterized in that The window reduction unit is calculated according to the following formula: Where u represents the bucket number, [B j ] indicates that it is Y j The barrel in.
5. The system according to claim 4, It is characterized in that The window aggregation unit obtains the calculation result of the multi-scalar multiplication according to the following formula: Among them, Y L Indicates that the Lth window is the last window, Y 0 represents the final window after merging, Y 1 Indicates the first window.
6. The system according to claim 2, It is characterized in that The split window unit sets the window according to the following steps: Before each subtask starts, estimate the amount of Montgomery modular multiplication calculations required to obtain an estimated amount; Selecting a corresponding window size to execute a subtask according to the estimated amount; Monitor the actual computational amount of each subtask in real time, and calculate the difference between the actual computational amount and the estimated amount; The difference is input into the trained deep learning model to decide whether to adjust the window size of the next subtask.
7. The system according to claim 1, It is characterized in that The bucket point reduction unit performs the following process: By counting the number of points in each bucket, the thread allocation is dynamically adjusted according to the proportion of points in each bucket; During the calculation process, the number of points and calculation progress in each bucket are monitored, and when the calculation task in a bucket is completed, the data of the current status of all buckets is collected; Based on the collected data, re-evaluation of dynamic thread allocation is performed.
8. The system according to claim 7, It is characterized in that For the in-bucket point reduction units, a tree structure is used for pairing in pairs to perform in-bucket point reduction parallel operations.
9. A general zk-SNARK zero-knowledge proof optimization method based on the system according to any one of claims 1 to 8, The following steps are involved: Generate and manage security parameters and keys for zero-knowledge proofs; Use the bucket algorithm to implement multi-scalar multiplication to generate proofs. The multi-scalar multiplication is the process of multiplying and adding the points and the corresponding scalars for a given set of points and scalars on an elliptic curve. Comparing the generated certificate with the key to confirm the validity of the certificate; The multi-scalar multiplication operation is implemented according to the following steps: Splitting the multi-scalar multiplication operation into multiple subtasks based on a set window, wherein the size of the window is dynamically set according to the amount of Montgomery modular multiplication calculation; Reduce each point on the finite field of the elliptic curve to a bucket and obtain the result of each subtask; Multiply the bucket number by the reduced bucket, and add up the buckets in the same window and reduce them into one bucket to obtain the window value of each window. Based on the obtained window value of each window, a calculation result of the multi-scalar multiplication is obtained.
10. A computer-readable storage medium having a computer program stored thereon, in, When the computer program is executed by a processor, the steps of the method according to claim 9 are implemented.
Citation Information
Patent Citations
A switch port traffic queue method and apparatus
CN109246031A
Scalar multiplication algorithm for reducing precomputation
CN114611051A
Zero-knowledge proof acceleration method and system based on GPU cluster
CN118157872A
Zero knowledge proof hardware accelerator and the method thereof
US20210266168A1
Cited By
Multi-scalar multiplication calculation method and device, computer equipment and program product
CN120104317A
Multi-scalar multiplication (MSM) computation
WO2026174829A1
Multiple scalar multiplication (MSM) computation method and apparatus, and computing device
WO2026179621A1
