Methods, Systems and Related Devices for Blockchain Data Processing
By splitting and transferring blockchain data to multiple nodes to store, and using recovery packets to solve the problem of blockchain storage pressure, the reliability and security of data transfer are improved.
Patent Information
- Application Number
- CN202010568739.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-06-19
- Publication Date
- 2025-08-01
- Estimated Expiration
- 2040-06-19
AI Technical Summary
Blockchain technology has excessive pressure on data storage, especially due to the increasing storage demand caused by the increasing amount of data.
Split blockchain data into multiple data packets and transferred to multiple nodes to store, and use recovery packets to recover when the data packet is unavailable, reducing storage pressure and improving the reliability and security of data transfer.
Through the data splitting and recovery mechanism, the storage pressure of blockchain ledgers is effectively reduced, and data packets can be recovered when data packets are unavailable, improving the reliability and security of data transfer.
Smart Images

Figure CN113824755B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of information technology, and in particular, to methods, systems, and related devices for blockchain data processing. Background Art
[0002] Blockchain technology, also known as distributed ledger technology, relies on multiple nodes to jointly participate in accounting and jointly maintain a reliable database. Whenever new transaction data needs to be written into the blockchain ledger, this data is aggregated into a block, and this block is added to the end of the existing blockchain ledger. Blockchain technology ensures that the newly added blocks of each node are the same through a consensus algorithm. In addition to recording transaction data, each block also contains a digest (such as a hash value) of the previous block, making the composed blockchain difficult to tamper with and forge. Therefore, blockchain technology can be decentralized without relying on a third-party credit institution.
[0003] During the process of using blockchain technology, the stored data continuously increases, resulting in an increasing storage pressure on the blockchain. Summary of the Invention
[0004] Embodiments of this application provide a method, a system, and related devices for blockchain data processing, which can relieve the storage pressure on the blockchain.
[0005] In a first aspect, an embodiment of this application provides a method for blockchain data processing, specifically a method for transferring blockchain data. The method includes: a first node determines first block data to be transferred from the stored blockchain ledger; then, the first node splits the first block data into at least two block data packets, and generates at least one recovery data packet according to the at least two block data packets, where the recovery data packet is used to recover the block data packet; furthermore, the first node sends the data packets in the at least two block data packets and the at least one recovery data packet to corresponding second nodes, records the first correspondence between the data packets of the first block data and the second nodes, and broadcasts the first correspondence; the first node also deletes the first block data in the stored blockchain ledger.
[0006] In this application, the block data in the blockchain ledger can be split and transferred to multiple nodes, thereby reducing the storage pressure on the blockchain ledger. And the recovery data packet can tolerate the unavailability of the block data packets transferred to some nodes, that is, the recovery data packet can be used to recover the block data packet when the block data packet is unavailable, thereby improving the reliability of block data transfer.
[0007] In one embodiment, the second node is a node in the blockchain system. Since the nodes in the blockchain system are more secure than the devices outside the blockchain system, transferring the data packet of the block data to the nodes inside the blockchain system is beneficial to improving the security of the block data transfer.
[0008] Optionally, the first node generates first verification data according to the first block data and broadcasts the first verification data, where the first verification data is used to verify the first block data. The first verification data facilitates verifying the obtained first block data when obtaining the transferred first block data later, thereby ensuring that the obtained first block data is accurate, that is, ensuring the reliability and security of the data.
[0009] Optionally, the first node generates corresponding second verification data according to each data packet (including block data packets and / or recovery data packets) of the first block data and broadcasts the second verification data, where the second verification data is used to verify the corresponding data packet to quickly determine whether there is an unavailable data packet and accurately determine which the unavailable data packet is.
[0010] Optionally, before the first node splits the first block data into at least two block data packets, the first node also triggers the blockchain system to perform a consistency check on the first block data. Specifically, the first node broadcasts a first consensus request indicating a consistency check on the first block data and receives a consensus success message for the first consensus request, thereby determining that the consistency check on the first block data is successful. This ensures that the first block data to be transferred is accurate and avoids potential security risks caused by transferring inaccurate block data.
[0011] Optionally, before the first node deletes the first block data in the stored blockchain ledger, the first node successfully obtains the transferred first block data. Specifically, the first node obtains the corresponding block data packet from the second node storing the block data packet according to the correspondence between the block data packet of the first block data and the second node storing the block data packet in the first correspondence relationship, and combines the obtained block data packets into second block data. When the second block data is the same as the first block data, the first node determines that it has successfully obtained the first block data. This ensures that the transferred block data can be successfully obtained to avoid the loss of block data caused by the inability to successfully obtain the transferred block data.
[0012] Optionally, before the first node deletes the first block data in the stored blockchain ledger, the first node triggers the blockchain system to conduct consensus on successfully obtaining the transferred first block data. Specifically, the first node broadcasts a second consensus request in the blockchain system, and the second consensus request is used to request verification of whether the transferred first block data can be successfully obtained; the first node receives a consensus success message for the second consensus request. Further, after consensus is successful, the first node further triggers the blockchain system to delete the first block data in the blockchain ledger. Specifically, the first node also broadcasts a deletion request, and the deletion request instructs to delete the first block data in the blockchain ledger. This can avoid the first node being attacked and exploited to randomly delete data in the blockchain ledger after multiple nodes reach a consensus on successfully obtaining the transferred first block data, thereby improving data security.
[0013] In one embodiment, the total data volume of the at least 1 recovery data packet is less than the total data volume of the at least 2 block data packets, so as to ensure the reliability of block data transfer while avoiding excessive storage space occupation by the recovery data packet and causing storage pressure.
[0014] Optionally, the first node determines the third block data to be transferred from the stored blockchain ledger, and the security requirement of the third block data is lower than that of the first block data; then the first node sends the third block data to a storage device outside the blockchain system, records the second correspondence between the third block data and the storage device, and broadcasts the second correspondence; the first node deletes the third block data in the stored blockchain ledger. Transferring the first block data with higher security requirements to the nodes inside the blockchain system and the third block data with lower security requirements to the storage device outside the blockchain system is beneficial to ensuring the security of the block data with high security requirements while further reducing the storage pressure of the blockchain system.
[0015] Optionally, the first node selects the second node according to the performance information of each node in the blockchain system, where the performance information includes one or more of the following: security, remaining storage space, access frequency, CPU occupancy rate, or failure rate.
[0016] In one embodiment, the second node is a security node in the blockchain system, where the security node is determined based on the security of each node in the blockchain system or determined through a consensus mechanism. Since there may be malicious lying nodes in the blockchain system, these malicious lying nodes can be avoided, thereby further improving the security of block data transfer. Optionally, the first node also triggers the blockchain system to delete the first block data in the blockchain ledger. Specifically, the first node broadcasts a deletion request, and the deletion request indicates the deletion of the first block data in the blockchain ledger.
[0017] In a second aspect, an embodiment of the present application provides a method for processing blockchain data, specifically a method for storing blockchain data. The method includes: the second node receives and stores the first data packet sent by the first node, where the first data packet is one or more data packets in the block data packets obtained by splitting the first block data and / or the recovery data packet of the block data packet for recovering the first block data, and the first block data is the data to be transferred in the blockchain ledger; then, the second node also receives and stores the first corresponding relationship, where the first corresponding relationship includes: the corresponding relationship between the block data packets of the first block data and the nodes storing the block data packets, and the corresponding relationship between the recovery data packets of the first block data and the nodes storing the recovery data packets.
[0018] In the present application, the block data in the blockchain ledger can be split and transferred to multiple nodes, thereby reducing the storage pressure on the blockchain ledger. And the recovery data packet can tolerate the unavailability of the block data packets transferred to some nodes, that is, the recovery data packet can be used to recover the block data packets when the block data packets are unavailable, thereby improving the reliability of block data transfer. The corresponding relationship between the data packets (block data packets, recovery data packets) of the transferred block data and the nodes storing these data packets is saved, so as to facilitate obtaining the transferred block data according to the corresponding relationship in the later stage.
[0019] In one embodiment, the second node is a node in the blockchain system. Since the nodes in the blockchain system are more secure than the devices outside the blockchain system, it is beneficial to improve the security of block data transfer by storing the data packets of the transferred block data in the nodes inside the blockchain system.
[0020] Further, the second node is a security node in the blockchain system, where the security node is determined based on the security of each node in the blockchain system or determined through a consensus mechanism. Since there may be malicious lying nodes in the blockchain system, these malicious lying nodes can be avoided, thereby further improving the security of block data transfer and storage.
[0021] In one embodiment, the second node is a node storing the blockchain ledger, and the method further includes: the second node receives a deletion request sent by the first node, where the deletion request indicates to delete the first block data in the blockchain ledger, and then the second node deletes the first block data stored in the blockchain ledger. In this way, the accounting node can delete the transferred block data in the stored blockchain ledger, thereby alleviating the storage pressure of the blockchain system.
[0022] Optionally, the second node also receives a consensus request (the second consensus request), where the consensus request indicates to verify whether the transferred first block data can be successfully obtained. Thus, the second node, as a node participating in this consensus, successfully obtains the transferred first block data according to the first correspondence (specifically, the correspondence between the block data packet and the node storing the block data packet), and broadcasts a verification success message. Further, the second node also receives a consensus success message for the consensus request, thereby determining that the blockchain system reaches a consensus on successfully obtaining the transferred first block data. In this case, if the second node is a node storing the blockchain ledger, the second node also deletes the first block data stored in the blockchain ledger. In this way, the first block data can be deleted after multiple nodes reach a consensus on successfully obtaining the transferred first block data, so as to prevent the first node from being attacked and misusing to randomly delete the data in the blockchain ledger, thereby improving data security.
[0023] In one embodiment, the second node successfully obtaining the transferred first block data specifically includes: the second node obtains the block data packet of the first block data from other nodes storing the block data packet of the first block data according to the correspondence between the block data packet of the first block data and the node storing the block data packet in the first correspondence, and combines the block data packets of the first block data into the second block data. When the second block data is consistent with the first block data, the second node determines that it has successfully obtained the transferred first block data.
[0024] Optionally, the second node also receives and stores the check data of the first data packet, and periodically performs an integrity check on the stored first data packet according to the check data of the first data packet, so as to ensure the reliability of the first data packet stored by the second node. Further, when the integrity check of the first data packet fails, the second node also obtains other data packets of the first block data from the nodes storing other data packets of the first block data according to the first corresponding relationship, where the other data packets of the first block data specifically refer to the block data packets and recovery data packets of the first block data other than the first data packet; the second node restores the first data packet according to the other data packets of the first block data. In this way, unavailable data packets can be detected in time and the unavailable data packets can be restored in time, thereby ensuring the reliability of the transferred block data and improving the acquisition efficiency of the transferred block data.
[0025] Optionally, the second node also receives the check data and stores the check data in the blockchain ledger, where the check data includes one or more of the following: the first check data for the integrity check of the first block data, and the second check data for the integrity check of the block data packets and recovery data packets of the first block data. Storing the check data in the blockchain ledger can ensure security, and the amount of data of the check data itself is not large, so it will not cause storage pressure.
[0026] In a third aspect, an embodiment of the present application provides a method for processing blockchain data, specifically a method for obtaining blockchain data. The method includes: the third node obtains the block data packets of the first block data from the corresponding nodes according to the corresponding relationship between the block data packets of the first block data and the nodes storing the block data packets; furthermore, the third node combines the obtained block data packets to obtain the first block data. In this way, the transferred block data in the blockchain system can still be obtained.
[0027] Optionally, when at least one block data packet in the block data packets of the first block data is unavailable, the third node also obtains the recovery data packets of the first block data from the corresponding nodes according to the corresponding relationship between the recovery data packets of the first block data and the nodes storing the recovery data packets, and restores the at least one unavailable block data packet according to the recovery data packets and the available block data packets; furthermore, the third node combines the at least one restored block data packet and the available block data packets to obtain the first block data. In this method, even if some block data packets are unavailable, the recovery data packets can still be used to restore the unavailable block data packets, thereby improving the reliability of block data transfer.
[0028] Optionally, the third node also performs an integrity check on the first block data according to the first verification data of the first block data, so that the third node determines whether the first block data is successfully obtained according to the result of the integrity check. The integrity check is used to ensure the security of the obtained first block data.
[0029] Optionally, the third node also performs an integrity check on each block data packet according to the verification data of the block data packet of the first block data. In this way, the third node can not only determine whether each block data packet is available, but also quickly determine which block data packet is unavailable.
[0030] Optionally, the third node also obtains the third block data from a storage device outside the blockchain system according to the second correspondence relationship, where the second correspondence relationship includes the correspondence relationship between the third block data and the storage device storing the third block data, and the security requirement of the first block data is higher than that of the third block data.
[0031] In a fourth aspect, an embodiment of the present application provides a blockchain data processing apparatus, which includes functional modules for executing any method of the first aspect; the present application does not limit the division of functional modules, and the functional modules can be correspondingly divided according to the process steps of the blockchain data processing method of the first aspect, or can be divided according to specific implementation needs. As an example, the apparatus includes a sending module, a processing module, a sending module, and / or a receiving module. Among them, the functional modules can be implemented by hardware or by hardware executing corresponding software.
[0032] In a fifth aspect, an embodiment of the present application provides a blockchain data processing apparatus, which includes a memory and at least one processor. The memory stores program code, and the processor calls the program code to execute any method of the first aspect. The apparatus may further include a communication interface for communicating with other devices.
[0033] In a sixth aspect, an embodiment of the present application provides a blockchain data processing apparatus, which includes functional modules for executing any method of the second aspect; the present application does not limit the division of functional modules, and the functional modules can be correspondingly divided according to the process steps of the blockchain data processing method of the second aspect, or can be divided according to specific implementation needs. As an example, the apparatus includes a receiving module, a storage module, a processing module, and / or a sending module. Among them, the functional modules can be implemented by hardware or by hardware executing corresponding software.
[0034] In a seventh aspect, an embodiment of the present application provides an apparatus for blockchain data processing. The apparatus includes a memory and at least one processor. The memory stores program code, and the processor invokes the program code to execute any method of the second aspect. The apparatus may further include a communication interface for communicating with other devices.
[0035] In an eighth aspect, an embodiment of the present application provides an apparatus for blockchain data processing. The apparatus includes functional modules for executing any method of the third aspect; the present application does not limit the division of the functional modules. The functional modules may be correspondingly divided according to the process steps of the blockchain data processing method of the third aspect, or may be divided according to specific implementation requirements. As an example, the apparatus includes a sending module, a receiving module, a processing module, and / or a storage module. Among them, the functional modules may be implemented by hardware or by hardware executing corresponding software.
[0036] In a ninth aspect, an embodiment of the present application provides an apparatus for blockchain data processing. The apparatus includes a memory and at least one processor. The memory stores program code, and the processor invokes the program code to execute any method of the third aspect. The apparatus may further include a communication interface for communicating with other devices.
[0037] In a tenth aspect, an embodiment of the present application provides a blockchain data processing system, including a first node and a second node. The first node is the apparatus described in the fourth aspect or the fifth aspect, and the second node is the apparatus described in the sixth aspect or the seventh aspect. Optionally, the system further includes a third node, and the third node is the apparatus described in the eighth aspect or the ninth aspect.
[0038] In an eleventh aspect, an embodiment of the present application provides a computer-readable storage medium. The computer-readable storage medium stores program code, and when the program code runs, it can enable the device running the program code to implement any method of the first aspect of the present application.
[0039] In a twelfth aspect, an embodiment of the present application provides a computer-readable storage medium. The computer-readable storage medium stores program code, and when the program code runs, it can enable the device running the program code to implement any method of the second aspect of the present application.
[0040] In a thirteenth aspect, an embodiment of the present application provides a computer-readable storage medium. The computer-readable storage medium stores program code, and when the program code runs, it can enable the device running the program code to implement any method of the third aspect of the present application.
[0041] In a fourteenth aspect, an embodiment of the present application provides a computer program product. When the computer program product runs on a computer, it enables the computer to implement any method of the first aspect of the present application.
[0042] In a fifteenth aspect, an embodiment of the present application provides a computer program product. When the computer program product runs on a computer, the computer is enabled to implement any of the methods in the second aspect of the present application.
[0043] In a sixteenth aspect, an embodiment of the present application provides a computer program product. When the computer program product runs on a computer, the computer is enabled to implement any of the methods in the third aspect of the present application.
[0044] In a seventeenth aspect, an embodiment of the present application provides a chip. When the chip runs, it is capable of implementing any of the methods in the first aspect of the present application.
[0045] In an eighteenth aspect, an embodiment of the present application provides a chip. When the chip runs, it is capable of implementing any of the methods in the second aspect of the present application.
[0046] In a nineteenth aspect, an embodiment of the present application provides a chip. When the chip runs, it is capable of implementing any of the methods in the third aspect of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the background art, the following will describe the drawings required to be used in the embodiments of the present application or the background art.
[0048] Figure 1A It is a schematic structural diagram of a blockchain ledger provided by an embodiment of the present application;
[0049] Figure 1B It is a schematic system architecture diagram of blockchain data processing provided by an embodiment of the present application;
[0050] Figure 2 It is a flowchart of a method for blockchain data processing provided by an embodiment of the present application;
[0051] Figure 3 It is another flowchart of a method for blockchain data processing provided by an embodiment of the present application;
[0052] Figure 4 It is another flowchart of a method for blockchain data processing provided by an embodiment of the present application;
[0053] Figure 5 It is another flowchart of a method for blockchain data processing provided by an embodiment of the present application;
[0054] Figure 6 It is a schematic structural diagram of a device for blockchain data processing provided by an embodiment of the present application;
[0055] Figure 7Schematic structural diagram of another blockchain data processing device provided by an embodiment of the present application;
[0056] Figure 8 Schematic structural diagram of another blockchain data processing device provided by an embodiment of the present application;
[0057] Figure 9 Schematic structural diagram of another blockchain data processing device provided by an embodiment of the present application. Detailed implementation manners
[0058] The embodiments of the present application will be described below with reference to the accompanying drawings in the embodiments of the present application.
[0059] To facilitate the understanding of the present application, some concepts related to blockchain technology are introduced here first.
[0060] Blockchain technology has the characteristic of decentralization and relies on multiple nodes to jointly participate in accounting and jointly maintain a reliable database, which is also called a blockchain ledger (or distributed ledger, ledger, etc.).
[0061] The blockchain ledger consists of multiple blocks, and each block includes several transaction information and the hash value of the previous block. These multiple blocks are sequentially connected in the order of generation, thus forming the blockchain ledger. As Figure 1A shown, it is a visualized schematic structural diagram of the blockchain ledger. The block height refers to the position of the block in the blockchain ledger, and the block height value can be used to identify the block. For example Figure 1A blocks H001, H002, etc. in. In addition, the block hash value refers to the value obtained by performing a hash calculation on the block header of the block and can also be used to identify the block. The block hash value can also be used to verify the block, making it difficult to tamper with and forge the blockchain ledger. For example, if block H002 contains the hash value of block H001, the node can verify the data of block H002 according to the hash value of block H001 contained in block H002. Therefore, each block hash value is like a chain between blocks, improving the security of the blockchain ledger.
[0062] Consensus mechanisms are used to ensure that blockchain systems meet different levels of consistency, and consensus mechanisms often require consensus algorithms to achieve. The consensus algorithm solves the problem of multiple nodes reaching an agreement on a certain proposal. Since the nodes in the blockchain system do not fully trust each other, there may be malicious lying nodes, and the consensus algorithm can well solve this problem. Although each node in the blockchain system may be a malicious lying node, the result of the consensus of many nodes is a credible result. Commonly used consensus algorithms include the practical byzantine fault tolerance (PBFT) algorithm, the proof of work (PoW) algorithm, the proof of endorse (POE) algorithm, and so on. In addition, the consensus algorithm also helps to detect malicious lying nodes, thereby improving the security of the blockchain system.
[0063] The nodes in the blockchain system are communication entities and can be specifically deployed on one or more physical devices. Nodes can be classified into the following types according to network functions: endorsement nodes, ordering nodes, accounting nodes, and so on. For example, after receiving a request to simulate the operation of a smart contract, the endorsement node runs the smart contract, signs the operation result of the smart contract, and then returns the operation result. The ordering node is used to perform consensus and sorting operations on transactions after receiving them, and then package the transactions into blocks and send the blocks to the accounting nodes. The accounting node is used to store the blockchain ledger, specifically to verify the received blocks and add the blocks to the blockchain ledger after the verification passes. Multiple accounting nodes can also periodically perform consistency verification on the blockchain ledgers stored by each of them, so as to timely discover the tampered data and ensure the data security of the blockchain ledger. Therefore, multiple accounting nodes will each store a complete blockchain ledger, which on the one hand ensures the security of the blockchain ledger and on the other hand also brings great pressure to the blockchain storage.
[0064] In addition, the blockchain system can also include a leader node. In this deployment, the ordering node sends the block to the leader node, and the leader node broadcasts the block so that each accounting node can receive the block. It should be understood that a node can simultaneously have the network functions of one or more of the above types of nodes, and this application does not make any restrictions on this. For example, a blockchain node can be both an endorsement node and an accounting node.
[0065] A smart contract is an event-driven, stateful program that can manage data on the blockchain ledger. Event information triggers the state judgment of the smart contract. If the judged state meets the trigger condition, preset actions will be automatically executed, such as querying or updating the blockchain ledger, etc.
[0066] In the process of using blockchain technology, as the number of blocks continuously increases, the storage of the blockchain ledger occupies a large amount of resources. Therefore, this application provides a method for optimizing blockchain data storage.
[0067] Figure 1B It is a schematic diagram of the system architecture of an embodiment of this application. As Figure 1B shown, the nodes within the dashed line range form a blockchain system. This blockchain system includes a first node 101 and a second node 102.
[0068] Among them, the first node 101 is used to determine the first block data to be transferred from the stored blockchain ledger; and split the first block data into at least 2 block data packets ( Figure 1B taking 2 block data packets in the example: block data packet A and block data packet B), generate at least 1 recovery data packet ( Figure 1B taking 1 recovery data packet in the example: recovery data packet C) according to the at least 2 block data packets, and the recovery data packet is used to recover the block data packet. Furthermore, the first node 101 is also used to send each of the at least 2 block data packets and the at least 1 recovery data packet to the corresponding second node 102. For example, the first node 101 sends block data packet A to the second node 102-1, sends block data packet B to the second node 102-2, and sends recovery data packet C to the second node 102-3. Correspondingly, the second node 102 is used to receive and store the first data packet sent by the first node 101. For the convenience of description, the data packet received by the second node 102 is called the first data packet. The first data packet is a block data packet and / or a recovery data packet of the first block data. It should be understood that the first node 101 may also send multiple data packets to the same second node 102. For example, the first node 101 sends both block data packet A and block data packet B to the second node 102-1.
[0069] The first node 101 is also used to record the first corresponding relationship between the data packet of the first block data and the second node 102, and broadcast the first corresponding relationship. Accordingly, each node in the blockchain system (which may include the second node 102 and the third node 103) is used to receive and store the first corresponding relationship. This first corresponding relationship is beneficial for accurately finding the block data packets of the first block data and restoring the storage location of the data packets when obtaining the first block data later. The first node 101 is also used to delete the first block data in the stored blockchain ledger. Therefore, the block data in the blockchain ledger can be split and transferred to multiple nodes, thus reducing the storage pressure on the blockchain ledger. And the recovery data packets can tolerate the unavailability of the block data packets transferred to some nodes (such as being lost, damaged or tampered with). When the block data packets are unavailable, the recovery data packets can be used to recover the block data packets, thereby improving the reliability and security of the block data transfer.
[0070] Furthermore, the first node 101 is also used to trigger the deletion of the first block data in the blockchain ledger. Specifically, the first node 101 broadcasts a deletion request, and this deletion request instructs to delete the first block data in the blockchain ledger. Thus, after receiving the deletion request, the accounting nodes in the blockchain delete the first block data in their own stored blockchain ledgers.
[0071] Furthermore, the first node 101 is also used to generate first verification data based on the first block data and broadcast the first verification data. Among them, the first verification data is used for the integrity verification of the first block data. Accordingly, each node in the blockchain system (which may include the second node 102 and the third node 103) is used to receive and store the first verification data. This first verification data facilitates the integrity verification of the obtained first block data when obtaining the transferred first block data later, thereby ensuring that the obtained first block data is accurate, that is, ensuring the reliability and security of the data.
[0072] Furthermore, the first node 101 is also used to generate corresponding second verification data based on each data packet (block data packet and / or recovery data packet) and broadcast the second verification data. Among them, the second verification data is used for the integrity verification of the corresponding data packet. Accordingly, each node in the blockchain system (which may include the second node 102 and the third node 103) is used to receive and store the second verification data. The second verification data is used for the integrity verification of the corresponding data packet to quickly determine whether there are unavailable data packets and accurately determine which data packets are unavailable.
[0073] As an alternative, the second node 102 is used to receive and store the verification data of the first data packet. The verification data of the first data packet is used for the integrity verification of the first data packet. There may be various situations described here. For example, when the second node 102 receives the second verification data of each data packet sent by the first node 101, the second node 102 only saves the verification data of the first data packet received by the second node 102, or the second node 102 saves the second verification data of each data packet, including the verification data of the first data packet; or when the second node 102 receives the first data packet sent by the first node 101 and simultaneously receives the verification data of the first data packet sent by the first node 101, the second node 102 saves the first data packet and the verification data of the first data packet.
[0074] Furthermore, the second node 102 is also used to periodically perform integrity verification on the first data packet according to the verification data of the first data packet, so as to ensure the reliability of the first data packet stored by the second node 102. When the integrity verification of the first data packet by the second node 102 fails, the second node 102 is used to obtain other block data packets and recovery data packets of the first block data from the corresponding node according to the first corresponding relationship, and recover the first data packet according to the other block data packets and recovery data packets. This can timely detect unavailable data packets and perform data packet recovery in a timely manner, avoiding the situation of low acquisition efficiency or inability to obtain due to the discovery of unavailable data during acquisition, thus further ensuring the reliability of the transferred block data and improving the acquisition efficiency of the transferred block data.
[0075] As an alternative, the first node 101 is also used to broadcast a first consensus request indicating consistency verification of the first block data, and after successful consensus, transfer the first block data. This ensures that the data to be transferred is accurate and avoids potential security risks caused by transferring inaccurate block data.
[0076] As an alternative, before the first node 101 deletes the first block data and triggers the deletion of the first block data, the first node 101 is also used to successfully obtain the transferred first block data, so as to ensure that the transferred block data can be successfully obtained, avoiding the loss of block data caused by the inability to successfully obtain the transferred block data. Specifically, the first node 101 obtains the corresponding block data packet from the second node 102 according to the corresponding relationship between the block data packet of the first block data in the first corresponding relationship and the second node 102 storing the block data packet, and combines the obtained block data packets into the second block data. When the second block data is the same as the first block data, the first node 101 determines that the first block data has been successfully obtained.
[0077] As an alternative, the first node 101 is further configured to broadcast a second consensus request, which indicates verifying whether the transferred first block data can be successfully obtained, and after receiving the consensus success message for the second consensus request, deleting the first block data and triggering the deletion of the first block data. This can ensure that the first block data is deleted after multiple nodes reach a consensus on successfully obtaining the transferred first block data, thereby avoiding the first node 101 being exploited to randomly delete data in the blockchain ledger and improving data security. Correspondingly, the second node 102 can be configured to participate in the consensus, that is, broadcast a verification success message when the transferred first block data is successfully obtained.
[0078] As an alternative, the first node 101 is further configured to select the second node 102 according to the performance information of each node in the blockchain system, thereby improving the success rate of transferring block data and overall improving the operation efficiency of the blockchain system.
[0079] The blockchain system may further include a third node 103, which is configured to obtain the first block data according to the first correspondence. Specifically, the third node 103 is configured to obtain the corresponding block data packet from the corresponding node (such as the second node 102-1, the second node 102-2) according to the correspondence between the block data packet of the first block data and the node storing the block data packet, and combine the block data packets to obtain the first block data. The correspondence is stored locally by the third node 103 or obtained from other nodes (such as the first node 101).
[0080] As an alternative, when at least one block data packet in the block data packets is unavailable, the third node 103 is configured to obtain the recovery data packet of the first block data from the corresponding node (such as the second node 102-3) according to the correspondence between the recovery data packet of the first block data and the node storing the recovery data packet. The third node 103 is further configured to recover the at least one unavailable block data packet according to the recovery data packet and the available block data packets, and combine the at least one recovered block data packet and the available block data packets to obtain the first block data. This ensures that the transferred block data can still be obtained, guaranteeing the availability of the transferred data.
[0081] Furthermore, the third node 103 is further configured to perform integrity verification on the first block data according to the first verification data, and the third node 103 determines whether the first block data is successfully obtained according to the result of the integrity verification. This can further identify whether the obtained first block data is accurate.
[0082] As an alternative, the third node 103 is used to perform integrity verification on each data packet according to the verification data of each data packet (i.e., the second verification data), so as to quickly and accurately determine whether there are unavailable data packets, and which data packets are unavailable when there are unavailable data packets.
[0083] It should be understood that the third node 103 may specifically be the first node 101, the second node 102, or other nodes in the blockchain system that have the function of obtaining transferred block data. In addition, Figure 1B For example only, the present application does not limit the number and type of nodes included in the blockchain system. The first node 101, the second node 102, and the third node 103, as nodes inside the blockchain system, may also have other functions at the same time, such as participating in consensus, running smart contracts, and / or storing the blockchain ledger and other functions for maintaining the blockchain ledger.
[0084] The system of the embodiment of the present application may further include a storage device 104. Among them, the storage device 104 may be a centralized storage device or a distributed storage device. The storage device 104 may communicate with the first node 101 in the blockchain system to store the third block data to be transferred. The security requirement of the third block data is lower than that of the first block data. Specifically, the first node 101 is further used to determine the third block data to be transferred from the blockchain ledger, record the second correspondence between the third block data and the storage device 104, broadcast the second correspondence, and delete the third block data stored in the blockchain ledger. The storage device 104 is used to receive and store the third block data.
[0085] Furthermore, the nodes in the blockchain system can obtain the third block data transferred to the storage device 104. Here, the third node 103 is still taken as an example for illustration. That is, the third node 103 is further used to obtain the third block data from the storage device 104 according to the second correspondence.
[0086] Compared with the nodes inside the blockchain system, the storage device 104, as a device outside the blockchain system, may have lower security. However, the advantage of the storage device 104 is that it does not occupy the storage space of the blockchain system, thus being able to improve the operation efficiency of the blockchain system, and the storage device 104 is easy to expand. Therefore, transferring the first block data with high security requirements to the nodes (the second node 102) inside the blockchain system, and transferring the third block data with low security requirements to the storage device 104 outside the blockchain system is beneficial to improving the operation efficiency of the blockchain system while ensuring the security of the block data with high security requirements. It should be understood that the security requirement can also be replaced by parameters such as importance and data level that measure the value of block data, and the present application does not make a limit.
[0087] In the embodiments of the present application, the storage device 104 is not classified into the blockchain system (that is, in the embodiments of the present application, the storage device 104 is regarded as a device external to the blockchain system). This is because the storage device 104 cannot participate in the consensus of the blockchain system, does not run the smart contracts of the blockchain system, and does not store the blockchain ledger, so it cannot participate in maintaining the blockchain ledger either. If those skilled in the art use a broader concept to define the blockchain system, for example, including devices that have processed block data within the scope of the blockchain system, then the storage device 104 may also be referred to as a device within the blockchain system. However, except for the function of storing the third block data, the storage device 104 does not have the functions of participating in the consensus of the blockchain system, running the smart contracts of the blockchain system, storing the blockchain ledger, etc., which are functions for maintaining the blockchain ledger.
[0088] The functions of each device in the present application will be further elaborated in detail in the subsequent embodiments. The solution of the present application will be described below in conjunction with specific embodiments.
[0089] Figure 2 It is a schematic flowchart of the blockchain data processing method provided by the present application. This method can be applied in Figure 1B the system shown. In the process of this method, the block data in the blockchain ledger can be split and transferred to multiple nodes in the blockchain system, or can be transferred to a storage device external to the blockchain system. The specific steps are as follows.
[0090] S201. The first node 101 determines the first block data to be transferred in the blockchain ledger.
[0091] The first block data meets the preset transfer conditions, and the preset transfer conditions include one or more of the following: generated within a specified time period (reference timestamp), block height value lower than the preset height value, block access frequency lower than the preset frequency value, and / or block data security requirement lower than the preset security requirement, etc. When the preset transfer conditions include multiple conditions, the multiple conditions can be in an AND relationship (all multiple conditions are met) or an OR relationship (at least one of the multiple conditions is met).
[0092] The first node 101 periodically detects whether there is block data in the blockchain ledger that meets the preset transfer conditions, or the first node 101 performs detection after an event is triggered, such as a memory warning event, etc.
[0093] In addition, the first node 101 can also determine the first block data to be transferred according to the message sent by the client. For example, when the user determines to transfer the first block data by himself / herself, a message is sent to the blockchain system through the client.
[0094] Optionally, the first block data is the data of one or more blocks. When the first block data is the data of one block, the identifier of the block (such as the block height value) can be directly used as the identifier of the first block data. When the first block data is the data of multiple blocks, the identifiers of the multiple blocks are directly concatenated as the identifier of the first block data, or the identifier of the first block data is generated according to the identifiers of the multiple blocks. The identifier of the first block data is used to identify the first block data. Specifically, the first block data is the data of multiple consecutive blocks, which is convenient for later acquisition.
[0095] Of course, there may also be a discontinuous situation. For example, the block data with block height values H100 - H103 reaches the preset block height value. However, among them, the security requirement level of H101 is high, so the block data of H101 cannot be transferred. As a result, the block data of H100, H102, and H103 reaches the preset transfer condition. Treating the discontinuous block data of H100, H102, and H103 as the first block data together, then when synthesizing the first block data from H100, H102, and H103, it is beneficial to insert certain specific characters at the end / start position of a block data to facilitate distinguishing different block data during later acquisition. In this case, individual transfers can also be made for each block data (for example, processing each of the block data of H100, H102, and H103 separately three times), that is, the first block data only includes one block data.
[0096] In addition, the first block data can also be part of the data in the block (such as some transaction data, which can be identified by a transaction identifier (Identity, ID)). In this case, the identifier of the part of the data (such as the transaction identifier) can be directly used as the identifier of the first block data, or the identifier of the block to which the part of the data belongs can be used as the identifier of the first block data.
[0097] S202. The first node 101 triggers the blockchain system to perform a consistency check on the first block data.
[0098] Specifically, the consistency check is implemented through a consensus mechanism, and the steps are as follows:
[0099] S202a. The first node 101 broadcasts a first consensus request, and the first consensus request indicates to perform a consistency check on the first block data.
[0100] The first consensus request may carry the identifier of the first block data and the verification data (such as hash value) of the first block data. Thus, the nodes participating in this consensus in the blockchain system find the corresponding block data from the locally stored blockchain ledger according to the identifier of the first block data, calculate the verification data of the corresponding block data, compare the verification data of the first block data with the verification data of the corresponding block data. If the two are the same, it is determined that the verification is successful, and the nodes that determine the verification is successful broadcast a notification message of successful verification in the blockchain network. If the two are different, it is determined that the verification fails, and the nodes that determine the verification fails broadcast a notification message of failed verification in the blockchain network or do not broadcast. Nodes with consensus service functions (such as sorting nodes) count the received notification messages of successful verification, thereby determining whether the conditions for successful consensus are met, and broadcast the consensus result in the blockchain system. If the conditions for successful consensus are met, the sorting node broadcasts a successful consensus message. For example, the condition for successful consensus is that the number of nodes with successful verification reaches a preset value. If the conditions for successful consensus are not met, the sorting node broadcasts a failed consensus message.
[0101] It should be understood that the first consensus request may not carry the identifier of the first block data, and in this case, the first consensus request triggers the consistency verification of the blockchain ledger. The consistency verification mentioned here is also carried out through the consensus mechanism, and the specific verification process will not be elaborated.
[0102] S202b. The first node 101 receives a successful consensus message for the first consensus request.
[0103] The first node 101 determines that the first block data is accurate and not tampered with according to the received successful consensus message. Furthermore, it is safe for the first node 101 to transfer the first block data, which can avoid potential security risks caused by transferring inaccurate block data. If the first node 101 receives a failed consensus message, the first block data may have been tampered with. The first node 101 first obtains accurate data from other nodes, or issues an alarm and performs corresponding processing according to the instructions of the administrator to obtain accurate data. After that, the first node 101 transfers the first block data, or other nodes transfer the corresponding block data.
[0104] It should be understood that since each node in the blockchain system may periodically perform consistency verification on the blockchain ledger, step S202 is optional. In addition, the first consensus request and the successful consensus message for the first consensus request are exemplary message names. For example, the first consensus request may also be called a consistency verification request, and the present application does not make any limitations in this regard.
[0105] S203. The first node 101 generates a data packet of the first block data.
[0106] The first node 101 splits the first block data into at least two block data packets.
[0107] As an optional way, the size of the block data packet is preset to N. N is a positive integer, and the unit of N can be bytes, bits, etc., without limitation. Denote the size of the first block data as S1, where S1 and N have the same unit or there is a conversion relationship between the units of S1 and N, and S1 is a positive integer. The first node 101 determines whether S1 is divisible by N. When S1 is divisible by N, the first node 101 directly splits the first block data into block data packets of equal length (both with a size of N). When S1 is not divisible by N, the first node 101 first pads the first block data so that the size S2 of the padded first block data is divisible by N, and then the first node 101 splits the padded first block data into block data packets of equal length (both with a size of N). Or in this case, when the first node 101 splits, the first few block data packets are of equal length (both with a size of N), and the first node 101 pads the last block data packet so that the last block data packet is of the same length as the other block data packets (also with a size of N). It should be understood that when there is a conversion relationship between the units of S1 and N, first perform unit conversion on S1 or N to unify their units and then perform the division operation.
[0108] As an optional way, the first node 101 sets the size N of the block data packet according to the size S1 of the first block data. For example, N is set to a factor of S1, and then the first block data is split into block data packets of equal length (both with a size of N).
[0109] As an optional way, the number of split block data packets is preset to M, and M is an integer greater than or equal to 2. The first node 101 determines whether S1 is divisible by M. When S1 is divisible by M, the first node 101 directly splits the first block data into M block data packets of equal length. When S1 is not divisible by M, the first node 101 first pads the first block data so that the size S2 of the padded first block data is divisible by M, and then the first node 101 splits the padded first block data into M block data packets of equal length. Or in this case, when the first node 101 splits, the first (M - 1) block data packets are of equal length, and the first node 101 pads the last block data packet so that the last block data packet is of the same length as the other block data packets.
[0110] The first node 101 generates at least one recovery data packet based on the at least two block data packets. The recovery data packet is used to recover the block data packets. The most common method for generating a recovery data packet is to copy (also called back up) the at least two block data packets to generate a corresponding recovery data packet for each block data packet. However, in this method, the total data volume of the at least one recovery data packet is the same as the total data volume of the at least two block data packets (one copy), or the total data volume of the at least one recovery data packet is larger than the total data volume of the at least two block data packets (multiple copies), thereby occupying a large amount of storage space.
[0111] As another optional method, the first node 101 calculates at least one recovery data packet based on the at least two block data packets. There are various specific calculation methods. For example, performing an XOR operation on the at least two block data packets to obtain one recovery data packet generates one recovery data packet. The total data volume of the recovery data packet is less than the total data volume of the at least two block data packets. Another example is performing a sum operation on the at least two block data packets to obtain a first recovery data packet. The at least two block data packets are then multiplied by corresponding coefficients and then summed again to obtain a second recovery data packet. This calculation method generates two recovery data packets. With this calculation method, when there are two block data packets, the total data volume of the recovery data packets is equal to the total data volume of the block data packets. However, in most cases, the number of block data packets exceeds two, and the total data volume of the recovery data packets is less than the total data volume of the block data packets. The smaller total data volume of the recovery data packets creates significant storage pressure.
[0112] S204 , the first node 101 sends the generated data packet to the corresponding second node 102 .
[0113] The generated data packets include at least two block data packets and at least one recovery data packet generated in step S203. The first node selects a certain number of second nodes 102 to transfer these data packets to the second nodes 102. There are various selection methods, such as random selection. For another example, the first node 101 selects the second nodes 102 according to the performance information of each node in the blockchain system. Among them, the performance information includes one or more of the following: security, remaining storage space, access frequency, Central Processing Unit (CPU) occupancy rate, or failure rate, etc. Specifically, the performance information of each node in the blockchain system can be obtained from a node that maintains the performance information of nodes (such as the leader node), or obtained by each node broadcasting periodically, etc. The first node 101 selects the second nodes 102 whose performance meets the preset conditions, such as secure nodes with high security. In addition, there may be some nodes in the blockchain system that do not have the function of storing the transferred data packets. Then the first node 101 randomly selects or selects the second nodes 102 according to the performance information among the nodes that have the function of storing the transferred data packets.
[0114] Optionally, the first node 101 can also determine the secure nodes through a consensus mechanism and select the second nodes 102 from the determined secure nodes, that is, the second nodes 102 are one or more nodes among the determined secure nodes. For example, the first node 101 (or other nodes in other blockchain systems) broadcasts a consensus request. After each node in the blockchain system receives the consensus request, it broadcasts a response message. The response messages returned by each node are signed using the private keys stored by themselves. After the nodes with consensus service functions (such as sorting nodes) receive the response messages from each node, they will decrypt the response messages using the public keys to determine the security of each node. If the decryption of the response message of a certain node fails, then the node is determined to have low security (a malicious lying node); if the decryption of the response message of a certain node is successful, then the node is determined to have high security (a secure node). The sorting node will carry the information of malicious lying nodes and / or the information of secure nodes when broadcasting the consensus result. Thus, the first node 101 determines the secure nodes according to the received consensus result and further selects the second nodes 102 from the secure nodes. As an implementation manner, the consensus request here can specifically be the first consensus request in S202. Then the nodes participating in the consensus also sign the notification message of successful verification or failed verification using the private keys stored by themselves. The sorting node not only determines whether the conditions for successful consensus are met, but also determines whether the nodes participating in the consensus are secure nodes or malicious lying nodes, and carries the information of malicious lying nodes and / or the information of secure nodes in the consensus result. As another implementation manner, the consensus request here can also be other consensus requests. For example, the first node 101 also broadcasts a consensus request for verifying security. The specific steps are similar and will not be elaborated here.
[0115] It should be understood that the blockchain system can periodically or event-triggeringly determine the security of each node in the blockchain system through a consensus mechanism, so as to maintain the security in the performance information of each node.
[0116] Ideally, the first node 101 selects X second nodes 102 for X data packets, so that the first node 101 sends each data packet to 1 second node 102 respectively. Wherein, X is an integer greater than or equal to 3, and the X data packets are the generated data packets as described above. Taking X = 3 as an example for illustration, in S204a, the first node 101 sends data packet A to the second node 102-1; in S204b, the first node 101 sends data packet B to the second node 102-2; in S204c, the first node 101 sends data packet C to the second node 102-3.
[0117] There may also be such a situation: the first node 101 selects Y second nodes 102 (Y is a positive integer less than X) for X data packets, so that the first node 101 may send more than 1 data packet to the same second node 102. This situation is generally due to fewer nodes in the blockchain system, fewer nodes whose performance reaches the preset conditions, or fewer nodes with the function of storing and transferring data packets, etc. For example, the first node 101 sends both data packet A and data packet B to the second node 102-2, and sends data packet C to the second node 102-3. Optionally, the first node 101 can also determine itself as a node for storing and transferring data packets, that is, the second node 102 includes the first node 101. For example, the first node stores data packet A by itself, and sends data packet B to the second node 102-2 and data packet C to the second node 102-3.
[0118] Correspondingly, the second node 102 receives and stores the data packets sent by the first node 101. For the convenience of description, the data packets received by the second node 102 are called first data packets. The first data packet is the block data packet and / or recovery data packet of the first block data. For example, the second node 102-1 receives and stores the data packet A sent by the first node 101, then for the second node 102-1, the first data packet is the data packet A.
[0119] It should be understood that the storage here is not storing into the blockchain ledger, that is, the first data packet is not stored in the blockchain in the form of a block. Specifically, the second node 102 stores the first data packet in the storage space for storing and transferring data packets, or the second node 102 stores the first data packet in other storage spaces other than the space for storing the blockchain ledger.
[0120] Optionally, after the second node 102 stores the first data packet successfully, it sends a data reception success message to the first node 101. Further, the second node 102 can also calculate the check data of the first data packet (such as the hash value of the first data packet), and send the check data of the first data packet to the first node 101. Thus, the first node 101 checks the first data packet according to the check data of the first data packet to determine whether the first data packet received by the second node 102 is accurate.
[0121] S205. The first node 101 records the first corresponding relationship between the data packet and the second node 102.
[0122] The first corresponding relationship describes the corresponding relationship between the data packet of the first block data and the second node 102 that stores the data packet.
[0123] Optionally, the first corresponding relationship is specifically the corresponding relationship between the identifier of the data packet of the first block data and the identifier of the second node 102. The identifier of the data packet of the first block data can both identify the first block data and the data packet therein. For example, the identifiers of the data packets of the first block data are respectively: H100A, H100B, H100C. Among them, H100 is the identifier of the first block data, used to identify the first block data, and A, B, C are the identifiers of the data packets, used to identify the order of the data packets in the first block data (that is, which data packet in the first block data specifically), such as H100A identifies the first data packet in the first block data, H100B identifies the second data block in the first block data, and H100C identifies the third data packet in the first block data, so that when obtaining the transferred first block data later, the data packets can be combined in order to obtain the correct first block data. The identifier of the second node 102 is used to identify the second node 102, specifically the node identifier of the second node 102 (for example, each node in the blockchain system has an assigned node identifier), or the Internet Protocol (IP) address of the second node 102.
[0124] Optionally, the first correspondence is specifically the correspondence between the identifier of the first block data, the identifier of the data packet, and the identifier of the second node 102. The identifier of the first block data is used to identify the first block data, and can specifically be a block height value or a transaction identifier, etc. (as introduced in S201). The identifier of the data packet is used to identify the data packet in a certain block data, for example, to identify the order of the data packet in the block data. Thus, the identifier of the first block data and the identifier of the data packet together can identify the data packet of the first block data. The identifier of the second node 102 will not be elaborated. In addition, the identifier of the data packet is not necessary. For example, the identifiers of multiple second nodes 102 are recorded in the order of the data packets in the block data, so as to also reflect which data packet stored on a certain second node 102 is the data packet in the first block data. For example, if the recorded first correspondence is as shown in Table 1, it means that the first data packet of H100 is stored in Node02, the second data packet of H100 is stored in Node08, and the third data packet of H100 is stored in Node09.
[0125] Table 1
[0126] H100 Node02 Node08 Node09
[0127] As can be seen from the above description, the data packets of the first block data include block data packets and recovery data packets. Then, another identifier can be used to identify whether a data packet is a block data packet or a recovery data packet, or the block data packet and the recovery data packet can be distinguished by the identifier of the data packet itself. For example, the data packet identifiers of the first block data are respectively: H100A-1, H100B-1, H100C-2, then the data packets identified by H100A-1 and H100B-1 are block data packets, and the data packet identified by H100C-2 is a recovery data packet. Or, the correspondence between the block data packet and the second node 102 storing the block data packet (abbreviated as the correspondence of the block data packet storage), and the correspondence between the recovery data packet and the second node 102 storing the recovery data packet (abbreviated as the correspondence of the recovery data packet storage) can be maintained as two types of correspondences. Then, the above first correspondence includes the correspondence of the block data packet storage and the correspondence of the recovery data packet storage. In addition, if for any block data, the number of recovery data packets is constant, for example, it is 2, then the recovery data packets can be arranged behind the block data packets. Then, for any block data, the last two data packets in the order are recovery data packets, and other data packets are block data packets, so no identifier is needed to distinguish.
[0128] It should be understood that the execution order of step S205 is not limited. For example, it can be executed simultaneously with S203, simultaneously with S204, or executed after S203, etc.
[0129] S206. The first node 101 broadcasts the first corresponding relationship.
[0130] The first node 101 broadcasts the first corresponding relationship in the blockchain system. Accordingly, each node in the blockchain system stores the first corresponding relationship.
[0131] As an optional manner, a node in the blockchain that has the function of storing transferable data packets (such as the second node 102) stores the first corresponding relationship, so that when the stored data packet is unavailable, other data packets can be obtained according to the first corresponding relationship to recover the unavailable data packet (see the description of S207 for details).
[0132] As an optional manner, a node in the blockchain that has the function of obtaining transferable block data (such as the third node 103) stores the first corresponding relationship, so that the first block data can be obtained according to the first corresponding relationship later. Specifically, the third node 103 stores the first corresponding relationship in other storage spaces except for the space used to store the blockchain ledger, such as the space used to store the corresponding relationship between data packets and nodes. It should be understood that a node that has the function of storing transferable data packets may also have the function of obtaining transferable block data at the same time.
[0133] It should be understood that the execution order of step S206 is also not limited, and it can be executed after step S205.
[0134] S207. The first node 101 generates verification data for the first block data and / or verification data for the data packets of the first block data.
[0135] Specifically, the first node 101 generates verification data for the first block data (simply referred to as the first verification data) according to the first block data. The first verification data is used to perform integrity verification on the first block data. Specifically, the first node 101 calculates the hash value of the first block data, and this hash value is the first verification data.
[0136] The first node 101 can also generate verification data for each data packet (including block data packets and recovery data packets) of the first block data respectively (simply referred to as the second verification data). The second verification data is used to perform integrity verification on the corresponding data packet. Specifically, the first node 101 calculates the hash value of the data packet, and this hash value is the second verification data of the data packet.
[0137] It should be understood that the execution order of step S207 is not limited. For example, it can be executed simultaneously with any step in S203 - S206, or executed after any step in S203 - S206, etc.
[0138] As an alternative, the first node 101 generates check data for each data packet in S203, and sends the data packet and the check data of the data packet to the corresponding second node 102 in S204. Correspondingly, the second node 102 receives and stores the data packet sent by the first node 101 and the check data of the data packet, that is, the first data packet and the check data of the first data packet. For example, in S204, the second node 102-1 receives and stores the data packet A and the check data of the data packet A; the second node 102-2 receives and stores the data packet B and the check data of the data packet B; the second node 102-3 receives and stores the data packet C and the check data of the data packet C.
[0139] Furthermore, the second node 102 can periodically perform an integrity check on the corresponding first data packet according to the stored check data of the first data packet, so as to ensure the reliability of the first data packet stored by the second node 102. When the integrity check of the first data packet by the second node 102 fails, the second node 102 obtains other data packets of the first block data from the corresponding node according to the first corresponding relationship stored in S206, and restores the first data packet according to the other data packets. The corresponding node here refers to the node storing other data packets of the first block data, and the other data packets of the first block data refer to the block data packets and recovery data packets of the first block data except the first data packet. Specifically, the second node 102 requests other data packets of the first block data from the corresponding node according to the first corresponding relationship, and receives the other data packets of the first block data returned by the corresponding node. If the first data packet is a certain block data packet of the first block data, the second node 102 regenerates the first data packet according to the recovery data packet and other block data packets of the first block data. The specific generation method can refer to the description of S403 in the embodiment shown in Figure 4 or the description of S506 in the embodiment shown in Figure 5 If the first data packet is a certain recovery data packet of the first block data, the second node 102 regenerates the first data packet according to the block data packets of the first block data. The specific generation method can refer to the description of S203 or the description of S304 in the embodiment shown in Figure 3
[0140] This facilitates the timely discovery of unavailable data packets and the timely recovery of unavailable data packets, avoiding the situation where unavailable data packets are discovered only when obtaining the first block data later, resulting in low acquisition efficiency or inability to obtain data. For example, the second node 102-1 periodically performs integrity verification on data packet A based on the verification data of data packet A. If the verification fails (i.e., data packet A is unavailable, such as being tampered with or data damaged, etc.), the second node 102-1 obtains data packet B and data packet C of the first block data from the second node 102-2 and the second node 102-3 according to the first corresponding relationship. Then the second node 102 regenerates data packet A (i.e., recovers data packet A) based on data packet B and data packet C.
[0141] S208. The first node 101 broadcasts verification data (specifically including the first verification data and / or the second verification data).
[0142] Specifically, the first node 101 broadcasts the first verification data and / or the second verification data in the blockchain system.
[0143] Correspondingly, each node in the blockchain system stores the first verification data and / or the second verification data. Optionally, nodes with the function of storing transferred data packets in the blockchain system (such as the second node 102) store the first verification data and / or the verification data of the second verification data. The second verification data includes the verification data of the first data packet. Thus, in this case, after storing the second verification data, the second node 102 can also periodically perform integrity verification on the corresponding first data packet based on the verification data of the first data packet, and recover the first data packet when the verification fails, thereby ensuring the reliability of the first data packet stored by the second node 102. For specific details, refer to the description in S207. Optionally, nodes with the function of obtaining transferred block data in the blockchain (such as the third node 103) store the verification data, so that when obtaining the first block data later, the integrity of the first block data and / or the data packets of the first block data can be verified based on the verification data. The specific storage method can refer to S206, which is similar and will not be elaborated here.
[0144] As an implementation manner, the first node 101 also triggers the blockchain system to store the verification data (the first verification data) of the first block data and / or the verification data (the second verification data) of the data packets of the first block data in the blockchain ledger. For example, the first node 101 sends the first verification data and / or the second verification data to the sorting node. After receiving the first verification data and / or the second verification data, the sorting node performs consensus and sorting operations on them, and then packages them into a block and broadcasts it, so that the accounting nodes in the blockchain system add a block containing the first verification data and / or the second verification data to the blockchain ledger stored by themselves.
[0145] It should be understood that the execution order of step S208 is not limited, and it can be executed after step S207. For example, if S207 has been executed before S206, then S208 can be executed simultaneously with S206.
[0146] As an optional method, the verification data (the first verification data, and / or the second verification data) of the first block data and the first corresponding relationship of the first block data can be carried in the same broadcast message. Further, the first node 101 also broadcasts the size S1 of the first block data in the blockchain system. Correspondingly, each node in the blockchain system stores the size S1 of the first block data. For details on which nodes store it and how to store it, refer to the description of storing the verification data of the first block data or storing the first corresponding relationship of the first block data, which will not be elaborated here. In this way, when obtaining the first block data later, it is possible to identify which are the padding data. As an optional method, the size S1 of the first block data, the first corresponding relationship of the first block data, and the verification data (the first verification data, and / or the second verification data) of the first block data can all be carried in the same broadcast message.
[0147] S209. The blockchain system deletes the first block data in the blockchain ledger.
[0148] The first node 101 deletes the first block data in the blockchain ledger stored by itself. Further, the first node 101 also triggers the blockchain system to delete the first block data in the blockchain ledger.
[0149] As an implementation method, the first node 101 broadcasts a deletion request, and this deletion request indicates to delete the first block data in the blockchain ledger. Thus, after the accounting nodes in the blockchain system receive this deletion request, they delete the first block data in the blockchain ledger stored by themselves.
[0150] As an implementation method, the first node 101 deletes the first block data in the blockchain ledger through a consensus mechanism. For example, this deletion request is a consensus request. After the nodes participating in this consensus receive this deletion request, they verify this deletion request. After verifying that this deletion request is legal, they broadcast a notification message indicating successful verification (that is, indicating agreement to delete this first block data). The nodes with consensus service functions (such as sorting nodes) count the notification messages indicating successful verification (regarding the deletion request) received, so as to determine whether the condition for successful consensus is met. If the condition for successful consensus is met, the sorting node broadcasts a consensus success message regarding the deletion request. Further, after the accounting nodes in the blockchain system receive this consensus success message, they delete the first block data in the blockchain ledger.
[0151] It should be understood that the order in which the first node deletes the first block data stored by itself and triggers the blockchain system to delete the first block data is not limited. For example, after the first node triggers the blockchain system to delete the first block data, it then deletes the first block data stored by itself. Additionally, if the second node 102 belongs to the accounting node, it will also perform the operations performed by the accounting node, which will not be elaborated here.
[0152] As an optional method, before the first node 101 deletes the first block data in the blockchain ledger stored by itself and / or triggers the blockchain system to delete the first block data in the blockchain ledger, the first node 101 first verifies that it can successfully obtain the transferred first block data (that is, verifies that it can successfully obtain the first block data according to the corresponding relationship stored in the block data packet in the first corresponding relationship), so as to ensure that the first block data has been successfully transferred, thus avoiding data loss caused by problems occurring during the transfer process but the data in the blockchain ledger being deleted. Specifically, the first node 101 requests the block data packet from the corresponding second node 102 according to the corresponding relationship stored in the block data packet of the first block data, receives the block data packet returned by the corresponding second node 102, and combines the received block data packets into the second block data. When the second block data is the same as (i.e., identical to) the first block data, the first node 101 determines that it has successfully obtained the first block data. It should be understood that if the data size obtained by concatenating the block data packets in sequence is greater than the length S1 of the first block data, the first node 101 also intercepts the concatenated data according to S1 to obtain the second block data. The step of intercepting can be included in the combination of block data packets mentioned in this application, which will not be elaborated further below.
[0153] As an optional method, before the first node 101 deletes the first block data in the blockchain ledger stored by itself and / or triggers the blockchain system to delete the first block data in the blockchain ledger, the first node 101 triggers the blockchain system to conduct a consensus on whether it can successfully obtain the transferred first block data. Specifically, the first node 101 broadcasts a second consensus request, which indicates verifying whether it can successfully obtain the transferred first block data, that is, requests to verify whether it can successfully obtain the first block data according to the first corresponding relationship (specifically, the corresponding relationship stored in the block data packet therein). Thus, after the nodes participating in this consensus in the blockchain system receive the second consensus request, they obtain the transferred first block data according to the corresponding relationship stored in the block data packet and broadcast a verification success message when the acquisition is successful.
[0154] Specifically, the nodes participating in this consensus are specifically some or all of the nodes that have the function of obtaining the transferred block data. Taking the third node 103 as an example of a node participating in this consensus for illustration, the other nodes are similar. The third node 103 obtains the corresponding block data packet from the second node 102 according to the corresponding relationship stored in the block data packet, combines the returned block data packets into the second block data, calculates the verification data of the second block data, compares the verification data of the second block data with the verification data of the first block data. When the two are the same, the third node 103 determines that it has successfully obtained the first block data and broadcasts a verification success message. It should be understood that if the third node 103 also stores a blockchain ledger, after obtaining the second block data, the third node 103 can directly compare the second block data with the first block data in the stored blockchain ledger. When the two are the same, it is determined that the first block data has been successfully obtained and a verification success message is broadcast.
[0155] Of course, if the second node 102 has the function of obtaining the transferred block data, then it can also participate in this consensus, and the method executed is similar to that of the above-mentioned third node 103. Taking the second node 102-1 as an example for illustration. The second node 102-1 obtains other block data packets of the first block data from other second nodes (i.e., the second nodes 102-2, 102-3) according to the corresponding relationship of the block data packet storage in the first corresponding relationship; combines the first block data packet stored by itself and the other block data packets of the first block data into the second block data; calculates the verification data of the second block data, compares the verification data of the second block data with the verification data of the first block data. When the two are the same, the second node 102-1 determines that it has successfully obtained the first block data and broadcasts a verification success message.
[0156] It should be understood that if the nodes participating in this consensus have already stored the first corresponding relationship and the verification data of the first block data, each node can use the first corresponding relationship and the verification data of the first block data stored by itself to perform the above verification. As another optional method, the second consensus request carries the first corresponding relationship and the verification data of the first block data, so that each node can use the first corresponding relationship and the verification data of the first block data carried in the received second consensus request to perform the above verification. In this case, S206 and S208 can be executed in this step, that is, the first corresponding relationship, the verification data of the first block data (the first verification data), and the verification data of the data packet of the first block data (the second verification data) can all be carried in the second consensus request and broadcast to the blockchain system. This application does not make any limitations on this.
[0157] Nodes with consensus service functions (such as sorting nodes) count the received verification success messages (regarding the second consensus request) to determine whether the conditions for consensus success are met. If the conditions for consensus success are met, the sorting node broadcasts a consensus success message for the second consensus request. Next, there are also at least two ways:
[0158] Way 1: The consensus success message for the second consensus request indicates the deletion of the first block data in the blockchain. After each accounting node in the blockchain system receives the consensus success message for the second consensus request, it deletes the first block data in its own stored blockchain ledger. This deletion operation is specifically controlled by a smart contract. For example, this consensus success message triggers the status judgment of the smart contract, and based on this consensus success message, it is determined that the current status meets the conditions for deleting the block data in the blockchain ledger, thereby deleting the first block data therein. In this case, the deletion operation can also be considered to be triggered by the second consensus request. Therefore, the above-mentioned second consensus request can also be used to trigger the deletion of the first block data in the blockchain ledger. Optionally, each accounting node also stores the first verification data and / or the second verification data in the blockchain ledger. It should be understood that this storage operation is also controlled by the smart contract and will not be elaborated further.
[0159] Way 2: The first node 101 receives the consensus success message for the second consensus request, thereby determining that the consensus for successfully obtaining the transferred first block data is successful. Further, the first node 101 triggers the blockchain system to delete the first block data in the blockchain ledger (for specific content, see the above, for example, the first node 101 broadcasts a deletion request), so that each accounting node in the blockchain system deletes the first block data in its own stored blockchain ledger. Optionally, the first node 101 also triggers the blockchain system to store the first verification data and / or the second verification data in the blockchain ledger.
[0160] It should be understood that the second consensus request and the deletion request are exemplary message names. For example, the second consensus request can also be called an indication message for verifying transferred data, and the deletion request can be called a deletion indication message, etc. The present application does not limit this.
[0161] In the embodiments of the present application, the block data in the blockchain ledger is split into block data packets and transferred to multiple nodes, and the multiple nodes store the block data packets, thereby reducing the storage pressure on the blockchain ledger. In addition, the embodiments of the present application also utilize recovery data packets, so that it is possible to tolerate the unavailability of block data packets transferred to some nodes (such as being damaged, lost, or tampered with). When the block data packets are unavailable, the recovery data packets can be used to recover the unavailable block data packets, thereby improving the reliability and security of the block data transfer. For example, in a blockchain system, 10 accounting nodes all store a complete blockchain ledger. The infrequently used block data H100 (one copy of H100 occupies 3 megabytes (MB) of memory) is split into 3 block data packets and transferred to 3 nodes for storage. Thus, the 30MB of memory occupied by H100 in the 10 accounting nodes is released, and the entire system reduces the occupied storage space by approximately 27MB. The memory occupation of the recovery data packets depends on the method of generating the recovery data packets. For details, refer to the description of S203. Taking the data volume of the recovery data packets accounting for 1 / 3 of the block data as an example, the transferred block data packets and the recovery data packets together occupy 4MB of memory, and the entire system reduces the occupied storage space by approximately 26MB. Of course, for the accounting nodes themselves, the 3MB of memory occupied by H100 is released, and the storage space occupation is also reduced.
[0162] In the present application, as an embodiment, some block data (first block data) in the blockchain ledger can be transferred to multiple nodes (second nodes 102) inside the blockchain system, and some other block data (third block data) in the blockchain ledger can be transferred to an external storage device 104 of the blockchain system. For the processing of the first block data, refer to steps S201 - S209 specifically; and for the processing of the third block data, the specific steps are as follows:
[0163] S210. The first node 101 determines the third block data to be transferred in the blockchain ledger.
[0164] For the blockchain system, the storage device 104 is an external device of the blockchain system. Therefore, the security of the storage device 104 is lower than that of the nodes inside the blockchain system. Thus, the security requirements for the third block data transferred to the storage device 104 are lower than those for the first block data transferred to the nodes inside the blockchain system.
[0165] Specifically, in S201, the first node 101 periodically or event-triggeringly detects whether there is block data that meets the preset transfer conditions. Then, in the embodiment of the present application, the first node 101 still performs such detection, and the first block data meets the first preset transfer condition, so that the first block data is transferred to a node inside the blockchain system (i.e., the second node 102); the third block data meets the second preset transfer condition, so that the third block data is transferred to the storage device 104. The security requirements in the first preset transfer condition and the second preset transfer condition are different. For example, the first preset transfer condition: the security requirement of the block data is between the first preset security requirement and the second preset security requirement; the second preset transfer condition: the security requirement of the block data is lower than the second preset security requirement. Among them, the second preset security requirement is lower than the first preset security requirement. However, other conditions in the first preset transfer condition and the second preset transfer condition can be the same or different. The same situation will not be elaborated here, and the different situation will be briefly introduced here. For example, the first preset transfer condition: the block height value is between the first preset height value and the second preset height value, the block access frequency is between the first preset frequency value and the second preset frequency value, etc.; the second preset transfer condition: the block height value is lower than the second preset height value, the block access frequency is lower than the second preset frequency value, etc. Among them, the second preset height value is lower than the first preset height value, and the second preset frequency value is lower than the first preset frequency value.
[0166] In addition, the first node 101 can also determine the third block data to be transferred according to the message sent by the client. For example, when the user determines by himself / herself to transfer the third block data to the storage device 104, a message is sent to the blockchain system through the client.
[0167] The third block data can be the data of one or more blocks, or part of the data in the block. Similar to the first block data, for details, see S201, which will not be elaborated here.
[0168] S211. The first node 101 sends the third block data to the storage device 104.
[0169] After receiving the third block data, the storage device 104 stores the third block data. As an optional method, the storage device 104 can back up the third block data by itself, so as to store it in multiple storage nodes of the storage device 104 to improve data reliability.
[0170] S212. The first node 101 records the second corresponding relationship between the third block data and the storage device 104.
[0171] The second corresponding relationship describes the corresponding relationship between the third block data and the storage device 104 that stores the third block data. Specifically, the second corresponding relationship is the corresponding relationship between the identifier of the third block data and the identifier of the storage device 104. The identifier of the storage device 104 may specifically be the IP address of the storage device 104.
[0172] The first node 101 may also generate verification data (such as the hash value of the third block data) for the third block data.
[0173] S213. The first node 101 broadcasts the second corresponding relationship.
[0174] The first node 101 broadcasts the second corresponding relationship in the blockchain system. Accordingly, each node in the blockchain system stores the first corresponding relationship. As an optional method, the nodes (such as the third node 103) in the blockchain system that have the function of obtaining the transferred block data store the second corresponding relationship, so that the first block data can be obtained according to the second corresponding relationship later. Specifically, the third node 103 stores the second corresponding relationship in other storage spaces except for the space used to store the blockchain ledger.
[0175] The first node 101 may also broadcast the verification data of the third block data in the blockchain system. Accordingly, each node in the blockchain system stores the verification data of the third block data. As an optional method, the nodes in the blockchain system that have the function of obtaining the transferred block data store the verification data of the third block data, so that the accuracy of the third block data obtained from the storage device 104 can be verified according to the verification data later.
[0176] S214. The blockchain system deletes the third block data in the blockchain ledger.
[0177] The first node 101 deletes the third block data in the blockchain ledger stored by itself.
[0178] Furthermore, the first node 101 also triggers the blockchain system to delete the third block data in the blockchain ledger. Specifically, the first node 101 deletes the third block data in the blockchain ledger through the consensus mechanism. Optionally, the first node 101 may also store the verification data of the third block data in the blockchain ledger through the consensus mechanism. For the specific method, see S209. The method is similar and will not be elaborated here.
[0179] In the embodiments of the present application, the first block data with high security requirements is transferred to the nodes inside the blockchain system, and the third block data with low security requirements is transferred to the storage device 104 outside the blockchain system, which ensures the security of the block data with high transfer security requirements and further alleviates the storage pressure of the blockchain system and improves the operation efficiency of the blockchain system.
[0180] To make the solutions of the embodiments shown in Figure 2 this application clearer, as Figure 3 shown, an example is used to specifically introduce Figure 2 the solutions of the embodiments shown. The method includes the following steps:
[0181] S301. The first node 101 determines the block data D to be transferred in the blockchain ledger.
[0182] The first node 101 periodically detects whether there is block data in the stored blockchain ledger that meets the preset transfer condition. The preset transfer condition is that the block access frequency is lower than 10 times / 1 week. There is a continuous block access frequency of 0 times / 1 week for blocks H001 to H010. Therefore, the first node 101 uses the data of these blocks H001 - H010 as the block data D to be transferred (i.e., the first block data in S201). The block data D is marked as H001 - 010, that is, the identifier of the block data D is H001 - 010.
[0183] It should be understood that S301 is an exemplary description of S201, and the description contents in S301 and S201 can be referred to each other.
[0184] S302. The first node 101 determines whether the size S1 of the block data D can be divided evenly by the number M of split data packets.
[0185] Among them, the size S1 of the block data D is 100B (bytes). The preset number M of split data packets is 3. In this case, S1 cannot be divided evenly by M. Therefore, the block data D is padded to form a block data packet D' so that the size S2 of the block data packet D' can be divided evenly by M. For example, 2B of "1" is padded after the block data D, and then the size S2 of the block data packet D' is 102B.
[0186] S303. The first node 101 splits the block data packet D' into M block data packets.
[0187] Still taking M = 3 as an example, the first node 101 splits the block data packet D' into three block data packets E1 (with a size of 34B), E2 (with a size of 34B), and E3 (with a size of 34B) of the same size.
[0188] It should be understood that if S1 is divisible by M, no padding is required, so the first node 101 splits the block data packet D into M block data packets.
[0189] S304 . The first node 101 calculates L recovery data packets according to the M block data packets.
[0190] There are many ways to generate recovery data packets. Here are two examples:
[0191] 1) When L = 1 (in this case, at most one block data packet is allowed to be unavailable), the recovery data packet P1 is calculated using the following formula:
[0192] P1=E1 XOR E2XOR E3.
[0193] Here, XOR represents an exclusive OR operation.
[0194] 2) When L = 2 (in this case, a maximum of 2 block data packets are allowed to be unavailable), the recovery data packets P1 and P2 are calculated using the following formula:
[0195] P1=E1+E2+E3;
[0196] P2=E1+2*E2+3*E3.
[0197] Among them, "+" represents the sum operation, and "*" represents the multiplication operation.
[0198] The following steps in the embodiment of the present application are described by taking the case where L=2 as an example. Other cases are similar.
[0199] It should be understood that S302-S304 are exemplary descriptions of S203, and the descriptions of S302-S304 and S203 can refer to each other.
[0200] S305 . The first node 101 generates verification data of the block data D, verification data of the block data packet, and verification data of the recovery data packet.
[0201] The first node 101 calculates the hash value H0(bfe7h) of the block data D, where H0 is the verification data of the block data D; the first node 101 calculates the hash value H E1 (afe3k), hash value H of block data packet E2 E2 (3e4gh), hash value H of block data packet E3 E3 (bfe7h), then H E1 、H E2 、H E3They are the verification data of block data packets E1, E2, and E3 respectively; the first node 101 calculates the hash values H P1 (da3sd) of the recovery data packet P1 and the hash value H P2 (xcz5y) of the recovery data packet P2. Then H P1 and H P2 are the verification data of the recovery data packet P1 and the recovery data packet P2 respectively.
[0202] It should be understood that S305 is an exemplary description of S207, and the description contents of S305 and S207 can be referred to each other.
[0203] S306. The first node 101 sends the block data packets and the recovery data packets to multiple second nodes 102 and records the first correspondence between the data packets and the second nodes 102.
[0204] The first node 101 randomly selects 5 nodes (i.e., second nodes 102-1, 102-2, 102-3, 102-4, 102-5) in the blockchain system that have the function of storing and transferring data packets to send the block data packets and the recovery data packets to these 5 nodes.
[0205] The first node 101 records the first correspondence between the data packets of the block data D and the sending nodes: {H001-010, [E1, 10.186.53.224(102-1)], [E2, 10.186.53.180(102-2)], [E3, 15.10.186.131(102-3)], [P1, 14.10.186.53(102-4)], [P2, 10.186.53.19(102-5)]}.
[0206] The first node 101 sends the block data packets E1, E2, E3 and the recovery data packets P1, P2 to the corresponding nodes according to the IP addresses of these 5 second nodes. For example, the first node 101 sends the block data packet E1 to the second node 102-1 with the IP address of 10.186.53.224, and sends the block data packet E2 to the second node 102-2 with the IP address of 10.186.53.180, and so on.
[0207] After each of these 5 second nodes receives the data packet, it stores the received data packet. For example, it stores the received data packet in the storage space for storing and transferring data packets. After the storage is successful, each second node returns a data reception success message.
[0208] It should be understood that there is no limitation on the execution order of S305 and S306. And S306 is an exemplary description of S204 and S205, and the description contents of S306 and S204, S205 can be referred to each other.
[0209] S307. The first node 101 broadcasts the size S1 (100B) of the block data D, the verification data H0 (bfe7h) of the block data D, the verification data H of the block data packet E1 (afe3k), H E2 (3e4gh), H E3 (bfe7h), the verification data H of the recovery data packet P1 (da3sd), H P2 (xcz5y), and the first corresponding relationship.
[0210] Correspondingly, each node in the blockchain system stores the above information received, such as S1, H0, H E1 、H E2 、H E3 ,H P1 、H P2 ,and the first corresponding relationship. As an optional way, the node with the function of storing transferred block data (such as the second node 102), and / or the node with the function of obtaining transferred block data (such as the third node 103) stores the above information.
[0211] It should be understood that S307 is an exemplary description of S206 and S208, and the description contents of S307 and S206, S208 can be referred to each other.
[0212] S308. The first node 101 deletes the block data D in the blockchain ledger.
[0213] The first node 101 triggers the deletion of the block data D in the blockchain ledger through the consensus mechanism. Specifically, the first node 101 broadcasts a consensus request, which carries block identifiers H001, H002,... H010, and the consensus request also carries the indication information for deleting the block data. The nodes participating in this consensus in the blockchain system broadcast a verification success notification message after verifying that the consensus request is legal. The node with the consensus service function (such as the sorting node) counts the received verification success notification messages, so as to judge whether the condition for successful consensus is reached. If the condition for successful consensus is reached, the sorting node broadcasts a consensus success message. Furthermore, after the nodes (including the first node 101) storing the blockchain ledger in the blockchain system receive the consensus success message, they delete the block data D stored by themselves.
[0214] As an alternative, the first node 101 also uses a consensus mechanism to store the verification data H0 of the block data D, the verification data H E1 、H E2 、H E3 of the block data packet, and the verification data H P1 、H P2 of the restored data packet into the blockchain ledger. Thus, all the nodes storing the blockchain ledger in the blockchain system add these verification data to the blockchain ledger.
[0215] It should be understood that S308 is an exemplary description of S209, and the description contents of S308 and S209 can be referred to each other.
[0216] Figure 4 FIG. is a schematic flowchart of the blockchain data processing method provided by the present application. This method can be applied in the Figure 1B system shown in FIG. In this method flow, the transferred block data can be obtained, and the specific steps are as follows.
[0217] S401. The third node 103 determines the first block data to be obtained.
[0218] The third node 103 is a node with the function of obtaining the transferred block data. As an alternative, the third node 103 receives a data request sent by the client, and the data request carries a transaction ID. Thus, after receiving the data request, the third node 103 determines whether the transaction data identified by the transaction ID has been transferred. Exemplarily, the third node 103 first determines the block to which the transaction data identified by the transaction ID belongs. If the blockchain ledger contains the data of this block, the third node 103 can directly read the required transaction data from the blockchain ledger. If the blockchain ledger does not contain the data of this block, or the identifier of the transferred block contains the identifier of this block, the third node 103 determines that the data of this block has been transferred.
[0219] From Figure 2As can be seen from the illustrated embodiments, the block data transferred at one time can be the data of one or more blocks, or can be part of the data in a block. And the transaction data identified by the transaction ID can belong to one block or to multiple consecutive blocks. Therefore, the transaction data may be part or all of the block data transferred at one time. Even if the transaction data is only part of the data, since the block data transferred at one time is split into multiple block data packets, the block data transferred at one time should be obtained first before reading this part of the data. In addition, the transaction data may also be part or all of the block data transferred multiple times, but the method of obtaining the block data transferred multiple times is similar. Therefore, the embodiments of the present application take obtaining the block data transferred at one time as an example for description. For ease of description, in the embodiments of the present application, the block data transferred at one time is referred to as the first block data, and the first block data to be obtained is the first block data corresponding to the transaction data.
[0220] As another alternative, a node in the blockchain system that does not have the function of obtaining the transferred block data (abbreviated as the fourth node) receives a data request sent by the client, and the data request carries the transaction ID. After receiving the data request, the fourth node determines whether the transaction data identified by the transaction identifier has been transferred. If the transaction data has not been transferred, the fourth node can directly read it from the blockchain ledger. If the transaction data has been transferred, the fourth node requests to obtain the transaction data or the first block data corresponding to the transaction data from other nodes that have the function of reading the transferred block data (such as the third node 103), for example, sends a data request carrying the transaction identifier or the identifier of the first block data to the third node 103. Specifically, the fourth node stores the identifiers (such as IP addresses) of multiple nodes that have the function of reading the transferred block data. Therefore, the fourth node selects a node from these multiple nodes (in this application, the third node 103 is taken as an example for description) to send a data request to this node. Or the fourth node stores the identifier of the third node 103, and the fourth node is configured to send a data request to the third node 103 when it is necessary to obtain the transferred block data. Furthermore, the third node 103 determines the first block data to be obtained according to the data request sent by the fourth node.
[0221] S402. The third node 103 obtains the data packet of the first block data from the second node 102 according to the first corresponding relationship.
[0222] The third node 103 determines the first corresponding relationship of the first block data according to the identifier of the first block data. Among them, the first corresponding relationship describes the corresponding relationship between the data packet of the first block data and the second node 102 that stores this data packet. Specifically, reference can be made to Figure 2Description of the illustrated embodiment S205. Specifically, the third node 103 may store the correspondences of multiple transferred block data. Among them, for a certain transferred block data, its correspondence specifically refers to the correspondence between the data packet of this block data and the node storing this data packet. The third node 103 searches for the first correspondence of the first block data from the stored correspondences of multiple transferred block data according to the identifier of the first block data. Or the third node 103 may obtain the first correspondence of the first block data from other nodes (such as the first node 101).
[0223] Furthermore, the third node 103 obtains the corresponding data packets from the second node 102 according to the first correspondence of the first block data. Specifically, the third node 103 determines in which nodes the data packets of the first block data are stored according to the first correspondence of the first block data, and then obtains the corresponding data packets from these nodes respectively. For example, in the first correspondence, the data packet H100A of H100 is stored in the second node 102-1, the data packet H100B is stored in the second node 102-2, and the data packet H100C is stored in the second node 102-3; thus, the third node 103 obtains the data packet H100A from the second node 102-1, the third node 103 obtains the data packet H100B from the second node 102-2, and the third node 103 obtains the data packet H100C from the second node 102-3.
[0224] Furthermore, the third node 103 determines whether all the block data packets of the first block data have been received. If all have been received, then continue to execute S403 or S404. If there is at least 1 block data packet not received, the third node 103 may wait for a preset time to receive this at least 1 block data packet, or the third node 103 may also obtain this at least 1 block data packet from the corresponding second node again. If the preset time is exceeded or the number of acquisition times exceeds the preset number, but still this at least 1 block data packet has not been received, then the third node 103 determines that this at least 1 block data packet is lost. That is, in this case, there is at least 1 block data packet in the block data packets of the first block data that is unavailable (specifically, data loss). Then the third node 103 restores this at least 1 unavailable block data packet according to the recovery data packet of the first block data and other available block data packets, so as to obtain the corresponding at least 1 recovered block data packet.
[0225] It should be understood that the third node 103 can obtain the block data packet and the recovery data packet of the first block data according to the first corresponding relationship, so that when there is an unavailable block data packet, the obtained recovery data packet can be directly used to recover the unavailable block data packet. Alternatively, the third node 103 can first obtain the block data packet of the first block data according to the corresponding relationship of the block data packet storage in the first corresponding relationship, and when there is an unavailable block data packet, then obtain the recovery data packet of the first block data according to the corresponding relationship of the recovery data packet storage in the first corresponding relationship. When there is no unavailable block data packet (that is, all block data packets are available), the third node 103 may not obtain the recovery data packet. The embodiments of the present application do not limit this.
[0226] S403. The third node 103 performs integrity verification on the obtained packet of the first block data according to the verification data (second verification data) of the packet of the first block data.
[0227] The third node 103 stores the verification data (second verification data) of the packet of the first block data.
[0228] For any packet of the first block data obtained, the third node 103 calculates the verification data (such as a hash value) of the obtained packet, compares the calculated verification data with the verification data of the stored packet, if the two are the same, the integrity verification is successful, if the two are different, the integrity verification fails.
[0229] If the integrity verification of all the block data packets of the first block data is successful, then S404 is continued to be executed. If there is at least one block data packet with an integrity verification failure, then the at least one block data packet is unavailable (specifically, the data is tampered with or damaged, etc.). Then the third node 103 recovers the at least one unavailable block data packet according to the recovery data packet of the first block data and the available block data packets, so as to obtain the corresponding at least one recovered block data packet.
[0230] It should be understood that the unavailable block data packets include the lost block data packets in S402 and / or the block data packets with integrity verification failures. As an optional method, the third node 103 may not recover the lost block data packets first in S402, but recover the unavailable block data packets (including the lost block data packets and the block data packets with integrity verification failures) after the integrity verification in S403.
[0231] In addition, when there are many unavailable block data packets in the first block data and these unavailable block data packets cannot be recovered even by using the recovery data packets, the third node 103 fails to obtain the first block data. For example, if there is 1 recovery data packet in the first block data (such as performing an exclusive OR operation on at least 2 block data packets to obtain 1 recovery data packet in S203), the maximum number of unavailable block data packets that can be recovered is 1. When the number of unavailable block data packets in the first block data exceeds 1, the acquisition of the first block data fails; for example, if there are 2 recovery data packets in the first block data (such as performing a sum operation on at least 2 block data packets to obtain the first recovery data packet, and performing a sum operation on at least 2 block data packets after multiplying them by corresponding coefficients respectively to obtain the second recovery data packet), the maximum number of unavailable block data packets that can be recovered is 2. When the number of unavailable block data packets in the first block data exceeds 2, the acquisition of the first block data fails.
[0232] S404. The third node 103 combines the block data packets of the first block data to obtain the first block data.
[0233] Specifically, the third node 103 concatenates the block data packets of the first block data in sequence. The third node 103 also stores the size S1 of the first block data, and the size S1 of the first block data is mainly used to determine whether the concatenated data contains padded data. If the size of the concatenated data is greater than the size S1 of the first block data, the concatenated data contains padded data, and the third node 103 also intercepts the concatenated data according to S1 to obtain the first block data. If the size of the concatenated data is equal to the size S1 of the first block data, the concatenated data does not contain padded data and is the first block data.
[0234] Among them, the block data packets of the first block data are the block data packets obtained from the second node 102 in S402. Or the block data packets of the first block data include the recovered block data packets in S403 or S404 and the available block data packets.
[0235] It should be understood that the concatenation order of the block data packets can be determined based on the identifiers of the block data packets or based on the first correspondence relationship. For specific details, reference can be made to the description of S205 in the Figure 2 illustrated embodiment, which will not be elaborated here.
[0236] The third node 103 also stores the verification data (first verification data) of the first block data. Further, the third node 103 performs an integrity verification on the first block data according to the stored first verification data, and determines whether the first block data is successfully obtained according to the result of the integrity verification. Specifically, the third node 103 calculates the verification data (such as a hash value) of the first block data, compares the calculated verification data of the first block data with the stored first verification data. If the two are the same, the integrity verification is successful, and the third node 103 successfully obtains the first block data; if the two are different, the integrity verification fails, and the third node 103 fails to obtain the first block data.
[0237] It should be understood that since the third node 103 can also perform an integrity verification on the first block data, S403 is optional. For example, if the third node 103 successfully verifies the integrity of the first block data in S404, then S403 is not executed. If the third node 103 fails to verify the integrity of the first block data in S404, then S403 is executed to determine the unavailable block data packet.
[0238] Further, if the third node 103 successfully obtains the first block data, the third node 103 returns the first block data to the fourth node. Or the third node 103 reads the requested transaction data from the first block data and returns the transaction data to the client or the fourth node. If the third node 103 fails to obtain the first block data, it returns a failure notification message to the client or the fourth node to notify the client or the fourth node that the data acquisition fails.
[0239] In the embodiment of the present application, the transferred block data can still be obtained, ensuring the availability of the transferred data. Moreover, the recovery data packet can also be used to recover the unavailable block data packet, so that it is possible to tolerate the unavailability of the block data packet transferred to some nodes, improving the success rate of obtaining the transferred data, and thus improving the reliability of the transferred data.
[0240] As an embodiment, some block data in the blockchain ledger is transferred to the storage device 104 outside the blockchain system. Correspondingly, the nodes in the blockchain system can also obtain the transferred block data from the storage device 104. Specifically, the steps are as follows:
[0241] S405. The third node 103 determines the third block data to be obtained.
[0242] The third node 103 receives a data request for a certain block data from the client or other nodes in the blockchain system, and then determines whether the requested block data has been transferred and / or where it has been transferred.
[0243] Specifically, in S401, the third node 103 determines that the requested block data has been transferred. In S402, the third node 103 determines, according to the stored first correspondence, that the requested block data has been transferred to the second node 102, and the third node 103 executes S402-404. For details, refer to the above description and will not be elaborated here. As another alternative, the third node 103 determines, according to the identifier of the third block data and the stored second correspondence, that the requested block data has been transferred to the storage device 104. For ease of description, in the embodiments of the present application, the block data that has been transferred to the storage device 104 is referred to as the third block data. Among them, the second correspondence describes the correspondence between the third block data and the storage device 104 that stores the third block data. For details, refer to the description of S212 and will not be elaborated here.
[0244] S406. The third node 103 obtains the third block data from the storage device 104.
[0245] Specifically, the third node 103 obtains the third block data from the storage device 104 according to the second correspondence. For example, the second correspondence is the correspondence between the identifier of the third block data and the identifier of the storage device 104 (such as the IP address of the storage device 104). The third node 103 determines the identifier of the corresponding storage device 104 according to the identifier of the third block data and the second correspondence, and then sends a data request message carrying the identifier of the third block data to the storage device 104 according to the identifier of the storage device 104. Correspondingly, the storage device 104 returns the third block data to the third node 103.
[0246] Further, after receiving the third block data, the third node 103 can also perform integrity verification on the third block data according to the stored verification data of the third block data. If the verification is successful, the third node 103 successfully obtains the third block data, and then the third node 103 also returns the third block data to the client or other nodes in the blockchain system. If the verification fails, the third node 103 fails to obtain the third block data, and then the third node 103 also returns a failure notification message to the client or other nodes in the blockchain system.
[0247] In the embodiments of the present application, whether the block data is transferred to multiple nodes (the second node 102) inside the blockchain system or to the storage device 104, the block data can be obtained by the nodes in the blockchain system, thus ensuring the availability of the transferred data.
[0248] To make the solution of the embodiments in the present application Figure 4 shown more clearly, as Figure 5 shown, an example is used to specifically introduce Figure 4The solution of the illustrated embodiment. The method includes the following steps:
[0249] S501. The fourth node in the blockchain system receives a data request carrying a transaction ID sent by the client.
[0250] Specifically, the client sends a data request carrying a transaction ID (bbac5ca) to the fourth node. After receiving the data request, the fourth node determines that the transaction data corresponding to the transaction ID is stored in block H002 (i.e., the block to which the transaction ID (bbac5ca) belongs is block H002).
[0251] S502. The fourth node determines whether block H002 has been transferred.
[0252] The fourth node searches for block H002 in the stored blockchain ledger to determine whether block H002 has been transferred. If there is data of block H002 in the blockchain ledger, then block H002 has not been transferred, and then the fourth node directly reads the data corresponding to the transaction ID from block H002. Next, step S510 can be directly executed.
[0253] If there is no data of block H002 in the blockchain ledger, then block H002 has been transferred. This fourth node does not have the function of obtaining the transferred block data, and the fourth node stores the identifiers of the nodes with the function of obtaining the transferred block data. Thus, the fourth node selects one node from these stored nodes to send a data request to that node. Specifically, the fourth node can select the node according to the performance information of each node. In this application, taking the selection of the third node 103 as an example for illustration, the fourth node forwards the data request to the third node 103 according to the identifier of the stored third node 103.
[0254] S503. The third node 103 obtains block data packets E1 to E according to the corresponding relationship of the block data packets stored in the first corresponding relationship of the block data D to which block H002 belongs M .
[0255] After receiving the data request, the third node 103 determines that the transferred block data where block H002 is located is the block data D identified by H001-010 (i.e., the first block data in S401). Further, the third node 103 obtains the corresponding block data packets from each second node 102 according to the corresponding relationship stored in the block data packets in the first corresponding relationship of the block data D. The first corresponding relationship describes the corresponding relationship between the data packets of the block data D and the nodes storing the data packets. For example, the first corresponding relationship is: {H001-010, [E1, 10.186.53.224(102-1)], [E2, 10.186.53.180(102-2)], [E3, 15.10.186.131(102-3)], [P1, 14.10.186.53(102-4)], [P2, 10.186.53.19(102-5)]}. Then the third node 103 obtains the block data packet E1 from the second node 102-1 with the IP address 10.186.53.224, obtains the block data packet E2 from the second node 102-2 with the IP address 10.186.53.180, and obtains the block data packet E3 from the second node 102-3 with the IP address 15.10.186.131. Correspondingly, the second nodes 102-1, 102-2, 102-3 send the corresponding block data packets E1, E2, E3 to the third node 103 respectively.
[0256] It should be understood that S501-S503 are exemplary descriptions of S401-S402, and the descriptions in S501-S503 and S401-S402 can be referred to each other.
[0257] S504. The third node 103 verifies the corresponding block data packets according to the verification data of the block data packets.
[0258] After receiving the block data packets E1, E2, E3, the third node 103 calculates the hash value of each block data packet, and then stores the H E1 、H E2 、H E3Compare them with the calculated hash values of the corresponding block data packets respectively to determine whether the verification of each block data packet is successful. For any block data packet, if the stored verification data is the same as the calculated hash value, the verification of this block data packet is successful, and then step S507 can be executed. If the stored verification data is different from the calculated hash value, the verification of this block data packet fails. The block data packet with verification failure can also be called an unavailable block data packet. The third node 103 further determines whether the number of unavailable block data packets is less than or equal to L. If the number of unavailable block data packets is greater than L, the unavailable block data packets cannot be recovered, that is, the acquisition of the block data D fails. If the number of unavailable block data packets is less than or equal to L, the unavailable block data packets can be recovered, and then the third node 103 acquires recovery data packets to recover the unavailable block data packets.
[0259] It should be understood that S504 is an exemplary description of S403, and the description contents in S504 and S403 can be referred to each other.
[0260] S505. The third node 103 acquires the recovery data packets P1 to P according to the corresponding relationship stored in the recovery data packets in the first corresponding relationship of the block data D L .
[0261] Still taking the first corresponding relationship in S503 as an example for illustration, the third node 103 acquires the recovery data packet P1 from the second node 102-4 with the IP address of 14.10.186.53 and acquires the recovery data packet P2 from the second node 102-5 with the IP address of 10.186.53.19 respectively. Correspondingly, the second nodes 102-4 and 102-5 send the corresponding recovery data packets P1 and P2 to the third node 103 respectively.
[0262] It should be understood that S505 is an exemplary description of S402, and the description contents in S505 and S402 can be referred to each other.
[0263] S506. The third node 103 recovers the block data packets with verification failure according to the recovery data packets.
[0264] For example, when L = 1, the hash value of the block data packet E1 calculated by the third node 103 in S504 is afe3k, the hash value of the block data packet E2 is 3e4gh, and the hash value of the block data packet E3 is jghj5; while the value of H E1 is afe3k, the value of H E2 is 3e4gh, the value of H E3The value is bfe7h. Thus, after verification, the third node 103 determines that the block data packets E1 and E2 are available, and the block data packet E3 is unavailable. Since the number of unavailable block data packets is 1, which is equal to L, the unavailable block data packet E3 can be recovered. The third node 103 recovers the block data packet E3 through the following formula:
[0265] E3 = E1 XOR E2 XOR P1.
[0266] Where XOR represents the exclusive OR operation.
[0267] For another example, when L = 2, the hash value of the block data packet E1 calculated by the third node 103 in S504 is afe3k, the hash value of the block data packet E2 is 3e4g0, and the hash value of the block data packet E3 is jghj5; and the value of H E1 is afe3k, the value of H E2 is 3e4gh, and the value of H E3 is bfe7h. Thus, after verification, the third node 103 determines that the block data packet E1 is available, and the block data packets E2 and E3 are unavailable. Since the number of unavailable block data packets is 2, which is equal to L, the unavailable block data packets E2 and E3 can be recovered. The third node 103 recovers the block data packets E2 and E3 by solving the following equations:
[0268]
[0269] It should be understood that there are multiple methods for recovering unavailable block data packets. The two methods for recovering unavailable block data packets listed here correspond to the two methods for generating recovery data packets in the embodiment shown in Figure 3 (see S304 specifically).
[0270] It should be understood that S506 is an exemplary description of S402 and S403, and the description contents in S505 and S402, S403 can be referred to each other.
[0271] S507, the third node 103 combines the block data packets E1 to E M to obtain the block data D.
[0272] Specifically, the third node 103 splices the block data packets E1 to E M to obtain the block data D' (the size S2 is 102B), and intercepts the block data D' according to the size S1 (100B) of the block data D to obtain the block data D.
[0273] It should be understood that the block data packets here are available block data packets, such as the available block data packet E1, and the block data packets E2 and E3 obtained after recovery in S506.
[0274] S508. The third node 103 verifies the block data D according to the verification data H0 of the block data D.
[0275] The third node 103 calculates the hash value of the block data D, and then compares the stored H0 with the calculated hash value of the block data D to determine whether the verification of the block data D is successful. If the two are different, the verification fails, that is, the obtained block data D is incorrect. In this case, the acquisition of the block data D fails. If the two are the same, the verification is successful, that is, the obtained block data D is correct. In this case, the acquisition of the block data D is successful.
[0276] S509. The third node 103 determines the data corresponding to the transaction ID (bbac5ca) from the block data D.
[0277] Specifically, the third node 103 determines the data corresponding to the transaction ID from the block H002 of the block data D and returns the data corresponding to the transaction ID to the fourth node.
[0278] S510. The fourth node returns the data corresponding to the transaction ID to the client.
[0279] It should be understood that S507 - 510 are exemplary descriptions of S404, and the descriptions in S507 - 510 and S404 can be referred to each other.
[0280] As Figure 6 shown, it is a schematic structural diagram of a blockchain data processing device provided by an embodiment of the present application. The first node 101, the second node 102, the third node 103, the storage device 104, etc. in the embodiments of the present application can all adopt the Figure 6 structure of the computer device shown.
[0281] The computer device includes at least one processor 601 and a memory 602, and may further include a communication bus 603, a communication interface 604, and an I / O interface 605. The processor may be a general - purpose central processing unit (CPU), a microprocessor, an application - specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the program of the present application solution.
[0282] The communication bus may include a path for transmitting information between the above - mentioned components. The communication interface uses any transceiver - like device for communicating with other devices or communication networks, such as communicating through Ethernet, radio access network (RAN), wireless local area network (Wireless Local Area Networks, WLAN), etc.
[0283] The memory may be a read-only memory (ROM) or other type of static storage device that can store static information and instructions, a random access memory (RAM) or other type of dynamic storage device that can store information and instructions, or may also be an Electrically Erasable Programmable Read-Only Memory (EEPROM), a Compact Disc Read-Only Memory (CD-ROM) or other optical disc storage, optical disc storage (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory may exist independently and be connected to the processor through a bus. The memory may also be integrated with the processor.
[0284] Among them, the memory is used to store the program code for executing the solution of this application and is controlled by the processor to execute. The processor is used to execute the program code stored in the memory. It should be understood that various information such as the above-mentioned first correspondence, second correspondence, first verification data, second verification data, and / or first data packet may also be stored in the memory, and the specific content will not be elaborated here.
[0285] In a specific implementation, the processor may include one or more CPUs, and each CPU may be a single-core processor or a multi-core processor. Here, the processor may refer to one or more devices, circuits, and / or processing cores for processing data (such as computer program instructions).
[0286] In a specific implementation, as an embodiment, the computer device may further include an input / output (I / O) interface. For example, the output device may be a liquid crystal display (LCD), a light emitting diode (LED) display device, a cathode ray tube (CRT) display device, or a projector, etc. The input device may be a mouse, a keyboard, a touch screen device, or a sensing device, etc.
[0287] The above computer device can be a general-purpose computer device or a special-purpose computer device. In a specific implementation, the computer device can be a desktop computer, a laptop computer, a network server, a personal digital assistant (PDA), a mobile phone, a tablet computer, a wireless terminal device, a communication device, an embedded device, or a device with a similar structure in Figure 6 the like. The embodiments of the present application do not limit the type of the computer device.
[0288] For the first node 101, when the processor therein executes the program code stored in the memory, the first node 101 can execute the method steps corresponding to the first node 101 in all of the above embodiments. For the specific execution process, please refer to the above embodiments, which will not be elaborated herein.
[0289] For the second node 102, when the processor therein executes the program code stored in the memory, the second node 102 can execute the method steps corresponding to the second node 102 in all of the above embodiments. For the specific execution process, please refer to the above embodiments, which will not be elaborated herein.
[0290] For the third node 103, when the processor therein executes the program code stored in the memory, the third node 103 can execute the method steps corresponding to the third node 103 in all of the above embodiments. For the specific execution process, please refer to the above embodiments, which will not be elaborated herein.
[0291] For the storage device 104, when the processor therein executes the program code stored in the memory, the storage device 104 can execute the method steps corresponding to the storage device 104 in all of the above embodiments. For the specific execution process, please refer to the above embodiments, which will not be elaborated herein.
[0292] As Figure 7 shown, it is a schematic structural diagram of a device for processing blockchain data (specifically the first node 101) provided by an embodiment of the present application, including a storage module 700, a processing module 701, and a sending module 702.
[0293] Among them, the storage module 700 is used to store the blockchain ledger. The processing module 701 is used to determine the first block data to be transferred in the stored blockchain ledger, split the first block data into at least two block data packets, and generate at least one recovery data packet according to the at least two block data packets. The recovery data packet is used to recover the block data packet. For specific content, please refer to the description of the first node 101 side in the above method embodiments, such as steps S201, S203, S301 - 304, etc.
[0294] A sending module 702, configured to send the data packets in the at least two block data packets and the at least one recovery data packet to corresponding second nodes. For specific content, reference may be made to the description on the side of the first node 101 in the foregoing method embodiments, such as steps S204, S306, etc. A processing module 701 is further configured to record the first correspondence between the data packets of the first block data and the second nodes. For specific content, reference may be made to the description on the side of the first node 101 in the foregoing method embodiments, such as steps S205, S306, etc. The sending module 702 is further configured to broadcast the first correspondence. For specific content, reference may be made to the description on the side of the first node 101 in the foregoing method embodiments, such as steps S206, S209, S307, etc.
[0295] The processing module 701 is further configured to delete the first block data in the blockchain ledger stored in the storage module 700. For specific content, reference may be made to the description on the side of the first node 101 in the foregoing method embodiments, such as steps S209, S308, etc.
[0296] In addition, the apparatus may further include a receiving module 703, etc. These modules of the apparatus are used to implement the related functions on the side of the first node 101 in the foregoing embodiments, which will not be elaborated herein. In the embodiments of the present application, the apparatus is presented in the form of functional modules. Here, the "module" may refer to an ASIC, a circuit, a processor and a memory executing one or more software or firmware programs, an integrated logic circuit, and / or other devices that can provide the above functions. In a simple embodiment, those skilled in the art can conceive that the apparatus can be implemented in the form as Figure 6 shown.
[0297] As Figure 8 shown, a schematic structural diagram of an apparatus for processing blockchain data (specifically, the second node 102) provided in an embodiment of the present application includes a receiving module 801 and a storage module 802.
[0298] Among them, the receiving module 801 is configured to receive a first data packet sent by a first node, where the first data packet is one or more data packets in the block data packets obtained by splitting the first block data, and / or a recovery data packet for recovering the block data packets, and the first block data is data to be transferred in the blockchain ledger. The storage module 802 is configured to store the received first data packet. For specific content, reference may be made to the description on the side of the second node 102 in the foregoing method embodiments, such as steps S204, S306, etc.
[0299] The receiving module 801 is further configured to receive a first corresponding relationship, where the first corresponding relationship includes: the corresponding relationship between the block data packet of the first block data and the node storing the block data packet, and the corresponding relationship between the recovery data packet of the first block data and the node storing the recovery data packet. The storage module 802 is further configured to store the first corresponding relationship. For specific content, reference may be made to the description on the side of the second node 102 in the foregoing method embodiments, such as steps S206, S307, etc.
[0300] In addition, the device may further include a sending module 803, a processing module 804, and so on. These modules of the device are used to implement the related functions on the side of the second node 102 in the foregoing embodiments, which will not be elaborated herein. In the embodiments of the present application, the device is presented in the form of functional modules. Here, the "module" may refer to an ASIC, a circuit, a processor and a memory executing one or more software or firmware programs, an integrated logic circuit, and / or other devices that can provide the above functions. In a simple embodiment, those skilled in the art can think that the device can be implemented in the form as Figure 6 shown.
[0301] As Figure 9 shown, a schematic structural diagram of a device for processing blockchain data (specifically the third node 103) provided by an embodiment of the present application includes a sending module 901, a receiving module 902, and a processing module 903.
[0302] Among them, the sending module 901 is configured to request the block data packet of the first block data from the corresponding node according to the corresponding relationship between the block data packet of the first block data and the node storing the block data packet; the receiving module 902 is configured to receive the block data packet of the first block data. For specific content, reference may be made to the description on the side of the third node 103 in the foregoing method embodiments, such as steps S401-402, S503, etc. )]]
[0303] The processing module 903 is further configured to combine the block data packets of the first block data to obtain the first block data. For specific content, reference may be made to the description on the side of the third node 103 in the foregoing method embodiments, such as steps S404, S507, etc.
[0304] In addition, the device may further include a storage module 904, and so on. These modules of the device are used to implement the related functions on the side of the third node 103 in the foregoing embodiments, which will not be elaborated herein. In the embodiments of the present application, the device is presented in the form of functional modules. Here, the "module" may refer to an ASIC, a circuit, a processor and a memory executing one or more software or firmware programs, an integrated logic circuit, and / or other devices that can provide the above functions. In a simple embodiment, those skilled in the art can think that the device can be implemented in the form as Figure 6It is implemented in the form shown.
[0305] In the description of this application, unless otherwise specified, " / " indicates that the objects associated before and after are in an "or" relationship. For example, A / B can represent A or B; "and / or" in this application is only a description of the association relationship of the associated objects, indicating that three relationships can exist. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone. Here, A and B can be singular or plural.
[0306] Those of ordinary skill in the art can realize that the modules and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described according to functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.
[0307] In several embodiments provided in this application, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. For example, the division of the modules is only a logical function division. In actual implementation, there can be other division methods. For example, multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed couplings or direct couplings or communication connections to each other can be indirect couplings or communication connections through some interfaces, devices, or modules, and can also be electrical, mechanical, or other forms of connection.
[0308] The modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, that is, they can be located in one place or distributed to multiple network modules. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of the embodiments of this application.
[0309] In addition, each functional module in various embodiments of the present application can be implemented in the form of hardware or in the form of a software functional module. If these functional modules are implemented in the form of software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a computer program product, which includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions described in the embodiments of the present application are fully or partially generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer program product is stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center in a wired manner (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or a wireless manner (such as infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or a data center that includes one or more integrated available media. The available medium can be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium (for example, a solid-state disk (SSD)).
[0310] As described above, the above are only specific embodiments of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present application can easily think of various equivalent modifications or substitutions, and these modifications or substitutions should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A method for blockchain data processing, characterized in that Including: The first node determines the first block data to be transferred in the stored blockchain ledger; The first node splits the first block data into at least two block data packets, and generates at least one recovery data packet according to the at least two block data packets, where the recovery data packet is used to recover the block data packet; The first node sends the data packets in the at least two block data packets and the at least one recovery data packet to the corresponding second node, records the first correspondence between the data packets of the first block data and the second node, and broadcasts the first correspondence; The first node deletes the first block data in the stored blockchain ledger.
2. The method according to claim 1, wherein The second node is a node in the blockchain system.
3. The method according to claim 1 or 2, characterized in that, Before the first node splits the first block data into at least two block data packets, it further includes: The first node broadcasts a first consensus request, the first consensus request instructs to perform a consistency check on the first block data, and receives a consensus success message for the first consensus request.
4. The method according to claim 1 or 2, characterized in that, Before the first node deletes the first block data, it further includes: The first node successfully obtains the transferred first block data.
5. The method according to claim 4, wherein The first node successfully obtains the transferred first block data, including: The first node obtains the corresponding block data packet from the second node storing the block data packet according to the correspondence between the block data packet of the first block data in the first correspondence and the second node storing the block data packet; The first node combines the obtained block data packets into second block data; When the second block data is the same as the first block data, the first node determines that it has successfully obtained the first block data.
6. The method according to claim 1 or 2, characterized in that, Before the first node deletes the first block data, it further includes: The first node broadcasts a second consensus request, the second consensus request instructs to check whether the transferred first block data can be successfully obtained; The first node receives a consensus success message for the second consensus request.
7. The method according to claim 1 or 2, characterized in that, The total data volume of the at least one recovery data packet is less than the total data volume of the at least two block data packets.
8. The method according to claim 1 or 2, characterized in that, It further includes: The first node determines the third block data to be transferred from the stored blockchain ledger, and the security requirement of the third block data is lower than the security requirement of the first block data; The first node sends the third block data to an external storage device of the blockchain system; The first node records the second correspondence between the third block data and the storage device, and broadcasts the second correspondence; The first node deletes the third block data in the stored blockchain ledger.
9. A method for blockchain data processing, characterized in that, Including: Receiving and storing the first data packet sent by the first node, where the first data packet is one or more data packets in the block data packets obtained by splitting the first block data, and / or the recovery data packet for recovering the block data packet, and the first block data is the data to be transferred in the blockchain ledger; Receive and store the first corresponding relationship, where the first corresponding relationship includes: the corresponding relationship between the block data packets of the first block data and the nodes storing the block data packets, and the corresponding relationship between the recovery data packets of the first block data and the nodes storing the recovery data packets.
10. The method according to claim 9, wherein The node executing the method is the second node in the blockchain system.
11. The method according to claim 10, characterized in that, The second node is the node storing the blockchain ledger, and the method further includes: The second node receives a deletion request sent by the first node, and the deletion request instructs to delete the first block data in the blockchain ledger. The second node deletes the first block data stored in the blockchain ledger.
12. According to the method described in any one of claims 9-11, wherein It further includes: Receive a consensus request, which is used to request verification of whether the transferred first block data can be successfully obtained. After successfully obtaining the transferred first block data, broadcast a verification success message.
13. The method according to any one of claims 9 to 11, characterized in that, It further includes: Receive and store the verification data of the first data packet. Periodically perform integrity verification on the first data packet according to the verification data of the first data packet.
14. The method according to claim 13, wherein When the integrity verification of the first data packet fails, it further includes: Obtain other data packets of the first block data from the nodes storing other data packets of the first block data according to the first corresponding relationship, where the other data packets of the first block data are data packets other than the first data packet among the block data packets and recovery data packets of the first block data. Restore the first data packet according to the other data packets of the first block data.
15. A device for processing blockchain data, characterized in that It includes: A storage module for storing the blockchain ledger. A processing module for determining the first block data to be transferred in the blockchain ledger stored in the storage module, splitting the first block data into at least 2 block data packets, and generating at least 1 recovery data packet according to the at least 2 block data packets, where the recovery data packet is used to restore the block data packet. A sending module for sending the data packets in the at least 2 block data packets and the at least 1 recovery data packet to the corresponding second nodes. The processing module is further used to record the first corresponding relationship between the data packets of the first block data and the second nodes. The sending module is further used to broadcast the first corresponding relationship. The processing module is further used to delete the first block data stored in the blockchain ledger in the storage module.
16. The device according to claim 15, characterized in that, The device further includes: a receiving module, and before the processing module is used to split the first block data into at least 2 block data packets, The sending module is further used to broadcast a first consensus request, which instructs to perform consistency verification on the first block data; the receiving module is used to receive a consensus success message for the first consensus request.
17. The device according to claim 16, characterized in that, Before the processing module is used to delete the first block data, the processing module is further used to successfully obtain the transferred first block data.
18. The device according to claim 17, characterized in that, The processing module is used to successfully obtain the transferred first block data, including: The sending module is configured to request a corresponding block data packet from a second node storing the block data packet according to the correspondence between the block data packet of the first block data in the first correspondence relationship and the second node storing the block data packet; The receiving module is configured to receive the block data packet returned by the second node storing the block data packet; The processing module is configured to combine the returned block data packets into second block data; when the second block data is the same as the first block data, it is determined that the first block data is successfully obtained.
19. The device according to any one of claims 16-18, characterized in that, Before the processing module is configured to delete the first block data, The sending module is further configured to broadcast a second consensus request, where the second consensus request indicates verifying whether the first block data that has been transferred can be successfully obtained; the receiving module is further configured to receive a consensus success message for the second consensus request.
20. The device according to any one of claims 15-18, characterized in that, The total data volume of the at least 1 recovery data packet is less than the total data volume of the at least 2 block data packets.
21. The device according to any one of claims 15-18, characterized in that, The processing module is further configured to determine third block data to be transferred from the blockchain ledger stored in the storage module, where the security requirement of the third block data is lower than the security requirement of the first block data; the sending module is further configured to send the third block data to a storage device outside the blockchain system; the processing module is further configured to record a second correspondence relationship between the third block data and the storage device; the sending module is further configured to broadcast the second correspondence relationship; the processing module is further configured to delete the third block data in the blockchain ledger stored in the storage module.
22. A device for processing blockchain data, characterized in that, Comprising: A receiving module, configured to receive a first data packet sent by a first node, where the first data packet is one or more data packets among the block data packets obtained by splitting the first block data, and / or a recovery data packet for recovering the block data packet, and the first block data is data to be transferred in the blockchain ledger; A storage module, configured to store the first data packet; The receiving module is further configured to receive a first correspondence relationship, where the first correspondence relationship includes: the correspondence between the block data packet of the first block data and the node storing the block data packet, and the correspondence between the recovery data packet of the first block data and the node storing the recovery data packet; The storage module is further configured to store the first correspondence relationship.
23. The device according to claim 22, characterized in that, Further comprising: The storage module is configured to store the blockchain ledger; The receiving module is further configured to receive a deletion request sent by the first node, where the deletion request indicates deleting the first block data in the blockchain ledger; The processing module is further configured to delete the first block data in the blockchain ledger stored by the storage module.
24. The device according to claim 22 or 23, characterized in that, The receiving module is further configured to receive a consensus request, which is used to request verification of whether the first block data that has been transferred can be successfully obtained; the sending module is configured to broadcast a verification success message after successfully obtaining the first block data that has been transferred.
25. The apparatus according to claim 23, wherein The receiving module is further configured to receive the check data of the first data packet; The storage module is further configured to store the check data of the first data packet; The processing module is further configured to periodically perform integrity verification on the first data packet according to the check data of the first data packet.
26. The device according to claim 25, characterized in that, When the integrity verification of the first data packet fails, The sending module is further configured to request the other data packets from the nodes storing the other data packets of the first block data according to the first corresponding relationship, where the other data packets are the block data packets and the recovery data packets of the first block data except the first data packet; The processing module is further configured to recover the first data packet according to the other data packets.
27. A system for blockchain data processing, characterized in that, It includes a first node and a second node, where the first node is the device according to any one of claims 15-21, and the second node is the device according to any one of claims 22-26.
Citation Information
Patent Citations
Data processing, block generation and synchronization method for block link networks
CN109492049A
Data transmission method and device based on block chain, and electronic device
CN110071876A