Data Processing Method, Apparatus, Device, and Computer-Readable Storage Medium

By sharding large-capacity data in blockchain technology and performing consensus operations, the problem of low efficiency of blockchain processing large-capacity data is solved, and a wider range of application scenarios are achieved.

CN113609215BActive Publication Date: 2025-06-13SHENZHEN QIXING FENGTAI TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110771561.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-07-07
Publication Date
2025-06-13
Estimated Expiration
2041-07-07

AI Technical Summary

Technical Problem

Blockchain technology is not efficient when processing large-capacity data, which limits its application scenarios.

Method used

By sharding large-capacity data and sending it to the sub-chain for the first consensus operation, obtaining the hash value set, and then sending the hash value set to the main chain for the second consensus operation, the hash value set is persisted to the main chain.

Benefits of technology

It improves the efficiency of blockchain processing large-capacity data and expands the application scenarios of blockchain technology.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113609215B_ABST
    Figure CN113609215B_ABST
Patent Text Reader

Abstract

The present invention discloses a data processing method, apparatus, device, and computer-readable storage medium, including: receiving a sharded data set sent by a client, performing a verification operation on the sharded data set, and sending the verified sharded data set to a sub-chain; performing a first consensus operation on the sharded data set through the sub-chain to persist the sharded data set in the storage nodes of the sub-chain and obtain a hash value set; receiving the hash value set sent by the sub-chain, sending the hash value set to the main chain, and performing a second consensus operation on the hash value set through the main chain to persist the hash value set in the storage nodes of the main chain. The present invention sends the sharded data set to the sub-chain for the first consensus operation to obtain a hash value set, and sends the hash value set to the main chain for the second consensus operation to persist the hash value set in the main chain, improving the efficiency of the blockchain in processing large-capacity data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of blockchain technology, and in particular, to a data processing method, apparatus, device, and computer-readable storage medium. Background Art

[0002] With the development of blockchain technology, more and more industries have applied blockchain technology. Since the storage space of the main chain of the blockchain is limited, when using the blockchain to process large-capacity data, the efficiency is often not high, which in turn limits the application scenarios of blockchain technology. Therefore, how to improve the efficiency of the blockchain in processing large-capacity data to expand the application scenarios of blockchain technology is an urgent problem to be solved. Summary of the Invention

[0003] The main object of the present invention is to provide a data processing method, apparatus, device, and computer-readable storage medium, aiming to solve the problem of how to improve the efficiency of the blockchain in processing large-capacity data to expand the application scenarios of blockchain technology.

[0004] To achieve the above object, the present invention provides a data processing method, and the data processing method includes the following steps:

[0005] Receive a sharded data set sent by a client, perform a verification operation on the sharded data set, and send the sharded data set that passes the verification operation to a sub-chain;

[0006] Perform a first consensus operation on the sharded data set through the sub-chain to persist the sharded data set into the storage nodes of the sub-chain and obtain a hash value set;

[0007] Receive the hash value set sent by the sub-chain, send the hash value set to the main chain, and perform a second consensus operation on the hash value set through the main chain to persist the hash value set into the storage nodes of the main chain.

[0008] Preferably, before the step of receiving a sharded data set sent by a client, performing a verification operation on the sharded data set, and sending the sharded data set that passes the verification operation to a sub-chain, the data processing method further includes:

[0009] When receiving target data, obtain the capacity of the target data, and compare the capacity of the target data with a preset capacity threshold to obtain a comparison result;

[0010] If the comparison result is that the capacity of the target data is greater than the preset capacity threshold, then perform a sharding operation on the target data through the client according to a preset sharding capacity to obtain the sharded data set.

[0011] Preferably, the step of verifying the sharded data and sending the set of sharded data that passes the verification operation to the sub-chain includes:

[0012] Verify whether there is duplicate sharded data in the set of sharded data and whether the format of the set of sharded data is correct, and obtain a verification result;

[0013] If the verification result is that there is no duplicate sharded data in the set of sharded data and the format of the set of sharded data is correct, then perform the step of sending the set of sharded data that passes the verification operation to the sub-chain.

[0014] Preferably, the step of performing a first consensus operation on the set of sharded data through the sub-chain to persist the set of sharded data to the storage nodes of the sub-chain and obtain a set of hash values includes:

[0015] Pack the set of sharded data into a first transaction set through the sub-chain, and pack the first transaction set into a first block set through the speaker node in the sub-chain;

[0016] Perform the first consensus operation on the first block set through the speaker node, council member nodes, and consensus nodes in the sub-chain to persist the set of sharded data in the first block set to the storage nodes of the sub-chain and obtain the set of hash values.

[0017] Preferably, the step of receiving the set of hash values sent by the sub-chain and sending the set of hash values to the main chain includes:

[0018] Receive the set of hash values sent by the sub-chain, pack the set of hash values into a second transaction set, and send the second transaction set to the main chain.

[0019] Preferably, the step of performing a second consensus operation on the set of hash values through the main chain to persist the set of hash values to the storage nodes of the main chain includes:

[0020] Pack the second transaction set into a second block set through the speaker node in the main chain;

[0021] Perform the second consensus operation on the second block set through the speaker node, council member nodes, and consensus nodes in the main chain to persist the set of hash values in the second block set to the storage nodes of the main chain.

[0022] Preferably, after the steps of receiving the set of hash values sent by the sub-chain, sending the set of hash values to the main chain, and performing a second consensus operation on the set of hash values through the main chain to persist the set of hash values to the storage nodes of the main chain, the data processing method further includes:

[0023] Performing an association operation between the hash values in the set of hash values and the corresponding shard data in the shard data set, so that the client can query the corresponding shard data in the sub-chain through the hash values in the main chain.

[0024] In addition, to achieve the above object, the present invention also provides a data processing device, the data processing device includes:

[0025] A verification module, configured to receive a shard data set sent by a client, perform a verification operation on the shard data set, and send the shard data set that passes the verification operation to the sub-chain;

[0026] A first consensus module, configured to perform a first consensus operation on the shard data set through the sub-chain to persist the shard data set to the storage nodes of the sub-chain and obtain a set of hash values;

[0027] A second consensus module, configured to receive the set of hash values sent by the sub-chain, send the set of hash values to the main chain, and perform a second consensus operation on the set of hash values through the main chain to persist the set of hash values to the storage nodes of the main chain.

[0028] Preferably, the verification module further includes a sharding module, and the sharding module is used for:

[0029] When receiving target data, obtaining the capacity of the target data, comparing the capacity of the target data with a preset capacity threshold, and obtaining a comparison result;

[0030] If the comparison result is that the capacity of the target data is greater than the preset capacity threshold, then perform a sharding operation on the target data through the client according to a preset sharding capacity to obtain the shard data set.

[0031] Preferably, the verification module is further used for:

[0032] Verifying whether there is the same shard data in the shard data set and whether the format of the shard data set is correct, and obtaining a verification result;

[0033] If the verification result is that there is no same shard data in the shard data set and the format of the shard data set is correct, then execute the step: sending the shard data set that passes the verification operation to the sub-chain.

[0034] Preferably, the first consensus module is further configured to:

[0035] Pack the shard data set into a first transaction set through the sub-chain, and pack the first transaction set into a first block set through the speaker node in the sub-chain;

[0036] Perform the first consensus operation on the first block set through the speaker node, council member node, and consensus node in the sub-chain, so as to persist the shard data set in the first block set to the storage node of the sub-chain and obtain the hash value set.

[0037] Preferably, the second consensus module further includes a packing module, and the packing module is configured to:

[0038] Receive the hash value set sent by the sub-chain, pack the hash value set into a second transaction set, and send the second transaction set to the main chain.

[0039] Preferably, the second consensus module is further configured to:

[0040] Pack the second transaction set into a second block set through the speaker node in the main chain;

[0041] Perform the second consensus operation on the second block set through the speaker node, council member node, and consensus node in the main chain, so as to persist the hash value set in the second block set to the storage node of the main chain.

[0042] Preferably, the second consensus module further includes an association module, and the association module is configured to:

[0043] Perform an association operation on the hash values in the hash value set and the corresponding shard data in the shard data set, so that the client can query the corresponding shard data in the sub-chain through the hash values in the main chain.

[0044] In addition, to achieve the above object, the present invention further provides a data processing device, which includes: a memory, a processor, and a data processing program stored on the memory and executable on the processor. When the data processing program is executed by the processor, the steps of the data processing method described above are implemented.

[0045] In addition, to achieve the above object, the present invention further provides a computer-readable storage medium, on which a data processing program is stored. When the data processing program is executed by a processor, the steps of the data processing method described above are implemented.

[0046] The data processing method proposed by the present invention receives a sharded data set sent by a client, performs a verification operation on the sharded data set, and sends the sharded data set that passes the verification operation to a sub-chain; the sub-chain performs a first consensus operation on the sharded data set to persist the sharded data set into the storage nodes of the sub-chain and obtain a hash value set; receives the hash value set sent by the sub-chain, sends the hash value set to the main chain, and the main chain performs a second consensus operation on the hash value set to persist the hash value set into the storage nodes of the main chain. The present invention sends the sharded data set to the sub-chain for the first consensus operation to obtain a hash value set, and sends the hash value set to the main chain for the second consensus operation to persist the hash value set into the main chain, improving the efficiency of the blockchain in processing data. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] Figure 1 is a schematic diagram of the device structure of the hardware operating environment involved in the embodiment solution of the present invention;

[0048] Figure 2 is a schematic flowchart of the first embodiment of the data processing method of the present invention;

[0049] The implementation, functional features, and advantages of the object of the present invention will be further described with reference to the accompanying drawings in combination with the embodiments. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0050] It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0051] As Figure 1 shown, Figure 1 is a schematic diagram of the device structure of the hardware operating environment involved in the embodiment solution of the present invention.

[0052] The device in the embodiment of the present invention can be a PC or a server device.

[0053] As Figure 1 shown, the device may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, and a communication bus 1002. Among them, the communication bus 1002 is used to implement connection communication between these components. The user interface 1003 may include a display screen (Display) and an input unit such as a keyboard (Keyboard). Optionally, the user interface 1003 may further include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory or a stable memory (non-volatile memory), such as a disk memory. Optionally, the memory 1005 may also be a storage device independent of the aforementioned processor 1001.

[0054] Those skilled in the art can understand that Figure 1 the device structure shown in does not constitute a limitation on the device, and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0055] As Figure 1 shown, in the memory 1005 as a computer storage medium, an operating system, a network communication module, a user interface module, and a data processing program may be included.

[0056] Among them, the operating system is a program for managing and controlling the portable data processing device and software resources, and supports the operation of the network communication module, the user interface module, the data processing program, and other programs or software; the network communication module is used to manage and control the network interface 1002; the user interface module is used to manage and control the user interface 1003.

[0057] In Figure 1 the data processing device shown, the data processing device calls the data processing program stored in the memory 1005 through the processor 1001, and executes the operations in each embodiment of the following data processing method.

[0058] Based on the above hardware structure, an embodiment of the data processing method of the present invention is proposed.

[0059] Referring to Figure 2 , Figure 2 is a schematic flowchart of the first embodiment of the data processing method of the present invention, and the method includes:

[0060] Step S10, receiving the sharded data set sent by the client, performing a verification operation on the sharded data set, and sending the sharded data set that passes the verification operation to the sub-chain;

[0061] Step S20, performing a first consensus operation on the sharded data set through the sub-chain to persist the sharded data set into the storage nodes of the sub-chain and obtain a hash value set;

[0062] Step S30, receiving the hash value set sent by the sub-chain, sending the hash value set to the main chain, and performing a second consensus operation on the hash value set through the main chain to persist the hash value set into the storage nodes of the main chain.

[0063] The data processing method of this embodiment is applied to a data processing device of an organization that processes data based on a blockchain. The data processing device can be a terminal or a PC device. For the convenience of description, the data processing device is taken as an example for description. The data processing device includes, but is not limited to: a client, a gateway, a sub-chain, and a main chain. After the gateway in the data processing device receives the sharded data set sent by the client, it performs a verification operation on the sharded data set through the gateway, and sends the sharded data set that passes the verification operation to the sub-chain. The data processing device packs the sharded data set through the sub-chain to obtain the first block data, and performs a first consensus operation on the first block data to persist the sharded data set into the storage nodes of the sub-chain and obtain a hash value set, and then sends the hash value set to the gateway. After the data processing device receives the hash value set through the gateway, it packs the hash value set into the second block data, sends the second block data to the main chain, and then performs a second consensus operation on the second block data through the main chain to persist the hash value set into the storage nodes of the main chain.

[0064] The data processing method of this embodiment receives the sharded data set sent by the client through the gateway, performs a verification operation on the sharded data set, and sends the sharded data set that passes the verification operation to the sub-chain; performs a first consensus operation on the sharded data set through the sub-chain to persist the sharded data set into the storage nodes of the sub-chain and obtain a hash value set; receives the hash value set sent by the sub-chain through the gateway, sends the hash value set to the main chain, and performs a second consensus operation on the hash value set through the main chain to persist the hash value set into the storage nodes of the main chain. The present invention sends the sharded data set to the sub-chain for the first consensus operation to obtain a hash value set, and sends the hash value set to the main chain for the second consensus operation to persist the hash value set into the main chain, improving the efficiency of the blockchain in processing data.

[0065] The following will explain each step in detail:

[0066] Step S10, receive the sharded data set sent by the client, perform a verification operation on the sharded data set, and send the sharded data set that passes the verification operation to the sub-chain;

[0067] In this embodiment, the data processing device receives the sharded data set sent by the client through the gateway, performs a verification operation on the sharded data set, and sends the sharded data set that passes the verification operation to the sub-chain. If the sharded data set does not pass the verification operation, the sharded data set is sent to the client, and the client re-shards the target data corresponding to the sharded data set to obtain a new sharded data set, and sends the new sharded data set to the gateway.

[0068] Specifically, before step S10 includes:

[0069] Step a, when receiving the target data, obtain the capacity of the target data, and compare the capacity of the target data with a preset capacity threshold to obtain a comparison result;

[0070] In this step, when the data processing device receives the target data uploaded by the relevant user, obtain the capacity of the target data, and compare the capacity of the target data with a preset capacity threshold to obtain a comparison result; it should be noted that the preset capacity threshold in the data processing device is set by the relevant R & D personnel according to the maximum storage capacity of the main chain of the blockchain. When the capacity of the target data is less than the preset capacity threshold, the target data is managed and stored by a general method. When the capacity of the target data is greater than the preset capacity threshold, the target data is managed and stored by the method of the present invention.

[0071] Step b, if the comparison result is that the capacity of the target data is greater than the preset capacity threshold, then according to the preset shard capacity, perform a sharding operation on the target data through the client to obtain the sharded data set.

[0072] In this step, if the data processing device obtains a comparison result that the capacity of the target data is greater than the preset capacity threshold, then according to the preset shard capacity, perform a sharding operation on the target data through the client to obtain the sharded data set. For example, the capacity of the target data is 30M, the preset capacity threshold is 20M, and the preset shard capacity is 1M; after the data processing device compares the capacity of the target data with the preset capacity threshold, if the comparison result is that the capacity of the target data is greater than the preset capacity threshold, then according to the preset shard capacity, perform a sharding operation on the target data to obtain 30 sharded data with a capacity of 1M each to obtain the sharded data set. It should be noted that when performing a sharding operation on the target data, the client will sort the sharded data according to the start position and end position of the target data, so that when the user needs to query the target data, the client can recombine it in the shard order to restore the original target data.

[0073] Specifically, step S10 further includes:

[0074] Step c, verify whether there is the same sharded data in the sharded data set and whether the format of the sharded data set is correct, and obtain a verification result;

[0075] In this step, the data processing device verifies through the gateway whether there is duplicate shard data in the shard data set sent by the client and whether the format of the shard data set is correct, and obtains a verification result. If there is duplicate shard data in the shard data set, the duplicate shard data is deleted, leaving only one of the duplicate shard data. If the format of the shard data set is incorrect, the shard data set needs to be returned to the client for re-sharding.

[0076] Step d, if the verification result is that there is no duplicate shard data in the shard data set and the format of the shard data set is correct, then execute the step of sending the shard data set that has passed the verification operation to the sub-chain.

[0077] In this step, if the verification result obtained by the data processing device is that there is no duplicate shard data in the shard data set and the format of the shard data set is correct, then execute the step of sending the shard data set that has passed the verification operation to the sub-chain. It should be noted that the shard data set received by the gateway may be sent repeatedly and the format may be disordered during the sending process. Therefore, the gateway needs to verify the shard data set to ensure the accuracy of the shard data set and avoid errors in subsequent steps.

[0078] Step S20, perform a first consensus operation on the shard data set through the sub-chain to persist the shard data set into the storage nodes of the sub-chain and obtain a hash value set;

[0079] In this embodiment, the data processing device performs a first consensus operation on the shard data set through the sub-chain to persist the shard data set into the storage nodes of the sub-chain and obtain a hash value set. It should be noted that after the first consensus operation of the sub-chain on the shard data set, each shard data in the shard data set will generate a unique corresponding hash value.

[0080] Specifically, step S20 further includes:

[0081] Step e, package the shard data set into a first transaction set through the sub-chain, and package the first transaction set into a first block set through the speaker node in the sub-chain;

[0082] In this step, the data processing device converts each shard set in the sharded data set into a corresponding transaction through a sub-chain, packs all the transactions into a first transaction set, and converts each transaction in the first transaction set into a corresponding block through the speaker node in the sub-chain, and packs all the blocks into a first block set; it should be noted that the speaker node in the sub-chain is elected from the council member nodes, and each council member node takes turns as the speaker node according to a preset election rule. In each round of the first consensus operation, consensus is performed on one block in the first block set. After the council member node with the largest number performs a round of the first consensus operation as the speaker node, in the next round, the council member node with the smallest number will be the speaker node, and this process repeats until consensus is completed for all blocks in the first block set.

[0083] Step f: Perform the first consensus operation on the first block set through the speaker node, council member nodes, and consensus nodes in the sub-chain, so as to persist the sharded data set in the first block set to the storage nodes of the sub-chain and obtain the hash value set.

[0084] In this step, the data processing device encapsulates and signs the first block in the generated first block set according to the block arrangement order through the speaker node in the sub-chain, and sends it to all council member nodes. After receiving the block with encapsulation and signature, the council member nodes verify whether the signature and transactions in the block are correct. When the signature and transactions in the block are both correct, all council member nodes encapsulate and sign the block and send it to all first consensus nodes. The first consensus nodes detect whether the blocks sent by the receiving council member nodes are timed out. If not, they verify all the blocks sent by the council member nodes. If it is verified that the corresponding number of transactions in all the blocks is greater than the preset number, they encapsulate and sign all the blocks and send the encapsulated blocks to all second consensus nodes. The second consensus nodes detect whether the blocks sent by the receiving first consensus nodes are timed out. If not, they verify all the blocks sent by the council member nodes. If it is verified that the corresponding number of transactions in all the blocks is greater than the preset number, they persist the corresponding shard data in the transactions of the corresponding blocks to the storage nodes of the sub-chain and obtain the corresponding hash values. After performing the consensus operation on all the blocks in the first block set, all the shard data is stored in the storage nodes of the sub-chain, and the hash values corresponding to all the shard data obtained are combined into a hash value set. It should be noted that when the council member nodes verify that the signature and transactions in the block sent by the speaker node are incorrect, or when the first consensus nodes receive the blocks sent by the council member nodes and are timed out, or when the second consensus nodes receive the blocks sent by the second consensus nodes and are timed out, the speaker node needs to be replaced, and a new speaker node generates blocks again; the calculation formula for the preset number is: f = n – ceil(n / 3), where f is the preset number, n is the total number of all consensus nodes in the sub-chain, and Ceil is used to calculate the smallest integer greater than or equal to the specified expression.

[0085] Step S30: Receive the hash value set sent by the sub-chain, send the hash value set to the main chain, and perform a second consensus operation on the hash value set through the main chain to persist the hash value set to the storage nodes of the main chain.

[0086] In this embodiment, the data processing device receives the hash value set sent by the sub-chain through the gateway, sends the hash value set to the main chain, and performs a second consensus operation on the hash value set through the main chain to persist the hash value set to the storage nodes of the main chain; it should be noted that the sub-chain stores the specific content of the shard data, and the main chain stores the hash value corresponding to each shard data, so as to make full use of the storage capacity of the sub-chain under the main chain, thereby reducing the pressure on the main chain to store data.

[0087] Specifically, step S30 further includes:

[0088] Step g: Receive the set of hash values sent by the sub-chain, pack the set of hash values into a second transaction set, and send the second transaction set to the main chain.

[0089] In this step, the data processing device receives the set of hash values sent by the sub-chain through the gateway, converts each hash value in the set of hash values into a transaction, combines all the transactions into a second transaction set, and sends the second transaction set to the main chain.

[0090] Step h: Pack the second transaction set into a second block set through the speaker node in the main chain;

[0091] In this step, the data processing device converts each transaction in the second transaction set into a block through the speaker node in the main chain, and packs all the blocks into a second block set. It should be noted that the election rules of the speaker node in the main chain are the same as those of the speaker node in the sub-chain, so no detailed description will be given here.

[0092] Step i: Perform the second consensus operation on the second block set through the speaker node, council member nodes, and consensus nodes in the main chain, so as to persist the set of hash values in the second block set into the storage node of the main chain.

[0093] In this step, the data processing device encapsulates and signs the first block in the generated second block set in the order of block arrangement through the speaker node, and sends it to all councilor nodes. After receiving the block with encapsulation and signature, the councilor nodes verify whether the signature and transactions in the block are correct. When the signature and transactions in the block are both correct, all councilor nodes encapsulate and sign the block, and send it to all first consensus nodes. The first consensus node detects whether the block sent by the receiving councilor node times out. If it does not time out, it verifies all the blocks sent by the councilor nodes. If it is verified that the corresponding number of transactions in all the blocks is greater than the preset number, it encapsulates and signs all the blocks, and sends the encapsulated blocks to all second consensus nodes. The second consensus node detects whether the block sent by the receiving first consensus node times out. If it does not time out, it verifies all the blocks sent by the councilor nodes. If it is verified that the corresponding number of transactions in all the blocks is greater than the preset number, it persists the corresponding hash value in the transactions of the corresponding block to the storage node of the main chain. After performing the consensus operation on all the blocks in the second block set, all the hash values are stored in the storage node of the main chain. It should be noted that when the councilor nodes verify that the signature and transactions in the block sent by the speaker node are incorrect, and when the first consensus node receives the block sent by the councilor node and times out, and when the second consensus node receives the block sent by the second consensus node and times out, the speaker node needs to be replaced, and a new speaker node generates a block again; the calculation formula for the preset number is: f = n – ceil(n / 3), where f is the preset number, n is the total number of all consensus nodes in all main chains, and Ceil is used to calculate the smallest integer greater than or equal to the specified expression.

[0094] After the gateway in the data processing device of this embodiment receives the sharded data set sent by the client, it verifies the sharded data set through the gateway and sends the sharded data set that passes the verification operation to the sub-chain; the data processing device packs the sharded data set through the sub-chain to obtain the first block data, and performs the first consensus operation on the first block data to persist the sharded data set into the storage nodes of the sub-chain and obtain a hash value set, and then sends the hash value set to the gateway; after the data processing device receives the hash value set through the gateway, it packs the hash value set into the second block data, sends the second block data to the main chain, and then performs the second consensus operation on the second block data through the main chain to persist the hash value set into the storage nodes of the main chain. By sharding the large-capacity data in the present invention to obtain sharded data, and through the first consensus operation and the second consensus operation, each sharded data corresponding to the large-capacity data is stored in the sub-chain, and each hash value corresponding to each sharded data is stored in the main chain, so that the main chain does not need to directly process the large-capacity data, only needs to process the small-capacity hash values, and thus the large-capacity data will not affect the performance of the main chain, thereby improving the efficiency of the blockchain in processing large-capacity data.

[0095] Further, based on the first embodiment of the data processing method of the present invention, a second embodiment of the data processing method of the present invention is proposed.

[0096] The difference between the second embodiment of the data processing method and the first embodiment of the data processing method is that after step S30, it further includes:

[0097] Step j, performing an association operation on the hash values in the hash value set and the corresponding sharded data in the sharded data set, so that the client can query the corresponding sharded data in the sub-chain through the hash values in the main chain.

[0098] In this embodiment, after the data processing device stores the sharded data set and the hash value set into the sub-chain and the main chain respectively, it performs an association operation on the hash values in the hash value set and the corresponding sharded data in the sharded data set through the gateway. Each hash value corresponds to a sharded data, and finally an index table of the sharded data is formed. Relevant users can query the exposed interface of the gateway through the client, and then obtain the specific content of the sharded data corresponding to the hash value stored on the main chain, and then recombine the sharded data in the sharded order to restore it to the original data format, so as to realize the query of the large-capacity data on the blockchain.

[0099] The data processing device of this embodiment performs an association operation on the hash values in the hash value set and the corresponding sharded data in the sharded data set through the gateway, so that the client can query the corresponding sharded data in the sub-chain through the hash values in the main chain, thereby improving the efficiency of data query and helping to expand the application scenarios of blockchain technology.

[0100] The present invention also provides a data processing device. The data processing device of the present invention includes:

[0101] A verification module, configured to receive a sharded data set sent by a client, perform a verification operation on the sharded data set, and send the sharded data set that passes the verification operation to a sub-chain;

[0102] A first consensus module, configured to perform a first consensus operation on the sharded data set through the sub-chain, so as to persist the sharded data set into storage nodes of the sub-chain and obtain a hash value set;

[0103] A second consensus module, configured to receive the hash value set sent by the sub-chain, send the hash value set to a main chain, and perform a second consensus operation on the hash value set through the main chain, so as to persist the hash value set into storage nodes of the main chain.

[0104] Preferably, the verification module further includes a sharding module, and the sharding module is configured to:

[0105] When receiving target data, obtain the capacity of the target data, compare the capacity of the target data with a preset capacity threshold, and obtain a comparison result;

[0106] If the comparison result is that the capacity of the target data is greater than the preset capacity threshold, perform a sharding operation on the target data through the client according to a preset sharding capacity, so as to obtain the sharded data set.

[0107] Preferably, the verification module is further configured to:

[0108] Verify whether there is the same sharded data in the sharded data set and whether the format of the sharded data set is correct, and obtain a verification result;

[0109] If the verification result is that there is no same sharded data in the sharded data set and the format of the sharded data set is correct, execute the step: send the sharded data set that passes the verification operation to the sub-chain.

[0110] Preferably, the first consensus module is further configured to:

[0111] Pack the sharded data set into a first transaction set through the sub-chain, and pack the first transaction set into a first block set through a speaker node in the sub-chain;

[0112] Perform the first consensus operation on the first block set through the speaker node, council member node, and consensus node in the sub-chain, so as to persist the shard data set in the first block set into the storage node of the sub-chain and obtain the hash value set.

[0113] Preferably, the second consensus module further includes a packaging module, and the packaging module is used for:

[0114] Receive the hash value set sent by the sub-chain, pack the hash value set into a second transaction set, and send the second transaction set to the main chain.

[0115] Preferably, the second consensus module is further used for:

[0116] Pack the second transaction set into a second block set through the speaker node in the main chain;

[0117] Perform the second consensus operation on the second block set through the speaker node, council member node, and consensus node in the main chain, so as to persist the hash value set in the second block set into the storage node of the main chain.

[0118] Preferably, the second consensus module further includes an association module, and the association module is used for:

[0119] Perform an association operation on the hash values in the hash value set and the corresponding shard data in the shard data set, so that the client can query the corresponding shard data in the sub-chain through the hash values in the main chain.

[0120] The present invention also provides a computer-readable storage medium.

[0121] A data processing program is stored on the computer-readable storage medium of the present invention, and when the data processing program is executed by a processor, the steps of the data processing method described above are implemented.

[0122] Among them, the method implemented when the data processing program running on the processor is executed can refer to each embodiment of the data processing method of the present invention, and will not be elaborated here.

[0123] It should be noted that in this article, the term "including", "comprising" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements not only includes those elements, but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or system. Without further limitation, an element defined by the statement "including one..." does not exclude the existence of additional identical elements in the process, method, article or system including that element.

[0124] The serial numbers of the embodiments of the present invention above are only for description and do not represent the superiority or inferiority of the embodiments.

[0125] Through the description of the above embodiments, those skilled in the art can clearly understand that the above embodiment methods can be implemented by means of software plus a necessary general hardware platform. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium as described above (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to enable a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in various embodiments of the present invention.

[0126] The above are only the preferred embodiments of the present invention, and do not limit the patent scope of the present invention accordingly. Any equivalent structure or equivalent process transformation made by using the description of the present invention and the accompanying drawings, or directly or indirectly applied in other related technical fields, shall be equally included in the patent protection scope of the present invention.

Claims

1. A data processing method, characterized in that, the data processing method includes the following steps: Receiving a sharded data set sent by a client; Verifying whether there is the same sharded data in the sharded data set and whether the format of the sharded data set is correct, and obtaining a verification result; If the verification result is that there is no same sharded data in the sharded data set and the format of the sharded data set is correct, then sending the sharded data set that has passed the verification operation to a sub-chain; Packing the sharded data set into a first transaction set through the sub-chain, and packing the first transaction set into a first block set through a speaker node in the sub-chain; Performing a first consensus operation on the first block set through the speaker node, council member node and consensus node in the sub-chain to persist the sharded data set in the first block set into a storage node of the sub-chain and obtaining a hash value set; Receiving the hash value set sent by the sub-chain, packing the hash value set into a second transaction set, and sending the second transaction set to a main chain; Packing the second transaction set into a second block set through a speaker node in the main chain; Performing a second consensus operation on the second block set through the speaker node, council member node and consensus node in the main chain to persist the hash value set in the second block set into a storage node of the main chain.

2. The data processing method according to claim 1, characterized in that, before the step of receiving the sharded data set sent by the client, the data processing method further includes: When receiving target data, obtaining the capacity of the target data, and comparing the capacity of the target data with a preset capacity threshold to obtain a comparison result; If the comparison result is that the capacity of the target data is greater than the preset capacity threshold, then performing a sharding operation on the target data through the client according to a preset sharding capacity to obtain the sharded data set.

3. The data processing method according to claim 1, characterized in that, after the step of performing a second consensus operation on the second block set through the speaker node, council member node and consensus node in the main chain to persist the hash value set in the second block set into a storage node of the main chain, the data processing method further includes: Performing an association operation between the hash values in the hash value set and the corresponding sharded data in the sharded data set, so that the client can query the corresponding sharded data in the sub-chain through the hash values in the main chain.

4. A data processing device, characterized in that, the data processing device includes: A verification module, configured to receive a sharded data set sent by a client, verify whether there is the same sharded data in the sharded data set and whether the format of the sharded data set is correct, and obtain a verification result. If the verification result is that there is no same sharded data in the sharded data set and the format of the sharded data set is correct, then sending the sharded data set that has passed the verification operation to a sub-chain; The first consensus module is used to pack the shard data set into a first transaction set through the sub-chain, and pack the first transaction set into a first block set through the speaker node in the sub-chain. Perform a first consensus operation on the first block set through the speaker node, council member node, and consensus node in the sub-chain to persist the shard data set in the first block set to the storage node of the sub-chain and obtain a hash value set; The second consensus module is used to receive the hash value set sent by the sub-chain, pack the hash value set into a second transaction set, send the second transaction set to the main chain, and pack the second transaction set into a second block set through the speaker node in the main chain. Perform a second consensus operation on the second block set through the speaker node, council member node, and consensus node in the main chain to persist the hash value set in the second block set to the storage node of the main chain.

5. A data processing device, characterized in that, the data processing device includes: a memory, a processor, and a data processing program stored on the memory and executable on the processor. When the data processing program is executed by the processor, the steps of the data processing method according to any one of claims 1 to 3 are implemented.

6. A computer-readable storage medium, characterized in that, a data processing program is stored on the computer-readable storage medium, and when the data processing program is executed by a processor, the data processing method according to any one of claims 1 to 3 is implemented.

Citation Information

Patent Citations

  • A logical fragmentation method and a logical fragmentation system for block chain nodes

    CN109885264A

  • Workload proof cooperative work method, blockchain node and blockchain system

    CN110874351A