Data processing method and device, computer equipment, storage medium and program product

By processing data shards into multiple shards and sending them by multiple data synchronization nodes, the problem of low data synchronization efficiency in blockchain networks is solved, and more efficient and accurate data synchronization is achieved, and network performance is improved.

CN119109932APending Publication Date: 2024-12-10TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310671581.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-06-07
Publication Date
2024-12-10

AI Technical Summary

Technical Problem

The data synchronization efficiency of the blockchain network is low, which makes it difficult for the data requesting node to keep up with the block output speed of the blockchain network, affecting the overall performance of the network.

Method used

By processing the target data shard into multiple data shards and sending these shards by multiple data synchronization nodes in the blockchain network, ensuring that each data shard is sent by different nodes and the data request node is receiving Verification and reorganization are carried out after sharding to improve the accuracy and efficiency of data synchronization.

Benefits of technology

By allocating the data synchronization pressure to multiple nodes, the data synchronization efficiency and accuracy of the blockchain network are improved, the data synchronization efficiency and accuracy of the blockchain network are avoided, and the overall performance of the network is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119109932A_ABST
    Figure CN119109932A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a data processing method and device, computer equipment, a storage medium and a program product. The data processing method comprises the following steps: sending a data synchronization request to N data synchronization nodes in a block chain network; the data synchronization request is used for requesting to synchronize target data, and the target data is fragmented into N data fragments; receiving a data fragment sent by each data synchronization node in the N data synchronization nodes; one data synchronization node in the N data synchronization nodes is responsible for sending one data fragment in the N data fragments, and different data synchronization nodes send different data fragments; the received N data fragments are verified; and if the verification of the N data fragments is passed, recombining the N data fragments to obtain target data. By adopting the embodiment of the invention, the data synchronization efficiency of the block chain network can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] Blockchain networks often need to synchronize data. Currently, the data synchronization process of blockchain networks is as follows: the data requesting node sends a data synchronization request to the data synchronization node, and the data synchronization node sends the data requested by the data requesting node to the data requesting node. Practice has found that in the data synchronization process of the above blockchain network, the data synchronization efficiency is low. Therefore, how to improve the data synchronization efficiency of the blockchain network has become a current research hotspot. Summary of the invention

[0003] The embodiments of the present application provide a data processing method, apparatus, computer equipment, storage medium, and program product, which can improve the data synchronization efficiency of the blockchain network.

[0004] On the one hand, an embodiment of the present application provides a data processing method, the data processing method comprising:

[0005] Send a data synchronization request to N data synchronization nodes in the blockchain network; the data synchronization request is used to request synchronization of target data, and the target data is sharded into N data shards, where N is an integer greater than 1;

[0006] Receive data slices sent by each of the N data synchronization nodes; one of the N data synchronization nodes is responsible for sending one of the N data slices, and different data synchronization nodes send different data slices;

[0007] Verify the N received data shards;

[0008] If N data shards pass the verification, the N data shards are reorganized to obtain the target data.

[0009] Accordingly, an embodiment of the present application provides a data processing device, the data processing device comprising:

[0010] A communication unit, used to send a data synchronization request to N data synchronization nodes in the blockchain network; the data synchronization request is used to request synchronization of target data, and the target data is sharded into N data shards, where N is an integer greater than 1;

[0011] The communication unit is further used to receive data slices respectively sent by each of the N data synchronization nodes; one of the N data synchronization nodes is responsible for sending one of the N data slices, and different data synchronization nodes send different data slices;

[0012] A processing unit, used to verify the received N data fragments;

[0013] The processing unit is also used to reorganize the N data shards to obtain target data if the N data shards are verified.

[0014] In one implementation, any one of the N data slices is sent after being encapsulated with a corresponding slice data header, and the slice data header of any one of the data slices includes data verification information and slice verification information; the processing unit is used to verify the received N data slices, specifically to perform the following steps:

[0015] Performing a first verification on the N data shards according to the received data verification information of the N data shards;

[0016] If the first verification of the N data shards passes, a second verification is performed on the N data shards according to the shard verification information of the N data shards;

[0017] If the second verification of N data shards passes, it is determined that the verification of N data shards passes.

[0018] In one implementation, the data verification information of any data shard is determined based on the N data shards; the processing unit is configured to perform the following steps when performing a first verification on the N data shards based on the received data verification information of the N data shards:

[0019] Compare the data verification information of N data shards;

[0020] If the data verification information of the N data shards is exactly the same, it is determined that the first verification of the N data shards has passed.

[0021] In one implementation, the shard verification information of any data shard is determined according to the corresponding data shard; the processing unit is used to perform the second verification on the N data shards according to the shard verification information of the N data shards, specifically to perform the following steps:

[0022] Compare the shard verification information of N data shards;

[0023] If the shard verification information of the N data shards is completely different, it is determined that the second verification of the N data shards is passed.

[0024] In one implementation, the first verification failure of the N data shards refers to that data verification information of a target data shard among the N data shards is different from data verification information of other data shards among the N data shards, and the other data shards refer to data shards other than the target data shard among the N data shards; the processing unit is further used to perform the following steps:

[0025] If the first verification of N data shards fails, the data synchronization node that requests to send the target data shard sends a new target data shard; the new target data shard and other data shards form new N data shards;

[0026] According to the data verification information of the new N data shards, a first verification is performed on the new N data shards.

[0027] In one implementation, the second verification failure of the N data shards means that there are at least two data shards in the N data shards whose shard verification information is the same; the processing unit is further used to perform the following steps:

[0028] If the second verification of the N data shards fails, determining an erroneous data shard among at least two data shards;

[0029] The data synchronization node that requests to send the erroneous data shard sends a new data shard; the new data shard and the remaining data shards constitute new N data shards, and the remaining data shards refer to the data shards other than the erroneous data shard in the N data shards;

[0030] According to the shard verification information of the new N data shards, a second verification is performed on the new N data shards.

[0031] In one implementation, any one of the at least two data shards is a reference data shard; the shard verification information of any one of the N data shards is determined according to the corresponding data shard; the processing unit is used to perform the following steps when determining an erroneous data shard in the at least two data shards:

[0032] Re-determine the shard verification information based on the reference data shard;

[0033] If the re-determined shard verification information is different from the shard verification information of the reference data shard, the reference data shard is determined to be an erroneous data shard.

[0034] In one implementation, the data synchronization node that sends the reference data shard is a reference data synchronization node; and the processing unit is configured to, when determining an erroneous data shard in at least two data shards, further perform the following steps:

[0035] If the re-determined shard verification information is the same as the shard verification information of the reference data shard, a normal data synchronization node among the N data synchronization nodes is requested to send the data shard sent by the reference data synchronization node; a normal data synchronization node refers to a data synchronization node among the N data synchronization nodes except for the data synchronization node that sends at least two data shards;

[0036] If the data shard sent by the normal data synchronization node is different from the reference data shard, the reference data shard is determined to be an erroneous data shard.

[0037] In one implementation, any data slice among the N data slices is sent after being encapsulated with a corresponding slice data header, and the slice data header of any data slice includes a slice index of the corresponding data slice; the slice index of any data slice is used to indicate the arrangement position of the corresponding data slice in the target data;

[0038] The processing unit is used to reorganize the N data slices to obtain the target data, and is specifically used to perform the following steps:

[0039] According to the shard indexes of the N data shards, the N data shards are reorganized to obtain the target data.

[0040] In one implementation, the processing unit is further configured to perform the following steps:

[0041] Obtaining data batch synchronization information; the data batch synchronization information is used to indicate the maximum amount of data that N data synchronization nodes synchronize at one time; when the amount of target data is greater than the amount of data indicated by the data batch synchronization information, the target data is split into multiple data segments, and the multiple data segments are synchronized segment by segment, and the amount of data in any data segment does not exceed the amount of data indicated by the data batch synchronization information;

[0042] When the amount of target data is less than or equal to the amount of data indicated by the data batch synchronization information, triggering the execution of the step of reorganizing the N data shards to obtain the target data;

[0043] When the data volume of the target data is greater than the data volume indicated by the data batch synchronization information, the N data slices are reorganized to obtain a data segment of the target data.

[0044] On the other hand, an embodiment of the present application provides a data processing method, the data processing method comprising:

[0045] Receive a data synchronization request sent by a data requesting node in the blockchain network; the data synchronization request is used to request N data synchronization nodes in the blockchain network to synchronize target data, where N is an integer greater than 1;

[0046] The target data is sliced ​​and processed to obtain N data slices; one of the N data synchronization nodes is responsible for sending one of the N data slices, and different data synchronization nodes send different data slices;

[0047] Determine the data shards that need to be sent among the N data shards, and send the data shards that need to be sent to the data request node; so that after the data request node receives the data shards sent by the N data synchronization nodes in the blockchain network, the N data shards received are verified. If the N data shards are verified, the N data shards are reorganized to obtain the target data.

[0048] Accordingly, an embodiment of the present application provides a data processing device, the data processing device comprising:

[0049] A communication unit, used to receive a data synchronization request sent by a data requesting node in the blockchain network; the data synchronization request is used to request N data synchronization nodes in the blockchain network to synchronize target data, where N is an integer greater than 1;

[0050] A processing unit is used to perform sharding processing on the target data to obtain N data shards; one of the N data synchronization nodes is responsible for sending one of the N data shards, and different data synchronization nodes send different data shards;

[0051] The processing unit is further used to determine the data slices to be sent among the N data slices;

[0052] The communication unit is also used to send the data shards to be sent to the data request node; so that after the data request node receives the data shards sent by the N data synchronization nodes in the blockchain network, the N data shards received are verified. If the N data shards are verified, the N data shards are reorganized to obtain the target data.

[0053] In one implementation, the N data shards have respective shard indexes, and the shard index of any one of the N data shards is used to indicate the arrangement position of the corresponding data shard in the target data; the data processing method is executed by a target data synchronization node, and the target data synchronization node is any one of the N data synchronization nodes;

[0054] The processing unit is used to determine the data slice to be sent from the N data slices, and is specifically used to perform the following steps:

[0055] Sort the N data synchronization nodes according to their node identifiers;

[0056] Obtain the arrangement position information of the target data synchronization node;

[0057] Among the N data shards, the data shard whose shard index corresponds to the arrangement position information of the target data synchronization node is determined as the data shard that needs to be sent.

[0058] In one implementation, the communication unit is used to send the data slices to be sent to the data requesting node, and is specifically used to perform the following steps:

[0059] Encapsulate the fragment data header for the data fragment to be sent;

[0060] Send the data fragments after encapsulating the fragment data header to the data request node;

[0061] Among them, the shard data header includes the shard index, data verification information and shard verification information of the data shard to be sent; the shard verification information is obtained by encrypting the data shard to be sent, and the data verification information is obtained by encrypting the shard verification information of N data shards; the shard index of the data shard to be sent is used to indicate the arrangement position of the data shard to be sent in the target data.

[0062] In one implementation, the processing unit is further configured to perform the following steps:

[0063] Obtaining data batch synchronization information, which is used to indicate the maximum amount of data that N data synchronization nodes can synchronize at one time;

[0064] If the data volume of the target data is less than or equal to the data volume indicated by the data batch synchronization information, a step of slicing the target data to obtain N data slicing steps is triggered;

[0065] If the data volume of the target data is larger than the data volume indicated by the data batch synchronization information, the target data is split into multiple data segments, and the multiple data segments are synchronized segment by segment.

[0066] Accordingly, an embodiment of the present application provides a computer device, the computer device comprising:

[0067] a processor suitable for implementing a computer program;

[0068] A computer-readable storage medium stores a computer program, and the computer program is suitable for being loaded by a processor and executing the above-mentioned data processing method.

[0069] Accordingly, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is read and executed by a processor of a computer device, the computer device executes the above-mentioned data processing method.

[0070] Accordingly, an embodiment of the present application provides a computer program product or a computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the above-mentioned data processing method.

[0071] In the embodiment of the present application, the target data requested for synchronization can be processed into N data fragments, and the N data synchronization nodes in the blockchain network synchronize the N data fragments respectively. One of the N data synchronization nodes is responsible for sending one of the N data fragments. Different data synchronization nodes send different data fragments. It can be seen that the data synchronization pressure in the blockchain network is shared among multiple data synchronization nodes, rather than concentrated on one data synchronization node in the blockchain network. This can improve the data synchronization efficiency of the blockchain network. In addition, after receiving the data fragments sent by the N data synchronization nodes respectively, the received N data fragments can be verified. If the N data fragments are verified, the N data fragments can be reorganized to obtain the target data. By verifying the N data fragments, the data synchronization accuracy of the blockchain network can be improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0072] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0073] Figure 1 This is a schematic diagram of the architecture of a conventional blockchain network provided in an embodiment of the present application;

[0074] Figure 2 This is a schematic diagram of the structure of a blockchain provided by an embodiment of the present application;

[0075] Figure 3 It is a structural schematic diagram of a block generation process provided by an embodiment of the present application;

[0076] Figure 4 This is a schematic diagram of the architecture of a blockchain network provided in an embodiment of the present application;

[0077] Figure 5 It is a flowchart of a data processing method provided in an embodiment of the present application;

[0078] Figure 6It is a flowchart of a data sharding verification process provided by an embodiment of the present application;

[0079] Figure 7 It is a flowchart of another data sharding verification process provided by an embodiment of the present application;

[0080] Figure 8 It is a flowchart of another data processing method provided in an embodiment of the present application;

[0081] Fig. 9 It is a flowchart of a data fragment sending process provided by an embodiment of the present application;

[0082] Fig.10 It is a flowchart of another data processing method provided in an embodiment of the present application;

[0083] Fig.11 is a structural schematic diagram of a data processing device provided in an embodiment of the present application;

[0084] Fig.12 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0085] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0086] In order to more clearly understand the technical solution provided by the embodiments of the present application, the key terms involved in the embodiments of the present application are introduced here:

[0087] (1) Blockchain network:

[0088] The blockchain network is a P2P (Peer to Peer) network, which is a point-to-point network. Each blockchain node connected point-to-point is called a peer node. The P2P network is based on a specific type of network protocol, so that there is no need for a central node to maintain the network status between peer nodes. Each peer node maintains the node status of the entire network and its connection status with adjacent nodes through broadcast interactions with adjacent nodes.

[0089] P2P network can be understood as Figure 1The data sharing system 10 shown. The data sharing system 10 refers to a system for sharing data between blockchain nodes and blockchain nodes, and the data sharing system may include multiple blockchain nodes 101, and the multiple blockchain nodes 101 may refer to each client, terminal or server in the data sharing system. Each blockchain node 101 can receive input information (for example, transaction) when performing normal work, and maintain the shared data in the data sharing system based on the received input information. In order to ensure the information intercommunication in the data sharing system, there may be an information connection between each blockchain node in the data sharing system, and information can be transmitted between blockchain nodes through the above information connection. For example, when any blockchain node in the data sharing system receives input information, other nodes in the data sharing system obtain the input information according to the consensus algorithm, and store the input information as data in the shared data, so that the data stored on all blockchain nodes in the data sharing system are consistent. For each blockchain node in the data sharing system, there is a node identifier corresponding to it, and each blockchain node in the data sharing system can store the node identifiers of other blockchain nodes in the data sharing system, so that the generated blocks can be broadcast to other blockchain nodes in the data sharing system according to the node identifiers of other blockchain nodes in the data sharing system. Each blockchain node can maintain a node identification list as shown in Table 1 below, and store the node name and node identification in the node identification list. The node identification can be an IP (Internet Protocol, a protocol for interconnecting networks) address or any other information that can be used to identify the blockchain node. Table 1 only uses the IP address as an example for explanation:

[0090] Table 1

[0091] Node Name Node ID Node 1 111.111.111.111 Node 2 222.222.222.222 … … Node N NNN.NNN.NNN.NNN

[0092] The blockchain nodes in the blockchain network may include consensus nodes, which can be used to reach a consensus on the blocks to be uploaded to the blockchain for storage. After the blocks pass the consensus, the blocks can be uploaded to the blockchain for storage. In the embodiment of the present application, the consensus node can also be used to synchronize data, synchronizing the data requested to be synchronized with the blockchain node requesting synchronization data.

[0093] (2) Blockchain:

[0094] Each blockchain node in the blockchain network stores an identical blockchain. Blockchain is a distributed ledger technology in the field of information technology. It is generally composed of consensus, transaction blocks, state data storage, cryptographic identity security, etc. Since the ledger is distributed and the blocks are consensus-based, it has the characteristics of being tamper-proof, traceable, and jointly maintained. The blockchain consists of multiple blocks, which can be seen in Figure 2 As shown in the blockchain structure, the blockchain consists of multiple blocks. The genesis block in the blockchain includes a block header and a block body. The block header of the genesis block stores input information feature values, version numbers, timestamps and difficulty values, and the block body of the genesis block stores input information (i.e., transactions). The next block of the genesis block takes the genesis block as its parent block, and the next block also includes a block header and a block body. In addition to storing the input information feature values, version numbers, timestamps and difficulty values ​​of the current block, the block header of the next block also stores the feature values ​​of the block header of the parent block, and so on, so that the block data stored in each block in the blockchain is associated with the block data stored in its parent block, thereby ensuring the security of the input information in the block.

[0095] When generating each block in the blockchain, refer to Figure 3 In the block generation process shown in the figure, when the blockchain node where the blockchain is located receives the input information, it verifies the input information. After the verification is completed, the input information is stored in the transaction pool, and the hash tree used to record the input information is updated; then, the update timestamp is updated to the time when the input information is received, and different random numbers are tried, and the eigenvalue calculation is performed multiple times, so that the calculated eigenvalue can satisfy the following formula:

[0096] SHA256(SHA256(version+prev_hash+merkle_root+ntime+nbits+x)) <TARGET

[0097] Among them, SHA256 (Secure Hash Algorithm 256, a secure hash algorithm) is the eigenvalue algorithm used to calculate the eigenvalue; version (version number) is the version information of the relevant block protocol in the blockchain; prev_hash is the block header eigenvalue of the parent block of the current block; merkle_root is the eigenvalue of the input information; ntime is the update time of the update timestamp; nbits is the current difficulty, which is a fixed value within a period of time and is determined again after exceeding the fixed time period; x is a random number; TARGET is the eigenvalue threshold, which can be determined based on nbits.

[0098] In this way, when the random number that satisfies the above formula is calculated, the information can be stored accordingly, the block header and block body can be generated, and the current block can be obtained. Subsequently, the blockchain node where the blockchain is located sends the newly generated block to other blockchain nodes in the data sharing system where it is located according to the node identification of other blockchain nodes in the data sharing system. Other blockchain nodes verify the newly generated block and add the newly generated block to the blockchain stored in it after the verification is completed.

[0099] As we all know, data synchronization is often required in blockchain networks. The general data synchronization process of blockchain networks is: the data requesting node sends a data synchronization request to the data synchronization node, and the data synchronization node sends the data requested by the data requesting node to the data requesting node. In practice, it is found that the data synchronization efficiency of the general data synchronization process of blockchain networks is low; blockchain networks with low data synchronization efficiency will have many problems. For example, when the data requested for synchronization is a block, if the efficiency of the blockchain network synchronizing blocks is lower than the efficiency of the blockchain network producing blocks, the data requesting node will never keep up with the speed of the blockchain network producing blocks.

[0100] Based on this, the embodiment of the present application proposes a data processing method that can improve the data synchronization efficiency of the blockchain network. In this data processing method, the data requested for synchronization can be processed into multiple data fragments, and the multiple data fragments are sent by different data synchronization nodes in the blockchain network. That is to say, each data synchronization node can be responsible for sending one of the multiple data fragments, and different data synchronization nodes send different data fragments. It can be seen that the data synchronization pressure in the blockchain network is shared among multiple data synchronization nodes, rather than concentrated on one data synchronization node in the blockchain network, which can improve the data synchronization efficiency of the blockchain network. In addition, after receiving the data fragments sent by each data synchronization node, the data request node can verify the multiple data fragments. After verifying that each data synchronization node has sent the correct data fragment and there is no abnormality in the data fragment, the received multiple data fragments can be reorganized to obtain the data requested for synchronization. It can be seen that by verifying the received multiple data fragments, the data synchronization accuracy of the blockchain network can be improved.

[0101] The following is an introduction to a blockchain network suitable for implementing the data processing method provided in the embodiment of the present application in conjunction with the accompanying drawings.

[0102] like Figure 4As shown, the blockchain network may include a data request node 401 and N data synchronization nodes 402 (N is an integer greater than 1), the data request node 401 may be a terminal or a server, and the data synchronization node 402 may be a terminal or a server; a direct communication connection may be established between the data request node 401 and the N data synchronization nodes 402 by wired communication, or an indirect communication connection may be established by wireless communication. The terminal mentioned in the embodiment of the present application may be any one of a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, a vehicle terminal, and a smart home appliance, but is not limited thereto; the server mentioned in the embodiment of the present application may be a separate physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and basic cloud computing services such as big data and artificial intelligence platforms, which are not limited in the embodiment of the present application.

[0103] In a blockchain network composed of a data request node 401 and N data synchronization nodes 402, the data synchronization process of the blockchain network may specifically include: ① When a data request node has a data synchronization demand, it may send a data synchronization request to the N data synchronization nodes. ② The N data synchronization nodes may process the data shards requested for synchronization into N data shards, and each of the N data synchronization nodes needs to determine the data shards that they need to send among the N data shards; in more detail, the N data synchronization nodes may sort the nodes according to the node identifiers, and the shard index of the data shard that any data synchronization node needs to send among the N data shards corresponds to the arrangement position of the corresponding data synchronization node in the node sorting; it can be understood that the data synchronization node with the node identifier arranged in the first position sends the first data shard, the data synchronization node with the node identifier arranged in the second position sends the second data shard, and so on. ③ After each of the N data synchronization nodes determines the data shards that need to be sent, it encapsulates the shard data header for the corresponding data shard and sends the corresponding data shard to the data request node. ④ After receiving N data shards, the data requesting node can verify the N data shards. After the N data shards are verified, the shard data header encapsulated for the data shards can be removed, and the N data shards can be reorganized according to the shard indexes of the N data shards to obtain the target data requested for synchronization.

[0104] In a blockchain network composed of a data request node 401 and N data synchronization nodes 402, the blockchain network can be suitable for implementing data synchronization scenarios such as block synchronization and transaction pool synchronization. Specifically:

[0105] In the block synchronization scenario, the data synchronization node can be a consensus node in the blockchain network. The data request node can be a node in the blockchain network that needs to synchronize blocks (for example, a node newly added to the blockchain network, a node restarted in the blockchain network, and a node recovered from a fault in the blockchain network, etc.). The block height of the data request node itself is lower than the latest block height of the blockchain network; the data synchronization request sent by the data request node may include the block range requested for synchronization, and the data request node lacks blocks within the block range requested for synchronization. The block range requested for synchronization can be determined based on the block height of the data request node itself and the latest block height of the blockchain network. It can be seen that in the block synchronization scenario, the block synchronization pressure can be distributed to each consensus node in the blockchain network, rather than concentrated on one consensus node in the blockchain network, which can improve the block synchronization efficiency of the blockchain network.

[0106] Similarly, in the transaction pool synchronization scenario, the data synchronization node can be a consensus node that operates normally in the blockchain network. The data request node can be a consensus node in the blockchain network that needs to synchronize the transaction pool (for example, a consensus node that has newly joined the blockchain network, a consensus node that has been restarted in the blockchain network, and a consensus node that has recovered from a fault in the blockchain network, etc.), and the transaction pool update time of the data request node itself is earlier than the latest transaction pool update time of the blockchain network; the data synchronization request sent by the data request node may include the transaction pool update time range for requesting synchronization, and within the transaction pool update time range, the transaction pool of the data request node is not updated, and the transaction pool update time range can be determined based on the transaction pool update time of the data request node itself and the latest transaction pool update time of the blockchain network. It can be seen that in the transaction pool synchronization scenario, the transaction pool synchronization pressure can be distributed to each consensus node in the blockchain network, rather than concentrated on one consensus node in the blockchain network, which can improve the transaction pool synchronization efficiency of the blockchain network.

[0107] It can be understood that the blockchain network described in the embodiment of the present application is to more clearly illustrate the technical solution of the embodiment of the present application, and does not constitute a limitation on the technical solution provided in the embodiment of the present application. Ordinary technicians in this field can know that with the evolution of the system architecture and the emergence of new business scenarios, the technical solution provided in the embodiment of the present application is also applicable to similar technical problems.

[0108] The data processing method provided in the embodiment of the present application is described in more detail below with reference to the accompanying drawings.

[0109] The present application embodiment provides a data processing method, which mainly introduces the way in which a data requesting node verifies data shards and the way in which a data requesting node reorganizes data shards. The data processing method can be executed by a computer device, which can be, for example, a data requesting node in a blockchain network. Figure 5 As shown, the data processing method may include but is not limited to the following steps S501 to S504:

[0110] S501, sending a data synchronization request to N data synchronization nodes in the blockchain network; the data synchronization request is used to request synchronization of target data, and the target data is sharded into N data shards.

[0111] When a data requesting node has a data synchronization requirement, it can send a data synchronization request to N data synchronization nodes in the blockchain network. The data synchronization request can be used to request synchronization of target data. In more detail, the data synchronization request can include a data range for which synchronization is requested, and the target data is data within the data range for which synchronization is requested.

[0112] When the data processing method provided by the embodiment of the present application is applied to the block synchronization scenario, the data synchronization node can be a consensus node in the blockchain network. The data request node may have any of the following data synchronization requirements: the data request node newly joins the blockchain network, the data request node is restarted, the data request node recovers after a failure, and so on. The data synchronization request sent by the data request node may include the block range for which synchronization is requested, and the target data may be a block within the block range for which synchronization is requested; the block range for which synchronization is requested may be determined based on the block height of the data request node itself and the latest block height of the blockchain network. For example, if the latest block height of the blockchain network is 1248 and the block height of the data request node itself is 1024, then the block range for which the data request node requests synchronization is 1025-1248.

[0113] When the data processing method provided by the embodiment of the present application is applied to the transaction pool synchronization scenario, the data synchronization node can be a consensus node operating normally in the blockchain network. The data request node has a data synchronization demand that can refer to any of the following: the data request node is a newly added consensus node in the blockchain network, the data request node is a restarted consensus node, and the data request node is a consensus node restored after a failure. The data synchronization request sent by the data request node can include the transaction pool update time range for requesting synchronization, and the target data can be a transaction updated within the transaction pool update time range; the transaction pool update time range can be determined based on the transaction pool update time of the data request node itself and the latest transaction pool update time of the blockchain network. For example, the latest transaction pool update time of the blockchain network is 23:26:45 on June 5, 2024, and the transaction pool update time of the data request node itself is 00:00:00 on June 5, 2024, then the transaction pool update time range requested by the data request node for synchronization is 00:00:01 on June 5, 2024-23:26:45 on June 5, 2024.

[0114] The target data can be sliced ​​and processed into N data slices by each of the N data synchronization nodes. Each of the N data synchronization nodes can determine the data slice that needs to be sent among the N data slices. After determining the data slice that needs to be sent, each data synchronization node can send the data slice that needs to be sent to the data request node. That is to say, one of the N data synchronization nodes can be responsible for sending one of the N data slices, and different data synchronization nodes send different data slices.

[0115] S502: Receive data fragments respectively sent by each of the N data synchronization nodes.

[0116] The data requesting node can receive data slices respectively sent by each of the N data synchronization nodes, that is, the data requesting node can receive N data slices.

[0117] S503: Verify the received N data fragments.

[0118] After receiving N data shards, the data requesting node can verify the received N data shards. The verification process of the N data shards can include a first verification of the N data shards and a second verification of the N data shards. Specifically: any one of the N data shards is sent after being encapsulated with a corresponding shard data header. The shard data header of any one of the data shards can include data verification information (RootHash) and shard verification information (Hash). A first verification can be performed on the N data shards based on the data verification information of the received N data shards; if the first verification of the N data shards passes, a second verification can be performed on the N data shards based on the shard verification information of the N data shards; if the second verification of the N data shards passes, it can be determined that the N data shards have passed the verification. Among them:

[0119] The first verification of N data shards can be used to verify whether the N data shards are from the same target data. In more detail, the data verification information of any data shard can be determined based on the N data shards, and the data verification information of the N data shards is determined in the same way, so the data verification information of the N data shards should be the same; if the data verification information of the N data shards is exactly the same, then it can be said that the received N data shards are from the same target data; if the data verification information of the target data shard among the N data shards is different from the data verification information of other data shards among the N data shards (other data shards among the N data shards refer to: data shards other than the target data shard among the N data shards), then it can be said that the target data shard and other data shards are from different target data, and there is an error in the target data shard. That is to say, the process of performing a first verification on the N data shards based on the received data verification information of the N data shards may include: comparing the data verification information of the N data shards; if the data verification information of the N data shards is exactly the same, it can be determined that the first verification of the N data shards has passed; if the data verification information of the target data shard among the N data shards is different from the data verification information of other data shards among the N data shards, it can be determined that the first verification of the N data shards has failed.

[0120] In the case where the first verification of N data shards fails, the data synchronization node that sent the target data shard can be requested to send a new target data shard. The new target data shard and other data shards can form new N data shards; then, the new N data shards can be first verified based on the data verification information of the new N data shards. If the data verification information of the new N data shards is exactly the same, it can be determined that the first verification has passed; if the data verification information of the new target data shard is still different from the data verification information of other data shards in the N data shards, it can be determined again that the first verification has failed. Furthermore, after determining again that the first verification has failed, it can be determined that the data synchronization node that sent the target data shard is an abnormal data synchronization node, and the abnormal data synchronization node can be removed from the blockchain network. The data request node can re-initiate a data synchronization request to the remaining data synchronization nodes after the abnormal data synchronization node is removed from the N data synchronization nodes.

[0121] For example, a data requesting node sends a data synchronization request to four data synchronization nodes (the four data synchronization nodes are data synchronization node 1, data synchronization node 2, data synchronization node 3, and data synchronization node 4), data synchronization node 1 sends data shard 1 to the data requesting node, data synchronization node 2 sends data shard 2 to the data requesting node, data synchronization node 3 sends data shard 3 to the data requesting node, and data synchronization node 4 sends data shard 4 to the data requesting node; if the data verification information of data shard 1, data shard 2, and data shard 4 is the same, and the data verification information of data shard 3 is different from the data verification information of data shard 1, data shard 2, and data shard 4, Then it can be determined that the first verification has failed, and a shard compensation request can be sent to data synchronization node 3, requesting data synchronization node 3 to send a new data shard 3; if the data verification information of the new data shard 3 is the same as the data verification information of data shard 1, data shard 2, and data shard 4, then it can be determined that the first verification has passed; if the data verification information of the new data shard 3 is still different from the data verification information of data shard 1, data shard 2, and data shard 4, then it can be determined that the first verification has failed again, and data synchronization node 3 can be removed from the blockchain network; the data request node can re-initiate a data synchronization request to data synchronization node 1, data synchronization node 2, and data synchronization node 4. It can be seen that by performing the first verification on the received N data shards, it can be ensured that the N data shards that pass the first verification come from the same target data, thereby improving the data synchronization accuracy of the blockchain network.

[0122] The second verification of N data shards can be used to verify whether the N data synchronization nodes have respectively sent different data shards among the N data shards. In more detail, the shard verification information of any data shard can be determined according to the corresponding data shard, and the shard verification information of the N data shards is determined in the same way. Therefore, the shard verification information of the N data shards should be completely different; if the shard verification information of the N data shards is completely different, it can be explained that the N data synchronization nodes have respectively sent different data shards among the N data shards; if there are at least two data shards among the N data shards whose shard verification information is the same, it can be explained that there is a data synchronization node that sent an erroneous data shard among the data synchronization nodes that sent at least two data shards. That is to say, the process of performing a second verification on the N data shards based on the shard verification information of the N data shards may include: comparing the shard verification information of the N data shards; if the shard verification information of the N data shards is completely different, it can be determined that the second verification of the N data shards has passed; if there are at least two data shards among the N data shards whose shard verification information is the same, it can be determined that the second verification of the N data shards has failed.

[0123] In the case where the second verification of N data shards fails, the wrong data shard can be determined in at least two data shards; the data synchronization node that requests to send the wrong data shard sends a new data shard, and the new data shard and the remaining data shards in the N data shards (the remaining data shards in the N data shards refer to: the data shards in the N data shards except the wrong data shard) form new N data shards; then, the new N data shards can be second-verified according to the shard verification information of the new N data shards. If the shard verification information of the new N data shards is completely different, it can be determined that the second verification is passed; if there are still data shards identical to the new data shards in the remaining data shards of the N data shards, it can be determined again that the second verification fails. Furthermore, if it is determined again that the second verification fails, it can be determined that the data synchronization node that sent the wrong data shard is an abnormal data synchronization node, and the abnormal data synchronization node can be removed from the blockchain network, and the data request node can re-initiate a data synchronization request to the remaining data synchronization nodes after the abnormal data synchronization nodes are removed from the N data synchronization nodes.

[0124] The method of determining an erroneous data slice in at least two data slices may include: any one of the at least two data slices may be represented as a reference data slice, the data synchronization node that sends the reference data slice is the reference data synchronization node, and the slice verification information may be re-determined according to the reference data slice; if the re-determined slice verification information is different from the slice verification information of the reference data slice, it may be explained that the reference data slice may be correct, but the slice verification information in the slice data header encapsulated for the reference data slice is wrong, in which case, the reference data slice may be determined to be an erroneous data slice. If the re-determined slice verification information is the same as the slice verification information of the reference data slice, it may be explained that the reference data slice itself is wrong, in which case, a normal data synchronization node among the N data synchronization nodes (a normal data synchronization node among the N data synchronization nodes refers to a data synchronization node among the N data synchronization nodes except the data synchronization node that sends at least two data slices) may be requested to send the data slice sent by the reference data synchronization node, and if the data slice sent by the normal data synchronization node is different from the reference data slice, the reference data slice may be determined to be an erroneous data slice.

[0125] For example, a data requesting node sends a data synchronization request to four data synchronization nodes (the four data synchronization nodes are data synchronization node 1, data synchronization node 2, data synchronization node 3, and data synchronization node 4), data synchronization node 1 sends data shard 1 to the data requesting node, data synchronization node 2 sends data shard 2 to the data requesting node, data synchronization node 3 sends data shard 3 to the data requesting node, and data synchronization node 4 sends data shard 4 to the data requesting node; if the shard verification information of data shard 1 is the same as the shard verification information of data shard 3, it can be determined that the first verification has failed. In this case, the erroneous data shard can be determined in data shard 1 and data shard 3. If data shard 1 is an erroneous data shard, a shard compensation request can be sent to data synchronization node 1, requesting data synchronization node 1 to send a new data shard 1; if the shard verification information of the new four data shards is completely different, then it can be determined that the second verification has passed. If there are still data shards that are the same as the new data shard 1 in data shard 2, data shard 3 and data shard 4, it can be determined again that the second verification has failed, and data synchronization node 1 can be removed from the blockchain network; the data request node can re-initiate a data synchronization request to data synchronization node 2, data synchronization node 3 and data synchronization node 4.

[0126] Taking data shard 1 as an example, the method of determining the wrong data shard in data shard 1 and data shard 3 may include: the shard verification information of data shard 1 may be re-determined. If the re-determined shard verification information is different from the shard verification information of data shard 1, data shard 1 may be determined to be an incorrect data shard; if the re-determined shard verification information is the same as the shard verification information of data shard 1, data synchronization node 2 and data synchronization node 4 may be requested to send data shard 1. If the data shard 1 sent by data synchronization node 2 and data synchronization node 4 is different from the data shard sent by data synchronization node 1, data shard 1 may be determined to be an incorrect data shard. It can be seen that by performing the first verification on the received N data shards, it can be ensured that the N data shards that pass the second verification are sent by different data synchronization nodes among the N data synchronization nodes, thereby improving the data synchronization accuracy of the blockchain network and avoiding data confusion during shard synchronization.

[0127] The above step S503 introduces the process of verifying the received N data fragments, which can be summarized as follows: Figure 6 and Figure 7 The process diagram shown is Figure 6 The verification process of performing the first verification and the second verification on N data shards is shown. Figure 7 The processing flow after the first verification and the second verification fail is shown; if the first verification or the second verification fails again after the data shard is reissued, the abnormal data synchronization node can be removed from the blockchain network, and the data request node can reconfigure the sharding rules for sharding processing (for example, the reconfigured sharding rules are: before removing the abnormal data synchronization node, the number of data synchronization nodes is 4, and the target data shard needs to be processed into 4 data shards. After removing the abnormal data synchronization node, the number of data synchronization nodes is 3, and the target data shard needs to be processed into 3 data shards). The data request node can re-initiate a data synchronization request to the remaining data synchronization nodes after the abnormal data synchronization nodes are removed from the N data synchronization nodes. It can be seen that by verifying the received N data shards, it can be ensured that the N data shards that pass the verification are from the same target data, and the N data shards are sent by different data synchronization nodes in the N data synchronization nodes, thereby improving the data synchronization accuracy of the blockchain network and effectively avoiding data confusion during shard synchronization.

[0128] S504: If the N data shards pass the verification, the N data shards are reorganized to obtain the target data.

[0129] If the N data shards pass the verification (specifically, the first verification and the second verification of the N data shards are both passed), the N data shards can be reassembled to obtain the target data. The shard data header of any data shard may include the shard index of the corresponding data shard, and the shard index of any data shard may be used to indicate the arrangement position of the corresponding data shard in the target data; thus, multiple data shards can be reassembled according to the shard indexes of the N data shards to obtain the target data.

[0130] Furthermore, the amount of data that can be synchronized by N data synchronization nodes at one time is limited. It is possible to determine whether the received N data shards are from the complete target data or from part of the target data (data segment of the target data) based on the amount of target data and the maximum amount of data that can be synchronized by N data synchronization nodes at one time. In more detail, data batch synchronization information can be obtained, and the data batch synchronization information can be used to indicate the maximum amount of data that can be synchronized by N data synchronization nodes at one time; when the amount of target data is greater than the amount of data indicated by the data batch synchronization information, that is, when the target data cannot be synchronized by N data synchronization nodes at one time, the target data can be split into multiple data segments, and multiple data segments are synchronized segment by segment (segment-by-segment synchronization means: each data segment is synchronized as data requested for synchronization once, and each data segment is synchronized in turn), and the amount of data of any data segment does not exceed the amount of data indicated by the data batch synchronization information. In this case, the N data segments are reorganized to obtain a data segment of the target data; when the amount of target data is less than or equal to the amount of data indicated by the data batch synchronization information, that is, when the target data can be synchronized by N data synchronization nodes at one time, the N data segments are reorganized to obtain the complete target data.

[0131] Taking the block synchronization scenario as an example, N data synchronization nodes can synchronize up to 50 blocks at a time. If the target data is 100 blocks and the amount of the target data is greater than the maximum amount of data that N data synchronization nodes can synchronize at one time, then the target data needs to be split into two data segments, one data segment includes 50 blocks. In this case, the received N data shards can come from the same data segment of the target data, that is, by reorganizing the N data shards, a data segment of the target data can be obtained. If the target data is 30 blocks and the amount of the target data is less than the maximum amount of data that N data synchronization nodes can synchronize at one time, then the target data does not need to be split. In this case, the target data can be obtained by reorganizing the N data shards. It can be seen that through the control of the data batch synchronization information, when the amount of data requested for synchronization is greater than the maximum amount of data that N data synchronization nodes can synchronize at one time, the data requested for synchronization can be split into multiple data segments, and then the multiple data segments are synchronized segment by segment, which can ensure that the data shard synchronization can be carried out stably and orderly.

[0132] In the embodiment of the present application, after the data request node in the blockchain network sends a data synchronization request to multiple data synchronization nodes in the blockchain network, the data synchronization pressure in the blockchain network is distributed to multiple data synchronization nodes, rather than concentrated on one data synchronization node in the blockchain network, which can improve the data synchronization efficiency of the blockchain network. In addition, after receiving the data shards sent by N data synchronization nodes respectively, the received N data shards can be verified. If the N data shards are verified, the N data shards can be reorganized to obtain the target data. By verifying the N data shards, the data synchronization accuracy of the blockchain network can be improved, and the data can be effectively prevented from being disordered during the shard synchronization process.

[0133] The embodiment of the present application provides a data processing method, which mainly introduces the process of data synchronization node sharding the data requested for synchronization, and the process of data synchronization node encapsulating the shard data header of the data shard. The data processing method can be executed by a computer device, which can be, for example, any one of the N data synchronization nodes in the blockchain network where the data request node requests to synchronize data. Figure 8 As shown, the data processing method may include but is not limited to the following steps S801 to S804:

[0134] S801, receiving a data synchronization request sent by a data requesting node in the blockchain network; the data synchronization request is used to request N data synchronization nodes in the blockchain network to synchronize target data.

[0135] Any of the N data synchronization nodes can receive a data synchronization request sent by a data request node in the blockchain network. The data synchronization request can be used to request the N data synchronization nodes in the blockchain network to synchronize the target data. In more detail, the data synchronization request may include a data range for which synchronization is requested, and the target data is data within the data range for which synchronization is requested. As described above, when the data processing method provided in the embodiment of the present application is applied to a block synchronization scenario, the data synchronization request sent by the data request node may include a block range for which synchronization is requested, and the target data may be a block within the block range for which synchronization is requested; when the data processing method provided in the embodiment of the present application is applied to a transaction pool synchronization scenario, the data synchronization request sent by the data request node may include a transaction pool update time range for which synchronization is requested, and the target data may be a transaction updated within the transaction pool update time range.

[0136] S802, slice the target data to obtain N data slices.

[0137] After receiving the data synchronization request, the target data requested for synchronization can be obtained based on the data synchronization request; when the data processing method provided in the embodiment of the present application is applied to the block synchronization scenario, the blocks within the block range requested for synchronization can be obtained as the target data based on the block range requested for synchronization included in the data synchronization request; when the data processing method provided in the embodiment of the present application is applied to the transaction pool synchronization scenario, the transactions within the transaction pool update time range requested for synchronization can be obtained as the target data based on the transaction pool update time range requested for synchronization included in the data synchronization request. Then, the target data can be sharded to obtain N data shards.

[0138] Sharding processing can be performed according to the number of data synchronization nodes to which the data requesting node requests to send data synchronization requests. That is to say, the data requesting node sends a data synchronization request to N data synchronization nodes in the blockchain network. The number of data synchronization nodes that the data requesting node requests to synchronize data is N. Then, the target data can be sharded into N data shards. Thus, one of the N data synchronization nodes can be responsible for sending one of the N data shards, and different data synchronization nodes send different data shards.

[0139] Furthermore, the target data can be evenly sharded into N data shards, that is, the data volume of the N data shards is the same, and this sharding processing method is very simple and fast. For example, the data request node requests 4 data synchronization nodes in the blockchain network to synchronize the target data, and the target data includes 40 blocks. Then the target data can be evenly sharded into 4 data shards, each of which includes 10 blocks.

[0140] Alternatively, the node performance information of N data synchronization nodes can be obtained, and based on the node performance information of the N data synchronization nodes, the target data can be sharded to obtain N data shards; the node performance information of any data synchronization node can be used to characterize the node performance of the corresponding data synchronization node. The larger the node performance information of the data synchronization node, the better the node performance of the data synchronization node, and the larger the amount of data that the data synchronization node can synchronize; under this sharding processing method, one data shard among the N data shards can match one data synchronization node among the N data synchronization nodes, and different data shards match different data synchronization nodes. The matching of data synchronization nodes and data shards can be understood as that the node performance information of the data synchronization node matches the data volume of the data shard, and the order of the node performance information of the data synchronization node in the node performance information of the N data synchronization nodes is consistent with the order of the data volume of the matching data shard in the data volume of the N data shards. For example, a data requesting node requests four data synchronization nodes in a blockchain network to synchronize target data. The node performance information relationship of the four data synchronization nodes is: the node performance information of data synchronization node 1 is greater than the node performance information of data synchronization node 3, the node performance information of data synchronization node 3 is greater than the node performance information of data synchronization node 2, and the node performance information of data synchronization node 2 is greater than the node performance information of data synchronization node 4; the target data shard can be processed into four data shards, and the data volume relationship of the four data shards is: the data volume of data shard 1 is greater than the data volume of data shard 3, the data volume of data shard 3 is greater than the data volume of data shard 2, and the data volume of data shard 2 is greater than the data volume of data shard 4; thus, data synchronization node 1 matches data shard 1, data synchronization node 2 matches data shard 2, data synchronization node 3 matches data shard 3, and data synchronization node 4 matches data shard 4. It can be seen that after the target data is sharded according to the node performance of N data synchronization nodes, the data synchronization nodes with good node performance match the data shards with large data volumes.

[0141] S803: Determine a data slice to be sent from among the N data slices.

[0142] As described above, one data synchronization node among N data synchronization nodes can be responsible for sending one data shard among N data shards. Different data synchronization nodes send different data shards. Therefore, for any data synchronization node among the N data synchronization nodes (which can be represented as the target data synchronization node), after sharding the target data to obtain N data shards, the target data synchronization node can determine the data shard that needs to be sent among the N data shards.

[0143] For the average sharding processing method, the target data synchronization node determines the data shards that need to be sent among the N data shards, which may specifically include: the N data shards have their own sharding indexes, and the sharding index of any one of the N data shards can be used to indicate the arrangement position of the corresponding data shard in the target data; based on this, the N data synchronization nodes can be sorted according to their node identifiers, and then the arrangement position information of the target data synchronization node can be obtained; the data shards corresponding to the sharding index and the arrangement position information of the target data synchronization node among the N data shards are determined as the data shards that need to be sent. In other words, the data synchronization node whose node identifier is ranked first is responsible for sending the data shard ranked first among the N data shards, the data synchronization node whose node identifier is ranked second is responsible for sending the data shard ranked second among the N data shards, and so on. It can be seen that for the average sharding processing method, the sharding processing method of the target data is very simple and fast. The node identifier of any data synchronization node can uniquely identify the corresponding data synchronization node in the blockchain network. The node identifiers of N data synchronization nodes are completely different. Therefore, the N data synchronization nodes select the data shards corresponding to the sharding index and the arrangement order according to the arrangement order of the node identifiers for sending. This can make the data shards determined by the N data synchronization nodes to be sent completely different, which can ensure that the data sharding synchronization can proceed steadily.

[0144] For the sharding processing method based on node performance information, there is a one-to-one matching relationship between the N data synchronization nodes and the N data shards, and the data shards that the target data synchronization node needs to send are the data shards that match the target data synchronization node. It can be seen that for the sharding processing method based on node performance information, the data synchronization nodes with good node performance send data shards with large data volumes, and the data synchronization nodes with poor node performance send data shards with small data volumes, so that the N data synchronization nodes can achieve load balancing as much as possible when synchronizing data shards.

[0145] S804, sending the data shards to be sent to the data requesting node; so that after receiving the data shards sent by the N data synchronization nodes in the blockchain network, the data requesting node verifies the N data shards received. If the N data shards are verified, the N data shards are reorganized to obtain the target data.

[0146] After determining the data slices to be sent, a slice data header can be encapsulated for the data slices to be sent, and the data slices after the slice data header is encapsulated can be sent to the data request node. Encapsulating the slice data header for the data slices to be sent can be understood as taking the data slices to be sent as the slice data body (Body), adding the slice data header (Header) to the slice data body to obtain a slice data packet, and sending the slice data packet to the data request node.

[0147] The data header for encapsulating the data slices to be sent may include but is not limited to the following information: the slice index of the data slices to be sent, data verification information, slice verification information and other information. Among them, the slice verification information (Hash) is obtained by encrypting the data slices to be sent, and the encryption process can be implemented based on the hash encryption algorithm. The embodiment of the present application does not limit the hash encryption algorithm. For example, the hash encryption algorithm can be SHA256 and MD5 (Message-Digest Algorithm, information digest algorithm), etc.; the data verification information (RootHash) is obtained by encrypting the slice verification information of N data slices, and specifically can be obtained by splicing the slice verification information of N data slices and then encrypting the spliced ​​verification information. Similarly, the encryption process can be implemented based on the hash encryption algorithm; the slice index of the data slice to be sent can be used to indicate the arrangement position of the data slice to be sent in the target data; other information can at least include the slice processing method of the target data.

[0148] For example, Fig. 9The figure shows an exemplary process of a data synchronization node sending data shards: a data requesting node sends a data synchronization request to four data synchronization nodes, and the target data is sharded into four data shards (data shard 1, data shard 2, data shard 3, and data shard 4); taking data shard 1 as an example, data shard 1 can be encrypted to obtain shard verification information (Hash1) of data shard 1; secondly, the shard verification information (Hash1) of data shard 1, the shard verification information (Hash2) of data shard 2, and the shard verification information (Hash3) of data shard 3 can be encrypted. The verification information (Hash3) and the shard verification information (Hash4) of data shard 4 are concatenated, and the concatenated verification information is encrypted to obtain the data verification information (RootHash); then, the data shard 1 can be used as the shard data body (Body), and a shard data header (Header) is added to the shard data body. The shard data header can include the shard verification information (Hash1) of data shard 1, the data verification information (RootHash) and other information; then, the shard data packet consisting of the shard data header and the shard data body can be sent to the data request node.

[0149] In addition, the amount of data that can be synchronized by N data synchronization nodes at one time is limited, and it is possible to determine whether the target data can be synchronized by the N data synchronization nodes at one time based on the amount of data of the target data and the maximum amount of data that can be synchronized by the N data synchronization nodes at one time. In more detail, data batch synchronization information can be obtained, and the data batch synchronization information can be used to indicate the maximum amount of data that can be synchronized by the N data synchronization nodes at one time. If the amount of data of the target data is less than or equal to the amount of data indicated by the data batch synchronization information, that is, if the N data synchronization nodes can synchronize the target data at one time, then steps S802-S804 in the embodiment of the present application can be executed, that is, the target data is sliced ​​to obtain N data slices, and the data slices that need to be sent are determined in the N data slices, and the data slices that need to be sent are sent to the data request node. If the amount of target data is larger than the amount of data indicated by the data batch synchronization information, that is, if N data synchronization nodes cannot synchronize the target data at one time, the target data can be split into multiple data segments, and the multiple data segments are synchronized segment by segment, and the number of any data segment does not exceed the amount of data indicated by the data batch synchronization information; synchronizing multiple data segments segment by segment means that each data segment is synchronized as data requested for synchronization, and each data segment is synchronized in turn. It can be seen that through the control of the data batch synchronization information, when the amount of data requested for synchronization is larger than the maximum amount of data that can be synchronized by N data synchronization nodes at one time, the data requested for synchronization can be split into multiple data segments, and then the multiple data segments are synchronized segment by segment, which can ensure that the data shard synchronization can be carried out stably and orderly.

[0150] In the embodiment of the present application, after the data request node in the blockchain network sends a data synchronization request to multiple data synchronization nodes in the blockchain network, the multiple data synchronization nodes can shard the target data of the synchronization request, specifically, each data synchronization node sends a data shard of the target data, and different data synchronization nodes send different data shards. The data synchronization pressure in the blockchain network is shared among multiple data synchronization nodes, rather than concentrated on one data synchronization node in the blockchain network, which can improve the data synchronization efficiency of the blockchain network. In addition, in the process of processing the target data shard into multiple data shards, the data synchronization node can consider the node performance of the data synchronization node for shard processing, so that when sending data shards, the data synchronization node with good node performance can send data shards with large data volume, and the data synchronization node with poor node performance can send data shards with small data volume, so that the data shard synchronization process can be load balanced.

[0151] The present application embodiment provides a data processing method, which mainly introduces the data synchronization process of the interaction between the data synchronization node and the data request node. Fig.10As shown, the data processing method may include but is not limited to the following steps S1001 to S1007:

[0152] S1001, a data requesting node sends a data synchronization request to N data synchronization nodes.

[0153] The data synchronization request can be used to request N data synchronization nodes in the blockchain network to synchronize target data. In more detail, the data synchronization request may include a data range requested for synchronization, and the target data is data within the data range requested for synchronization.

[0154] S1002: The data synchronization node obtains target data requested for synchronization based on the data synchronization request.

[0155] The data synchronization node may obtain data within the data range requested for synchronization, as target data, based on the data range requested for synchronization included in the data synchronization request.

[0156] S1003, the data synchronization node shards the target data to obtain N data shards.

[0157] Each data synchronization node can shard the target data based on the number of data synchronization nodes (N) requested by the data request node to obtain N data shards, that is, the number of data synchronization nodes requested by the data request node to synchronize data is the same as the number of data shards obtained by sharding the target data. In addition, when sharding the target data, an average sharding method can be used, or a sharding method based on node performance can be used.

[0158] S1004: The data synchronization node determines a data shard that needs to be sent from among N data shards.

[0159] One data synchronization node among N data synchronization nodes can be responsible for sending one data shard among N data shards, and different data synchronization nodes send different data shards. Therefore, for the N data shards obtained by the average sharding processing method, in order to ensure that the N data shards can be sent separately by different data synchronization nodes among the N data synchronization nodes, the N data synchronization nodes can be sorted according to their node identifiers, and the data shards that any data synchronization node needs to send among the N data shards are the data shards whose shard indexes among the N data shards correspond to the arrangement positions of the corresponding data synchronization nodes; for the N data shards obtained by the sharding processing method based on node performance, in order to ensure the load balancing of the N data synchronization nodes, the data shards that any data synchronization node needs to send among the N data shards are the data shards whose data volumes among the N data shards match the node performance information of the corresponding data synchronization node.

[0160] S1005, the data synchronization node sends the data slices that need to be sent to the data request node.

[0161] After determining the data slices to be sent, any data synchronization node can encapsulate the slice data header for the data slices to be sent, and send the data slices after the encapsulated slice data header to the data request node. The encapsulated slice data header may at least include: data verification information of the data slices to be sent, slice verification information of the data slices to be sent, and slice index of the data slices to be sent.

[0162] S1005, the data requesting node verifies the received N data fragments.

[0163] The verification of N data shards may include: a first verification of the N data shards according to the data verification information of the N data shards, and a second verification of the N data shards according to the shard verification information of the N data shards. If the data verification information of the N data shards is exactly the same, it is determined that the first verification of the N data shards has passed, and the second verification is performed; if the shard verification information of the N data shards is completely different, it is determined that the second verification of the N data shards has passed; if both the first verification and the second verification are passed, it can be determined that the verification of the N data shards has passed.

[0164] S1006, if the verification of the N data shards is passed, the data requesting node reorganizes the N data shards to obtain the target data.

[0165] The data request node can reorganize the N data shards according to the shard indexes of the N data shards to obtain the target data.

[0166] In the embodiment of the present application, the target data requested for synchronization can be processed into N data fragments, and the N data synchronization nodes in the blockchain network synchronize the N data fragments respectively. One of the N data synchronization nodes is responsible for sending one of the N data fragments. Different data synchronization nodes send different data fragments. It can be seen that the data synchronization pressure in the blockchain network is shared among multiple data synchronization nodes, rather than concentrated on one data synchronization node in the blockchain network. This can improve the data synchronization efficiency of the blockchain network. In addition, after receiving the data fragments sent by the N data synchronization nodes respectively, the received N data fragments can be verified. If the N data fragments are verified, the N data fragments can be reorganized to obtain the target data. By verifying the N data fragments, the data synchronization accuracy of the blockchain network can be improved.

[0167] The method of the embodiment of the present application is described in detail above. In order to facilitate better implementation of the above scheme of the embodiment of the present application, the device of the embodiment of the present application is provided below accordingly.

[0168] See also Fig.11 , Fig.11 It is a structural diagram of a data processing device provided in an embodiment of the present application. The data processing device can be set in a computer device provided in an embodiment of the present application, and the computer device can be a data request node in a blockchain network. Fig.11 The data processing device shown may be a computer program (including program code) running in a computer device, and the data processing device may be used to execute Figure 5 or Fig.10 In the method embodiment shown, the data requesting node performs some or all of the steps. Fig.11 , the data processing device may include the following units:

[0169] The communication unit 1101 is used to send a data synchronization request to N data synchronization nodes in the blockchain network; the data synchronization request is used to request synchronization of target data, and the target data is sharded into N data shards, where N is an integer greater than 1;

[0170] The communication unit 1101 is further used to receive data slices respectively sent by each of the N data synchronization nodes; one of the N data synchronization nodes is responsible for sending one of the N data slices, and different data synchronization nodes send different data slices;

[0171] The processing unit 1102 is used to verify the received N data fragments;

[0172] The processing unit 1102 is further configured to reorganize the N data shards to obtain target data if the N data shards pass verification.

[0173] In one implementation, any one of the N data slices is sent after being encapsulated with a corresponding slice data header, and the slice data header of any one of the data slices includes data verification information and slice verification information; the processing unit 1102 is used to verify the received N data slices, specifically to perform the following steps:

[0174] Performing a first verification on the N data shards according to the received data verification information of the N data shards;

[0175] If the first verification of the N data shards passes, a second verification is performed on the N data shards according to the shard verification information of the N data shards;

[0176] If the second verification of N data shards passes, it is determined that the verification of N data shards passes.

[0177] In one implementation, the data verification information of any data shard is determined based on the N data shards; the processing unit 1102 is configured to perform the following steps when performing a first verification on the N data shards based on the received data verification information of the N data shards:

[0178] Compare the data verification information of N data shards;

[0179] If the data verification information of the N data shards is exactly the same, it is determined that the first verification of the N data shards has passed.

[0180] In one implementation, the shard verification information of any data shard is determined according to the corresponding data shard; the processing unit 1102 is used to perform the second verification on the N data shards according to the shard verification information of the N data shards, specifically to perform the following steps:

[0181] Compare the shard verification information of N data shards;

[0182] If the shard verification information of the N data shards is completely different, it is determined that the second verification of the N data shards is passed.

[0183] In one implementation, the first verification failure of the N data shards refers to that data verification information of a target data shard among the N data shards is different from data verification information of other data shards among the N data shards, and the other data shards refer to data shards other than the target data shard among the N data shards; the processing unit 1102 is further configured to execute the following steps:

[0184] If the first verification of N data shards fails, the data synchronization node that requests to send the target data shard sends a new target data shard; the new target data shard and other data shards form new N data shards;

[0185] According to the data verification information of the new N data shards, a first verification is performed on the new N data shards.

[0186] In one implementation, the second verification failure of the N data shards means that there are at least two data shards in the N data shards whose shard verification information is the same; the processing unit 1102 is further configured to perform the following steps:

[0187] If the second verification of the N data shards fails, determining an erroneous data shard among at least two data shards;

[0188] The data synchronization node that requests to send the erroneous data shard sends a new data shard; the new data shard and the remaining data shards constitute new N data shards, and the remaining data shards refer to the data shards other than the erroneous data shard in the N data shards;

[0189] According to the shard verification information of the new N data shards, a second verification is performed on the new N data shards.

[0190] In one implementation, any one of the at least two data shards is a reference data shard; the shard verification information of any one of the N data shards is determined according to the corresponding data shard; the processing unit 1102 is configured to, when determining an erroneous data shard in the at least two data shards, specifically perform the following steps:

[0191] Re-determine the shard verification information based on the reference data shard;

[0192] If the re-determined shard verification information is different from the shard verification information of the reference data shard, the reference data shard is determined to be an erroneous data shard.

[0193] In one implementation, the data synchronization node that sends the reference data shard is a reference data synchronization node; the processing unit 1102 is configured to, when determining an erroneous data shard in at least two data shards, further perform the following steps:

[0194] If the re-determined shard verification information is the same as the shard verification information of the reference data shard, a normal data synchronization node among the N data synchronization nodes is requested to send the data shard sent by the reference data synchronization node; a normal data synchronization node refers to a data synchronization node among the N data synchronization nodes except for the data synchronization node that sends at least two data shards;

[0195] If the data shard sent by the normal data synchronization node is different from the reference data shard, the reference data shard is determined to be an erroneous data shard.

[0196] In one implementation, any data slice among the N data slices is sent after being encapsulated with a corresponding slice data header, and the slice data header of any data slice includes a slice index of the corresponding data slice; the slice index of any data slice is used to indicate the arrangement position of the corresponding data slice in the target data;

[0197] The processing unit 1102 is used to reorganize the N data slices to obtain the target data, and is specifically used to perform the following steps:

[0198] According to the shard indexes of the N data shards, the N data shards are reorganized to obtain the target data.

[0199] In one implementation, the processing unit 1102 is further configured to perform the following steps:

[0200] Obtaining data batch synchronization information; the data batch synchronization information is used to indicate the maximum amount of data that N data synchronization nodes synchronize at one time; when the amount of target data is greater than the amount of data indicated by the data batch synchronization information, the target data is split into multiple data segments, and the multiple data segments are synchronized segment by segment, and the amount of data in any data segment does not exceed the amount of data indicated by the data batch synchronization information;

[0201] When the amount of target data is less than or equal to the amount of data indicated by the data batch synchronization information, triggering the execution of the step of reorganizing the N data shards to obtain the target data;

[0202] When the data volume of the target data is greater than the data volume indicated by the data batch synchronization information, the N data slices are reorganized to obtain a data segment of the target data.

[0203] According to another embodiment of the present application, Fig.11 The various units in the data processing device shown can be respectively or all combined into one or several other units to constitute, or some of the units (some) can also be split into multiple smaller units in function to constitute, which can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present application. The above-mentioned units are divided based on logical functions. In practical applications, the function of a unit can also be implemented by multiple units, or the function of multiple units can be implemented by one unit. In other embodiments of the present application, the data processing device may also include other units. In practical applications, these functions can also be implemented with the assistance of other units, and can be implemented by the collaboration of multiple units.

[0204] According to another embodiment of the present application, the program can be executed by running on a general computing device such as a computer including a central processing unit (CPU), a random access memory medium (RAM), a read-only memory medium (ROM), and other processing elements and storage elements. Figure 5 or Fig.10 A computer program (including program code) for each step involved in part or all of the method executed by the data request node shown in the figure is used to construct a computer program (including program code) for each step involved in the method executed by the data request node shown in the figure Fig.11 The data processing device shown in the embodiment of the present application is implemented by the data processing device. The computer program can be recorded on a computer-readable storage medium, for example, and loaded into the above-mentioned computing device through the computer-readable storage medium and run therein.

[0205] In the embodiment of the present application, the target data requested for synchronization can be processed into N data fragments, and the N data synchronization nodes in the blockchain network synchronize the N data fragments respectively. One of the N data synchronization nodes is responsible for sending one of the N data fragments. Different data synchronization nodes send different data fragments. It can be seen that the data synchronization pressure in the blockchain network is shared among multiple data synchronization nodes, rather than concentrated on one data synchronization node in the blockchain network. This can improve the data synchronization efficiency of the blockchain network. In addition, after receiving the data fragments sent by the N data synchronization nodes respectively, the received N data fragments can be verified. If the N data fragments are verified, the N data fragments can be reorganized to obtain the target data. By verifying the N data fragments, the data synchronization accuracy of the blockchain network can be improved.

[0206] See also Fig.11 , Fig.11 It is a structural diagram of a data processing device provided in an embodiment of the present application. The data processing device can be set in the computer device provided in the embodiment of the present application. The computer device can be any data synchronization node in the blockchain network. Fig.11 The data processing device shown may be a computer program (including program code) running in a computer device, and the data processing device may be used to execute Figure 8 or Fig.10 In the method embodiment shown, the data synchronization node performs some or all of the steps. Fig.11 , the data processing device may include the following units:

[0207] The communication unit 1101 is used to receive a data synchronization request sent by a data requesting node in the blockchain network; the data synchronization request is used to request N data synchronization nodes in the blockchain network to synchronize target data, where N is an integer greater than 1;

[0208] The processing unit 1102 is used to perform sharding processing on the target data to obtain N data shards; one of the N data synchronization nodes is responsible for sending one of the N data shards, and different data synchronization nodes send different data shards;

[0209] The processing unit 1102 is further configured to determine a data slice to be sent from the N data slices;

[0210] The communication unit 1101 is also used to send the data shards to be sent to the data requesting node; so that after the data requesting node receives the data shards sent by the N data synchronization nodes in the blockchain network, the N data shards received are verified. If the N data shards are verified, the N data shards are reorganized to obtain the target data.

[0211] In one implementation, the N data shards have respective shard indexes, and the shard index of any one of the N data shards is used to indicate the arrangement position of the corresponding data shard in the target data; the data processing method is executed by a target data synchronization node, and the target data synchronization node is any one of the N data synchronization nodes;

[0212] The processing unit 1102 is configured to perform the following steps when determining a data slice to be sent from the N data slices:

[0213] Sort the N data synchronization nodes according to their node identifiers;

[0214] Obtain the arrangement position information of the target data synchronization node;

[0215] Among the N data shards, the data shard whose shard index corresponds to the arrangement position information of the target data synchronization node is determined as the data shard that needs to be sent.

[0216] In one implementation, the communication unit 1101 is used to send the data slices to be sent to the data requesting node, and is specifically used to perform the following steps:

[0217] Encapsulate the fragment data header for the data fragment to be sent;

[0218] Send the data fragments after encapsulating the fragment data header to the data request node;

[0219] Among them, the shard data header includes the shard index, data verification information and shard verification information of the data shard to be sent; the shard verification information is obtained by encrypting the data shard to be sent, and the data verification information is obtained by encrypting the shard verification information of N data shards; the shard index of the data shard to be sent is used to indicate the arrangement position of the data shard to be sent in the target data.

[0220] In one implementation, the processing unit 1102 is further configured to perform the following steps:

[0221] Obtaining data batch synchronization information, which is used to indicate the maximum amount of data that N data synchronization nodes can synchronize at one time;

[0222] If the data volume of the target data is less than or equal to the data volume indicated by the data batch synchronization information, a step of slicing the target data to obtain N data slicing steps is triggered;

[0223] If the data volume of the target data is larger than the data volume indicated by the data batch synchronization information, the target data is split into multiple data segments, and the multiple data segments are synchronized segment by segment.

[0224] According to another embodiment of the present application, Fig.11 The various units in the data processing device shown can be respectively or all combined into one or several other units to constitute, or some of the units (some) can also be split into multiple smaller units in function to constitute, which can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present application. The above-mentioned units are divided based on logical functions. In practical applications, the function of a unit can also be implemented by multiple units, or the function of multiple units can be implemented by one unit. In other embodiments of the present application, the data processing device may also include other units. In practical applications, these functions can also be implemented with the assistance of other units, and can be implemented by the collaboration of multiple units.

[0225] According to another embodiment of the present application, the program can be executed by running on a general computing device such as a computer including a central processing unit (CPU), a random access memory medium (RAM), a read-only memory medium (ROM), and other processing elements and storage elements. Figure 8 or Fig.10 A computer program (including program code) for each step involved in part or all of the method executed by the data synchronization node shown in the figure is used to construct a computer program (including program code) for each step involved in the method executed by the data synchronization node shown in the figure Fig.11 The data processing device shown in the embodiment of the present application is implemented by the data processing device. The computer program can be recorded on a computer-readable storage medium, for example, and loaded into the above-mentioned computing device through the computer-readable storage medium and run therein.

[0226] In the embodiment of the present application, the target data requested for synchronization can be processed into N data fragments, and the N data synchronization nodes in the blockchain network synchronize the N data fragments respectively. One of the N data synchronization nodes is responsible for sending one of the N data fragments. Different data synchronization nodes send different data fragments. It can be seen that the data synchronization pressure in the blockchain network is shared among multiple data synchronization nodes, rather than concentrated on one data synchronization node in the blockchain network. This can improve the data synchronization efficiency of the blockchain network. In addition, after receiving the data fragments sent by the N data synchronization nodes respectively, the received N data fragments can be verified. If the N data fragments are verified, the N data fragments can be reorganized to obtain the target data. By verifying the N data fragments, the data synchronization accuracy of the blockchain network can be improved.

[0227] Based on the above method and device embodiments, the present application embodiment provides a computer device. Fig.12 , Fig.12 It is a structural diagram of a computer device provided in an embodiment of the present application. Fig.12 The computer device shown includes at least a processor 1201, an input interface 1202, an output interface 1203, and a computer-readable storage medium 1204. The processor 1201, the input interface 1202, the output interface 1203, and the computer-readable storage medium 1204 may be connected via a bus or other means.

[0228] The computer-readable storage medium 1204 may be stored in a memory of a computer device. The computer-readable storage medium 1204 is used to store a computer program. The computer program includes computer instructions. The processor 1201 is used to execute the program instructions stored in the computer-readable storage medium 1204. The processor 1201 (or CPU (Central Processing Unit)) is the computing core and control core of the computer device, which is suitable for implementing one or more computer instructions, and is specifically suitable for loading and executing one or more computer instructions to implement a corresponding method flow or a corresponding function.

[0229] The embodiment of the present application also provides a computer-readable storage medium (Memory), which is a memory device in a computer device for storing programs and data. It is understandable that the computer-readable storage medium here can include both built-in storage media in the computer device and, of course, extended storage media supported by the computer device. The computer-readable storage medium provides a storage space that stores the operating system of the computer device. In addition, one or more computer instructions suitable for being loaded and executed by the processor are also stored in the storage space. These computer instructions can be one or more computer programs (including program codes). It should be noted that the computer-readable storage medium here can be a high-speed RAM memory, or a non-volatile memory (Non-VolatileMemory), such as at least one disk storage; optionally, it can also be at least one computer-readable storage medium located away from the aforementioned processor.

[0230] In some embodiments, the processor 1201 may load and execute one or more computer instructions stored in the computer-readable storage medium 1204 to implement the above-mentioned Figure 5 or Fig.10 The corresponding steps executed by the data requesting node in the data processing method shown. In a specific implementation, the computer instructions in the computer readable storage medium 1204 are loaded by the processor 1201 and execute the following steps:

[0231] Send a data synchronization request to N data synchronization nodes in the blockchain network; the data synchronization request is used to request synchronization of target data, and the target data is sharded into N data shards, where N is an integer greater than 1;

[0232] Receive data slices sent by each of the N data synchronization nodes; one of the N data synchronization nodes is responsible for sending one of the N data slices, and different data synchronization nodes send different data slices;

[0233] Verify the N received data shards;

[0234] If N data shards pass the verification, the N data shards are reorganized to obtain the target data.

[0235] In one implementation, any one of the N data slices is sent after being encapsulated with a corresponding slice data header, and the slice data header of any one of the data slices includes data verification information and slice verification information; when the computer instructions in the computer-readable storage medium 1204 are loaded and executed by the processor 1201 to verify the received N data slices, they are specifically used to perform the following steps:

[0236] Performing a first verification on the N data shards according to the received data verification information of the N data shards;

[0237] If the first verification of the N data shards passes, a second verification is performed on the N data shards according to the shard verification information of the N data shards;

[0238] If the second verification of N data shards passes, it is determined that the verification of N data shards passes.

[0239] In one implementation, the data verification information of any data shard is determined based on the N data shards; the computer instructions in the computer-readable storage medium 1204 are loaded and executed by the processor 1201 to perform the first verification on the N data shards based on the received data verification information of the N data shards, specifically for performing the following steps:

[0240] Compare the data verification information of N data shards;

[0241] If the data verification information of the N data shards is exactly the same, it is determined that the first verification of the N data shards has passed.

[0242] In one implementation, the shard verification information of any data shard is determined according to the corresponding data shard; the computer instructions in the computer-readable storage medium 1204 are loaded and executed by the processor 1201 according to the shard verification information of the N data shards, and when the second verification is performed on the N data shards, they are specifically used to perform the following steps:

[0243] Compare the shard verification information of N data shards;

[0244] If the shard verification information of the N data shards is completely different, it is determined that the second verification of the N data shards is passed.

[0245] In one implementation, the first verification failure of the N data shards refers to data verification information of a target data shard among the N data shards being different from data verification information of other data shards among the N data shards, and the other data shards are data shards other than the target data shard among the N data shards; the computer instructions in the computer-readable storage medium 1204 are loaded by the processor 1201 and are further used to execute the following steps:

[0246] If the first verification of N data shards fails, the data synchronization node that requests to send the target data shard sends a new target data shard; the new target data shard and other data shards form new N data shards;

[0247] According to the data verification information of the new N data shards, a first verification is performed on the new N data shards.

[0248] In one implementation, the second verification failure of the N data shards means that there are at least two data shards in the N data shards whose shard verification information is the same; the computer instructions in the computer-readable storage medium 1204 are loaded by the processor 1201 and are also used to execute the following steps:

[0249] If the second verification of the N data shards fails, determining an erroneous data shard among at least two data shards;

[0250] The data synchronization node that requests to send the erroneous data shard sends a new data shard; the new data shard and the remaining data shards constitute new N data shards, and the remaining data shards refer to the data shards other than the erroneous data shard in the N data shards;

[0251] According to the shard verification information of the new N data shards, a second verification is performed on the new N data shards.

[0252] In one implementation, any one of the at least two data shards is a reference data shard; the shard verification information of any one of the N data shards is determined according to the corresponding data shard; and the computer instructions in the computer-readable storage medium 1204 are loaded and executed by the processor 1201 to perform the following steps when an erroneous data shard is determined in the at least two data shards:

[0253] Re-determine the shard verification information based on the reference data shard;

[0254] If the re-determined shard verification information is different from the shard verification information of the reference data shard, the reference data shard is determined to be an erroneous data shard.

[0255] In one implementation, the data synchronization node that sends the reference data shard is a reference data synchronization node; when the computer instructions in the computer-readable storage medium 1204 are loaded and executed by the processor 1201 to determine the erroneous data shard in the at least two data shards, the computer instructions are also used to perform the following steps:

[0256] If the re-determined shard verification information is the same as the shard verification information of the reference data shard, a normal data synchronization node among the N data synchronization nodes is requested to send the data shard sent by the reference data synchronization node; a normal data synchronization node refers to a data synchronization node among the N data synchronization nodes except for the data synchronization node that sends at least two data shards;

[0257] If the data shard sent by the normal data synchronization node is different from the reference data shard, the reference data shard is determined to be an erroneous data shard.

[0258] In one implementation, any data slice among the N data slices is sent after being encapsulated with a corresponding slice data header, and the slice data header of any data slice includes a slice index of the corresponding data slice; the slice index of any data slice is used to indicate the arrangement position of the corresponding data slice in the target data;

[0259] The computer instructions in the computer-readable storage medium 1204 are loaded and executed by the processor 1201 to reorganize the N data slices to obtain the target data, specifically for performing the following steps:

[0260] According to the shard indexes of the N data shards, the N data shards are reorganized to obtain the target data.

[0261] In one implementation, the computer instructions in the computer readable storage medium 1204 are loaded by the processor 1201 and are further used to perform the following steps:

[0262] Obtaining data batch synchronization information; the data batch synchronization information is used to indicate the maximum amount of data that N data synchronization nodes synchronize at one time; when the amount of target data is greater than the amount of data indicated by the data batch synchronization information, the target data is split into multiple data segments, and the multiple data segments are synchronized segment by segment, and the amount of data in any data segment does not exceed the amount of data indicated by the data batch synchronization information;

[0263] When the amount of target data is less than or equal to the amount of data indicated by the data batch synchronization information, triggering the execution of the step of reorganizing the N data shards to obtain the target data;

[0264] When the data volume of the target data is greater than the data volume indicated by the data batch synchronization information, the N data slices are reorganized to obtain a data segment of the target data.

[0265] In other embodiments, the processor 1201 may load and execute one or more computer instructions stored in the computer-readable storage medium 1204 to implement the above-mentioned Figure 8 or Fig.10 The corresponding steps executed by the data synchronization node in the data processing method shown. In a specific implementation, the computer instructions in the computer-readable storage medium 1204 are loaded by the processor 1201 and execute the following steps:

[0266] Receive a data synchronization request sent by a data requesting node in the blockchain network; the data synchronization request is used to request N data synchronization nodes in the blockchain network to synchronize target data, where N is an integer greater than 1;

[0267] The target data is sliced ​​and processed to obtain N data slices; one of the N data synchronization nodes is responsible for sending one of the N data slices, and different data synchronization nodes send different data slices;

[0268] Determine the data slice that needs to be sent among the N data slices;

[0269] The data shards to be sent are sent to the data requesting node; after receiving the data shards respectively sent by the N data synchronization nodes in the blockchain network, the data requesting node verifies the N data shards received. If the N data shards are verified, the N data shards are reorganized to obtain the target data.

[0270] In one implementation, the N data shards have respective shard indexes, and the shard index of any one of the N data shards is used to indicate the arrangement position of the corresponding data shard in the target data; the data processing method is executed by a target data synchronization node, and the target data synchronization node is any one of the N data synchronization nodes;

[0271] When the computer instructions in the computer-readable storage medium 1204 are loaded and executed by the processor 1201 to determine the data slices to be sent among the N data slices, the computer instructions are specifically used to perform the following steps:

[0272] Sort the N data synchronization nodes according to their node identifiers;

[0273] Obtain the arrangement position information of the target data synchronization node;

[0274] Among the N data shards, the data shard whose shard index corresponds to the arrangement position information of the target data synchronization node is determined as the data shard that needs to be sent.

[0275] In one implementation, when the computer instructions in the computer-readable storage medium 1204 are loaded and executed by the processor 1201 to send the data slices to be sent to the data requesting node, they are specifically used to perform the following steps:

[0276] Encapsulate the fragment data header for the data fragment to be sent;

[0277] Send the data fragments after encapsulating the fragment data header to the data request node;

[0278] Among them, the shard data header includes the shard index, data verification information and shard verification information of the data shard to be sent; the shard verification information is obtained by encrypting the data shard to be sent, and the data verification information is obtained by encrypting the shard verification information of N data shards; the shard index of the data shard to be sent is used to indicate the arrangement position of the data shard to be sent in the target data.

[0279] In one implementation, the computer instructions in the computer readable storage medium 1204 are loaded by the processor 1201 and are further used to perform the following steps:

[0280] Obtaining data batch synchronization information, which is used to indicate the maximum amount of data that N data synchronization nodes can synchronize at one time;

[0281] If the data volume of the target data is less than or equal to the data volume indicated by the data batch synchronization information, a step of slicing the target data to obtain N data slicing steps is triggered;

[0282] If the data volume of the target data is larger than the data volume indicated by the data batch synchronization information, the target data is split into multiple data segments, and the multiple data segments are synchronized segment by segment.

[0283] In the embodiment of the present application, the target data requested for synchronization can be processed into N data fragments, and the N data synchronization nodes in the blockchain network synchronize the N data fragments respectively. One of the N data synchronization nodes is responsible for sending one of the N data fragments. Different data synchronization nodes send different data fragments. It can be seen that the data synchronization pressure in the blockchain network is shared among multiple data synchronization nodes, rather than concentrated on one data synchronization node in the blockchain network. This can improve the data synchronization efficiency of the blockchain network. In addition, after receiving the data fragments sent by the N data synchronization nodes respectively, the received N data fragments can be verified. If the N data fragments are verified, the N data fragments can be reorganized to obtain the target data. By verifying the N data fragments, the data synchronization accuracy of the blockchain network can be improved.

[0284] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A data processing method, characterized in that: include: Send data synchronization requests to N data synchronization nodes in the blockchain network; The data synchronization request is used to request synchronization of target data, and the target data is fragmented into N data fragments, where N is an integer greater than 1; Receiving data fragments respectively sent by each of the N data synchronization nodes; One of the N data synchronization nodes is responsible for sending one of the N data slices, and different data synchronization nodes send different data slices; Verifying the received N data fragments; If the N data slices pass the verification, the N data slices are reorganized to obtain the target data.

2. The method according to claim 1, characterized in that Any data slice of the N data slices is sent after being encapsulated with a corresponding slice data header, and the slice data header of any data slice includes data verification information and slice verification information; The verifying the received N data slices includes: Performing a first verification on the N data shards according to the received data verification information of the N data shards; If the first verification of the N data shards passes, performing a second verification on the N data shards according to the shard verification information of the N data shards; If the second verification of the N data shards passes, it is determined that the verification of the N data shards passes.

3. The method according to claim 2, characterized in that The data verification information of any data shard is determined jointly based on the N data shards; and the first verification of the N data shards based on the received data verification information of the N data shards includes: Comparing the data verification information of the N data shards; If the data verification information of the N data slices is completely identical, it is determined that the first verification of the N data slices is passed.

4. The method according to claim 2, characterized in that The shard verification information of any data shard is determined according to the corresponding data shard; and performing a second verification on the N data shards according to the shard verification information of the N data shards includes: Comparing the shard verification information of the N data shards; If the slice verification information of the N data slices is completely different, it is determined that the second verification of the N data slices is passed.

5. The method according to claim 2, characterized in that The first verification failure of the N data shards refers to that data verification information of a target data shard among the N data shards is different from data verification information of other data shards among the N data shards, and the other data shards refer to data shards among the N data shards except the target data shard; the method further includes: If the first verification of the N data shards fails, the data synchronization node that sends the target data shard is requested to send a new target data shard; the new target data shard and the other data shards form new N data shards; According to the data verification information of the new N data shards, a first verification is performed on the new N data shards.

6. The method according to claim 2, characterized in that The second verification failure of the N data shards means that there are at least two data shards in the N data shards whose shard verification information is the same; the method further includes: If the second verification of the N data shards fails, determining an erroneous data shard among the at least two data shards; The data synchronization node that requests to send the erroneous data slice sends a new data slice; the new data slice and the remaining data slices constitute new N data slices, and the remaining data slices refer to the data slices other than the erroneous data slice in the N data slices; According to the shard verification information of the new N data shards, a second verification is performed on the new N data shards.

7. The method according to claim 6, characterized in that Any one of the at least two data shards is a reference data shard; the shard verification information of any one of the N data shards is determined based on the corresponding data shard; The step of determining an erroneous data slice among the at least two data slices comprises: Re-determining the shard verification information according to the reference data shard; If the re-determined slice verification information is different from the slice verification information of the reference data slice, the reference data slice is determined to be an erroneous data slice.

8. The method according to claim 7, characterized in that The data synchronization node that sends the reference data slice is a reference data synchronization node; and the step of determining an erroneous data slice in the at least two data slices further includes: If the re-determined shard verification information is the same as the shard verification information of the reference data shard, request a normal data synchronization node among the N data synchronization nodes to send the data shard sent by the reference data synchronization node; the normal data synchronization node refers to a data synchronization node among the N data synchronization nodes except the data synchronization node that sends the at least two data shards; If the data slice sent by the normal data synchronization node is different from the reference data slice, it is determined that the reference data slice is an erroneous data slice.

9. The method according to claim 1, characterized in that Any data slice of the N data slices is sent after being encapsulated with a corresponding slice data header, and the slice data header of any data slice includes a slice index of the corresponding data slice; the slice index of any data slice is used to indicate the arrangement position of the corresponding data slice in the target data; The reorganizing the N data slices to obtain the target data includes: According to the shard indexes of the N data shards, the N data shards are reorganized to obtain the target data.

10. The method according to claim 1, characterized in that The method further comprises: Acquire data batch synchronization information; the data batch synchronization information is used to indicate the maximum amount of data that the N data synchronization nodes synchronize at one time; when the amount of data of the target data is greater than the amount of data indicated by the data batch synchronization information, the target data is split into multiple data segments, and the multiple data segments are synchronized segment by segment, and the amount of data of any data segment does not exceed the amount of data indicated by the data batch synchronization information; When the data volume of the target data is less than or equal to the data volume indicated by the data batch synchronization information, triggering the step of reorganizing the N data fragments to obtain the target data; When the data volume of the target data is greater than the data volume indicated by the data batch synchronization information, the N data slices are reorganized to obtain a data segment of the target data.

11. A data processing method, characterized in that: include: Receive data synchronization requests sent by data request nodes in the blockchain network; The data synchronization request is used to request N data synchronization nodes in the blockchain network to synchronize target data, where N is an integer greater than 1; The target data is sliced ​​to obtain N data slices; one of the N data synchronization nodes is responsible for sending one of the N data slices, and different data synchronization nodes send different data slices; Determine a data slice that needs to be sent from the N data slices, and send the data slice that needs to be sent to the data requesting node; After receiving the data fragments respectively sent by the N data synchronization nodes, the data request node verifies the received N data fragments. If the N data fragments pass the verification, the N data fragments are reorganized to obtain the target data.

12. The method according to claim 11, characterized in that The N data slices have respective slice indexes, and the slice index of any one of the N data slices is used to indicate the arrangement position of the corresponding data slice in the target data; The method is performed by a target data synchronization node, and the target data synchronization node is any one of the N data synchronization nodes; The determining of the data slices to be sent among the N data slices includes: sorting the N data synchronization nodes according to the node identifiers of the N data synchronization nodes; Obtaining arrangement position information of the target data synchronization node; Among the N data slices, the data slice whose slice index corresponds to the arrangement position information of the target data synchronization node is determined as the data slice that needs to be sent.

13. The method according to claim 11, characterized in that The sending the data slices to be sent to the data requesting node includes: Encapsulating a slice data header for the data slice to be sent; Sending the data slices after encapsulating the slice data header to the data requesting node; Among them, the shard data header includes the shard index, data verification information and shard verification information of the data shard to be sent; the shard verification information is obtained by encrypting the data shard to be sent, and the data verification information is obtained by encrypting the shard verification information of the N data shards; the shard index of the data shard to be sent is used to indicate the arrangement position of the data shard to be sent in the target data.

14. The method according to claim 11, characterized in that The method further comprises: Acquire data batch synchronization information, where the data batch synchronization information is used to indicate a maximum amount of data to be synchronized by the N data synchronization nodes at one time; If the data volume of the target data is less than or equal to the data volume indicated by the data batch synchronization information, triggering the step of slicing the target data to obtain N data slicing; If the data volume of the target data is larger than the data volume indicated by the data batch synchronization information, the target data is split into multiple data segments, and the multiple data segments are synchronized segment by segment.

15. A data processing device, characterized in that: include: A communication unit, used to send data synchronization requests to N data synchronization nodes in the blockchain network; The data synchronization request is used to request synchronization of target data, and the target data is fragmented into N data fragments, where N is an integer greater than 1; The communication unit is further used to receive data slices respectively sent by each of the N data synchronization nodes; one of the N data synchronization nodes is responsible for sending one of the N data slices, and different data synchronization nodes send different data slices; A processing unit, configured to verify the received N data fragments; The processing unit is further configured to reorganize the N data shards to obtain the target data if the N data shards pass verification.

16. A data processing device, characterized in that: include: A communication unit, used to receive a data synchronization request sent by a data requesting node in the blockchain network; The data synchronization request is used to request N data synchronization nodes in the blockchain network to synchronize target data, where N is an integer greater than 1; A processing unit is used to perform sharding processing on the target data to obtain N data shards; one of the N data synchronization nodes is responsible for sending one of the N data shards, and different data synchronization nodes send different data shards; The processing unit is further used to determine the data slices to be sent among the N data slices; The communication unit is also used to send the data fragments that need to be sent to the data request node; so that after receiving the data fragments sent by the N data synchronization nodes respectively, the data request node verifies the N data fragments received, and if the N data fragments are verified, the N data fragments are reorganized to obtain the target data.

17. A computer device, characterized in that: The computer device comprises: a processor suitable for implementing a computer program; A computer-readable storage medium storing a computer program, wherein the computer program is suitable for being loaded by the processor and executing the data processing method according to any one of claims 1 to 10, or executing the data processing method according to any one of claims 11 to 14.

18. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is suitable for being loaded by a processor and executing the data processing method according to any one of claims 1 to 10, or executing the data processing method according to any one of claims 11 to 14.

19. A computer program product, characterized in that The computer program product comprises computer instructions, and when the computer instructions are executed by a processor, the data processing method according to any one of claims 1 to 10 is implemented, or the data processing method according to any one of claims 11 to 14 is implemented.