Data processing method, system, device and computer equipment in blockchain

By receiving query requests, sharding and exchanging data in the blockchain, the problem of data statistics insecurity between heterogeneous blockchains is solved, and efficient and secure data processing and privacy protection are achieved.

CN119760017APending Publication Date: 2025-04-04CHINA TELECOM BESTPAY CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411802611.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-09
Publication Date
2025-04-04

AI Technical Summary

Technical Problem

Data statistics between heterogeneous blockchains are not secure enough, and existing cross-chain solutions lack effective security protection mechanisms.

Method used

By receiving the query request, querying and extracting the initial data of multiple blockchains, sharding the data based on the preset sharding rules, and exchanging and calculating the sharding data according to the preset exchange rules, and finally determining the target data corresponding to the query request.

Benefits of technology

It realizes efficient data query and processing across multiple blockchains, improves the speed of data query, and ensures data security and privacy protection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119760017A_ABST
    Figure CN119760017A_ABST
Patent Text Reader

Abstract

The present invention discloses a data processing method, system, device and computer equipment in a blockchain. The method includes: receiving a query request; based on the query request, querying and extracting the initial data corresponding to each of the multiple blockchains; based on the preset sharding rules corresponding to each of the multiple blockchains, sharding the initial data corresponding to each of the multiple blockchains; based on the preset exchange rules, determining the sharding data for exchange corresponding to each of the multiple blockchains; respectively exchanging the sharding data for exchange corresponding to each of the multiple blockchains with the sharding data for exchange corresponding to the corresponding blockchain for exchange; respectively calculating the sum of the new multiple sharding data corresponding to each of the multiple blockchains; and determining the target data corresponding to the query request according to the new data corresponding to each of the multiple blockchains. The present invention solves the technical problem that data statistics between heterogeneous blockchains are not safe enough.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of blockchain and secure computing, and in particular to a data processing method, system, device and computer equipment in a blockchain. Background Art

[0002] With the rapid development and widespread application of blockchain technology, a variety of blockchain systems based on different architectures and technical standards have emerged in different industries and fields, forming the so-called "heterogeneous blockchain" environment. Although these heterogeneous blockchain systems have solved the problems of data recording, asset circulation and smart contract execution in specific scenarios, the data isolation and information island phenomenon between them have become increasingly prominent, limiting the integration and efficient use of data resources.

[0003] Especially in terms of data statistics and analysis, the traditional centralized data processing method cannot meet the needs of a decentralized environment. At the same time, data privacy protection and secure transmission have become challenges that need to be solved urgently. Although the existing cross-chain solutions can realize asset transfer and information exchange between heterogeneous blockchains to a certain extent, they lack effective security protection mechanisms for computing tasks such as statistical summation of sensitive data or privacy data.

[0004] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention

[0005] The embodiments of the present invention provide a method, system, device and computer equipment for data processing in a blockchain, so as to at least solve the technical problem that data statistics between heterogeneous blockchains are not secure enough.

[0006] According to one aspect of an embodiment of the present invention, a data processing method in a blockchain is provided, comprising: receiving a query request; based on the query request, querying and extracting initial data corresponding to each of a plurality of blockchains; based on a preset sharding rule corresponding to each of the plurality of blockchains, sharding the extracted initial data corresponding to each of the plurality of blockchains to obtain a plurality of sharding data corresponding to each of the plurality of blockchains; based on a preset exchange rule, determining the sharding data for exchange corresponding to each of the plurality of blockchains and the blockchains to be exchanged; respectively exchanging the sharding data for exchange corresponding to each of the plurality of blockchains with the sharding data for exchange corresponding to the corresponding blockchains to be exchanged to obtain a plurality of new sharding data corresponding to each of the plurality of blockchains; respectively calculating the sum of the plurality of new sharding data corresponding to each of the plurality of blockchains to obtain new data corresponding to each of the plurality of blockchains; and determining the target data corresponding to the query request according to the new data corresponding to each of the plurality of blockchains.

[0007] Optionally, based on the query request, querying and extracting initial data corresponding to each of the multiple blockchains, including: determining a data keyword and the corresponding multiple blockchains based on the query request; and querying and extracting initial data corresponding to each of the multiple blockchains based on the data keyword.

[0008] Optionally, based on preset sharding rules corresponding to each of the multiple blockchains, sharding the extracted initial data corresponding to each of the multiple blockchains to obtain multiple sharding data corresponding to each of the multiple blockchains, includes: obtaining the number of multiple blockchains; determining the number of shards corresponding to each of the multiple blockchains based on the number of multiple blockchains; based on the preset sharding rules and the number of shards corresponding to each of the multiple blockchains, sharding the extracted initial data corresponding to each of the multiple blockchains to obtain multiple sharding data corresponding to each of the multiple blockchains.

[0009] Optionally, based on a preset exchange rule, determining the shard data for exchange and the blockchains for exchange corresponding to each of the multiple blockchains includes: retaining any one of the multiple shard data corresponding to each of the multiple blockchains, and using the remaining shard data as the shard data for exchange corresponding to each of the multiple blockchains; based on the preset exchange rule, determining that the blockchains for exchange corresponding to each of the multiple blockchains are all the remaining blockchains in the multiple blockchains, wherein one shard data is exchanged between any two blockchains.

[0010] Optionally, before sharding the initial data corresponding to each of the multiple blockchains based on the preset sharding rules corresponding to each of the multiple blockchains, the method includes: determining the preset sharding rules corresponding to each of the multiple blockchains based on the development frameworks and operating environments corresponding to each of the multiple blockchains; and respectively configuring the preset sharding rules corresponding to each of the multiple blockchains on the corresponding blockchains.

[0011] According to another aspect of an embodiment of the present invention, a data processing system in a blockchain is further provided, applying any one of the above-mentioned data processing methods in a blockchain, including: a relay gateway module, used to exchange shard data for exchange corresponding to each of the multiple blockchains and calculate the target data corresponding to the query request; an adapter module, used to query and extract the initial data corresponding to each of the multiple blockchains and shard the extracted initial data corresponding to each of the multiple blockchains based on the preset sharding rules corresponding to each of the multiple blockchains, and calculate the sum of the new multiple shard data corresponding to each of the multiple blockchains to obtain the new data corresponding to each of the multiple blockchains.

[0012] According to another aspect of an embodiment of the present invention, a data processing device in a blockchain is also provided, including: a receiving module for receiving a query request; an extraction module for querying and extracting initial data corresponding to each of multiple blockchains based on the query request; a sharding module for sharding the initial data corresponding to each of the extracted multiple blockchains based on preset sharding rules corresponding to each of the multiple blockchains, to obtain multiple sharding data corresponding to each of the multiple blockchains; a first determination module for determining the sharding data for exchange corresponding to each of the multiple blockchains and the blockchains to be exchanged based on preset exchange rules; an exchange module for respectively exchanging the sharding data for exchange corresponding to each of the multiple blockchains with the sharding data for exchange corresponding to the corresponding blockchain to be exchanged, to obtain new multiple sharding data corresponding to each of the multiple blockchains; a calculation module for respectively calculating the sum of the new multiple sharding data corresponding to each of the multiple blockchains, to obtain new data corresponding to each of the multiple blockchains; a second determination module for determining the target data corresponding to the query request according to the new data corresponding to each of the multiple blockchains.

[0013] According to another aspect of an embodiment of the present invention, a non-volatile storage medium is further provided, the non-volatile storage medium including a stored program, wherein when the program is running, the device where the non-volatile storage medium is located is controlled to execute any one of the above-mentioned data processing methods in the blockchain.

[0014] According to another aspect of an embodiment of the present invention, a computer device is further provided, the computer device comprising a processor, the processor being used to run a program, wherein when the program is run, any one of the above-mentioned data processing methods in the blockchain is executed.

[0015] According to another aspect of an embodiment of the present invention, a computer program product is also provided, including a computer program, which implements any of the above-mentioned data processing methods in the blockchain when the computer program is executed by a processor.

[0016] In an embodiment of the present invention, a data processing method in a blockchain is adopted, by receiving a query request; querying and extracting initial data corresponding to each of the multiple blockchains based on the query request; sharding the extracted initial data corresponding to each of the multiple blockchains based on the preset sharding rules corresponding to each of the multiple blockchains to obtain multiple sharding data corresponding to each of the multiple blockchains; determining the sharding data for exchange corresponding to each of the multiple blockchains and the blockchains for exchange based on the preset exchange rules; respectively exchanging the sharding data for exchange corresponding to each of the multiple blockchains with the sharding data for exchange corresponding to the corresponding blockchains for exchange to obtain new multiple sharding data corresponding to each of the multiple blockchains; respectively calculating the sum of the new multiple sharding data corresponding to each of the multiple blockchains to obtain new data corresponding to each of the multiple blockchains; determining the target data corresponding to the query request according to the new data corresponding to each of the multiple blockchains, thereby achieving the purpose of efficient query and processing of data across multiple blockchains, thereby achieving the technical effect of improving the speed of data query and ensuring the security and privacy protection of data, and thus solving the technical problem that data statistics between heterogeneous blockchains are not safe enough. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] 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:

[0018] Figure 1 A hardware structure block diagram of a computer terminal for implementing a data processing method in a blockchain is shown;

[0019] Figure 2 It is a flowchart of a data processing method in a blockchain provided by an embodiment of the present invention;

[0020] Figure 3 This is a schematic diagram of a process for securely summing data of a heterogeneous blockchain provided according to an optional embodiment of the present invention;

[0021] Figure 4 is an architecture diagram of a data processing system in a blockchain provided according to an embodiment of the present invention;

[0022] Figure 5 It is a structural block diagram of a data processing device in a blockchain provided according to an embodiment of the present invention. DETAILED DESCRIPTION

[0023] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme 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 described embodiments 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 creative work should fall within the scope of protection of the present invention.

[0024] It should be noted that the terms "first", "second", etc. in the specification 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 data 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 that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0025] According to an embodiment of the present invention, an embodiment of a data processing method in a blockchain 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.

[0026] The method embodiment provided in the first embodiment of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Figure 1 The hardware structure block diagram of a computer terminal for implementing a data processing method in a blockchain is shown. Figure 1 As shown, the computer terminal 10 may include one or more (102a, 102b, ..., 102n are used to illustrate) processors (the processor 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 BUS bus), a network interface, a power supply and / or a camera. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown.

[0027] It should be noted that the one or more processors and / or other data processing circuits described above may generally be referred to herein as "data processing circuits". The data processing circuits may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. In addition, the data processing circuit may be a single independent processing module, or may be incorporated in whole or in part into any of the other components in the computer terminal 10. As described in the embodiments of the present application, the data processing circuit acts as a processor control (e.g., selection of a variable resistor terminal path connected to an interface).

[0028] The memory 104 can be used to store software programs and modules of application software, such as program instructions / data storage devices corresponding to the data processing method in the blockchain in the embodiment of the present invention. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, the data processing method in the blockchain of the above-mentioned application is realized. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor, and these remote memories may be connected to the computer terminal 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0029] The display may be, for example, a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of the computer terminal 10 .

[0030] Figure 2 is a flow chart of a data processing method in a blockchain according to an embodiment of the present invention, such as Figure 2 As shown, the method comprises the following steps:

[0031] Step S201, receiving a query request.

[0032] In this step, the query request can be a query of the overall situation of the data of multiple blockchains. Therefore, the user or system can create a secure summation task corresponding to the query request through the relay gateway. This task contains the query parameters, such as query keywords (for example, product name, disease type, etc.), and a specified list of participants, that is, the heterogeneous blockchains where the data to be counted is located. Before the query is initiated, each adapter needs to register information at the relay gateway, including the address, port, and detailed information of the smart contract of the adapter. In addition, the relay gateway is also responsible for authenticating the initiator of the query task to ensure the legitimacy and security of the task. After receiving the query request, the relay gateway distributes the request to the specified adapter according to the parameters in the task. This distribution process can follow specific network protocols and encryption standards to protect the security of data during transmission.

[0033] Step S202: Based on the query request, query and extract the initial data corresponding to each of the multiple blockchains.

[0034] In this step, the query request usually contains clear query parameters, such as query keywords (such as product name, disease type, etc.), which helps to locate specific data. At the same time, the request will also specify the list of blockchains to be queried to ensure the comprehensiveness and accuracy of the data. After receiving the query request, the adapter will use its interface with the corresponding blockchain to perform data retrieval operations on the blockchain according to the query parameters to find the initial data that matches the query keyword. Due to the immutability and transparency of blockchain data, the adapter can accurately and efficiently locate and extract the initial data.

[0035] Step S203: based on the preset sharding rules corresponding to the multiple blockchains, the extracted initial data corresponding to the multiple blockchains are sharded to obtain multiple sharding data corresponding to the multiple blockchains.

[0036] In this step, before data query and extraction, a set of sharding rules, i.e., smart contracts, need to be defined for each blockchain. Smart contracts can include the number of shards, the size of shards, and specific algorithms for how to split data into multiple shards. Based on the principle of secret sharing, it is necessary to ensure that the initial data can only be restored when all shards are merged, so the design of the rules must take into account both data security and computational efficiency. Among them, secret sharing refers to hiding the secret value by splitting the secret value into multiple random copies and distributing these numbers to different parties. Each participant gets a part of the original data, and one or a few participants cannot restore the original data. Only when their respective data are put together can the real data be restored. When the adapter receives the query request distributed by the relay gateway, it will call the smart contract on the corresponding blockchain. The smart contract will split the initial data extracted from the blockchain to obtain shard data, and return part of the shard data to the relay gateway. For example, the value of the initial data corresponding to the query request on a certain blockchain can be 10. According to the preset sharding rules, the initial data is divided into 2 shard data, so 10 can be divided into 1 and 9.

[0037] Step S204: Based on the preset exchange rules, determine the shard data for exchange and the blockchains for exchange corresponding to each of the multiple blockchains.

[0038] In this step, the smart contract can select the shard data and exchange object for exchange based on the preset exchange rules. For example, the smart contract divides the initial data into n pieces. After the segmentation is completed, the smart contract can retain one shard (such as x1) on the local node and the remaining shard data (x2, x3...x n ) as the shard data for exchange, and select the blockchain corresponding to each shard data. Data packets are usually encrypted before sending to protect the security of data during transmission.

[0039] Step S205, respectively exchange the shard data for exchange corresponding to each of the multiple blockchains with the shard data for exchange corresponding to the corresponding blockchain to be exchanged, to obtain multiple new shard data corresponding to each of the multiple blockchains.

[0040] In this step, before the data exchange begins, the adapter encapsulates the shard data for exchange into a data packet and encrypts the data packet using an encryption algorithm. The purpose of encryption is to ensure that even if the data packet is intercepted during transmission, the data cannot be decrypted and interpreted. In addition to the encrypted shard data, the data packet may also contain the identifier of the sending blockchain, the identifier of the receiving blockchain, and a digital signature or hash value for verifying the integrity of the data. Each adapter then sends the shard data for exchange to the relay gateway, which is responsible for coordinating the data exchange and ensuring that data is sent and received according to the preset rules. For example, the relay gateway sends the shard data x2, x3, etc. sent by adapter A to adapters B, C, etc., and sends the shard data y2, y3, etc. received from them to adapter A. When the adapter receives the data packet corresponding to other blockchains, it uses the corresponding encryption key to decrypt the data packet and extract the shard data. The adapter then integrates the locally retained shard data with the received shard data to form a new and complete shard data set.

[0041] Step S206, respectively calculate the sum of the new multiple shard data corresponding to the multiple blockchains to obtain the new data corresponding to the multiple blockchains.

[0042] In this step, the adapter calls the smart contract on its local blockchain to sum the newly stored sharded data set. When performing calculations, the smart contract uses specific algorithms in secret sharing technology, which ensure that the original value of the data is not revealed even during the calculation process. The calculation process may involve decrypting all sharded data, then performing the summation operation, and finally encrypting or protecting the result to maintain the privacy of the data. After the smart contract performs the summation calculation, a new data value is generated, that is, the new data corresponding to each of the multiple blockchains. This value is the result of the summation of all sharded data. After each adapter's smart contract completes the calculation, the adapter will report the new data value (summation result) to the relay gateway in an encrypted or securely encapsulated form.

[0043] Step S207: Determine the target data corresponding to the query request based on the new data corresponding to each of the multiple blockchains.

[0044] In this step, the relay gateway aggregates the new data corresponding to each of the multiple blockchains, that is, the summation results, that is, the new data values ​​from all blockchains are added together. Since the summation results of each blockchain are calculated independently, the aggregation operation can directly obtain the sum of all blockchain data involved in the entire query request without exposing any details of the individual blockchain data. After the above steps, the relay gateway finally determines and outputs the target data corresponding to the query request. This data is the result of secure summation and privacy protection processing, and can be used for macro data analysis, report generation or other decision support processes without leaking any privacy information related to the original data. For example, suppose the query request requires parties A and B to find the sum, each with numbers x and y. x and y are decomposed respectively to obtain x=x1+x2 and y=y1+y2. Both parties share x2 and y2 respectively. Then party A calculates z1=x1+y2 and party B calculates z2=y1+x2. z1 and z2 are shared, and z is calculated. Obviously, z=x+y=z1+z2=x1+x2+y1+y2. Through the above steps, while achieving the purpose of obtaining the sum of x and y, it also ensures that the values ​​of x and y themselves will not be leaked.

[0045] Through the above steps, the goal of efficient query and processing of data across multiple blockchains is achieved, thereby achieving the technical effect of improving the speed of data query and ensuring data security and privacy protection, and further solving the technical problem of insufficient security for data statistics between heterogeneous blockchains.

[0046] As an optional embodiment, based on the query request, querying and extracting the initial data corresponding to each of the multiple blockchains includes: determining a data keyword and the corresponding multiple blockchains based on the query request; and querying and extracting the initial data corresponding to each of the multiple blockchains based on the data keyword.

[0047] Optionally, the relay gateway can receive query requests from the outside. The query request usually contains specific requirements, such as the type of query, the time range of the data, etc. Based on the content of the query request, one or more keywords for data search can be determined. For example, these keywords can be specific product IDs, disease names, user IDs, etc., which are used to locate the initial data to be queried in different blockchains. Based on the query requirements and data keywords, it can be determined which blockchains need to participate in this query. Since the data may be distributed on blockchains of various architectures, multiple blockchains related to the keywords in the query request can be identified and selected based on the metadata index of the blockchain, the query interface of the smart contract, or other data identification methods.

[0048] After determining the data keywords and multiple blockchains to be extracted, the relay gateway can send query instructions to the adapters of the selected multiple blockchains, which contain the data keywords and specific query requirements. After receiving the query instructions, the adapters of multiple blockchains will call the smart contract on their local blockchains, search for data in the blockchain based on the received data keywords, and after locating the data related to the keywords, they will extract the data as the initial data.

[0049] As an optional embodiment, based on the preset sharding rules corresponding to the multiple blockchains, the extracted initial data corresponding to each of the multiple blockchains are sharded to obtain multiple sharding data corresponding to each of the multiple blockchains, including: obtaining the number of multiple blockchains; determining the number of shards corresponding to each of the multiple blockchains based on the number of multiple blockchains; based on the preset sharding rules and the number of shards corresponding to each of the multiple blockchains, the extracted initial data corresponding to each of the multiple blockchains are sharded to obtain multiple sharding data corresponding to each of the multiple blockchains.

[0050] Optionally, after the relay gateway receives the query request, it can identify and obtain the number of blockchains that will participate in the data statistics according to the data keyword in the request. Based on the number of blockchains obtained, a suitable number of shards can be determined. For example, the number of shards can be equal to the number of multiple blockchains participating in the data statistics to ensure that each blockchain can receive at least one data shard and thus participate in the sum calculation. Then, based on the preset sharding rule, the corresponding initial data is divided into a corresponding number of shard data to obtain multiple shard data corresponding to each of the multiple blockchains.

[0051] As an optional embodiment, based on a preset exchange rule, determining the shard data for exchange and the blockchains for exchange corresponding to each of the multiple blockchains includes: retaining any one of the multiple shard data corresponding to each of the multiple blockchains, and using the remaining shard data as the shard data for exchange corresponding to each of the multiple blockchains; based on the preset exchange rule, determining that the blockchains for exchange corresponding to each of the multiple blockchains are all the remaining blockchains in the multiple blockchains, wherein one shard data is exchanged between any two blockchains.

[0052] Optionally, after data sharding, each blockchain adapter can retain one shard data as the private data of this node, and this shard will not be sent out. In addition to the one shard data retained, the adapter will use the remaining shard data as data shards for exchange, ready to exchange data with other blockchains. According to the preset rules, each blockchain can exchange shard data with all other blockchains, but only once with any blockchain, and each exchange involves only one shard. In this way, each blockchain will eventually have the shard data of all other blockchains, but will not hold a complete data set. For example, there are three blockchains participating in data statistics, and the corresponding initial data are x, y, and z, respectively. The three data are sharded into x=x1+x2+x3, y=y1+y2+y3, and z=z1+z2+z3, and then each blockchain retains x1, y1, and z1 respectively. For x, x2 can be sent to y, and x3 can be sent to z; for y, y2 can be sent to x, and y3 can be sent to z; for z, z3 can be sent to x, and z2 can be sent to y. Finally, the new shard data corresponding to the three blockchains are x1, y2, z3; y1, x2, z2; z1, y3, x3.

[0053] As an optional embodiment, before sharding the initial data corresponding to each of the multiple blockchains based on the preset sharding rules corresponding to each of the multiple blockchains, the method includes: determining the preset sharding rules corresponding to each of the multiple blockchains based on the development frameworks and operating environments corresponding to each of the multiple blockchains; and respectively configuring the preset sharding rules corresponding to each of the multiple blockchains on the corresponding blockchains.

[0054] Optionally, the preset sharding rules corresponding to each of the multiple blockchains are smart contracts. The smart contract can be deployed on the blockchain. According to the query keywords, the initial data can be divided into n pieces based on the secret sharing technology, and the other n-1 sharded data can be returned to other groups, and the sharded data of this node can be saved on the blockchain.

[0055] Since different blockchains may be based on different development frameworks and operating environments, for example, Ethereum uses Solidity to write smart contracts, while Fabric uses Go or Java. Therefore, when determining the preset sharding rules, i.e., smart contracts, for each blockchain, its specific development framework and operating environment need to be considered to ensure that the smart contract can be effectively implemented on the blockchain. After determining the preset smart contract, the next step is to configure it in each blockchain. This means that after receiving the query request, each adapter will split the initial data into multiple shard data by calling the smart contract on the blockchain, and save one of the shards on the chain, while the other shards are sent to the relay gateway for subsequent data exchange and summation calculation. Using a single smart contract for all blockchains without considering the differences in their development frameworks and operating environments may result in the inability to correctly implement smart contracts on some blockchains, or inefficiency, or even insecurity. By customizing smart contracts for the development framework and operating environment of each blockchain, this method can be seamlessly applied to multiple heterogeneous blockchains, improving the flexibility and efficiency of cross-chain data statistics.

[0056] As an optional embodiment, Figure 3 is a schematic diagram of a process of securely summing data of a heterogeneous blockchain provided according to an optional embodiment of the present invention, such as Figure 3 As shown, the specific steps are as follows:

[0057] S1: Each participant first registers the adapter-related information, such as address, port, contract, etc., in the relay gateway, creates a secure summation task, specifies the participant, queries the information keyword x, and sends the data query task to each blockchain adapter.

[0058] S2: Adapter A (adapting to different types of blockchains) receives the request, calls the local blockchain SDK, and then calls the local smart contract a (for data sharding) x = x1 + x2 + x3 + ... + x n , returns the shard data. The number of shards needs to be consistent with the number of participants, that is, returns x2, x3, ..., x n .

[0059] S3: Adapter B (adapting to different types of blockchains) receives the request, calls the local blockchain SDK, and then calls the local smart contract b (for data sharding) x=y1+y2+y3+...+y n , return the shard data. The number of shards needs to be consistent with the number of participants, that is, return y2, y3, ..., y n .

[0060] S4: The operations for other adapters are the same as above.

[0061] S5: The relay gateway exchanges the shard data returned by the adapter with other adapters. The blockchains that have been exchanged will no longer be exchanged. The shard data returned by other blockchains will be sent to the adapter again, and the smart contract x used for data exchange will be called. The smart contract uses the locally saved shard data (such as x1), sums and returns it.

[0062] S6: The relay gateway receives the summed data returned by each adapter and sums it again to obtain the statistical value of the entire query value in each blockchain.

[0063] The advantage of the optional embodiment of the present invention is that it can ensure the security and privacy of data in the process of summation calculation involving multiple parties. By adopting heterogeneous blockchains and secret sharing, the security of data in the transmission and calculation process can be ensured, which is suitable for the secure summation calculation requirements of different blockchains in various scenarios. For example, the query interface can be called by the relay gateway to count the sales information of parts stored in different cross-chains, and understand the overall sales of parts in heterogeneous cross-chains; the query interface can also be called by the relay gateway to count the sales of food, clothing, housing and transportation products in different shopping malls, and query the overall sales of heterogeneous cross-chain products to provide a reference for the macro-economy; the query interface can also be called by the relay gateway to count the recovery of a certain disease in different hospitals and different blockchains, and query the overall recovery of the disease nationwide.

[0064] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should know that the present invention is not limited by the described action sequence, because according to the present invention, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.

[0065] Through the description of the above implementation methods, those skilled in the art can clearly understand that the data processing method in the blockchain according to the above embodiment can be implemented by means of software plus the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, disk, optical disk), including several instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present invention.

[0066] According to an embodiment of the present invention, a data processing system in a blockchain applying the data processing method in a blockchain is also provided. Figure 4is an architecture diagram of a data processing system in a blockchain provided according to an embodiment of the present invention, such as Figure 4 As shown, the system includes: a relay gateway module, which is used to exchange the shard data corresponding to each of the multiple blockchains and calculate the target data corresponding to the query request; an adapter module, which is used to query and extract the initial data corresponding to each of the multiple blockchains and shard the extracted initial data corresponding to each of the multiple blockchains based on the preset sharding rules corresponding to each of the multiple blockchains, and calculate the sum of the new multiple shard data corresponding to each of the multiple blockchains to obtain the new data corresponding to each of the multiple blockchains.

[0067] Optionally, the relay gateway module is the core component of the entire data processing system, which is responsible for coordinating and managing the interaction between different blockchains, including the exchange of data and the calculation of target data. The relay gateway can receive the shard data for exchange from the adapter module, and selectively send these data to the adapter modules of other blockchains according to the preset exchange rules. After completing the data exchange, the relay gateway can collect the sum of the shard data returned by each adapter module (i.e., new data), and then sum up these new data again to finally obtain the target data corresponding to the query request. This target data can represent the statistical sum of specific keywords in all participating blockchains, and the privacy of the original data is protected during the calculation process.

[0068] The adapter module is deployed on each blockchain to interact with the relay gateway module to perform data query, extraction, sharding, and calculation of the sum of new data. The adapter module can split the extracted initial data into multiple shard data based on the preset sharding rules. The formulation of the sharding rules takes into account the privacy protection requirements of the data and the security mechanism of secret sharing, ensuring that even if part of the shard data is leaked, the original data cannot be restored individually or partially. The adapter module can retain one of the shard data as local reserved data, and the remaining shard data is sent to the relay gateway as shard data for exchange for subsequent data exchange. After the data exchange is completed, the adapter module receives the shard data of all other blockchains, and uses the locally retained shard data and the received shard data for summation to obtain the sum of multiple new shard data, that is, the new data corresponding to the adapter module, and then returns the calculated new data to the relay gateway for the final target data calculation.

[0069] According to an embodiment of the present invention, there is also provided a data processing device in a blockchain for implementing the data processing method in the blockchain. Figure 5 is a structural block diagram of a data processing device in a blockchain provided according to an embodiment of the present invention, such as Figure 5As shown, the data processing device in the blockchain includes: a receiving module 51, an extraction module 52, a sharding module 53, a first determination module 54, an exchange module 55, a calculation module 56 and a second determination module 57. The data processing device in the blockchain is described below.

[0070] The receiving module 51 is used to receive a query request.

[0071] The extraction module 52 is connected to the receiving module 51 and is used to query and extract the initial data corresponding to each of the multiple blockchains based on the query request.

[0072] The sharding module 53 is connected to the extraction module 52, and is used to shard the extracted initial data corresponding to each of the multiple blockchains based on the preset sharding rules corresponding to each of the multiple blockchains, so as to obtain multiple sharding data corresponding to each of the multiple blockchains.

[0073] The first determination module 54 is connected to the sharding module 53, and is used to determine the sharding data for exchange and the blockchains for exchange corresponding to each of the multiple blockchains based on a preset exchange rule.

[0074] The exchange module 55 is connected to the first determination module 54, and is used to exchange the shard data for exchange corresponding to each of the multiple blockchains with the shard data for exchange corresponding to the corresponding blockchain to be exchanged, so as to obtain new multiple shard data corresponding to each of the multiple blockchains.

[0075] The calculation module 56 is connected to the exchange module 55, and is used to calculate the sum of the new multiple shard data corresponding to the multiple blockchains respectively, and obtain the new data corresponding to the multiple blockchains respectively.

[0076] The second determination module 57 is connected to the calculation module 56 and is used to determine the target data corresponding to the query request according to the new data corresponding to each of the multiple blockchains.

[0077] It should be noted that the receiving module 51, the extracting module 52, the slicing module 53, the first determining module 54, the exchanging module 55, the calculating module 56 and the second determining module 57 correspond to steps S201 to S207 in the embodiment, and the examples and application scenarios implemented by the multiple modules and the corresponding steps are the same, but are not limited to the contents disclosed in the above embodiment. It should be noted that the above modules as part of the device can be run in the computer terminal 10 provided in the embodiment.

[0078] An embodiment of the present invention may provide a computer device. Optionally, in this embodiment, the computer device may be located in at least one network device among multiple network devices of a computer network. The computer device includes a memory and a processor.

[0079] Among them, the memory can be used to store software programs and modules, such as the program instructions / modules corresponding to the data processing method and device in the blockchain in the embodiment of the present invention. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, that is, realizing the data processing method in the blockchain mentioned above. The memory may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include a memory remotely arranged relative to the processor, and these remote memories can be connected to the computer terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0080] The processor can call the information and application stored in the memory through the transmission device to perform the following steps: receive a query request; based on the query request, query and extract the initial data corresponding to each of the multiple blockchains; based on the preset sharding rules corresponding to each of the multiple blockchains, shard the extracted initial data corresponding to each of the multiple blockchains to obtain multiple sharding data corresponding to each of the multiple blockchains; based on the preset exchange rules, determine the sharding data for exchange corresponding to each of the multiple blockchains and the blockchains to be exchanged; exchange the sharding data for exchange corresponding to each of the multiple blockchains with the sharding data for exchange corresponding to the corresponding blockchain to be exchanged, to obtain new multiple sharding data corresponding to each of the multiple blockchains; calculate the sum of the new multiple sharding data corresponding to each of the multiple blockchains, to obtain new data corresponding to each of the multiple blockchains; determine the target data corresponding to the query request according to the new data corresponding to each of the multiple blockchains.

[0081] By adopting the embodiment of the present invention, a data processing method in a blockchain is provided, which receives a query request; based on the query request, queries and extracts initial data corresponding to each of the multiple blockchains; based on the preset sharding rules corresponding to each of the multiple blockchains, shards the extracted initial data corresponding to each of the multiple blockchains to obtain multiple sharding data corresponding to each of the multiple blockchains; based on the preset exchange rule, determines the sharding data for exchange corresponding to each of the multiple blockchains and the blockchains for exchange; respectively exchanges the sharding data for exchange corresponding to each of the multiple blockchains with the sharding data for exchange corresponding to the corresponding blockchains for exchange, to obtain new multiple sharding data corresponding to each of the multiple blockchains; respectively calculates the sum of the new multiple sharding data corresponding to each of the multiple blockchains, to obtain new data corresponding to each of the multiple blockchains; according to the new data corresponding to each of the multiple blockchains, determines the target data corresponding to the query request, thereby achieving the purpose of efficient query and processing of data across multiple blockchains, thereby achieving the technical effect of improving the speed of data query and ensuring the security and privacy protection of data, and further solving the technical problem that data statistics between heterogeneous blockchains are not safe enough.

[0082] A person of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the hardware related to the terminal device through a program, and the program can be stored in a non-volatile storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0083] The embodiment of the present invention further provides a non-volatile storage medium. Optionally, in this embodiment, the non-volatile storage medium can be used to store the program code executed by the data processing method in the blockchain provided by the above embodiment.

[0084] Optionally, in this embodiment, the non-volatile storage medium may be located in any computer terminal in a computer terminal group in a computer network, or in any mobile terminal in a mobile terminal group.

[0085] Optionally, in this embodiment, the non-volatile storage medium is configured to store a program code for performing the following steps: receiving a query request; based on the query request, querying and extracting initial data corresponding to each of the multiple blockchains; based on a preset sharding rule corresponding to each of the multiple blockchains, sharding the extracted initial data corresponding to each of the multiple blockchains to obtain multiple sharding data corresponding to each of the multiple blockchains; based on a preset exchange rule, determining the sharding data for exchange corresponding to each of the multiple blockchains and the blockchain to be exchanged; respectively exchanging the sharding data for exchange corresponding to each of the multiple blockchains with the sharding data for exchange corresponding to the corresponding blockchain to be exchanged to obtain new multiple sharding data corresponding to each of the multiple blockchains; respectively calculating the sum of the new multiple sharding data corresponding to each of the multiple blockchains to obtain new data corresponding to each of the multiple blockchains; determining the target data corresponding to the query request according to the new data corresponding to each of the multiple blockchains.

[0086] An embodiment of the present invention further provides a computer program product, including a computer program. Optionally, in this embodiment, when the computer program is executed by a processor, it can achieve: receiving a query request; based on the query request, querying and extracting initial data corresponding to each of the multiple blockchains; based on the preset sharding rules corresponding to each of the multiple blockchains, sharding the extracted initial data corresponding to each of the multiple blockchains to obtain multiple sharding data corresponding to each of the multiple blockchains; based on the preset exchange rules, determining the sharding data for exchange corresponding to each of the multiple blockchains and the blockchains to be exchanged; respectively exchanging the sharding data for exchange corresponding to each of the multiple blockchains with the sharding data for exchange corresponding to the corresponding blockchain to be exchanged, to obtain new multiple sharding data corresponding to each of the multiple blockchains; respectively calculating the sum of the new multiple sharding data corresponding to each of the multiple blockchains to obtain new data corresponding to each of the multiple blockchains; and determining the target data corresponding to the query request according to the new data corresponding to each of the multiple blockchains.

[0087] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0088] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0089] 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 schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, 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.

[0090] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0091] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0092] 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 non-volatile 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, including a number of instructions to enable 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 and other media that can store program codes.

[0093] 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 principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A data processing method in a blockchain, characterized in that: include: receiving a query request; Based on the query request, query and extract initial data corresponding to each of the multiple blockchains; Based on the preset sharding rules corresponding to the multiple blockchains, the extracted initial data corresponding to the multiple blockchains are sharded to obtain multiple sharding data corresponding to the multiple blockchains; Based on a preset exchange rule, determine the shard data for exchange and the blockchain for exchange corresponding to each of the multiple blockchains; Respectively exchange the shard data for exchange corresponding to each of the multiple blockchains with the shard data for exchange corresponding to the corresponding blockchain to be exchanged, to obtain multiple new shard data corresponding to each of the multiple blockchains; Calculate the sum of the new multiple shard data corresponding to each of the multiple blockchains respectively to obtain the new data corresponding to each of the multiple blockchains; According to the new data corresponding to each of the multiple blockchains, the target data corresponding to the query request is determined.

2. The method according to claim 1, characterized in that Based on the query request, querying and extracting initial data corresponding to each of the plurality of blockchains includes: Based on the query request, determine a data keyword and the corresponding multiple blockchains; Based on the data keyword, query and extract the initial data corresponding to each of the multiple blockchains.

3. The method according to claim 1, characterized in that The step of sharding the extracted initial data corresponding to each of the multiple blockchains based on the preset sharding rules corresponding to each of the multiple blockchains to obtain multiple sharding data corresponding to each of the multiple blockchains includes: Obtaining the number of the multiple blockchains; Based on the number of the multiple blockchains, determine the number of shards corresponding to each of the multiple blockchains; Based on the preset sharding rules and sharding numbers corresponding to the multiple blockchains, the extracted initial data corresponding to the multiple blockchains are sharded to obtain multiple sharding data corresponding to the multiple blockchains.

4. The method according to claim 1, characterized in that: The determining, based on the preset exchange rule, the shard data for exchange and the blockchains for exchange corresponding to each of the plurality of blockchains includes: Respectively retain any one of the multiple shard data corresponding to the multiple blockchains, and use the remaining shard data as the shard data for exchange corresponding to the multiple blockchains; Based on the preset exchange rule, it is determined that the blockchains corresponding to the multiple blockchains to be exchanged are all the remaining blockchains in the multiple blockchains, wherein one shard data is exchanged between any two blockchains.

5. The method according to claim 1, characterized in that Before sharding the initial data corresponding to each of the multiple blockchains based on the preset sharding rules corresponding to each of the multiple blockchains, the method includes: Determine preset sharding rules corresponding to each of the multiple blockchains based on the development frameworks and operating environments corresponding to each of the multiple blockchains; The preset sharding rules corresponding to each of the multiple blockchains are respectively configured on the corresponding blockchains.

6. A data processing system in a blockchain, characterized in that: The method for processing data in a blockchain according to any one of claims 1 to 5 above comprises: The relay gateway module is used to exchange the shard data corresponding to each of the multiple blockchains and calculate the target data corresponding to the query request; The adapter module is used to query and extract the initial data corresponding to each of the multiple blockchains, and to shard the extracted initial data corresponding to each of the multiple blockchains based on the preset sharding rules corresponding to each of the multiple blockchains, and to calculate the sum of the new multiple sharding data corresponding to each of the multiple blockchains to obtain the new data corresponding to each of the multiple blockchains.

7. A data processing device in a blockchain, characterized in that: include: A receiving module, used for receiving a query request; An extraction module, used to query and extract initial data corresponding to each of the multiple blockchains based on the query request; A sharding module, configured to shard the extracted initial data corresponding to each of the multiple blockchains based on preset sharding rules corresponding to each of the multiple blockchains, to obtain multiple sharding data corresponding to each of the multiple blockchains; A first determination module is used to determine the shard data for exchange and the blockchain for exchange corresponding to each of the multiple blockchains based on a preset exchange rule; An exchange module, used to exchange the shard data for exchange corresponding to each of the multiple blockchains with the shard data for exchange corresponding to the corresponding blockchain to be exchanged, to obtain new multiple shard data corresponding to each of the multiple blockchains; A calculation module, used to respectively calculate the sum of the new multiple shard data corresponding to the multiple blockchains, to obtain the new data corresponding to the multiple blockchains; The second determination module is used to determine the target data corresponding to the query request according to the new data corresponding to each of the multiple blockchains.

8. A non-volatile storage medium, characterized in that: The non-volatile storage medium includes a stored program, wherein when the program is running, the device where the non-volatile storage medium is located is controlled to execute the data processing method in the blockchain described in any one of claims 1 to 5.

9. A computer device, characterized in that: include: Memory and processor, The memory stores a computer program; The processor is used to execute the computer program stored in the memory, and when the computer program is run, the processor executes the data processing method in the blockchain described in any one of claims 1 to 5.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the data processing method in the blockchain described in any one of claims 1 to 5 is implemented.

Citation Information

Cited By

  • Block data query method and device in fragmented block chain, and electronic equipment

    CN120541123A