Data query method and device based on blockchain network, and electronic device
Through the combination of blockchain network and anonymous query smart contracts, the data security problem of financial institutions when querying customer information is solved, the data anonymous query and secure calculation are realized, and the security and reliability of data query are enhanced.
Patent Information
- Application Number
- CN202210488244.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-06
- Publication Date
- 2025-08-15
- Estimated Expiration
- 2042-05-06
AI Technical Summary
When financial institutions query customer information, the existing technology cannot guarantee data security, especially when collusion between multiple servers poses a risk of privacy leakage, and cannot perform effective statistical calculations.
The data query method based on blockchain network is adopted to calculate the target data through anonymous query smart contracts, and the data statistical results are encrypted using the public key of the query end node to ensure that the data is cleaned after synchronization, and combined with cryptography technology and blockchain smart contracts to realize the anonymous query and secure calculation of data.
It realizes the security and privacy of data during the query process, prevents data leakage, and supports statistical calculation of data, enhancing the security and reliability of data query.
Smart Images

Figure CN114880366B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of blockchain technology, and in particular to a data query method and device, and electronic equipment based on a blockchain network. Background Art
[0002] In related technologies, when financial institutions query the rating information, credit information, product sales information, and actual resource usage information (for example, actual electricity consumption statistics) of corporate financing customers, the query technology they adopt is mostly based on oblivious transmission, and the security of anonymous queries is enhanced through technologies such as MD5 hash bucketing or data obfuscation. At the same time, in order to solve the problem of large-scale data queries, 2 / 4 / 8 server optimization methods are adopted.
[0003] Existing query methods typically only perform queries, but fail to perform statistical calculations on the query results. This requires the use of a trusted third-party platform, which increases the risk of data leakage. Furthermore, typical anonymous queries return large amounts of data. While this data cannot be decrypted, it remains with the querying party. If retained for an extended period, this data could pose a data leakage risk. When querying large databases, multiple query servers are used. If these servers collude, data leakage can occur, ultimately leading to privacy breaches.
[0004] To address the above-mentioned problems, no effective solutions have been proposed so far. Summary of the Invention
[0005] The embodiments of the present invention provide a data query method and device, and an electronic device based on a blockchain network, so as to at least solve the technical problem in related technologies that financial institutions cannot guarantee data security when querying customer information.
[0006] According to one aspect of an embodiment of the present invention, a data query method based on a blockchain network is provided, which is applied to a data blockchain node in a blockchain network, wherein the data blockchain node and the query end node have previously established a link relationship, comprising: receiving a data query request initiated by the query end node, wherein the data query request carries a data identifier of target data to be queried and a plurality of random sets of data elements, each of the random sets of data elements carrying data information and capacity information of the target data obtained from a data directory published on the blockchain network; responding to the data query request, obtaining the target data from a privacy database of a data service end, and performing statistical calculations on the target data to be queried using the contract code in a pre-configured anonymous query smart contract to obtain data statistical results, wherein the data stored in the privacy database is private domain isolated data; encrypting the data statistical results using the public key of the query end node, and synchronizing the encrypted data statistical results to the query end node; and upon confirming that all data statistical results have been synchronized to the query end node, clearing the data statistical results in the data blockchain node.
[0007] Optionally, before receiving the data query request initiated by the query end node, it also includes: receiving metadata information sent by the data service end, wherein the metadata information includes at least one of the following: data unique identification, data introduction, data field information, data volume, authorization policy, usage scenario and data ownership object.
[0008] Optionally, after receiving the data query request initiated by the query end node, it also includes: extracting the metadata information carried in the data query request; determining the data ownership object of the target data based on the metadata information; obtaining the contact information associated with the data ownership object in the notification system; pushing data query notification to the data ownership object based on the contact information; receiving the data authorization instruction of the data ownership object; and confirming that the query end node has the right to use the data when the data authorization instruction indicates consent to the authorization, wherein, when the query end node has the right to use the data, it can obtain data capacity information from the privacy database of the data service end.
[0009] Optionally, before receiving the data query request initiated by the query end node, the method further includes: receiving a contract deployment request submitted by a contract deployer, wherein the contract deployment request carries at least: a to-be-published anonymous query smart contract and a contract scope; responding to the contract deployment request, sending a contract deployment notification to each institutional entity contact object within the contract scope; receiving a contract review instruction transmitted by each of the institutional entity contact objects; and starting to deploy the anonymous query smart contract within the contract scope when the contract review instruction indicates that all institutional entity contacts within the contract scope agree to deploy the anonymous query smart contract.
[0010] Optionally, before receiving the contract deployment request submitted by the contract deployer, it also includes: after the anonymous query smart contract is written, the contract deployer uses a pre-configured contract publishing device to generate the contract identifier, contract scope, access rights, contract code, interface name, and input parameter format of the anonymous query smart contract.
[0011] Optionally, the step of starting to deploy the anonymous query smart contract within the contract scope includes: using a pre-configured contract deployment device to scan the contract code of the anonymous query smart contract to obtain a contract scanning result; performing a contract detection on the contract scanning result to obtain a contract detection result; when the contract detection result indicates that there is no problem with the contract code of the anonymous query smart contract, using the contract deployment device to start deploying the anonymous query smart contract within the contract scope.
[0012] Optionally, before receiving the data query request initiated by the query end node, it also includes: receiving a data publishing request transmitted by the data provider, wherein the data publishing request carries: the data to be published and data attribute information, and the data attribute information includes at least one of the following: data ownership object, data profile, data category, data table name, table field name, authorization policy, data connection method; responding to the data publishing request, generating a data identifier for the data to be published; synchronizing the data to be published, the data attribute information and the data identifier to all nodes on the blockchain network, and updating the data directory in the blockchain network.
[0013] Optionally, a state database is pre-deployed on the blockchain network, and the state database records at least one of the following information: object information of the institutional entity's contact object, data query records, data operation records, contract information of the smart contract, metadata information, and data authorization information.
[0014] Optionally, the data blockchain node in the blockchain network is deployed with an offline preload component, and the offline preload component is connected to the privacy database of the data server.
[0015] According to another aspect of an embodiment of the present invention, a data query method based on a blockchain network is also provided, which is applied to a data blockchain node in a blockchain network, wherein a link relationship has been established in advance between the data blockchain node and the query end node, and comprises: receiving a data query request initiated by the query end node, wherein the data query request carries the target data to be queried and a target data set obtained from a privacy database of a data service end, wherein the target data set carries data information and capacity information of other data after excluding the target data, and the data stored in the privacy database is private domain isolated data; responding to the data query request, reading each data in the target data set, and performing statistical calculations on each data in the target data set using the contract code in a pre-configured anonymous query smart contract to obtain data statistical results; encrypting the data statistical results using the public key of the query end node, and synchronizing the encrypted data statistical results to the query end node; and clearing the data statistical results in the data blockchain node after confirming that all data statistical results are synchronized to the query end node.
[0016] Optionally, the data blockchain node in the blockchain network is deployed with an online preload component, and the online preload component is connected to the privacy database of the data server.
[0017] According to another aspect of an embodiment of the present invention, a data query device based on a blockchain network is provided, which is applied to a data blockchain node in a blockchain network, wherein the data blockchain node and a query end node have previously established a link relationship, and includes: a first receiving unit, configured to receive a data query request initiated by the query end node, wherein the data query request carries a data identifier of target data to be queried and a plurality of random sets of data elements, each of the random sets of data elements carrying data information and capacity information of the target data obtained from a data directory published on the blockchain network; a first statistical unit, configured to respond to the data query request, obtain the target data from a privacy database of a data service end, and perform statistical calculations on the target data to be queried using contract code in a pre-configured anonymous query smart contract to obtain data statistical results, wherein the data stored in the privacy database is private domain isolated data; a first encryption unit, configured to encrypt the data statistical results using the public key of the query end node and synchronize the encrypted data statistical results to the query end node; and a first cleaning unit, configured to clean up the data statistical results in the data blockchain node upon confirming that all data statistical results have been synchronized to the query end node.
[0018] Optionally, the data query device based on the blockchain network also includes: a first receiving module, used to receive metadata information sent by the data service end before receiving the data query request initiated by the query end node, wherein the metadata information includes at least one of the following: data unique identification, data introduction, data field information, data volume, authorization policy, usage scenario and data ownership object.
[0019] Optionally, the data query device based on the blockchain network also includes: a first extraction module, used to extract the metadata information carried in the data query request after receiving the data query request initiated by the query end node; a first determination module, used to determine the data ownership object of the target data based on the metadata information; obtain the contact information associated with the data ownership object in the notification system; a first push module, used to push the data query notification to the data ownership object based on the contact information; a second receiving module, used to receive the data authorization instruction of the data ownership object; a second determination module, used to confirm that the query end node has the right to use the data when the data authorization instruction indicates consent to the authorization, wherein, when the query end node has the right to use the data, it can obtain data capacity information from the privacy database of the data service end.
[0020] Optionally, the data query device based on the blockchain network also includes: a third receiving module, used to receive a contract deployment request submitted by the contract deployer before receiving the data query request initiated by the query end node, wherein the contract deployment request carries at least: the anonymous query smart contract to be published and the contract scope; a second push module, used to respond to the contract deployment request and send a contract deployment notification to each institutional entity contact object within the contract scope; a fourth receiving module, used to receive a contract review instruction transmitted by each of the institutional entity contact objects; a first deployment module, used to start deploying the anonymous query smart contract within the contract scope when the contract review instruction indicates that all institutional entity contacts within the contract scope agree to deploy the anonymous query smart contract.
[0021] Optionally, the data query device based on the blockchain network also includes: a first generation module, which is used to generate the contract identifier, contract scope, access rights, contract code, interface name, and input parameter format of the anonymous query smart contract by the contract deployer using a pre-configured contract publishing device before receiving the contract deployment request submitted by the contract deployer, after the anonymous query smart contract is written.
[0022] Optionally, the first deployment module includes: a first scanning submodule, used to use a pre-configured contract deployment device to scan the contract code of the stealth query smart contract to obtain a contract scanning result; a first detection submodule, used to perform contract detection on the contract scanning result to obtain a contract detection result; a first deployment submodule, used to use the contract deployment device to start deploying the stealth query smart contract within the contract scope when the contract detection result indicates that there is no problem with the contract code of the stealth query smart contract.
[0023] Optionally, the data query device based on the blockchain network also includes: a fifth receiving module, which is used to receive a data publishing request transmitted by the data provider before receiving the data query request initiated by the query end node, wherein the data publishing request carries: data to be published and data attribute information, and the data attribute information includes at least one of the following: data ownership object, data profile, data category, data table name, table field name, authorization policy, and data connection method; a second generating module, which is used to respond to the data publishing request and generate a data identifier for the data to be published; synchronize the data to be published, the data attribute information and the data identifier to all nodes on the blockchain network, and update the data directory in the blockchain network.
[0024] Optionally, a state database is pre-deployed on the blockchain network, and the state database records at least one of the following information: object information of the institutional entity's contact object, data query records, data operation records, contract information of the smart contract, metadata information, and data authorization information.
[0025] Optionally, the data blockchain node in the blockchain network is deployed with an offline preload component, and the offline preload component is connected to the privacy database of the data server.
[0026] According to another aspect of an embodiment of the present invention, a data query device based on a blockchain network is also provided, which is applied to a data blockchain node in a blockchain network, wherein the data blockchain node and the query end node have pre-established a link relationship, comprising: a second receiving unit, configured to receive a data query request initiated by the query end node, wherein the data query request carries target data to be queried and a target data set obtained from a privacy database of a data service end, the target data set carries data information and capacity information of other data after excluding the target data, and the data stored in the privacy database is private domain isolated data; a second statistical unit, configured to respond to the data query request, read each data in the target data set, and perform statistical calculations on each data in the target data set using the contract code in a pre-configured anonymous query smart contract to obtain data statistical results; a second encryption unit, configured to encrypt the data statistical results using the public key of the query end node and synchronize the encrypted data statistical results to the query end node; and a second cleaning unit, configured to clean up the data statistical results in the data blockchain node after confirming that all data statistical results have been synchronized to the query end node.
[0027] Optionally, the data blockchain node in the blockchain network is deployed with an online preload component, and the online preload component is connected to the privacy database of the data server.
[0028] According to another aspect of an embodiment of the present invention, an electronic device is also provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute any one of the above-mentioned blockchain network-based data query methods by executing the executable instructions.
[0029] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is further provided, wherein the computer-readable storage medium includes a stored computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute any one of the above-mentioned blockchain network-based data query methods.
[0030] In an embodiment of the present invention, a data query request initiated by a query end node is received, the query request is responded to, target data is retrieved from a privacy database on a data server, and statistical calculations are performed on the target data to be queried using the contract code in a pre-configured anonymous query smart contract to obtain statistical results. The statistical results are encrypted using the public key of the query end node and synchronized to the query end node. After confirming that all statistical results have been synchronized to the query end node, the statistical results in the data blockchain node are cleared. In this embodiment, cryptographic techniques and blockchain smart contracts are combined to implement anonymous query statistics. While performing anonymous queries, statistical calculations can be performed on encrypted data. Blockchain technology is utilized to enhance data security during anonymous query statistics, thereby resolving the technical issue in related technologies where financial institutions are unable to guarantee data security when querying customer information. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0032] Figure 1 is a schematic diagram of an optional deployment of a blockchain network according to an embodiment of the present invention;
[0033] Figure 2 is a flowchart of an optional data query method based on a blockchain network according to an embodiment of the present invention;
[0034] Figure 3 This is a flowchart of an optional contract review and contract release according to an embodiment of the present invention;
[0035] Figure 4 is a flow chart of an optional data release authorization application according to an embodiment of the present invention;
[0036] Figure 5 is a schematic diagram of an optional blockchain node according to an embodiment of the present invention;
[0037] Figure 6 is a flowchart of another optional data query method based on a blockchain network according to an embodiment of the present invention;
[0038] Figure 7 2 is a schematic diagram of an optional data query device based on a blockchain network according to an embodiment of the present invention;
[0039] Figure 8 is a schematic diagram of another optional data query device based on a blockchain network according to an embodiment of the present invention;
[0040] Figure 9 This is a hardware structure block diagram of an electronic device (or mobile device) according to a data query method based on a blockchain network according to an embodiment of the present invention. DETAILED DESCRIPTION
[0041] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.
[0042] It should be noted that the terms "first", "second", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0043] It should be noted that the data query method and device based on the blockchain network in the present disclosure can be used in the field of financial technology to process data queries, and can also be used in any field other than the field of financial technology to process data queries. The present disclosure does not limit the application field of the data query method and device based on the blockchain network.
[0044] It should be noted that the relevant information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for display and analysis, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties. For example, an interface is set up between this system and the relevant user or organization. Before obtaining relevant information, it is necessary to send an acquisition request to the aforementioned user or organization through the interface, and obtain the relevant information after receiving the consent information fed back by the aforementioned user or organization.
[0045] The following embodiments of the present invention can be applied to various information query systems, applications or devices. For example, banking and financial institutions can securely obtain actual electricity consumption statistics of corporate financing customers at power grid companies, and apply them to daily monitoring and prevention of credit risks and duration management, and form customer electricity credit information through continuous data analysis, which can be extended to the customer's rating and credit management at banking and financial institutions, thereby improving credit management efficiency and actively playing the role of financial support services in the real economy.
[0046] In the present invention, anonymous query statistics can be realized based on cryptographic technology and blockchain smart contracts, and encrypted data can be calculated and counted while anonymous queries are being realized; blockchain technology is used to enhance the security of anonymous query statistics, including automatic cleanup of encrypted query results and tracking of encrypted data copies; blockchain technology is used to realize data authorization supervision, statistical logic auditing, data processing monitoring, and abnormal alarms.
[0047] The following is a schematic description of the blockchain network and implementation environment involved in each embodiment of the present invention.
[0048] Figure 1 is a schematic diagram of an optional deployment blockchain network according to an embodiment of the present invention, such as Figure 1 As shown, the blockchain network includes multiple blockchain nodes 1. The blockchain network is connected to banking financial institutions and data service providers (for example, power grid companies). Banking institutions deploy one "blockchain node" and power grid companies deploy two "blockchain nodes". All "blockchain nodes" are peer nodes, and the two "blockchain nodes" of the data service provider cannot collude with each other, which is guaranteed by the blockchain mechanism.
[0049] In the following embodiments of the present invention, a blockchain network established by a financial institution and a data provider is used to illustrate the present invention. A power grid company, acting as the data service provider, must deploy two nodes on the data service provider (a 2-server model, comprising a server1 blockchain node and a server2 blockchain node, with server1 responsible for anonymous queries during the offline phase and server2 responsible for anonymous queries during the online phase). Data authorization rules are determined through offline negotiation. Then, either party issues a data authorization contract and designates the contract's valid subjects (e.g., a financial institution and a power grid company). The designated subject user completes registration on the blockchain in advance and reserves contact information (e.g., a mobile phone number or email address). Once the data authorization contract is successfully published on the blockchain, the relevant subject users are automatically notified for processing. After the subject user reviews the authorization contract and agrees with no objections, they vote to notify the blockchain of their approval of the contract's deployment.
[0050] Blockchain technology is used to solve the problem of collusion between server1 and server2, and the behavior of server2 is constrained by the open and transparent nature of blockchain.
[0051] Before using the anonymous query and statistics function, financial institutions and data service providers must use data authorization contracts to publish and retrieve data, apply for data use, and confirm data authorization. To use the anonymous query and statistics function, the data querying party, i.e., the bank or financial institution, must first publish the anonymous query and statistics contract. The contract's functions include anonymous queries and encrypted statistical calculations of query results. Similarly, after successful on-chain publication, the blockchain will notify the administrator of the data service provider to review the contract. Once the administrator approves the contract, they will send a deployment authorization instruction to the blockchain, completing the deployment of the anonymous query and statistics contract.
[0052] When using the anonymous query statistics function, this embodiment is divided into two phases: offline and online. In the offline phase: First, the data querying party divides the service database size N into M sets S, with the indices 0, 1, ..., N-1. The number of elements in each set S is sqr(N) (i.e., the square root of N). These generated sets are then sent to the anonymous query statistics contract of the server1 blockchain node of the data service provider. The server1 node contract extracts the corresponding database data based on the set partitioning, executes the statistical calculation code, compresses the statistical results, and generates a temporary key to encrypt the compressed result. The encrypted data is then uploaded to the blockchain network (the data querying party's blockchain trusted domain) and the temporary key is returned to the data querying party's node.
[0053] For the online stage: the data query party removes the data ID to be queried from the corresponding set and sends the temporary key corresponding to the set to the anonymous query statistics contract of the server2 blockchain node of the data service provider. After receiving the query set, the server2 node contract takes out the corresponding element in the set and executes the statistical calculation code, and also performs encryption processing. Then, statistical calculation is performed through the statistical calculation logic part of the anonymous query statistics contract, and then compression and modulus processing are performed as with server1. Then, it flows to the blockchain node contract of the trusted domain of the data query party. The contract sums and moduloses it with the compression result obtained by server1 previously stored in the trusted domain to obtain the data to be queried, and finally returns the final result to the data query party.
[0054] The following combination Figure 1 The present invention is described in detail with reference to the accompanying drawings and various embodiments.
[0055] Example 1
[0056] According to an embodiment of the present invention, an embodiment of a data query method based on a blockchain network is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in an order different from that shown here.
[0057] An embodiment of the present invention provides a data query method based on a blockchain network, which is applied to a data blockchain node in the blockchain network, and a link relationship is pre-established between the data blockchain node and the query end node.
[0058] The data blockchain node involved in this embodiment can be a blockchain node loaded with an offline preloaded component, that is, the data blockchain node in the blockchain network is deployed with an offline preloaded component, and the offline preloaded component is connected to the first privacy database of the data server.
[0059] The privacy database in this embodiment primarily stores off-chain private data, including the service provider's queryable private data, the query provider's pre-loaded private data, and encryption keys. This data is private, isolated, and inaccessible to the outside world and monitored by the blockchain.
[0060] This embodiment combines the following Figure 2 First, let me explain the offline query method.
[0061] Figure 2 This is a flowchart of an optional data query method based on a blockchain network according to an embodiment of the present invention. Figure 2 As shown, the method includes the following steps:
[0062] Step S201: Receive a data query request initiated by a query end node, wherein the data query request carries a data identifier of the target data to be queried and a plurality of random sets of data elements, each of which carries data information and capacity information of the target data obtained from a published data directory on the blockchain network;
[0063] Step S202: Respond to the data query request, obtain the target data from the privacy database of the data server, and use the contract code in the pre-configured anonymous query smart contract to perform statistical calculations on the target data to obtain data statistical results. The data stored in the privacy database is private domain isolated data.
[0064] Step S203: encrypt the data statistical results using the public key of the query end node, and synchronize the encrypted data statistical results to the query end node;
[0065] Step S204: After confirming that all data statistical results are synchronized to the query end node, clean up the data statistical results in the data blockchain node.
[0066] Through the above steps, a data query request initiated by a query end node can be received, the data query request can be responded to, the target data can be obtained from the privacy database of the data service end, and the contract code in the pre-configured anonymous query smart contract can be used to perform statistical calculations on the target data to be queried, thereby obtaining data statistical results. The data statistical results can be encrypted using the public key of the query end node and synchronized to the query end node. After confirming that all data statistical results have been synchronized to the query end node, the data statistical results in the data blockchain node are cleared. In this embodiment, cryptographic technology and blockchain smart contracts can be combined to implement anonymous data query statistics. While implementing anonymous queries, calculations and statistics can be performed on encrypted data. Blockchain technology is used to enhance data security during anonymous query statistics, thereby resolving the technical problem in related technologies that financial institutions cannot guarantee data security when querying customer information.
[0067] Optionally, before receiving a data query request initiated by a query end node, the method includes: receiving metadata information sent by a data service end, wherein the metadata information includes at least one of the following: data unique identifier, data introduction, data field information, data volume, authorization policy, usage scenario and data ownership object.
[0068] Before performing a data query, it is necessary to ensure that the blockchain node has the right to use the data. The blockchain node needs to obtain data authorization. In this embodiment, data authorization can be achieved through a blockchain smart contract. Through the form of a functional interface, the caller can use the corresponding function by specifying the specific function name. The data service provider first uses the data publishing function to publish the metadata information of the data to be opened to the blockchain. The published information includes but is not limited to: the unique identifier of the data, the data description, the data field information, the data volume, the available authorization methods, the available usage scenarios, and the data owner. At the same time, the contact information of the data owner is registered in the notification system. The data user uses the query interface to query the data list information on the current blockchain.
[0069] The unique identifier of the data may include but is not limited to: data number, data character, data storage address, etc.
[0070] Before performing a data query, the smart contract published to the blockchain needs to be reviewed. As an optional implementation method of this embodiment, before receiving the data query request initiated by the query end node, the method further includes: receiving a contract deployment request submitted by the contract deployer, wherein the contract deployment request carries at least: the anonymous query smart contract to be published and the contract scope; responding to the contract deployment request, sending a contract deployment notification to each institutional entity contact object within the contract scope; receiving a contract review instruction transmitted by each institutional entity contact object; and starting to deploy the anonymous query smart contract within the contract scope when the contract review instruction indicates that all institutional entity contacts within the contract scope agree to deploy the anonymous query smart contract.
[0071] As another optional embodiment of this embodiment, before receiving the contract deployment request submitted by the contract deployer, it also includes: after the anonymous query smart contract is written, the contract deployer uses a pre-configured contract publishing device to generate the contract identifier, contract scope, access rights, contract code, interface name, and input parameter format of the anonymous query smart contract.
[0072] Optionally, the step of starting to deploy the stealth query smart contract within the contract scope includes: using a pre-configured contract deployment device to scan the contract code of the stealth query smart contract to obtain a contract scanning result; performing a contract test on the contract scanning result to obtain a contract test result; when the contract test result indicates that there is no problem with the contract code of the stealth query smart contract, using the contract deployment device to start deploying the stealth query smart contract within the contract scope.
[0073] To audit smart contracts published to the blockchain, contracts subject to review include, but are not limited to, data authorization contracts and anonymous query statistics contracts. All code or programs involving data manipulation and calculations must undergo review and must pass multiple reviews before they can be deployed and run on the blockchain. First, the contract deployer submits a contract deployment request to the blockchain network and specifies the contract scope. Upon receiving the deployment request, the blockchain forwards it to the contacts of each institutional entity within the contract scope. Upon receiving the contract review request, each contact reviews the contract content and, upon confirmation, sends a consent instruction to the blockchain. Once the blockchain network receives consent from all entities within the scope, it begins deploying the smart contract.
[0074] Figure 3 This is a flow chart of an optional contract review and contract release according to an embodiment of the present invention. Figure 3 As shown, including:
[0075] Step S301: The contract issuer prepares the smart contract, including writing, compiling, and testing;
[0076] Step S302: Initiate a contract release request to the blockchain through the contract release device; the contract release device refers to the blockchain SDK, which integrates contract release query, data release query, contract transaction, etc. The functional devices used by the following user client are all provided by this SDK, specifying the contract unique ID, release scope, access rights, contract code, interface name, input parameter format, etc.
[0077] Step S303: After receiving the request, the blockchain network calls the contract review module for processing. After receiving the request, the blockchain network determines the type of request. If the request type is determined to be a contract release request, the request is forwarded to the contract review module for processing.
[0078] Step S304: After receiving the contract release request, the contract review module parses the contract release request and forwards the contract review information and contract code to the notification module. After parsing the request parameters, the contract review object can be determined based on the release scope (the release scope is determined when the blockchain consortium network is established and stored in the blockchain network's state database, which can be directly obtained from the chain). The contract review information includes but is not limited to: the contract unique ID, access rights, and the identity information of the review object;
[0079] Optionally, a state database is pre-deployed on the blockchain network, and the state database records at least one of the following information: object information of the institutional entity's contact object, data query records, data operation records, contract information of the smart contract, metadata information, and data authorization information.
[0080] In this embodiment, the state database primarily stores the blockchain network status, including information about the current blockchain network's institutional nodes, data query records, data operation records, contract information, data metadata, and data authorization information. This data is publicly available and transparent, and some can be used for auditing purposes.
[0081] Step S305: The notification module obtains the contact information of the audit subject's identity information based on the contract audit information and sends a contract audit notification to the contact. After obtaining the contract audit information, the notification module can obtain the contact information of the corresponding identity (e.g., mobile phone number or email address) from the state database. The contact information is registered on the blockchain by the alliance organization and stored in the state database. Different notification engines are used to send the contract audit notification to the contact according to the contact information.
[0082] Step S306: The corresponding contact receives the contract review notification and first obtains the contract-related information and contract code from the blockchain through the contract review device (SDK). After the review is passed, the contract review device then sends an instruction to approve the contract deployment to the blockchain. The instruction to approve the contract deployment is also sent to the blockchain in the form of a request, and the contract unique ID is specified in the request message.
[0083] Step S307: The blockchain receives the request and determines that it is a contract deployment consent instruction based on the request type. The request is forwarded to the contract review module. The contract review module parses the request and receives the deployment consent instruction for the specified contract ID. It checks whether all the review objects in the release scope in step S304 have collected the deployment consent instruction. If not, it continues to wait. If so, it triggers the contract deployment device to start deploying the smart contract.
[0084] Step S308: The contract deployment device scans, compiles, and checks the contract code. If no problems are found, it begins to deploy the smart contract on the blockchain nodes within the specified range.
[0085] Step S309: The contract issuer can use the contract query device (SDK) to query the release status of the contract through the contract unique ID, including unreviewed, under review, under deployment, deployment failed or deployment successful.
[0086] When the blockchain audits contracts and deploys smart contracts, it is also necessary to apply for authorization for the published data.
[0087] As an optional implementation method of this embodiment, before receiving the data query request initiated by the query end node, it also includes: receiving a data publishing request transmitted by the data provider, wherein the data publishing request carries: data to be published and data attribute information, and the data attribute information includes at least one of the following: data ownership object, data profile, data category, data table name, table field name, authorization policy, and data connection method; responding to the data publishing request, generating a data identifier for the data to be published; synchronizing the data to be published, data attribute information, and data identifier to all nodes on the blockchain network, and updating the data directory in the blockchain network.
[0088] Figure 4 FIG. 1 is a flow chart of an optional data release authorization application according to an embodiment of the present invention. Figure 4 As shown, the following steps are included:
[0089] Step S401: The data subject prepares the data and stores it in a blockchain privacy database. This privacy database is an off-chain privacy database and cannot be directly accessed on the chain.
[0090] Step S402: The data party sends a data publishing request to the blockchain through the data publishing device (SDK). The request information must include the data owner, data profile, data category, data table name, table field name, what calculations the data can be used for, authorization method (authorization can be based on duration or number of uses), data connection method, etc.
[0091] Step S403: After receiving the request, the blockchain synchronizes it to all nodes on the blockchain network. After receiving the request, the blockchain network will first determine the request type. If the request type is a data release request, a unique ID will be generated for the data. The consensus process will then begin, and the data will be synchronized to all nodes on the blockchain network. The data will eventually be stored in the state database for on-chain access.
[0092] Step S404: The data user obtains the data directory information published on the chain through the data query device (SDK), determines whether it is the data they need based on the data description and purpose, and saves the ID of the data entry;
[0093] Step S405: The data user uses the data authorization application device (SDK) to initiate a data authorization application request to the blockchain using the data entry ID obtained in step S404;
[0094] Step S406: After receiving the request, the blockchain determines that it is a data authorization application request based on the request type and sends it to the data authorization module;
[0095] Step S407: After receiving the request, the data authorization module sends a data authorization application notification to the contact. The data authorization module begins parsing the request parameters. First, based on the data entry ID, it retrieves the data information of the corresponding entry from the status database, finds the identity of the data owner, and sends the identity information and application request to the notification module. The notification module then finds the contact information corresponding to the identity and sends the data authorization application notification to the contact.
[0096] Step S408: After receiving the authorization application notification, the data owner first obtains the detailed information of the authorization request through the data authorization device. After reviewing and approving the request, the owner initiates a request for authorization to the blockchain, which includes the specific authorization method.
[0097] Step S409: After receiving the request, the blockchain determines that it is a data authorization request based on the request type and forwards the request to the data authorization module. After receiving the authorization instruction, the module opens data permissions to the user who applied for use and records it in the status database. During the subsequent data use process, the blockchain will verify it according to the authorization method. If there is no authorization or the authorization has expired, the data cannot be used.
[0098] The following combines the above Figures 2 to 4The embodiments of the present invention are further described with reference to the implementation steps of the present invention.
[0099] Step S201: Receive a data query request initiated by a query end node, wherein the data query request carries a data identifier of the target data to be queried and a plurality of random sets of data elements, each random set of data elements carries data information and capacity information of the target data obtained from a data directory published on the blockchain network.
[0100] The querying party / querying end can obtain the element information and capacity information n of the queried data from the data directory published on the blockchain, and generate a random set of data elements And the size of each set S The generated aggregate information is sent to the querying party's local blockchain node (i.e., the query end node mentioned above) through the anonymous query request device (SDK); after receiving the request, the query end node sends this aggregate information to the data party's blockchain node through the blockchain link (including consensus, contract execution and other steps. Such steps are to record the query action on the blockchain and will not save the relevant query data on the chain). At the same time, this aggregate information needs to be saved in the local first privacy database.
[0101] Optionally, after receiving the data query request initiated by the query end node, it also includes: extracting metadata information carried in the data query request; determining the data ownership object of the target data based on the metadata information; obtaining the contact information of the associated data ownership object in the notification system; pushing the data query notification to the data ownership object based on the contact information; receiving the data authorization instruction of the data ownership object; and confirming that the query end node has the right to use the data when the data authorization instruction indicates consent to the authorization, wherein, when the query end node has the right to use the data, it can obtain data capacity information from the privacy database of the data service end.
[0102] After the data user determines the data they wish to use, they upload the data's unique identifier, data authorization method, user information, and usage scenarios to the blockchain through the data application function. Upon receiving the data application request and detecting that the requested data belongs to a certain right holder, the blockchain forwards the application information to the notification module, which proactively notifies the right holder through the data right holder's registered contact information. The right holder receives the application information, reviews it, and, after approval, uses the data authorization function to upload the authorization consent instruction to the blockchain. During subsequent data usage, the blockchain will first determine whether the user has the right to use the data, whether the permission has expired, or whether there has been any unauthorized behavior. This allows for effective and secure monitoring of data usage to ensure legal and compliant data use.
[0103] In step S202, in response to the data query request, the target data is obtained from the privacy database of the data server, and the contract code in the pre-configured anonymous query smart contract is used to perform statistical calculations on the target data to obtain data statistical results. The data stored in the privacy database is private domain isolated data.
[0104] In this embodiment, after receiving the request, the data party blockchain node executes the anonymous query statistics contract, obtains data from the local first privacy database, and then performs statistical calculations based on the joint statistical code logic in the anonymous query smart contract.
[0105] Step S203: encrypt the data statistical result using the public key of the query end node, and synchronize the encrypted data statistical result to the query end node.
[0106] After completing the statistical calculation, the encryption component can be used to encrypt the statistical result data and divide it into S1, S2, ... Sm. Assuming that each statistical result is X, h1, h2, ... hm are calculated.
[0107]
[0108] After encryption is completed, the public key of the querying party's blockchain node (referred to as the querying end node) is used to encrypt h1, h2, ...hm respectively.
[0109] Step S204: After confirming that all data statistical results are synchronized to the query end node, clean up the data statistical results in the data blockchain node.
[0110] The data party blockchain node returns the encrypted calculation result to the query end node. After receiving the result, the query end node uses its own private key to decrypt the returned result and saves h1, h2, ...hm to the local first privacy database. At the same time, the query end node starts the privacy data file monitoring program to monitor file copying, editing, modification, and moving operations. After confirming that the query end node has received the result information, the data party blockchain node uses the data automatic cleaning module to clean up the generated data.
[0111] The following is a schematic illustration of the blockchain nodes involved in the embodiments of the present invention.
[0112] Figure 5 is a schematic diagram of an optional blockchain node according to an embodiment of the present invention, such as Figure 5 As shown, the blockchain node includes: a data authorization module 501, a contract audit module 502, an anonymous query statistics module 503, a data automatic cleaning module 504, an intelligent notification module 505, a status database 506 and a privacy database 507.
[0113] The data authorization module 501 is primarily implemented through blockchain smart contracts, and its functions include data release, data application, and data authorization. Through a functional interface, the caller accesses the corresponding function by specifying the specific function name. The data service provider first uses the data release function to publish the metadata of the data to be released to the blockchain. This information includes the data's unique identifier, data description, data field information, data volume, available authorization methods, available usage scenarios, and data owner. Simultaneously, the intelligent notification module 505 registers the data owner's contact information with the notification system. Data users use the query interface to query the data list on the current blockchain. After determining the data to be used, the data user uses the data application function to upload the application information, including the data's unique identifier, data authorization method, user information, and usage scenarios, to the blockchain. Upon receiving the data application request and detecting that the requested data belongs to a specific owner, the blockchain forwards the application information to the intelligent notification module 505, which proactively pushes a notification to the owner using the data owner's registered contact information. After the owner receives the application information and approves it, they use the data authorization function to upload the authorization consent instruction to the blockchain. In the subsequent data usage process, the blockchain will first determine whether the user has the right to use the data, whether the usage rights have expired or there is any unauthorized behavior. It can effectively and securely monitor the data usage process to ensure the legality and compliance of data use.
[0114] The contract audit module 502 primarily audits smart contracts published to the blockchain. Contracts subject to audit include data authorization contracts and anonymous query statistics contracts. Code or programs designed for data manipulation and calculations also need to be audited. Only after passing multiple audits can they be deployed and run on the blockchain. First, the contract deployer submits a contract deployment request to the blockchain and specifies the contract scope. Upon receiving the deployment request, the blockchain forwards it to the smart notification module 505, which then uses the institution's registration information to notify the contacts of each institutional entity within the contract scope. Upon receiving the contract audit request, each contact reviews the contract content requested for publication and, upon confirmation, sends a consent instruction to the blockchain approving the contract deployment. Once the blockchain receives the consent instructions from all entities within the scope, it begins deploying the smart contract.
[0115] The anonymous query statistics module 503 includes an "offline preload component 131," an "online query component 132," and an "encryption component 133." This module is primarily implemented through a smart contract, namely the anonymous query statistics contract. This smart contract deployment also requires approval from the contract audit module 502 and the smart notification module 505 before it can be deployed on-chain.
[0116] During the initial deployment phase of the blockchain network, the data service provider (in this technical solution, the power grid company) will deploy two blockchain nodes. The data service provider will designate one node to deploy the "offline preload component 131" and the other to deploy the "online query component 132." Due to security concerns, this setting cannot be altered. This setting is achieved through consensus among all parties through the blockchain and then stored on the chain. Neither party can arbitrarily change this setting unless they compromise the blockchain consensus. Furthermore, the offline preload blockchain node and the online query blockchain node cannot collude. Private data is physically isolated and stored in their respective private databases 507. The data is encrypted, making it impossible for the data service provider to decrypt it without the key. Simultaneously, the automatic data cleanup module 504 will regularly clean the private database 507. The blockchain also monitors the copying of private data 507. Any copying of private data is recorded on the blockchain and notified to the relevant entity's contact via the intelligent notification module 505.
[0117] The offline preload component 131 will perform a full encrypted preload of the data to be checked by the data service provider, and then update it regularly. The data service provider will provide data capacity information during the data release process. The data query party will first query the data capacity information through the data directory released on the chain (note that this operation must be performed after completing data authorization). Assuming that there is a data set D: x∈{0, 1}n, n is the data capacity size, the data query party uses the "encryption component 133" SDK to generate a random set And the size of each set S Then S1, S2, ... Sm are sent to the local blockchain node of the data party. After receiving the offline preloading request, the local blockchain node of the data party forwards the request to the offline preloading node of the data service party. After receiving the request, the offline preloading node starts to call the anonymous query statistics contract. The contract first obtains data from the data service party (note that the data here is not obtained on the chain, nor will it be transmitted to the chain, but is obtained through the off-chain privacy database 17). Then, statistical calculations are performed according to the joint statistical code logic in the contract. The statistical result data is then encrypted using the "encryption component 133" and divided according to S1, S2, ... Sm. Assuming that each statistical result is X, h1, h2, ... hm are calculated.
[0118]
[0119] After encryption is complete, the offline preloaded blockchain node uses the public key of the querying blockchain node to encrypt h1, h2, …hm, respectively. It then synchronizes the encrypted data to the data querying blockchain node. After confirming successful synchronization, the "automatic data cleanup module 504" begins to clean up the offline preloaded node. This step ensures that the online querying blockchain node cannot obtain the query set information S for the data query preload from the offline preloaded node. At the same time, the data querying blockchain node has a file event monitoring process. Any modification, copying, or cutting of the encrypted result data will be detected and recorded on the blockchain, and made public to other nodes for subsequent accountability.
[0120] The online query component 132 mainly involves the online query blockchain node of the data service provider, which is also implemented through the anonymous query statistics contract (note that this is actually the same contract called by the offline preloaded node, but the blockchain system will execute different built-in code function modules according to different identity roles). The data query party first sends a query request to the local blockchain node, informing it of the data Xi to be queried (note that this process is carried out within the local security domain of the query party and will not leak the query data). After receiving the request, the local blockchain node finds the set Sj where the query data is located, removes the element Xi from the set Sj to obtain Sj'=Sj / {i}, and then forwards Sj' to the online query node of the data service provider. After receiving the request, the online query node takes out each element from Sj' in turn, and then performs statistical calculations through the statistical code logic of the anonymous query statistics contract. The obtained statistical results are encrypted using the "encryption component 133". Assuming that the encryption processing result is a, then,
[0121]
[0122] Then use the public key of the querying party's blockchain node to encrypt a, and send the encrypted result to the blockchain node of the data querying party. After receiving a, the blockchain node of the querying party first uses its own private key to decrypt the data, and then uses "encryption component 133" to perform the decryption operation to obtain the query result Xi, that is,
[0123] X i =h j +a mod 2;
[0124]
[0125] Since all elements except Xi are multiples of 2 after addition, modulo 2 will result in 0, leaving Xi as the query result. The blockchain node then returns the query result to the querying user.
[0126] The automatic data cleanup module 504 is primarily responsible for regularly cleaning up blockchain system data. This cleanup includes data generated by user queries and keys, and the cleanup function is automatically triggered. This module also has a data copy detection function. By monitoring file operation instructions on the system, it determines whether there are any data copying or modification operations, and then issues an alarm.
[0127] The intelligent notification module 505 is mainly responsible for event and alarm notifications, including contract audit notifications, data authorization application notifications, data anomaly alarms, data copy leakage alarms, etc.
[0128] The state database 506 primarily stores the blockchain world state, including information about the current blockchain network's institutional nodes, data query records, data operation records, contract information, data metadata, and data authorization information. This data is publicly available and transparent, and some can be used for auditing purposes.
[0129] The privacy database 507 primarily stores off-chain private data, including the service provider's queryable private data, the query party's pre-loaded private data, encryption keys, etc. This data is private, isolated, and inaccessible to the outside world. It is monitored by the blockchain.
[0130] The following combines the above Figure 5 A specific offline data query method is schematically illustrated.
[0131] Optionally, an embodiment of the present invention provides an implementation plan for an offline phase of anonymous query statistics. The steps of the offline phase of anonymous query statistics include:
[0132] Step 11: The querying party generates a random set of data elements;
[0133] The querying party can refer to the user or the terminal where the financial institution staff works. The querying party can obtain the element information and capacity information n of the queried data from the data directory published on the blockchain. First, a random set of data elements is generated. And the size of each set S
[0134] Step 12: Send the generated random set of data elements to the querying party’s local blockchain node via the anonymous query request device (SDK);
[0135] Step 13: After receiving the request, the querying party's local blockchain node sends the aggregate information to the data party's blockchain node. This aggregate information is sent to the data party's blockchain node 1 through the blockchain link (including consensus, contract execution, and other steps. These steps are to record the query action on the blockchain and do not save the relevant query data on the chain). At the same time, this aggregate information needs to be saved in the local "privacy database 17";
[0136] Step 14: After receiving the request, the data party blockchain node 1 executes the anonymous query statistics contract, obtains data from the local "privacy database 17", performs statistical calculations according to the joint statistical code logic in the contract, and then uses the encryption component to encrypt the statistical result data and divide it into S1, S2, ... Sm. Assuming that each statistical result is X, calculate h1, h2, ... hm,
[0137]
[0138] After encryption is completed, use the public key of the querying party's blockchain node to encrypt h1, h2, ...hm respectively;
[0139] Step 15: The data party's blockchain node 1 returns the encrypted calculation result to the query party's local blockchain node;
[0140] Step 16: After receiving the result, the querying party's local blockchain node decrypts the returned result using its own private key and saves h1, h2, ...hm to the local privacy database;
[0141] Step 17: The local blockchain node of the querying party starts the private data file monitoring program, monitoring operations such as copying, editing, modifying, and moving the file;
[0142] Step 18: After confirming that the query party's local blockchain node has received the result information, the data party blockchain node 1 uses the data automatic cleaning module to clean up the data generated in step 14.
[0143] In the embodiment of the present invention, anonymous query statistics are realized through smart contracts, and anonymous query data can be statistically calculated to obtain corresponding summary results, thereby enriching the anonymous query function.
[0144] In an embodiment of the present invention, full-process collaboration and monitoring of anonymous queries are achieved through blockchain. The anonymous query process is monitored and access is restricted by the blockchain. Any illegal operations will be recorded on the blockchain, including illegal access to nodes, illegal access to databases, and illegal copying of private data. The anonymous query statistical contract requires multi-party review on the chain, and data directory information and authorization information are published publicly through the blockchain, with strong consistency and validity.
[0145] In the embodiment of the present invention, the anonymous query security of the 2-server model is enhanced by blockchain technology. The anonymous query parties (data party and query party) use the anonymous query function of the blockchain to prevent collusion between servers. Any cheating behavior will be recorded on the blockchain and cannot be denied.
[0146] The present invention is schematically described below in conjunction with another optional embodiment.
[0147] Example 2
[0148] An embodiment of the present invention provides a data query method based on a blockchain network, which is applied to a data blockchain node in the blockchain network, and a link relationship is pre-established between the data blockchain node and the query end node.
[0149] The data blockchain node involved in this embodiment can be a blockchain node loaded with an online preloaded component, that is, the data blockchain node in the blockchain network is deployed with an online preloaded component, and the online preloaded component is connected to the second privacy database of the data server.
[0150] The second privacy database in this embodiment of the present invention stores off-chain private data, including the service provider's queryable private data, the query party's pre-loaded private data, encryption keys, and more. This data is private, isolated, and inaccessible to the outside world and monitored by the blockchain.
[0151] This embodiment combines the following Figure 6 Explain how to make an online inquiry.
[0152] Figure 6 1 is a flowchart of another optional data query method based on a blockchain network according to an embodiment of the present invention, comprising:
[0153] Step S602: Receive a data query request initiated by a query end node. The data query request carries the target data to be queried and a target data set obtained from the privacy database of the data server. The target data set carries data information and capacity information of other data after the target data is removed. The data stored in the privacy database is private domain isolated data.
[0154] Step S604: respond to the data query request, read each data in the target data set, and use the contract code in the pre-configured anonymous query smart contract to perform statistical calculations on each data in the target data set to obtain data statistical results;
[0155] Step S606: Encrypt the data statistics result using the public key of the query end node, and synchronize the encrypted data statistics result to the query end node;
[0156] Step S608: After confirming that all data statistical results are synchronized to the query end node, the data statistical results in the data blockchain node are cleared.
[0157] Through the above steps, a data query request initiated by a query end node can be received, the query request can be responded to, each data item in the target data set can be read, and the contract code in a pre-configured anonymous query smart contract can be used to perform statistical calculations on each data item in the target data set to obtain data statistical results. The data statistical results can then be encrypted using the public key of the query end node and synchronized to the query end node. After confirming that all data statistical results have been synchronized to the query end node, the data statistical results in the data blockchain node can be cleared. In this embodiment, cryptographic technology and blockchain smart contracts can be combined to implement anonymous query statistics for data. While implementing anonymous queries, calculations and statistics can be performed on encrypted data. Blockchain technology is used to enhance data security during anonymous query statistics, thereby resolving the technical problem in related technologies where financial institutions cannot guarantee data security when querying customer information.
[0158] Optionally, the data blockchain nodes in the blockchain network are deployed with online preloaded components, and the online preloaded components are connected to the privacy database of the data server.
[0159] The following combination Figure 5 A detailed method of anonymous query statistics in the online phase is illustrated.
[0160] The online phase of anonymous query statistics process steps are as follows:
[0161] Step 21: The querying party determines the element to be queried and sends the element to be queried to the local blockchain node via the anonymous query initiator (SDK);
[0162] Step 22: After receiving the query element, the querying party's local blockchain node first obtains the step set information from the privacy database, finds the set where the query element is located, removes the element from the set, and obtains a new set;
[0163] Step 23: Send the obtained new set to the data party's blockchain node 2 through the blockchain link;
[0164] Step 24: After receiving the request, the data party blockchain node 2 executes the anonymous query statistics contract, takes each element from the new set in turn, and then performs statistical calculations using the statistical code logic of the anonymous query statistics contract. The obtained statistical results are encrypted using the encryption component. Assuming that the encrypted processing result is a, then,
[0165]
[0166] Then encrypt a using the public key of the querying party's blockchain node;
[0167] Step 25: The data party's blockchain node 2 sends the encryption result a to the data query party's blockchain node;
[0168] Step 26: After receiving the result information, the querying blockchain node first decrypts the result using its own private key, and then obtains the previously saved set calculation encryption result information from the local second privacy database;
[0169] Step 27: Use the encryption component to perform a decryption calculation operation on the result obtained in step 26 to obtain the query result Xi, that is,
[0170] X i =h j +a mod 2;
[0171]
[0172] Since all elements except Xi are multiples of 2 after addition, mod 2 will result in 0, and the remaining Xi is the query result;
[0173] Step 28: The local blockchain node of the querying party returns the query result information to the querying party.
[0174] The present invention is described below in conjunction with another optional embodiment.
[0175] Example 3
[0176] This embodiment provides a data query device based on a blockchain network. The various implementation units included in the data query device correspond to the various implementation steps in the above-mentioned embodiment one.
[0177] This embodiment provides a data query device based on a blockchain network, which is applied to a data blockchain node in the blockchain network. A link relationship has been established in advance between the data blockchain node and the query end node.
[0178] The data blockchain node involved in this embodiment can be a blockchain node loaded with an offline preloaded component, that is, the data blockchain node in the blockchain network is deployed with an offline preloaded component, and the offline preloaded component is connected to the first privacy database of the data server.
[0179] The privacy database in this embodiment primarily stores off-chain private data, including the service provider's queryable private data, the query provider's pre-loaded private data, and encryption keys. This data is private, isolated, and inaccessible to the outside world and monitored by the blockchain.
[0180] Figure 7is a schematic diagram of an optional data query device based on a blockchain network according to an embodiment of the present invention. Figure 7 As shown, the data query device includes: a first receiving unit 71, a first statistical unit 72, a first encryption unit 73, and a first cleaning unit 74, wherein:
[0181] A first receiving unit 71 is configured to receive a data query request initiated by a query end node, wherein the data query request carries a data identifier of target data to be queried and a plurality of random sets of data elements, each of which carries data information and capacity information of the target data obtained from a data directory published on the blockchain network;
[0182] A first statistics unit 72 is configured to respond to data query requests, obtain target data from the privacy database of the data server, and perform statistical calculations on the target data to be queried using the contract code in the pre-configured anonymous query smart contract to obtain data statistical results. The data stored in the privacy database is private domain isolated data.
[0183] A first encryption unit 73 is configured to encrypt the data statistical result using the public key of the query end node and synchronize the encrypted data statistical result to the query end node;
[0184] The first cleaning unit 74 is used to clean up the data statistical results in the data blockchain node after confirming that all data statistical results are synchronized to the query end node.
[0185] The above-mentioned blockchain network-based data query device can receive data query requests initiated by a querying end node via a first receiving unit 71, respond to the data query requests via a first statistics unit 72, retrieve target data from a privacy database on a data server, and perform statistical calculations on the target data to be queried using the contract code in a pre-configured anonymous query smart contract to obtain statistical results. The data stored in the privacy database is private domain-isolated data. The first encryption unit 73 encrypts the statistical results using the public key of the querying end node and synchronizes the encrypted statistical results to the querying end node. After confirming that all statistical results have been synchronized to the querying end node, the first cleaning unit 74 cleans the statistical results from the blockchain node. In this embodiment, cryptographic techniques and blockchain smart contracts can be combined to implement anonymous data query and statistics. While performing anonymous queries, statistical calculations can be performed on encrypted data. Blockchain technology is utilized to enhance data security during anonymous query and statistics, thereby resolving the technical issue in related technologies where financial institutions cannot guarantee data security when querying customer information.
[0186] Optionally, the data query device based on the blockchain network also includes: a first receiving module, used to receive metadata information sent by the data service end before receiving the data query request initiated by the query end node, wherein the metadata information includes at least one of the following: data unique identification, data introduction, data field information, data volume, authorization policy, usage scenario and data ownership object.
[0187] Optionally, the data query device based on the blockchain network also includes: a first extraction module, which is used to extract metadata information carried in the data query request after receiving the data query request initiated by the query end node; a first determination module, which is used to determine the data ownership object of the target data based on the metadata information; obtain the contact information of the associated data ownership object in the notification system; a first push module, which is used to push data query notifications to the data ownership object based on the contact information; a second receiving module, which is used to receive data authorization instructions from the data ownership object; and a second determination module, which is used to confirm that the query end node has the right to use the data when the data authorization instruction indicates consent to the authorization, wherein when the query end node has the right to use the data, it can obtain data capacity information from the privacy database of the data service end.
[0188] Optionally, the data query device based on the blockchain network also includes: a third receiving module, used to receive a contract deployment request submitted by the contract deployer before receiving the data query request initiated by the query end node, wherein the contract deployment request carries at least: the anonymous query smart contract to be published and the contract scope; a second push module, used to respond to the contract deployment request and send a contract deployment notification to each institutional entity contact object within the contract scope; a fourth receiving module, used to receive a contract review instruction transmitted by each institutional entity contact object; and a first deployment module, used to start deploying the anonymous query smart contract within the contract scope when the contract review instruction indicates that all institutional entity contacts within the contract scope agree to deploy the anonymous query smart contract.
[0189] Optionally, the data query device based on the blockchain network also includes: a first generation module, which is used to generate the contract identifier, contract scope, access rights, contract code, interface name, and input parameter format of the anonymous query smart contract by the contract deployer using a pre-configured contract publishing device before receiving the contract deployment request submitted by the contract deployer, after the anonymous query smart contract is written.
[0190] Optionally, the first deployment module includes: a first scanning sub-module, used to use a pre-configured contract deployment device to scan the contract code of the stealth query smart contract to obtain a contract scanning result; a first detection sub-module, used to perform contract detection on the contract scanning result to obtain a contract detection result; and a first deployment sub-module, used to use the contract deployment device to start deploying the stealth query smart contract within the contract scope when the contract detection result indicates that there is no problem with the contract code of the stealth query smart contract.
[0191] Optionally, the data query device based on the blockchain network also includes: a fifth receiving module, which is used to receive a data publishing request transmitted by the data provider before receiving the data query request initiated by the query end node, wherein the data publishing request carries: data to be published and data attribute information, and the data attribute information includes at least one of the following: data ownership object, data profile, data category, data table name, table field name, authorization policy, and data connection method; a second generating module, which is used to respond to the data publishing request and generate a data identifier for the data to be published; synchronize the data to be published, data attribute information and data identifier to all nodes on the blockchain network, and update the data directory in the blockchain network.
[0192] Optionally, a state database is pre-deployed on the blockchain network, and the state database records at least one of the following information: object information of the institutional entity's contact object, data query records, data operation records, contract information of the smart contract, metadata information, and data authorization information.
[0193] Optionally, the data blockchain nodes in the blockchain network are deployed with offline preloaded components, and the offline preloaded components are connected to the privacy database of the data server.
[0194] The present invention is described below in conjunction with another optional embodiment.
[0195] Example 4
[0196] This embodiment provides a data query device based on a blockchain network. The various implementation units included in the data query device correspond to the various implementation steps in the above-mentioned embodiment one.
[0197] This embodiment provides a data query device based on a blockchain network, which is applied to a data blockchain node in the blockchain network. A link relationship has been established in advance between the data blockchain node and the query end node.
[0198] The data blockchain node involved in this embodiment can be a blockchain node loaded with an online preloaded component, that is, the data blockchain node in the blockchain network is deployed with an online preloaded component, and the online preloaded component is connected to the second privacy database of the data server.
[0199] The second privacy database in this embodiment of the present invention stores off-chain private data, including the service provider's queryable private data, the query party's pre-loaded private data, encryption keys, and more. This data is private, isolated, and inaccessible to the outside world and monitored by the blockchain.
[0200] Figure 8 is a schematic diagram of another optional data query device based on a blockchain network according to an embodiment of the present invention. Figure 8 As shown, it includes: a second receiving unit 81, a second counting unit 82, a second encryption unit 83, and a second cleaning unit 84, wherein,
[0201] A second receiving unit 81 is configured to receive a data query request initiated by a query end node, wherein the data query request carries the target data to be queried and a target data set obtained from the privacy database of the data server, wherein the target data set carries data information and capacity information of other data after the target data is removed, and the data stored in the privacy database is private domain isolated data;
[0202] The second statistical unit 82 is used to respond to the data query request, read each data in the target data set, and perform statistical calculations on each data in the target data set using the contract code in the pre-configured anonymous query smart contract to obtain data statistical results;
[0203] The second encryption unit 83 is used to encrypt the data statistical results using the public key of the query end node and synchronize the encrypted data statistical results to the query end node;
[0204] The second cleaning unit 84 is used to clean up the data statistical results in the data blockchain node after confirming that all data statistical results are synchronized to the query end node.
[0205] The above-mentioned blockchain network-based data query device can receive data query requests initiated by a query end node via a second receiving unit 81. A second statistical unit 82 responds to the data query request, reads each data item in the target data set, and performs statistical calculations on each data item in the target data set using the contract code in a pre-configured anonymous query smart contract to obtain statistical results. A second encryption unit 83 encrypts the statistical results using the public key of the query end node and synchronizes the encrypted statistical results to the query end node. After confirming that all statistical results have been synchronized to the query end node, a second cleaning unit 84 cleans the statistical results from the blockchain node. In this embodiment, cryptographic techniques and blockchain smart contracts can be combined to implement anonymous query and statistical analysis of data. While performing anonymous queries, statistical calculations can be performed on encrypted data. Blockchain technology is utilized to enhance data security during anonymous query and statistical analysis, thereby resolving the technical issue in related technologies where financial institutions are unable to guarantee data security when querying customer information.
[0206] Optionally, the data blockchain nodes in the blockchain network are deployed with online preloaded components, and the online preloaded components are connected to the privacy database of the data server.
[0207] The above-mentioned data query device based on the blockchain network may also include a processor and a memory. The above-mentioned first receiving unit 71, the first statistical unit 72, the first encryption unit 73, the first cleaning unit 74, the second receiving unit 81, the second statistical unit 82, the second encryption unit 83, the second cleaning unit 84, etc. are all stored in the memory as program units, and the processor executes the above-mentioned program units stored in the memory to realize the corresponding functions.
[0208] The processor includes a kernel that retrieves the corresponding program unit from memory. One or more kernels can be configured to respond to data query requests by adjusting kernel parameters, reading individual data points in the target data set, and performing statistical calculations on each data point in the target data set using the contract code in a pre-configured anonymous query smart contract to obtain statistical results. The statistical results are encrypted using the public key of the query-end node and synchronized to the query-end node.
[0209] The above-mentioned memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0210] According to another aspect of an embodiment of the present invention, an electronic device is also provided, including: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute any one of the above-mentioned blockchain network-based data query methods by executing the executable instructions.
[0211] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is further provided, wherein the computer-readable storage medium includes a stored computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute any one of the above-mentioned blockchain network-based data query methods.
[0212] Figure 9 This is a hardware structure diagram of an electronic device (or mobile device) according to a data query method based on a blockchain network according to an embodiment of the present invention. Figure 9 As shown, the electronic device may include one or more (illustrated as 102a, 102b, ..., 102n in the figure) processors 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 104 for storing data. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the I / O interface), a network interface, a keyboard, a power supply and / or a camera. It will be understood by those skilled in the art that Figure 9 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 9 More or fewer components than shown, or with Figure 9 Different configurations shown.
[0213] The serial numbers of the above embodiments of the present invention are for description only and do not represent the advantages or disadvantages of the embodiments.
[0214] In the above embodiments of the present invention, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0215] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only exemplary. For example, the division of the units can be a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0216] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0217] In addition, the functional units in the various embodiments of the present invention may be integrated into a single processing unit, each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0218] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk, etc. Various media that can store program codes.
[0219] The above is only 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 data query method based on a blockchain network, characterized in that: The data blockchain node in the blockchain network is deployed with an offline preload component, the offline preload component is connected to the first privacy database of the data service end, and the data blockchain node has a pre-established link relationship with the query end node, including: Receiving a data query request initiated by the query end node, wherein the data query request carries a data identifier of the target data to be queried and a plurality of random sets of data elements, each of the random sets of data elements carrying data information and capacity information of the target data obtained from a data directory published on the blockchain network; In response to the data query request, the target data is obtained from the privacy database of the data service end, and the contract code in the pre-configured anonymous query smart contract is used to perform statistical calculations on the target data to be queried to obtain data statistical results, wherein the data stored in the privacy database is private domain isolated data; Encrypting the data statistics result using the public key of the query end node, and synchronizing the encrypted data statistics result to the query end node; After confirming that all data statistical results are synchronized to the query end node, the data statistical results in the data blockchain node are cleared.
2. The data query method according to claim 1, characterized in that: Before receiving the data query request initiated by the query end node, the method further includes: Receive metadata information sent by the data server, wherein the metadata information includes at least one of the following: data unique identifier, data introduction, data field information, data volume, authorization policy, usage scenario and data ownership object.
3. The data query method according to claim 2, characterized in that: After receiving the data query request initiated by the query end node, the method further includes: Extracting the metadata information carried in the data query request; Determining the data ownership object of the target data based on the metadata information; Obtain the contact information of the data ownership object in the notification system; Pushing a data query notification to the data owner based on the contact information; Receiving a data authorization instruction of the data ownership object; When the data authorization instruction indicates that the authorization is agreed, it is confirmed that the query end node has the right to use the data. When the query end node has the right to use the data, data capacity information can be obtained from the privacy database of the data service end.
4. The data query method according to claim 1, characterized in that: Before receiving the data query request initiated by the query end node, the method further includes: Receive a contract deployment request submitted by a contract deployer, wherein the contract deployment request carries at least: a to-be-published anonymous query smart contract and a contract scope; In response to the contract deployment request, a contract deployment notification is sent to each institutional entity contact object within the contract scope; Receiving a contract review instruction transmitted by each of the institutional subject contact objects; When the contract review instruction indicates that all institutional entities within the contract scope agree to deploy the anonymous query smart contract, the anonymous query smart contract is deployed within the contract scope.
5. The data query method according to claim 4, characterized in that: Before receiving the contract deployment request submitted by the contract deployer, it also includes: After the anonymous query smart contract is written, the contract deployer uses a pre-configured contract publishing device to generate the contract identifier, contract scope, access rights, contract code, interface name and input parameter format of the anonymous query smart contract.
6. The data query method according to claim 4, characterized in that: The steps of starting to deploy the anonymous query smart contract within the contract scope include: Scanning the contract code of the anonymous query smart contract using a pre-configured contract deployment device to obtain a contract scanning result; Performing contract detection on the contract scanning result to obtain a contract detection result; When the contract detection result indicates that there is no problem with the contract code of the anonymous query smart contract, the contract deployment device is used to start deploying the anonymous query smart contract within the contract scope.
7. The data query method according to claim 1, characterized in that: Before receiving the data query request initiated by the query end node, the method further includes: Receiving a data publishing request transmitted by a data provider, wherein the data publishing request carries: data to be published and data attribute information, wherein the data attribute information includes at least one of the following: data ownership object, data profile, data category, data table name, table field name, authorization policy, and data connection method; In response to the data publishing request, generating a data identifier for the data to be published; The data to be published, the data attribute information, and the data identifier are synchronized to all nodes on the blockchain network, and the data directory in the blockchain network is updated.
8. The data query method according to any one of claims 1 to 7, characterized in that: A state database is pre-deployed on the blockchain network, and the state database records at least one of the following information: object information of the organization entity's contact object, data query records, data operation records, contract information of the smart contract, metadata information, and data authorization information.
9. The data query method according to any one of claims 1 to 7, characterized in that: The data blockchain nodes in the blockchain network are deployed with offline preload components, and the offline preload components are connected to the privacy database of the data server.
10. A data query method based on a blockchain network, characterized in that: The data blockchain node in the blockchain network is deployed with an online preload component, which is connected to the second privacy database of the data service end. The data blockchain node has a pre-established link relationship with the query end node, including: Receive a data query request initiated by the query end node, wherein the data query request carries the target data to be queried and a target data set obtained from the privacy database of the data service end, the target data set carries data information and capacity information of other data after excluding the target data, and the data stored in the privacy database is private domain isolated data; Responding to the data query request, reading each data in the target data set, and performing statistical calculations on each data in the target data set using the contract code in the pre-configured anonymous query smart contract to obtain data statistical results; Encrypting the data statistics result using the public key of the query end node, and synchronizing the encrypted data statistics result to the query end node; After confirming that all data statistical results are synchronized to the query end node, the data statistical results in the data blockchain node are cleared.
11. The data query method according to claim 10, characterized in that: The data blockchain nodes in the blockchain network are deployed with online preload components, and the online preload components are connected to the privacy database of the data server.
12. A data query device based on a blockchain network, characterized in that: The data blockchain node in the blockchain network is deployed with an offline preload component, the offline preload component is connected to the first privacy database of the data service end, and the data blockchain node has a pre-established link relationship with the query end node, including: A first receiving unit is configured to receive a data query request initiated by the query end node, wherein the data query request carries a data identifier of target data to be queried and a plurality of random sets of data elements, each of the random sets of data elements carrying data information and capacity information of the target data obtained from a data directory published on the blockchain network; a first statistical unit, configured to respond to the data query request, obtain the target data from the privacy database of the data server, and perform statistical calculations on the target data to be queried using the contract code in a pre-configured anonymous query smart contract to obtain data statistical results, wherein the data stored in the privacy database is private domain isolated data; a first encryption unit, configured to encrypt the data statistical result using the public key of the query end node, and synchronize the encrypted data statistical result to the query end node; The first cleaning unit is used to clean up the data statistical results in the data blockchain node when confirming that all data statistical results are synchronized to the query end node.
13. A data query device based on a blockchain network, characterized in that: The data blockchain node in the blockchain network is deployed with an online preload component, which is connected to the second privacy database of the data service end. The data blockchain node has a pre-established link relationship with the query end node, including: a second receiving unit, configured to receive a data query request initiated by the query end node, wherein the data query request carries target data to be queried and a target data set obtained from a privacy database of the data service end, the target data set carries data information and capacity information of other data after excluding the target data, and the data stored in the privacy database is private domain isolated data; a second statistical unit, configured to respond to the data query request, read each data in the target data set, and perform statistical calculations on each data in the target data set using the contract code in the pre-configured anonymous query smart contract to obtain data statistical results; a second encryption unit, configured to encrypt the data statistical result using the public key of the query end node, and synchronize the encrypted data statistical result to the query end node; The second cleaning unit is used to clean up the data statistical results in the data blockchain node when confirming that all data statistical results are synchronized to the query end node.
14. A computer-readable storage medium, characterized in that The computer-readable storage medium includes a stored computer program, wherein, when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute the data query method based on the blockchain network according to any one of claims 1 to 11.
15. An electronic device, characterized in that: The system comprises one or more processors and a memory, wherein the memory is used to store 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 data query method based on the blockchain network as described in any one of claims 1 to 11.
Citation Information
Patent Citations
Data authorization and query method and device based on block chain
CN110060162A
Blockchain private data sharing method and device, computer equipment and storage medium
CN111935208A