Blockchain-based privacy intersection method and related apparatus
By storing real Merkle roots on the Ethereum blockchain and combining them with off-chain data transmission, the problems of data tampering and high cost in traditional privacy intersection techniques are solved, achieving efficient and secure intersection calculation and data protection.
Patent Information
- Application Number
- CN202510058749.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-14
- Publication Date
- 2025-11-11
- Estimated Expiration
- 2045-01-14
AI Technical Summary
In traditional privacy intersection techniques, the second hash set is easily tampered with during transmission, leading to errors in intersection calculation and failing to guarantee data integrity and privacy.
A blockchain-based privacy intersection method is adopted, which performs hash calculations and data verification on the Ethereum blockchain through the client and server. The XXH64 hash function is used to generate hash sets and mapping sets, and the real Merkle root is stored through a smart contract to ensure data integrity and privacy.
This approach ensures the accuracy and security of intersection calculations while guaranteeing data privacy, reduces data transmission costs, and improves the transparency and credibility of the system.
Smart Images

Figure CN119995823B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of privacy intersection technology, and in particular to a blockchain-based privacy intersection method and related apparatus. Background Technology
[0002] In today's big data and information society, data sharing and interaction have become crucial. In various scenarios (such as healthcare, finance, and e-commerce), different data holders need to calculate intersection data while ensuring privacy to obtain common business needs. This process requires the use of Private Set Intersection (PSI) technology, a cryptographic technique that allows two parties to find intersection data without exposing their complete data. That is, each party's data set can only know the public data without revealing the non-intersection parts, thus enabling intersection calculation while protecting data privacy.
[0003] The traditional privacy intersection technique works as follows: the client initiates a privacy intersection request, calculates the first hash set of the first data set provided by the client, and after receiving the privacy intersection request, the server calculates the second hash set of the second data set provided by the server and sends the second hash set to the client. The client then calculates the intersection of the first and second hash sets to complete the privacy intersection process. However, traditional privacy intersection techniques face the following challenges in practical applications: the second hash set is very likely to be tampered with by a third party during transmission, resulting in an incorrect intersection of the first and second hash sets, and the correct intersection data cannot be guaranteed. Summary of the Invention
[0004] The purpose of this application is to provide a blockchain-based privacy intersection method and related apparatus, which can verify the data integrity of a second dataset to ensure that the intersection data is correctly obtained.
[0005] To achieve the above objectives, this application provides the following solution:
[0006] In a first aspect, this application provides a blockchain-based privacy intersection system, which includes: a client and a server, both of which are nodes on the Ethereum blockchain;
[0007] The client initiates a privacy intersection task, performs hash calculations on the first data set to obtain the first hash set, records the mapping relationship between the hash values in the first hash set and the data in the first data set to obtain the mapping set, and sends the client's first Ethereum address to the server.
[0008] The server and client communicate with each other. When the server receives a privacy intersection task, it performs a hash calculation on the second data set to obtain a second hash set, calculates the real Merkle root of the second hash set, uploads the first Ethereum address, the real Merkle root, and the task number to the Ethereum blockchain, and sends the second hash set, the server's second Ethereum address, and the task number to the client. The task number is the unique identifier of the privacy intersection task.
[0009] The client is used to query the Ethereum blockchain based on the second Ethereum address and task number to obtain the real Merkle root, calculate the calculated Merkle root of the second hash set, and if the calculated Merkle root is the same as the real Merkle root, calculate the intersection of the first hash set and the second hash set. Based on the mapping set, the hash values in the intersection are converted into data to obtain the privacy intersection result.
[0010] Optionally, the client includes a first data processing module, a first data transmission module, a first blockchain interaction module, and a hash verification and intersection module;
[0011] The first data processing module is used to perform hash calculation on the first data set using the XXH64 hash function to obtain the first hash set, record the mapping relationship between the hash values in the first hash set and the data in the first data set to obtain the mapping set, and send the first hash set and the mapping set to the hash verification and intersection module.
[0012] The first data transmission module is used to send the client's first Ethereum address to the server;
[0013] The first blockchain interaction module is used to call a smart contract based on the second Ethereum address and task number to query the Ethereum blockchain, obtain the real Merkel root, and send the real Merkel root to the hash verification and intersection module.
[0014] The hash verification intersection module is used to calculate the calculated Merkle root of the second hash set. If the calculated Merkle root is the same as the real Merkle root, the intersection of the first hash set and the second hash set is calculated. Based on the mapping set, the hash values in the intersection are converted into data to obtain the privacy intersection result.
[0015] Optionally, the server includes a second data processing module, a second data transmission module, and a second blockchain interaction module;
[0016] The second data processing module is used to perform hash calculation on the second data set using the XXH64 hash function to obtain the second hash set, calculate the real Merkle root of the second hash set, and send the second hash set to the second data transmission module and the real Merkle root to the second blockchain interaction module.
[0017] The second data transmission module is used to send the second hash set, the server's second Ethereum address, and the task number to the client;
[0018] The second blockchain interaction module is used to call the smart contract and upload the first Ethereum address, the real Merkle root, and the task number to the Ethereum blockchain.
[0019] Secondly, this application provides a blockchain-based privacy intersection method, applied to the blockchain-based privacy intersection system described in any one of the above-mentioned methods, wherein the blockchain-based privacy intersection method includes:
[0020] Initiate a privacy-based intersection task, perform hash calculation on the first data set to obtain the first hash set, record the mapping relationship between the hash values in the first hash set and the data in the first data set to obtain the mapping set, and send the client's first Ethereum address to the server.
[0021] The client receives the second hash set, the server's second Ethereum address, and the task number returned by the server. Upon receiving a privacy intersection task, the server performs hash calculations on the second data set to obtain the second hash set, calculates the true Merkle root of the second hash set, uploads the first Ethereum address, the true Merkle root, and the task number to the Ethereum blockchain, and sends the second hash set, the server's second Ethereum address, and the task number to the client. The task number is the unique identifier for the privacy intersection task.
[0022] The Ethereum blockchain is queried based on the second Ethereum address and task number to obtain the real Merkle root. The Merkle root of the second hash set is then calculated. If the calculated Merkle root is the same as the real Merkle root, the intersection of the first hash set and the second hash set is calculated. The hash values in the intersection are then converted into data based on the mapping set to obtain the privacy intersection result.
[0023] Optionally, a hash calculation is performed on the first data set to obtain a first hash set, specifically including: performing a hash calculation on the first data set using the XXH64 hash function to obtain a first hash set.
[0024] Optionally, both the first data set and the second data set can be a single column of data, or both the first data set and the second data set can be a single row of data.
[0025] Optionally, after obtaining the privacy intersection result, if the server denies the existence of target data in the second data set, the blockchain-based privacy intersection method further includes: calculating the target hash value corresponding to the target data, determining the Merkel proof path corresponding to the target data based on the target hash value and the second hash set, and uploading the target hash value, Merkel proof path, task number, and second Ethereum address to the Ethereum blockchain; the Ethereum blockchain is used to calculate the target Merkel root based on the target hash value and the Merkel proof path, and if the target Merkel root is the same as the real Merkel root, then the target data belongs to the second data set.
[0026] Thirdly, this application provides a computer device, including: a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor executes the computer program to implement the blockchain-based privacy intersection method described in any one of the above.
[0027] Fourthly, this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the blockchain-based privacy intersection method described above.
[0028] Fifthly, this application provides a computer program product, including a computer program that, when executed by a processor, implements the blockchain-based privacy intersection method described above.
[0029] According to the specific embodiments provided in this application, this application has the following technical effects:
[0030] This application provides a blockchain-based privacy intersection method and related apparatus, including: a client and a server, both of which are nodes on the Ethereum blockchain. The client initiates a privacy intersection task, performs hash calculation on a first data set to obtain a first hash set, records the mapping relationship between the hash values in the first hash set and the data in the first data set to obtain a mapping set, and sends the client's first Ethereum address to the server. When the server receives the privacy intersection task, it performs hash calculation on a second data set to obtain a second hash set, calculates the real Merkle root of the second hash set, uploads the first Ethereum address, the real Merkle root, and the task number to the Ethereum blockchain, and sends the second hash set, the server's second Ethereum address, and the task number to the client. The client queries the Ethereum blockchain based on the second Ethereum address and the task number to obtain the real Merkle root, calculates the computed Merkle root of the second hash set, and if the computed Merkle root and the real Merkle root are the same, calculates the intersection of the first hash set and the second hash set, converts the hash values in the intersection into data based on the mapping set, and obtains the privacy intersection result. This application introduces blockchain technology to store the real Merkle root of the second hash set on the Ethereum blockchain and send the second hash set to the client off-chain. The client can query the real Merkle root from the Ethereum blockchain and verify the data integrity of the second hash set through the real Merkle root. After ensuring that the second hash set is correct, the intersection of the first hash set and the second hash set is calculated to ensure that the intersection data is correctly obtained, thereby improving the security and reliability of the privacy intersection technology. Attached Figure Description
[0031] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0032] Figure 1 This is a schematic diagram of the framework of a blockchain-based privacy intersection system provided in Embodiment 1 of this application.
[0033] Figure 2 This is a flowchart illustrating a blockchain-based privacy intersection method provided in Embodiment 2 of this application.
[0034] Figure 3 This is a schematic diagram of the structure of a computer device provided in Embodiment 3 of this application. Detailed Implementation
[0035] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0036] Example 1
[0037] This embodiment provides a blockchain-based privacy intersection system, which includes a client and a server, both of which are nodes on the Ethereum blockchain.
[0038] The client initiates a privacy-based intersection task, performs hash calculations on the first data set to obtain the first hash set, records the mapping relationship between the hash values in the first hash set and the data in the first data set to obtain the mapping set, and sends the client's first Ethereum address to the server.
[0039] The server and client communicate with each other. When the server receives a privacy intersection task, it performs a hash calculation on the second data set to obtain a second hash set, calculates the real Merkle root of the second hash set, uploads the first Ethereum address, the real Merkle root, and the task number to the Ethereum blockchain, and sends the second hash set, the server's second Ethereum address, and the task number to the client. The task number is a unique identifier for the privacy intersection task.
[0040] The client is used to query the Ethereum blockchain based on the second Ethereum address and task number to obtain the real Merkle root, calculate the calculated Merkle root of the second hash set, and if the calculated Merkle root is the same as the real Merkle root, calculate the intersection of the first hash set and the second hash set. Based on the mapping set, the hash values in the intersection are converted into data to obtain the privacy intersection result.
[0041] This embodiment of the privacy intersection system utilizes blockchain technology to achieve identity authentication and data integrity verification. It aims to protect a privacy intersection system based on the Ethereum blockchain. Specifically, the Ethereum blockchain is introduced into the privacy intersection process. In a single privacy intersection process, the main roles are a client (composed of mobile terminals) and a server (composed of server devices). Both the client and server are nodes on the Ethereum blockchain, capable of uploading and querying specified data. Leveraging the transparency and immutability of the Ethereum blockchain, the security of privacy data and the trustworthiness of the computation process are ensured. The specific method includes participants hashing their data and uploading it to the Ethereum blockchain, then performing the privacy intersection calculation off-chain. During the privacy intersection calculation, the authenticity and validity of the calculation are verified using data stored on the Ethereum blockchain. This method solves the data tampering problem in existing privacy intersection technologies and improves the security of privacy protection.
[0042] like Figure 1 As shown, the privacy intersection process in this embodiment is described as follows:
[0043] (1) The client initiates the task.
[0044] The client initiates a privacy intersection task. After the privacy intersection task is initiated, the client will perform a hash calculation on the specified first data set using the XXH64 hash function on its local device to generate the corresponding first hash set H. client Specifically, each piece of data in the first data set is hashed to obtain a hash value for each piece of data. All hash values are then combined to form the first hash set H. client And in generating the first hash set H client During the process, the data in the first data set and the first hash set H are recorded in real time. client The correspondence between hash values in the record, that is, the record of the first hash set H client The mapping relationship between hash values in the first data set and the data in the second data set is used to generate a mapping set MAP that maps hash values to the original data. client This is used for subsequent intersection operations.
[0045] It should be noted that a hash function is a mathematical algorithm that transforms an input of arbitrary length into a fixed-length output (called a hash value or digest). It is irreversible and is often used for data integrity verification and fast lookup. The hash function used in this embodiment is XXHash, specifically the XXH64 hash function. XXHash is an extremely fast non-encrypted hash algorithm designed for high-speed processing of large amounts of data. It is typically used to check data integrity and compare files. It features speed, low latency, and low collision rate, making it suitable for high-performance application scenarios.
[0046] At the same time, the client will send its first Ethereum address, Add, to the server. client Send the first Ethereum address Add client The purpose is to facilitate the accurate retrieval of the content required for this privacy intersection task on the Ethereum blockchain (also known as the Ethereum blockchain network) by combining information provided by the client and the server, that is, to find the true Merkle root E generated based on the server's second hash set. server .
[0047] It should be noted that the Ethereum blockchain is a decentralized blockchain platform that supports smart contracts. Users can develop and run applications on it without third parties. An Ethereum address is a user's unique identifier on the Ethereum blockchain, generated by the account's public key. It usually starts with "0x" followed by 40 hexadecimal characters and is used to receive and send Ether or interact with smart contracts. A smart contract is a self-executing program that runs on the blockchain and automatically executes transactions or operations according to pre-set rules without third-party intervention, and the execution results are public and transparent.
[0048] (2) The server performs data preprocessing.
[0049] On the local device, the server uses the XXH64 hash function to perform a hash calculation on the specified second data set that needs to be privacy-intersected with the first data set, and obtains the second hash set H. server Specifically, a hash calculation is performed on each piece of data in the second data set to obtain the hash value of each piece of data. All hash values are combined to form the second hash set H. server Meanwhile, the server constructs a second hash set H during the hash calculation process. server The corresponding Merkle Tree is a data structure that compresses a large amount of data into a unique root hash value through layer-by-layer hash calculation. By dividing the data into blocks and hashing each block, and then recursively combining adjacent hash values to calculate a new hash value, a unique root hash value (i.e., the Merkle Root) is generated. This data structure can effectively verify the integrity and consistency of any data block without checking the entire dataset. Therefore, Merkle Trees are used to verify data integrity. Merkle Trees constructed from different hash sets all have a unique Merkle Root, so the Merkle Root can be used to verify whether the data content has been tampered with.
[0050] The second hash set H is constructed after the hash calculation is completed. server The corresponding Merkle root R of the Merkle tree server The pending data will be uploaded to the Ethereum blockchain along with other data fields so that subsequent clients can use it to verify data integrity.
[0051] (3) The server sends verification information to the Ethereum blockchain.
[0052] The server will add the first Ethereum address received from the client. client Real Merkelgen R server And based on the addresses at both ends (i.e., the client's first Ethereum address Add) client Add the second Ethereum address on the server side server A unique task number M, generated from the client's first Ethereum address (Add) and other information, is uploaded to the Ethereum blockchain. The task number M can be set as needed, as long as one privacy request corresponds to one task number M. For example, it can be the client's first Ethereum address (Add). client Add the server's second Ethereum address server The upload time is used as the task number M. Real Merkelgen R server Once uploaded to the Ethereum blockchain, it cannot be tampered with. It can record past privacy-sharing tasks, serving as a reference for initiating subsequent privacy-sharing tasks, and it is a true Merklegen R... server The second hash set H, which is recorded on the Ethereum blockchain and cannot be tampered with, can be used to verify the transmission at any subsequent time. server The completeness of the content.
[0053] (4) The server sends the required content to the client.
[0054] The server will use the second hash set H server Add the server's second Ethereum address server The task number M is transmitted to the client, and this data helps the client obtain the real Merklegen R. server This is to perform the verification work and then execute the subsequent intersection operation.
[0055] Because data transfer on the Ethereum blockchain is costly and slow, it is not suitable for transferring large-scale data. The second hash set H... server Often, the data volume is very large, and using on-chain transmission would incur huge costs in terms of both money and time. Therefore, when transmitting this part of the content, the server and the client establish a network channel off-chain using protocols such as HTTP (Hypertext Transfer Protocol) to carry out fast and large-scale data transmission.
[0056] (5) The client queries and verifies the real Merkelgen.
[0057] In obtaining the second Ethereum address of the server in this privacy-sharing task, Add serverAfter the task number M, the client can use these parameters to call a smart contract on the Ethereum blockchain to quickly verify its identity and obtain the real Merkle root corresponding to this privacy-sensitive submission task. server .
[0058] The client has obtained the second hash set H through off-chain methods. server Therefore, it can be done on the local device based on the second hash set H. server Construct a Merkle tree to obtain a computational Merkle root R' server If there is R′ server =R server This indicates that the second hash set H obtained through off-chain transfer... server The data integrity is reliable, and subsequent intersection operations can be performed.
[0059] (6) The client finds the intersection and obtains the intersection data.
[0060] The client finds the first hash set H client With the second hash set H server Consistent hash entries (i.e., hash values) are generated within a set of data (i.e., the first data set and the second data set). These hash entries correspond to the hash values of the same data (also called elements) in the two sets of data specified at both ends. This is achieved through a mapping set MAP. client Consistent hash entries can be mapped back to their corresponding original data. The client records this data as the privacy intersection result, which is then output as a file to the local path specified by the client. During this process, the server cannot obtain the intersection content, and the client cannot obtain other data from the server except for the same data, thus maximizing the protection of data privacy and security.
[0061] In this embodiment, the client initiates the privacy intersection task, performs identity verification on the Ethereum blockchain through a smart contract, obtains the real Merkle root uploaded by the server, and performs data integrity verification and intersection operation on the local device. The server is the provider of the privacy intersection data, and sends the real Merkle root used to verify data integrity to the Ethereum blockchain through a smart contract. The two parties can transform into each other in different privacy intersection tasks, and the final privacy intersection result will be output to the client's local device.
[0062] The following, combined with Figure 1 The following is an introduction to the various modules in the client and server:
[0063] (a) Client.
[0064] (1) First data processing module.
[0065] Input a column of data from a specified dataset as the first data set. The first data processing module will generate a corresponding hash value for each data in the first data set by using the XXH64 hash function, thus obtaining the first hash set. It will also store the mapping from the hash value to the original data, thus obtaining a mapping set, so as to quickly recover the original data content of the intersection after finding the intersection.
[0066] (2) First blockchain interaction module.
[0067] The first blockchain interaction module uses the received second Ethereum address and task number from the server as parameters to call a smart contract to retrieve the real Merkle root uploaded by the server to the Ethereum blockchain, thereby verifying data integrity. When the server denies that the provided second data set contains a certain target data, the first blockchain interaction module can also verify the validity of the Merkle proof path by having the client actively specify the target hash value and corresponding Merkle proof path for that target data, thus determining whether the target data exists in the second data set provided by the server. The steps are as follows:
[0068] 1) After completing the privacy intersection, the client first calculates the target hash value H(D) of the target data that the server denies. Then, using the complete second hash set provided by the server, the client generates a Merkel proof path layer by layer according to the Merkel tree construction rules. The generation process is as follows: First, locate the position of the target hash value H(D) of the target data in the second hash set and use it as the starting point of the leaf node; then, determine the hash values of its sibling nodes at each level and record them sequentially, thus forming the Merkel proof path P = [H...]. sibling1 H sibling2 H siblingN ], H sibling1 For its sibling node in layer 1, H sibling2 For its sibling node in the second layer, H siblingN Let H(D) be the target hash value of the target data. The first layer is the layer containing the target hash value of the target data. The second layer is the layer below the first layer in the direction from the first layer to the root node. The Nth layer is the layer above the root node. For example, for the target hash value H(D) of the target data, in the first layer, the hash value H of its sibling node (the node that shares the same parent node and is located in the same layer) is used. sibling1 Add it to the path, at level 2, the hash value H of its parent node's sibling node. sibling2 Add it to the path, and so on, until the root node.
[0069] 2) After obtaining the complete Merkle proof path, the client combines the target hash value H(D) of the target data with the Merkle proof path P to construct the Merkle Proof, which is then submitted to the Ethereum blockchain for verification.
[0070] 3) The client takes the target hash value H(D) of the target data and the calculated Merkel proof path P as parameters, and uploads these parameters, task number and the second Ethereum address of the server to the Ethereum blockchain by calling the smart contract on the Ethereum blockchain.
[0071] 4) After receiving the target hash value H(D), Merkle proof path P, task number, and second Ethereum address of the target data uploaded by the client, the smart contract, according to the construction rules of the Merkle tree, starts from the target hash value H(D) of the target data and recursively calculates the hash value H of the parent node layer by layer based on the Merkle proof path P. parent =H(H) current ||H sibling ) or H parent =H(H) sibling ||H current ), H current H is the hash value of the current node (i.e., the node corresponding to the target hash value of the target data and its parent node). sibling The hash value of the sibling node is used until the root hash value (i.e., the target Merkle root) H is finally calculated. calculated .
[0072] 5) The smart contract retrieves the real Merkle root corresponding to the task number and the second Ethereum address from the Ethereum blockchain. server The calculated target Merkelgen H calculated With the real Merkle root stored on the Ethereum blockchain server The two sets are compared. If they are the same, it means that the target data exists in the second set of data; if they are different, it means that the target data does not exist in the second set of data.
[0073] 6) Finally, the smart contract returns verification status information to the client based on the verification result, and records the verification process and results in the Ethereum blockchain to ensure that the whole process is open, transparent and tamper-proof, providing the client with a reliable verification basis.
[0074] (3) First data transmission module.
[0075] The first data transmission module is responsible for transmitting the client's first Ethereum address to the server off-chain. This first Ethereum address will be used by the client to perform identity verification and obtain the real Merkle root on the Ethereum blockchain.
[0076] (4) Hash verification and intersection module.
[0077] The hash verification intersection module calculates the calculated Merkle root of the second hash set. If the calculated Merkle root is the same as the real Merkle root, the intersection of the first hash set and the second hash set is calculated. Based on the mapping set, the hash values in the intersection are converted into data to obtain the privacy intersection result.
[0078] (ii) Server side.
[0079] (1) Second data processing module.
[0080] Input a column of data from a specified dataset as the second data set. The second data processing module will generate a corresponding hash value for each data in the second data set by using the XXH64 hash function, resulting in a second hash set. A Merkle tree is constructed from the hash values in the generated second hash set to generate the real Merkle root. The second hash set will be transmitted to the client through the second data transmission module, and the real Merkle root will be uploaded to the Ethereum blockchain through the second blockchain interaction module.
[0081] The formula for calculating the Merkle root can be expressed as:
[0082] Merkle Root=H(…H(H(D1)||H(D2))||H(H(D3)||H(D4))…||H(H(DN-1)||H(DN))…);
[0083] The above formula can be broken down into the following steps:
[0084] 1) Leaf node hash: Perform hash calculation on each data block to generate the hash value of the leaf node, for example, H(D1), H(D2), ..., where H represents the hash function, such as XXH64.
[0085] 2) Recursively calculate the parent node: Combine the hash values of two adjacent leaf nodes, then perform hash calculation to generate the hash value of the parent node. For example, the first leaf node and the second leaf node are combined to generate the first parent node H(H(D1)||H(D2)), where || represents the concatenation operation.
[0086] 3) Continue recursively until the root node: repeatedly combine the hash values of adjacent nodes and perform hash calculations until only the hash value of the root node remains. This value is the real Merkle root.
[0087] (2) Second blockchain interaction module.
[0088] The second blockchain interaction module is responsible for sending the real Merkle root generated by the second data processing module, the first Ethereum address sent by the client, and the unique task number generated based on the addresses of both parties and other parameters to the Ethereum blockchain by calling the smart contract. It waits for the client to interact with the Ethereum blockchain to obtain the real Merkle root or verify whether a certain target data exists in the second data set.
[0089] (3) Second data transmission module.
[0090] The second data transmission module establishes a data transmission channel via the HTTP protocol, quickly transmitting the server's second Ethereum address, task number, and second hash set off-chain to the client.
[0091] In this embodiment, the client includes a first data processing module, a first data transmission module, a first blockchain interaction module, and a hash verification and intersection module.
[0092] The first data processing module is used to perform hash calculation on the first data set using the XXH64 hash function to obtain the first hash set, record the mapping relationship between the hash values in the first hash set and the data in the first data set to obtain the mapping set, and send the first hash set and the mapping set to the hash verification and intersection module.
[0093] The first data transmission module is used to send the client's first Ethereum address to the server.
[0094] The first blockchain interaction module is used to call a smart contract based on the second Ethereum address and task number to query the Ethereum blockchain, obtain the real Merkle root, and send the real Merkle root to the hash verification and intersection module.
[0095] The hash verification intersection module is used to calculate the calculated Merkle root of the second hash set. If the calculated Merkle root is the same as the real Merkle root, the intersection of the first hash set and the second hash set is calculated. Based on the mapping set, the hash values in the intersection are converted into data to obtain the privacy intersection result.
[0096] The server includes a second data processing module, a second data transmission module, and a second blockchain interaction module.
[0097] The second data processing module is used to perform hash calculation on the second data set using the XXH64 hash function to obtain the second hash set, calculate the real Merkle root of the second hash set, send the second hash set to the second data transmission module, and send the real Merkle root to the second blockchain interaction module.
[0098] The second data transmission module is used to send the second hash set, the server's second Ethereum address, and the task number to the client.
[0099] The second blockchain interaction module is used to call the smart contract and upload the first Ethereum address, the real Merkle root, and the task number to the Ethereum blockchain.
[0100] Compared to existing privacy-preserving intersection techniques, this embodiment combines blockchain technology with off-chain data transmission schemes, significantly improving the security of privacy protection, the effectiveness of data integrity verification, and the efficiency of data transmission. Specific technical effects are as follows:
[0101] (1) Efficient data integrity verification.
[0102] This embodiment leverages the immutability of blockchain to record the real Merkle root of the second hash set on the Ethereum blockchain. The real Merkle root is generated by calculating the hash values in the second hash set layer by layer and is closely related to each hash value in the second hash set. Therefore, by simply recording the real Merkle root on the Ethereum blockchain, the integrity and immutability of all hash values in the second hash set can be ensured. Clients can query the real Merkle root and verify data integrity through the Ethereum blockchain without storing the complete second hash set on the chain, thus improving the convenience and credibility of evidence storage.
[0103] (2) Optimization of data privacy protection and interaction efficiency.
[0104] Traditional blockchain solutions are costly and slow to transmit large-scale data. This embodiment stores minimal data (real Merkle root) on-chain and uses off-chain communication protocols (such as HTTP) to transmit a second hash set, avoiding the high cost of large-scale data transmission on-chain. Clients can directly verify data integrity locally through off-chain data. This design significantly reduces data transmission costs and achieves secure and efficient data interaction through the combination of on-chain and off-chain methods.
[0105] (3) Flexible identity authentication and task tracking.
[0106] This embodiment designs a smart contract for identity authentication and data tracking. Each privacy-sharing task generates a unique task number and identity information record on the blockchain. Flexible identity authentication is achieved through smart contract calls, allowing clients to quickly verify and trace historical privacy-sharing tasks by task number, thereby increasing the system's security and transparency.
[0107] (4) Security of privacy-sensitive intersection results.
[0108] The system only allows clients to access elements in the intersection; other non-intersection parts cannot be leaked. By performing hash intersection operations on the data sets off-chain and utilizing the mapping relationship (the client's hash value is mapped to the original data), the client can quickly recover the intersection data while ensuring the security of the server's data. The server cannot access the intersection content, thus protecting the privacy of both parties' data.
[0109] In summary, this embodiment, by innovatively combining blockchain and privacy intersection technology, overcomes the problems of difficult data integrity verification, high data transmission costs, and incomplete privacy protection in traditional privacy intersection technologies, and provides an efficient, reliable, and highly secure privacy intersection solution.
[0110] Traditional privacy intersection techniques suffer from high computational and communication overhead. This is because they primarily rely on high-density cryptographic methods such as homomorphic encryption and Secure Multi-Party Computation (MPC). While these methods protect privacy, they often generate significant computational and communication burdens, especially in big data processing environments, limiting the practical application of privacy intersection techniques. To address this issue, this embodiment introduces the XXH64 hash function, which can improve computational efficiency, solve the problem of high computational overhead, and generate a smaller amount of data in the computation result, thus solving the problem of high communication overhead.
[0111] Traditional privacy intersection techniques also suffer from the problem of difficulty in monitoring data tampering. This is because traditional privacy intersection techniques are difficult to effectively prevent data tampering, especially in multi-party collaborative computing scenarios. It is difficult to guarantee the authenticity and integrity of the data of the participating parties. Once a participant tampers with the data, the intersection calculation result will be affected, and it is difficult to trace the source of the problem. To address this issue, in this embodiment, when the server denies that the second data set it provides contains a certain target data, the client can actively specify the target hash value of the target data and the corresponding Merkle proof path to verify whether the Merkle proof path is valid, thereby determining whether the target data exists in the second data set provided by the server, thus preventing the tampering of the second data set.
[0112] Currently, no mature technology can effectively combine blockchain with privacy intersection technology to achieve both data integrity verification and privacy protection. Traditional privacy intersection technologies mostly rely on cryptographic methods, such as homomorphic encryption and multi-party secure computation. While these methods offer some degree of data privacy, they fail to provide effective protection against data tampering and reliable authentication. Furthermore, traditional privacy intersection technologies incur high computational and communication costs when processing large-scale data. In contrast, privacy intersection solutions combined with blockchain technology can provide an efficient and low-cost solution through on-chain notarization and off-chain data processing. Therefore, privacy intersection systems incorporating blockchain technology are innovative and unique in the current technological context.
[0113] This embodiment proposes a privacy-preserving intersection system that combines blockchain technology to achieve dual protection of data security and integrity. The immutability and transparency of blockchain enable effective monitoring of the authenticity of data submissions during data sharing. At the same time, the combination of blockchain and off-chain data transmission schemes achieves efficient computation and data transmission while reducing the high costs of on-chain storage and communication. The introduction of smart contracts not only enhances the flexibility of task tracking and identity authentication but also improves the overall system security and operability.
[0114] Example 2
[0115] This embodiment provides a blockchain-based privacy-preserving intersection method, such as... Figure 2 As shown, the blockchain-based privacy intersection method includes:
[0116] S1: Initiate a privacy-based intersection task, perform hash calculation on the first data set to obtain the first hash set, record the mapping relationship between the hash values in the first hash set and the data in the first data set to obtain the mapping set, and send the client's first Ethereum address to the server.
[0117] S2: Receive the second hash set, the server's second Ethereum address, and the task number returned by the server; the server is used to perform hash calculation on the second data set when it receives the privacy intersection task, obtain the second hash set, calculate the real Merkle root of the second hash set, upload the first Ethereum address, the real Merkle root, and the task number to the Ethereum blockchain, and send the second hash set, the server's second Ethereum address, and the task number to the client; the task number is the unique identifier of the privacy intersection task.
[0118] S3: Based on the second Ethereum address and task number, query the Ethereum blockchain to obtain the real Merkle root, calculate the calculated Merkle root of the second hash set. If the calculated Merkle root is the same as the real Merkle root, calculate the intersection of the first hash set and the second hash set, and convert the hash values in the intersection into data based on the mapping set to obtain the privacy intersection result.
[0119] Specifically, the process of performing a hash calculation on the first data set to obtain the first hash set includes: using the XXH64 hash function to perform a hash calculation on the first data set to obtain the first hash set.
[0120] In this case, both the first data set and the second data set are either a single column of data, or both the first data set and the second data set are a single row of data.
[0121] After obtaining the privacy intersection result, if the server denies the existence of the target data in the second data set, the privacy intersection method based on blockchain in this embodiment further includes: calculating the target hash value corresponding to the target data, determining the Merkel proof path corresponding to the target data based on the target hash value and the second hash set, uploading the target hash value, the Merkel proof path, the task number, and the second Ethereum address to the Ethereum blockchain, and using the Ethereum blockchain to calculate the target Merkel root based on the target hash value and the Merkel proof path. If the target Merkel root is the same as the real Merkel root, then the target data belongs to the second data set.
[0122] Example 3
[0123] In one exemplary embodiment, a computer device is provided, which may be a server or a terminal, and its internal structure diagram may be as follows. Figure 3 As shown, the computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores data. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. When the computer program is executed by the processor, it implements the blockchain-based privacy intersection method described in Example 2.
[0124] Those skilled in the art will understand that Figure 3 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0125] In one exemplary embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the blockchain-based privacy intersection method of embodiment 2.
[0126] Example 4
[0127] In one exemplary embodiment, a computer-readable storage medium is provided storing a computer program that, when executed by a processor, implements the blockchain-based privacy intersection method of embodiment 2.
[0128] Example 5
[0129] In one exemplary embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the blockchain-based privacy intersection method of embodiment 2.
[0130] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.
[0131] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0132] This document uses specific examples to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. Furthermore, those skilled in the art will recognize that, based on the ideas of this application, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A blockchain-based privacy-preserving intersection system, characterized in that, The blockchain-based privacy-preserving intersection system includes: a client and a server, both of which are nodes on the Ethereum blockchain; The client initiates a privacy intersection task, performs hash calculations on the first data set to obtain the first hash set, records the mapping relationship between the hash values in the first hash set and the data in the first data set to obtain the mapping set, and sends the client's first Ethereum address to the server. The server and client communicate with each other. When the server receives a privacy intersection task, it performs a hash calculation on the second data set to obtain a second hash set, calculates the real Merkle root of the second hash set, uploads the first Ethereum address, the real Merkle root, and the task number to the Ethereum blockchain, and sends the second hash set, the server's second Ethereum address, and the task number to the client. The task number is the unique identifier of the privacy intersection task. The client is used to query the Ethereum blockchain based on the second Ethereum address and task number to obtain the real Merkle root, calculate the calculated Merkle root of the second hash set, and if the calculated Merkle root is the same as the real Merkle root, calculate the intersection of the first hash set and the second hash set. Based on the mapping set, the hash values in the intersection are converted into data to obtain the privacy intersection result.
2. The blockchain-based privacy intersection system according to claim 1, characterized in that, The client includes a first data processing module, a first data transmission module, a first blockchain interaction module, and a hash verification and intersection module; The first data processing module is used to perform hash calculation on the first data set using the XXH64 hash function to obtain the first hash set, record the mapping relationship between the hash values in the first hash set and the data in the first data set to obtain the mapping set, and send the first hash set and the mapping set to the hash verification and intersection module. The first data transmission module is used to send the client's first Ethereum address to the server; The first blockchain interaction module is used to call a smart contract based on the second Ethereum address and task number to query the Ethereum blockchain, obtain the real Merkel root, and send the real Merkel root to the hash verification and intersection module. The hash verification intersection module is used to calculate the calculated Merkle root of the second hash set. If the calculated Merkle root is the same as the real Merkle root, the intersection of the first hash set and the second hash set is calculated. Based on the mapping set, the hash values in the intersection are converted into data to obtain the privacy intersection result.
3. The blockchain-based privacy intersection system according to claim 1, characterized in that, The server includes a second data processing module, a second data transmission module, and a second blockchain interaction module; The second data processing module is used to perform hash calculation on the second data set using the XXH64 hash function to obtain the second hash set, calculate the real Merkle root of the second hash set, and send the second hash set to the second data transmission module and the real Merkle root to the second blockchain interaction module. The second data transmission module is used to send the second hash set, the server's second Ethereum address, and the task number to the client; The second blockchain interaction module is used to call the smart contract and upload the first Ethereum address, the real Merkle root, and the task number to the Ethereum blockchain.
4. A blockchain-based privacy intersection method, applied to the blockchain-based privacy intersection system according to any one of claims 1-3, characterized in that, The blockchain-based privacy intersection method includes: Initiate a privacy-based intersection task, perform hash calculation on the first data set to obtain the first hash set, record the mapping relationship between the hash values in the first hash set and the data in the first data set to obtain the mapping set, and send the client's first Ethereum address to the server. The client receives the second hash set, the server's second Ethereum address, and the task number returned by the server. Upon receiving a privacy intersection task, the server performs hash calculations on the second data set to obtain the second hash set, calculates the true Merkle root of the second hash set, uploads the first Ethereum address, the true Merkle root, and the task number to the Ethereum blockchain, and sends the second hash set, the server's second Ethereum address, and the task number to the client. The task number is the unique identifier for the privacy intersection task. The Ethereum blockchain is queried based on the second Ethereum address and task number to obtain the real Merkle root. The Merkle root of the second hash set is then calculated. If the calculated Merkle root is the same as the real Merkle root, the intersection of the first hash set and the second hash set is calculated. The hash values in the intersection are then converted into data based on the mapping set to obtain the privacy intersection result.
5. The blockchain-based privacy intersection method according to claim 4, characterized in that, Perform hash calculation on the first data set to obtain the first hash set. Specifically, this includes: performing hash calculation on the first data set using the XXH64 hash function to obtain the first hash set.
6. The blockchain-based privacy intersection method according to claim 5, characterized in that, The first data set and the second data set are both columns of data, or the first data set and the second data set are both rows of data.
7. The blockchain-based privacy intersection method according to claim 4, characterized in that, After obtaining the privacy intersection result, if the server denies the existence of the target data in the second data set, the blockchain-based privacy intersection method further includes: calculating the target hash value corresponding to the target data, determining the Merkel proof path corresponding to the target data based on the target hash value and the second hash set, and uploading the target hash value, Merkel proof path, task number, and second Ethereum address to the Ethereum blockchain; the Ethereum blockchain is used to calculate the target Merkel root based on the target hash value and the Merkel proof path. If the target Merkel root is the same as the real Merkel root, then the target data belongs to the second data set.
8. A computer device, comprising: A memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that the processor executes the computer program to implement the blockchain-based privacy intersection method according to any one of claims 4-7.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the blockchain-based privacy intersection method according to any one of claims 4-7.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the blockchain-based privacy intersection method according to any one of claims 4-7.
Citation Information
Patent Citations
Trusted privacy set intersection method and device based on block chain, and server
CN118074921A
Asset certification method and device
CN118396751A