Privacy protection method based on blockchain and KZG commitment

By adopting KZG commitment and multi-party computing protocols on the blockchain, combined with smart contracts and elliptic curve pairing operations, fine-grained privacy protection and efficient verification of data are achieved, solving the problems of high computational overhead and low efficiency of traditional privacy protection technologies, and improving the performance and scalability of the blockchain system.

CN120068127BActive Publication Date: 2025-09-19JUMENG INNOVATION (BEIJING) SOFTWARE TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510559919.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-04-30
Publication Date
2025-09-19
Estimated Expiration
2045-04-30

AI Technical Summary

Technical Problem

Traditional privacy protection technologies have high computational overhead on blockchains, resulting in transaction delays and inefficiency. Existing solutions require large-scale transformation of blockchain architecture or reliance on off-chain systems, affecting maintainability and interoperability.

Method used

A privacy protection method based on blockchain and KZG commitment is adopted. Through data block processing and Lagrange interpolation method to construct polynomial representation, combined with multi-party computing protocol and smart contracts, fine-grained data access control and efficient verification are achieved.

Benefits of technology

Without leaking the original data, it can achieve data privacy protection and verifiability, reduce computing overhead, meet the performance requirements of high-frequency trading scenarios, and improve the efficiency and flexibility of the blockchain system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120068127B_ABST
    Figure CN120068127B_ABST
Patent Text Reader

Abstract

The present invention provides a privacy protection method based on blockchain and KZG commitments, relating to the field of blockchain technology. The method comprises: receiving raw data to be protected from a data source, including digitized information in text, image, audio, and video formats; processing the raw data into blocks, and constructing a polynomial representation for each data block using Lagrange interpolation to obtain corresponding polynomial coefficients; generating trusted setting parameters based on the polynomial coefficients and a multi-party computation protocol, and generating KZG commitments based on the polynomial coefficients and the trusted setting parameters; encrypting each data block after block processing using an encryption algorithm to obtain encrypted data, and packaging the encrypted data with the KZG commitment to generate a packaged data block. The present invention improves the efficiency and flexibility of data privacy protection, ensuring data verifiability while reducing computational complexity.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of blockchain technology, and in particular to a privacy protection method based on blockchain and KZG commitment. Background Art

[0002] Traditional privacy protection technologies, including zero-knowledge proofs (ZKPs) and fully homomorphic encryption (FHE), often have high computational overhead. These technologies require complex cryptographic operations, including elliptic curve operations, multiple pairing operations, and homomorphic operations, resulting in a long time for single proof generation and verification.

[0003] For example, in high-frequency trading in the financial sector, every transaction requires rapid verification and settlement. Using ZKP or FHE for privacy protection, due to the high computational complexity, can lead to transaction delays, impacting market efficiency and user experience. Many traditional privacy protection technologies employ extreme approaches of full encryption or full disclosure, lacking the ability to provide fine-grained privacy protection for data. This means either all data is encrypted, resulting in inefficient processing, or all data is publicly available, failing to protect sensitive information.

[0004] Secondly, in the medical field, patient health data contains a large amount of sensitive information. While sharing this data with full encryption protects privacy, it also requires doctors to perform complex decryption operations when processing the data, reducing work efficiency. On the other hand, making this data fully public could potentially compromise patient privacy.

[0005] The blockchain's fundamental data structure treats each transaction as an independent entity, lacking a mechanism to link transactions. Consequently, cross-transaction verification requires retrieving and decrypting the entire contents of multiple transactions, which is inefficient and can lead to unnecessary data leaks. Existing privacy protection solutions often require major modifications to the underlying blockchain architecture or require additional off-chain systems to manage keys and data. This not only increases complexity but also hinders maintainability and interoperability. Summary of the Invention

[0006] The technical problem to be solved by the present invention is to provide a privacy protection method based on blockchain and KZG commitment, improve the efficiency and flexibility of privacy protection, and optimize performance and scalability.

[0007] In order to solve the above technical problems, the technical solutions of the present invention are as follows:

[0008] First, a privacy protection method based on blockchain and KZG commitment, comprising:

[0009] Receive the original data to be protected from the data source, including digital information in text, image, audio, and video formats;

[0010] The original data is divided into blocks and a polynomial representation is constructed for each data block using the Lagrange interpolation method to obtain the corresponding polynomial coefficients;

[0011] Generate trusted setup parameters based on the polynomial coefficients and the multi-party computation protocol, and generate a KZG commitment based on the polynomial coefficients and the trusted setup parameters. Use the encryption algorithm to encrypt each data block after block processing to obtain encrypted data, and then package the encrypted data with the KZG commitment to generate a packaged data block.

[0012] Using blockchain smart contracts, proof data, and elliptic curve pairing operations, the authenticity of the KZG commitment in the packaged data block is verified to obtain the verification result;

[0013] After confirming the authenticity of KZG's commitment, data access control rules are set according to the blockchain's smart contract, including a list of user addresses allowed to access, a selector of functions allowed to be called, the validity period of the rules, and whether additional proof is required;

[0014] According to the data access control rules, the identity and permissions of the access requester, the access requester's access rights to the verified KZG commitment and the corresponding encrypted data are verified to achieve fine-grained data access control.

[0015] Furthermore, the original data is divided into blocks and a polynomial representation is constructed for each data block using the Lagrange interpolation method to obtain the corresponding polynomial coefficients, including:

[0016] Determine the size of each data block and divide it into blocks according to the size of each data block to obtain data points;

[0017] According to the data points, the corresponding Lagrange basis functions are calculated, and polynomials are constructed according to the Lagrange basis functions to obtain the corresponding polynomial coefficients.

[0018] Furthermore, the corresponding Lagrange basis functions are calculated based on the data points, and polynomials are constructed based on the Lagrange basis functions to obtain the corresponding polynomial coefficients, including:

[0019] Divide the original data into blocks of predefined size to obtain a series of data points, each of which has an abscissa and a ordinate;

[0020] For each data point, initialize a variable to store the value of the Lagrange basis function;

[0021] For each data point, a shape adjustment value is calculated to adjust the shape of the basis function;

[0022] Calculating a position adjustment value according to the shape adjustment value to adjust the shape and position, and calculating a polynomial correction term according to the adjusted shape and position;

[0023] The shape adjustment value, the position adjustment value and the polynomial correction term are fused to obtain an intermediate correction value, and the final value of the Lagrangian basis function is obtained according to the intermediate correction value.

[0024] Furthermore, a trusted setup parameter is generated based on the polynomial coefficients and the multi-party computation protocol, and a KZG commitment is generated based on the polynomial coefficients and the trusted setup parameter, including:

[0025] According to the polynomial coefficients corresponding to the data block, the rules of the blockchain node in the calculation link are determined to generate the trusted setting parameters;

[0026] According to the trusted setting parameters, secret sharing is used to split the polynomial coefficients into multiple shares, and the trusted setting parameters and polynomial coefficients are fused through interactive calculation to generate KZG commitment.

[0027] Furthermore, the blockchain’s smart contracts, proof data, and elliptic curve pairing operations are used to verify the authenticity of the KZG commitment in the packaged data block, obtaining verification results including:

[0028] The user sends a verification request to the smart contract through the blockchain client. According to the verification principle of KZG commitment, the smart contract performs elliptic curve pairing operation to calculate the pairing result of the commitment value and the polynomial commitment;

[0029] The pairing result of the commitment value and the polynomial commitment is verified to obtain a verification result.

[0030] Furthermore, the data in the verification request includes the KZG commitment to be verified, the certification data and the challenge value generated by the user.

[0031] Furthermore, based on data access control rules, the identity and permissions of the access requester, the access requester's access rights to the verified KZG commitment and the corresponding encrypted data are verified to achieve fine-grained data access control, including:

[0032] According to the KZG commitment of the access request, the corresponding data access control rules are determined from the access control contract, and the access requester's permissions are verified;

[0033] Based on the verification of the access requester, check whether the access request meets the relevant conditions in the data access control rules, including whether it is multi-signed and whether the request time is within the validity period of the rules, so as to achieve fine-grained data access control.

[0034] Furthermore, the verification process includes checking the identity and authority of the access requester and whether the access requester complies with the set data access control rules.

[0035] In a second aspect, a computing device includes:

[0036] one or more processors;

[0037] The storage device is used to store one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement the method.

[0038] According to a third aspect, a computer-readable storage medium stores a program, which implements the method described above when executed by a processor.

[0039] The above solution of the present invention includes at least the following beneficial effects:

[0040] The KZG commitment mechanism enables data privacy protection without leaking the original data. Furthermore, the efficient verification features of KZG commitments ensure data verifiability, resolving the conflict between blockchain transparency and data privacy. The EVM precompiled contracts and storage mechanism optimize the data verification process, maintaining a constant time complexity and supporting batch verification operations for improved data verification efficiency. A transaction linkage mechanism is added to the blockchain architecture to enable data sharing and verification between related transactions. This mechanism not only maintains data privacy but also allows users to flexibly access and verify data across transactions as needed, providing strong support for the diverse and complex nature of blockchain applications.

[0041] By improving cryptographic algorithms and optimizing system architecture, the computational overhead of privacy protection is reduced, and the verification time is controlled at the millisecond level, which can meet the performance requirements of high-frequency trading scenarios and improve the overall operating efficiency of the blockchain system. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] Figure 1 This is a flowchart of a privacy protection method based on blockchain and KZG commitment provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0043] Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.

[0044] like Figure 1As shown, an embodiment of the present invention proposes a privacy protection method based on blockchain and KZG commitment, the method comprising the following steps:

[0045] Step 1: Receive the original data to be protected from the data source, including digital information in text, image, audio, and video formats;

[0046] Step 2: Divide the original data into blocks and use the Lagrange interpolation method to construct a polynomial representation for each data block to obtain the corresponding polynomial coefficients;

[0047] Step 3: Generate trusted setup parameters based on the polynomial coefficients and the multi-party computation protocol, and generate a KZG commitment based on the polynomial coefficients and the trusted setup parameters. Encrypt each data block after block processing using an encryption algorithm to obtain encrypted data, and package the encrypted data with the KZG commitment to generate a packaged data block.

[0048] Step 4: Use the blockchain’s smart contract, proof data, and elliptic curve pairing operations to verify the authenticity of the KZG commitment in the packaged data block and obtain the verification result;

[0049] Step 5: After confirming the authenticity of KZG's commitment, data access control rules are set according to the blockchain's smart contract, including a list of user addresses allowed to access, a selector of functions allowed to be called, the validity period of the rules, and whether additional proof is required;

[0050] Step 6: Verify the access requester's access rights to the verified KZG commitment and the corresponding encrypted data based on the data access control rules, the identity and permissions of the access requester to achieve fine-grained data access control.

[0051] In an embodiment of the present invention, data privacy protection is achieved by processing the original data in blocks, using the Lagrange interpolation method to construct a polynomial representation, and combining it with the KZG commitment mechanism. The blockchain's smart contracts and elliptic curve pairing operations are used to verify the authenticity of the KZG commitment, improving verification efficiency and meeting the needs of high-frequency trading scenarios. Based on the blockchain's smart contracts, detailed data access control rules are set, including a list of user addresses allowed to access, a selector of functions allowed to be called, the validity period of the rules, and whether additional proof is required. This controls the visibility of data to different roles to achieve fine-grained data access control. Strict permission verification is performed based on the data access control rules and the identity and permissions of the access requester to prevent data leakage and illegal access. The multi-party computing protocol (MPC) is used to generate trusted setting parameters to ensure parameter security and prevent the occurrence of single points of failure.

[0052] In a preferred embodiment of the present invention, the above step 1, receiving the original data to be protected from the data source, including digitized information in text, image, audio, and video formats, may include:

[0053] In an embodiment of the present invention, different data sources are identified and connected, including local file systems, databases, API interfaces, and cloud storage service data sources. Based on the type and format of the data source, a connection is established with the data source and data is received, including streaming, batch downloading, or on-demand acquisition.

[0054] The received data is processed in a standardized manner, including data format conversion, data type conversion and unit unification. The processed data is securely stored and managed, including data addition, deletion, modification and query, data backup and recovery, and data permission control.

[0055] In a preferred embodiment of the present invention, the above step 2, dividing the original data into blocks and constructing a polynomial representation for each data block using the Lagrange interpolation method to obtain the corresponding polynomial coefficients, may include:

[0056] Step 220, determining the size of each data block, and dividing the data blocks according to the size of each data block to obtain data points;

[0057] Step 221 : Calculate the corresponding Lagrangian basis function according to the data points, and construct a polynomial according to the Lagrangian basis function to obtain the corresponding polynomial coefficients.

[0058] In an embodiment of the present invention, data is divided into multiple data blocks one by one according to a predefined data block size. Each data block is an independent data point, including byte data of a certain length. The data points are stored in a memory or a temporary storage medium, and the corresponding Lagrangian basis functions are calculated.

[0059] Step 221 : Use the Lagrange basis function values ​​of the data points and the corresponding data values ​​to construct a polynomial through linear combination.

[0060] Suppose there is a data set consisting of four data points:

[0061] Data point 1: [0, 0x01020304] (position 0, value 0x01020304);

[0062] Data point 2: [1, 0x05060708] (position 1, value 0x05060708);

[0063] Data point 3: [2, 0x090a0b0c] (position 2, value 0x090a0b0c);

[0064] Data point 4: [3, 0x0d0e0f10] (position 3, value 0x0d0e0f10);

[0065] The data is divided into blocks with a size of 2 bytes per block, and the following data points are obtained:

[0066] Data point 1: [0, 0x0102];

[0067] Data point 2: [1, 0x0304];

[0068] Data point 3: [2, 0x0506];

[0069] Data point 4: [3, 0x0708];

[0070] Data point 5: [4, 0x090A];

[0071] Data point 6: [5, 0x0b0c];

[0072] Data point 7: [6, 0x0d0e];

[0073] Data point 8: [7, 0x0F10];

[0074] Calculate the Lagrange basis function for each data point, construct a polynomial based on the basis function and the value of the data point, and the obtained polynomial coefficients are [ , , , ].

[0075] By segmenting raw data and constructing polynomials using Lagrange interpolation, data verification and access control are achieved without directly storing or transmitting the raw data, thereby protecting data privacy. Based on blockchain smart contracts and a fine-grained permission management mechanism, precise access control for different roles and users is implemented, ensuring that only authorized users can access and use data. Through a modular system design and standardized precompiled contract interfaces, this privacy-preserving solution can be easily integrated into existing blockchain systems and supports future functionality expansion. Trusted setup parameters generated by the multi-party computation (MPC) protocol ensure security and robustness, preventing single points of failure.

[0076] In another preferred embodiment of the present invention, the corresponding Lagrangian basis functions are calculated according to the data points, and a polynomial is constructed according to the Lagrangian basis functions to obtain the corresponding polynomial coefficients, which may include:

[0077] Divide the original data into blocks of predefined size to obtain a series of data points, each of which has an abscissa and a ordinate;

[0078] For each data point, initialize a variable to store the value of the Lagrange basis function;

[0079] For each data point, a shape adjustment value is calculated to adjust the shape of the basis function;

[0080] Calculating a position adjustment value according to the shape adjustment value to adjust the shape and position, and calculating a polynomial correction term according to the adjusted shape and position;

[0081] The shape adjustment value, the position adjustment value and the polynomial correction term are fused to obtain an intermediate correction value, and the final value of the Lagrangian basis function is obtained according to the intermediate correction value.

[0082] In this embodiment of the present invention, it is assumed that there is a set of data points with a total of +1, respectively ( , ),( , ),…,( , ), now we want to focus on the data points ( , ) to calculate the corresponding Lagrangian basis function .from =0 starts, to = -1 ends (here = ),Will These expressions are multiplied together. For example, if =3, =5, the horizontal coordinates of the data points are =1, =2, =3, =4, =6, then this part is (5-1)×(5-2)=4×3=12. = +1 to start, = End, will - ) Multiply these expressions together. Continuing with the example above, this part is (5-6)=-1. Multiply the results of the two consecutive parts to get the value of the numerator. In this example, the value of the numerator is 12×(-1)=-12. =0 starts, to = -1 End ( = ), this time it is ( - ) Multiply these formulas together. Taking the data just now as an example, =4, this part is (4-1)×(4-2)=3×2=6. = +1 to start, = End, will - ) are multiplied together. In this example, this part is (4-6)=-2.

[0083] Multiply the two products of the denominator to get the value of the denominator. In this example, the value of the denominator is 6×(-2)=-12. Dividing the value of the numerator by the value of the denominator gives the final value of the Lagrange basis function, which is ,in, is the first The horizontal coordinate of the data point, Indicates except The horizontal coordinate of the external data point, is the index of the data point, is the total number of data points minus 1.

[0084] Shape and position adjustment values ​​allow for more precise control of the shape and position of the Lagrangian basis functions, improving the accuracy of polynomial interpolation. This ensures that the constructed polynomial curve passes through all given data points more accurately, reducing interpolation errors. Automatically adjusting the shape and position of the basis functions based on the distribution characteristics and changing trends of different data points enhances the algorithm's adaptability and robustness. This enables the algorithm to handle more complex and variable datasets, increasing its practicality and broad applicability. Precalculating shape and position adjustment values ​​reduces repetitive calculations and improves the algorithm's computational efficiency. In the privacy-preserving methods of blockchain and KZG commitments, improved interpolation accuracy and adaptability can better protect data privacy, enhancing data security and privacy protection effectiveness.

[0085] In a preferred embodiment of the present invention, the above step 3, generating trusted setup parameters based on the polynomial coefficients and the multi-party computation protocol, and generating the KZG commitment based on the polynomial coefficients and the trusted setup parameters, may include:

[0086] Step 330: Determine the rules of the blockchain node in the calculation phase based on the polynomial coefficients corresponding to the data block to generate trusted setting parameters;

[0087] In step 331 , the polynomial coefficients are divided into multiple shares using secret sharing according to the trusted setting parameters, and the trusted setting parameters and the polynomial coefficients are integrated through interactive calculation to generate a KZG commitment.

[0088] In this embodiment of the present invention, the polynomial coefficients corresponding to the data block are obtained and stored in the form of an array to determine the topology of the blockchain network, including the number of nodes. And the unique identifier ID of each node. Define the role and task of each node in the calculation process, determine the communication rules between nodes, including the order, format and encryption method of message transmission. Generate a public trusted setting parameter based on the polynomial coefficients and node rules .

[0089] Step 331, use the secret sharing algorithm to convert the polynomial coefficients [ , ,..., ] Split into shares, each node Get a share , nodes interact and compute with each other through predefined communication rules. Use your own share and trusted setup parameters , calculate an intermediate result All nodes will intermediate results Sent to a central node for fusion to generate the final KZG commitment.

[0090] Suppose there is a blockchain network with three nodes A, B and C, the polynomial coefficients are [1, 3, 2], and the number of nodes is = 3, the node identifiers are A, B and C. Define each node to be responsible for calculating the polynomial in = 1, = 2 and X=3, after each node completes the calculation, it sends the result to the central node , generate trusted setting parameters =abc123....

[0091] Use the secret sharing algorithm to split the polynomial coefficients [1, 3, 2] into 3 shares:

[0092] Node A obtains shares [1_A, 3_A, 2_A];

[0093] Node B obtains shares [1_B, 3_B, 2_B];

[0094] Node C obtains shares [1_C, 3_C, 2_C];

[0095] Interactive Computing

[0096] Node A calculates RA = f(1_A, 3_A, 2_A, T);

[0097] Node B calculates RB = f(1_B, 3_B, 2_B, T);

[0098] Node C calculates RC = f(1_C, 3_C, 2_C, T);

[0099] Assumptions Is an encryption function that generates KZG commitments. Central node Receive RA, RB and RC, calculate C= (RA, RB, RC), the final KZG commitment is a public value that can be used to verify the integrity of the polynomial. RA, RB, and RC are intermediate calculation products in the process of generating the KZG commitment. Nodes A, B, and C use their own shares of the polynomial coefficients (i.e., [1_A, 3_A, 2_A], [1_B, 3_B, 2_B], [1_C, 3_C, 2_C]) and the public trusted setting parameters. , through the function These values ​​are obtained by calculation. They represent the stage output of each node in the entire calculation process and are the transition data from the original data (polynomial coefficients) to the final KZG commitment.

[0100] By splitting the polynomial coefficients into multiple shares, data leakage from individual nodes is prevented. A common trusted setup parameter is generated, ensuring that all nodes use the same parameters during the computation process, preventing inconsistencies between nodes. The resulting KZG commitment is a public value that can be used to verify the integrity of the polynomial without revealing the specific coefficients, protecting data privacy and preventing the leakage of sensitive information. Intermediate results generated by each node during the computation can be used to verify the results of other nodes, ensuring the correctness and consistency of the entire computation process, improving computational efficiency, and making it suitable for large-scale blockchain networks. Secret sharing and interactive computation mechanisms make collusion attacks between nodes difficult, enhancing system security.

[0101] In a preferred embodiment of the present invention, step 4 above utilizes blockchain smart contracts, proof data, and elliptic curve pairing operations to verify the authenticity of the KZG commitment in the packaged data block, and obtains a verification result, which may include:

[0102] In step 440, the user sends a verification request to the smart contract through the blockchain client. Based on the verification principle of the KZG commitment, the smart contract performs an elliptic curve pairing operation to calculate the pairing result of the commitment value and the polynomial commitment. The data in the verification request includes the KZG commitment to be verified, the proof data, and the user-generated challenge value.

[0103] Step 441 : Verify the pairing result of the commitment value and the polynomial commitment to obtain a verification result.

[0104] In this embodiment of the present invention, the user constructs a verification request through the blockchain client. The request includes the KZG commitment to be verified, the relevant proof data, and the user's identity information. After receiving the verification request, the smart contract first verifies the format and content integrity of the request, and loads the relevant parameters of the elliptic curve from the blockchain node. According to the generation principle of the KZG commitment, the smart contract uses the elliptic curve parameters and the information in the proof data, including the commitment ,prove ,Location ,value The smart contract calculates the pairing result of the polynomial commitment, where is a hidden value, It is a generator on the elliptic curve, and stores the calculated commitment value and the pairing result of the polynomial commitment as an intermediate result.

[0105] In step 441, the smart contract compares the commitment value calculated in step 440 with the polynomial commitment pairing result. If the two pairing results are equal, the KZG commitment is considered authentic and verification is successful. Otherwise, verification fails, and the smart contract records the verification result and stores it on the blockchain.

[0106] Suppose there is a blockchain application where the user wants to verify whether the KZG commitment of a data block is true. The blockchain client sends a verification request to the smart contract, including the KZG commitment to be verified. , Proof Data (Proof Points ,Location ,value ) and the user's identity information.

[0107] The blockchain client constructs and sends a verification request to the smart contract. After receiving the request, the smart contract verifies the format and content integrity of the request, ensures that the request contains all necessary verification information, and loads the relevant parameters of the elliptic curve from the blockchain node, including the base point. 、 and elliptic curve equations. The smart contract uses the elliptic curve parameters and the information in the proof data to calculate the pairing of the commitment value and the polynomial commitment. The smart contract compares the two pairings and finds them equal, indicating that the KZG commitment is authentic.

[0108] By leveraging elliptic curve pairing operations and the KZG commitment verification principle, smart contracts can efficiently verify the authenticity of data blocks, ensuring that data has not been tampered with during transmission and storage. Smart contracts perform verification operations on the blockchain, eliminating the need for centralized verification authorities, improving verification efficiency and reducing costs. Users can initiate verification requests through the blockchain client and receive real-time verification results, enhancing user trust in blockchain data. This provides a reliable data authenticity verification mechanism for blockchain applications and promotes the application and development of blockchain technology in finance, healthcare, and the Internet of Things. By integrating blockchain smart contracts and encryption technologies, it supports complex privacy protection requirements, including fine-grained data access control and data desensitization.

[0109] In a preferred embodiment of the present invention, after confirming the authenticity of the KZG commitment in step 5, data access control rules are set according to the blockchain smart contract, including a list of user addresses allowed to access, a selector of functions allowed to be called, the validity period of the rules, and whether additional proof is required. These rules may include:

[0110] In this embodiment of the present invention, the KZG commitment is verified for authenticity through a blockchain-based smart contract. The verification result is then checked to see if it is true (i.e., passed). If it is false (i.e., failed), subsequent steps are discontinued and an error message is recorded. Data owners define data access control rules based on actual needs, including a list of user addresses allowed to access the data; a function selector that specifies which smart contract functions are allowed to be called to access the data; a rule validity period that specifies the validity period of the access control rule, after which the rule automatically expires; and the requirement for additional proof that specifies whether the user is required to provide additional proof information before accessing the data.

[0111] The encoded access control rules are stored in a selected location. When storing them within a smart contract, this can be done by calling the smart contract's storage function. When storing them in the blockchain's public storage space, the corresponding storage protocol and interface must be used. The association between access control rules and KZG commitments is established on the blockchain. A query interface is designed within the smart contract to allow authorized users to query the access control rules associated with a specific KZG commitment. The query interface logic is implemented, including verifying the queryer's identity and permissions, retrieving the access control rules from the storage location, decoding the rules into a readable format, and returning them to the queryer.

[0112] In a preferred embodiment of the present invention, step 6 above verifies the access requester's access rights to the verified KZG commitment and the corresponding encrypted data based on the data access control rules and the identity and permissions of the access requester to implement fine-grained data access control, which may include:

[0113] Step 660: Based on the KZG commitment requested for access, determine the corresponding data access control rules from the access control contract and verify the access requester's authority. The verification process includes checking the access requester's identity, authority, and compliance with the set data access control rules.

[0114] Step 661 , based on verifying the access requester, checks whether the access request meets the relevant conditions in the data access control rules, including whether there are multiple signatures and whether the request time is within the validity period of the rules, so as to achieve fine-grained data access control.

[0115] In this embodiment of the present invention, a smart contract receives an access request and extracts key information from the request, including the identifier of the KZG commitment to be accessed, the identity of the access requester, and the type of requested operation. Based on the KZG commitment identifier, the smart contract queries a mapping table in the Access Control Contract (ACC) to obtain the access control rules associated with the KZG commitment, including a list of allowed accessor identities, the minimum required access privilege level, the time window, and multi-signature requirements. The smart contract then checks whether the requester's privilege level meets the requirements of the rules.

[0116] In step 661, if the rule requires multiple signatures, the smart contract checks whether the request contains a sufficient number of valid signatures, including that the signer's identity is in the authorized list, the signature time is within the rule's validity period, and the signature content is consistent with the requested operation. The smart contract also checks whether the request time is within the time window defined by the rule. If the time is invalid, access is denied.

[0117] Suppose there's a medical data sharing platform on the blockchain. User A wants to access User B's encrypted medical data (stored via KZG commitment C_B). Access control rules require that only users with the "MEDICAL_ACCESS" permission be allowed. Access must be directly authorized by User B (with a single signature) and must occur between [2023-10-01 00:00:00, 2023-10-31 23:59:59]. The permission management contract is queried to confirm that UserA_Address has the permission. It also checks that Sig_A is signed by UserB_Address and that the timestamp is within the validity period. All conditions are met.

[0118] Access control is achieved down to the operational level through multi-dimensional rules based on identity, permissions, time, and multi-signatures. Unauthorized users are prevented from accessing sensitive data, reducing the risk of data leakage. Multi-signature and time window restrictions enhance security. Access control rules can be dynamically configured to support complex business needs. All access requests and verification results are recorded on the blockchain for easy auditing and traceability. Access control logic is automatically executed by smart contracts, eliminating the need for centralized institutions.

[0119] When applying it, check the original data format to ensure it supports arbitrary binary data and use Protobuf or JSON serialization formats. Ensure that the size of a single data packet does not exceed 1MB. If the data is larger, process it in chunks. Standardize the data using big-endian byte order and UTF-8 encoding.

[0120] After standardizing and compressing the data, Lagrange interpolation is used to convert it into a polynomial representation. The provided SDK supports data conversion in multiple languages. If the data is incorrectly formatted or out of range, a specific error code is returned and logged. The abnormal data is then corrected or rejected.

[0121] Call the KZG_COMMITMENT_GENERATE precompiled contract, using the multi-party computing protocol (MPC), by Independent participants jointly generate trusted setup parameters. Each participant generates a random number and calculates its contribution, ultimately resulting in two sets of trusted setup parameters. The parameter generation process incorporates a threshold mechanism to prevent single points of failure. The original data is divided into blocks (256 bytes each), and a polynomial is constructed for each block using Lagrange interpolation. If the data format or range is abnormal, the error handling mechanism is used.

[0122] Using encoded polynomials and trusted setup parameters Calculate the KZG commitment, which is a point on the elliptic curve with a fixed size. , generating proof data to prove the value of the polynomial at that point and storing the proof data in a standardized structure. Using the AES-256-GCM encryption algorithm, a unique Data Encryption Key (DEK) is generated for each data point based on the identity key management system. The DEK is encrypted with the recipient's public key, and the original data is then encrypted with the DEK. Finally, the encrypted data and the encrypted DEK are packaged together. The standard transaction structure is expanded to include KZG commitments, encrypted data, associated fields (an array of associated transaction hashes, an array of associated types, and an array of related commitment IDs), and access rules, and packaged in a specific format. Using standard P2P network protocols, transactions can be broadcasted network-wide or to a specific group of nodes.

[0123] The transaction processor parses transaction-related fields and extracts the associated transaction hashes. It then searches the KZG commitments for the associated transactions using the index system, verifies the caller's access rights, extracts the KZG commitments and corresponding proof data, and performs verification calculations. It then extracts the transaction sender's address, queries the access control contract to obtain the permission configuration, and determines whether the sender possesses the required permissions. If insufficient, access is denied; otherwise, processing continues. If verification passes, the encrypted data is decrypted, the smart contract call is executed, and an audit log is recorded. If verification fails, the transaction is rolled back, the failure reason is recorded, and a failure event is triggered. The AES-256-GCM encryption algorithm is used to protect the original data. The encryption key is regularly updated to achieve forward security, and a secure key exchange and distribution mechanism is supported. Fine-grained access control is implemented based on the smart contract, supporting dynamic permission adjustments based on roles, time, and conditions, and providing a permission delegation mechanism. Audit logs are recorded for all key operations, including the operation type, time, operator, affected objects, and results. The logs are cryptographically protected and provide query and analysis tools to support compliance audits.

[0124] An embodiment of the present invention further provides a computing device comprising: a processor and a memory storing a computer program, wherein the computer program, when executed by the processor, performs the above-described method. All implementations in the above-described method embodiments are applicable to this embodiment and can achieve the same technical effects.

[0125] The embodiment of the present invention further provides a computer-readable storage medium storing instructions, which, when executed on a computer, causes the computer to execute the above-described method. All implementations in the above-described method embodiment are applicable to this embodiment and can achieve the same technical effects.

[0126] The above is a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as within the scope of protection of the present invention.

Claims

1. A privacy protection method based on blockchain and KZG commitment, characterized by: The method comprises: Receive the original data to be protected from the data source, including digital information in text, image, audio, and video formats; The original data is divided into blocks and a polynomial representation is constructed for each data block using the Lagrange interpolation method to obtain the corresponding polynomial coefficients; Generate trusted setup parameters based on the polynomial coefficients and the multi-party computation protocol, and generate a KZG commitment based on the polynomial coefficients and the trusted setup parameters. Use the encryption algorithm to encrypt each data block after block processing to obtain encrypted data, and then package the encrypted data with the KZG commitment to generate a packaged data block. Generate trusted setup parameters based on the polynomial coefficients and the multi-party computation protocol, and generate KZG commitments based on the polynomial coefficients and the trusted setup parameters, including: According to the polynomial coefficients corresponding to the data block, the rules of the blockchain node in the calculation link are determined to generate the trusted setting parameters; Based on the trusted setup parameters, secret sharing is used to split the polynomial coefficients into multiple shares. The trusted setup parameters and polynomial coefficients are then fused through interactive calculation to generate a KZG commitment. Using blockchain smart contracts, proof data, and elliptic curve pairing operations, the authenticity of the KZG commitment in the packaged data block is verified to obtain the verification result; After confirming the authenticity of KZG's commitment, data access control rules are set according to the blockchain's smart contract, including a list of user addresses allowed to access, a selector of functions allowed to be called, the validity period of the rules, and whether additional proof is required; According to the data access control rules, the identity and permissions of the access requester, the access requester's access rights to the verified KZG commitment and the corresponding encrypted data are verified to achieve fine-grained data access control.

2. The privacy protection method based on blockchain and KZG commitment according to claim 1 is characterized in that: The original data is divided into blocks and the Lagrange interpolation method is used to construct a polynomial representation for each data block to obtain the corresponding polynomial coefficients, including: Determine the size of each data block and divide it into blocks according to the size of each data block to obtain data points; According to the data points, the corresponding Lagrange basis functions are calculated, and polynomials are constructed according to the Lagrange basis functions to obtain the corresponding polynomial coefficients.

3. The privacy protection method based on blockchain and KZG commitment according to claim 2 is characterized in that: According to the data points, the corresponding Lagrange basis functions are calculated, and polynomials are constructed based on the Lagrange basis functions to obtain the corresponding polynomial coefficients, including: Divide the original data into blocks of predefined size to obtain a series of data points, each of which has an abscissa and a ordinate; For each data point, initialize a variable to store the value of the Lagrange basis function; For each data point, a shape adjustment value is calculated to adjust the shape of the basis function; Calculating a position adjustment value according to the shape adjustment value to adjust the shape and position, and calculating a polynomial correction term according to the adjusted shape and position; The shape adjustment value, the position adjustment value and the polynomial correction term are fused to obtain an intermediate correction value, and the final value of the Lagrangian basis function is obtained according to the intermediate correction value.

4. The privacy protection method based on blockchain and KZG commitment according to claim 3 is characterized in that: Using blockchain smart contracts, proof data, and elliptic curve pairing operations, the authenticity of the KZG commitment in the packaged data block is verified, and the verification results include: The user sends a verification request to the smart contract through the blockchain client. According to the verification principle of KZG commitment, the smart contract performs elliptic curve pairing operation to calculate the pairing result of the commitment value and the polynomial commitment; The pairing result of the commitment value and the polynomial commitment is verified to obtain a verification result.

5. The privacy protection method based on blockchain and KZG commitment according to claim 4 is characterized in that: The data in the verification request includes the KZG commitment to be verified, the proof data and the challenge value generated by the user.

6. The privacy protection method based on blockchain and KZG commitment according to claim 5, characterized in that: Verify the access requester's access rights to the verified KZG commitment and corresponding encrypted data based on data access control rules, the access requester's identity and permissions, to achieve fine-grained data access control, including: According to the KZG commitment of the access request, the corresponding data access control rules are determined from the access control contract, and the access requester's permissions are verified; Based on the verification of the access requester, check whether the access request meets the relevant conditions in the data access control rules, including whether it is multi-signed and whether the request time is within the validity period of the rules, so as to achieve fine-grained data access control.

7. The privacy protection method based on blockchain and KZG commitment according to claim 6, characterized in that: The verification request process includes checking the identity and authority of the access requester and whether it complies with the set data access control rules.

8. A computing device, characterized in that include: one or more processors; A storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7.

9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a program, which, when executed by a processor, implements the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Method based on polynomial commitment, electronic equipment and readable storage medium

    CN117278213A

  • Verifiable outsourcing service calculation method based on block chain

    CN118316587A