Block coding storage method and system based on erasure code and storage relationship model
Through the combination of tree structure and erasure coding, the utilization of storage resources of nodes in the blockchain system is optimized, and the synchronization pressure problem caused by imbalance in storage resources is solved, and the system's storage performance and transmission efficiency are improved.
Patent Information
- Application Number
- CN202311050716.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-21
- Publication Date
- 2025-08-22
- Estimated Expiration
- 2043-08-21
AI Technical Summary
In the scenario of unbalanced storage resource distribution, some nodes in the blockchain system are limited in storage resources, resulting in increased pressure on the synchronization of ledger data, reduced synchronization speed, and decreased system performance.
The block synchronization algorithm based on tree structure and erasure coding is adopted, nodes are organized through tree structure, and blocks are encoded using erasure coding. An improved consistent hash distribution strategy based on node storage resource weight is adopted to distribute the encoded blocks to child nodes to optimize storage resource utilization.
It improves the storage performance and search and transmission efficiency of blockchain systems, reduces the exchange of ledger data between nodes, and effectively shares the storage pressure in scenarios of unbalanced resource distribution.
Smart Images

Figure CN117194565B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the fields of blockchain technology and erasure code technology, and specifically relates to a block coding storage method and system based on an erasure code and storage relationship model. Background Art
[0002] In scenarios where storage resources are unevenly distributed, the storage capacity of each node varies significantly. Because blockchains require all nodes in the system to store a complete copy of ledger data, some nodes with limited storage resources are unable to store complete ledger data, significantly increasing the pressure on ledger data synchronization and reducing synchronization speed. This, in turn, degrades overall system performance. In scenarios where storage resources are unevenly distributed, the main research directions for optimizing blockchain ledger data synchronization are as follows:
[0003] (1) Lightweight nodes
[0004] The Bitcoin white paper proposes a storage optimization model for Simplified Payment Verification (SPV). The core concept of SPV is to construct light nodes that do not store complete data. Light nodes retain only block header information and forgo the right to retain complete block data. They only request block content from other full nodes when necessary. The integrity of content received from full nodes is verified using a Merkle tree. In scenarios where storage resources are unevenly distributed, resource-constrained nodes can act as light nodes, improving overall system storage efficiency.
[0005] (2) Synchronization model based on storage resources
[0006] Jia et al. proposed a blockchain storage model based on node storage capacity. They categorize all nodes participating in the blockchain network into two groups based on their storage resource holdings: high-storage capacity nodes and low-storage capacity nodes. Block copies are then divided into several blocks, which are stored separately on different nodes. High-storage capacity nodes are required to store both complete block data and the blocks. Low-storage capacity nodes only need to store a subset of the blocks. This storage model efficiently utilizes system storage resources based on node storage capacity. However, because all nodes are divided into only two groups, the granularity of the classification is too large, preventing more efficient use of storage resources.
[0007] (3) Network coding technology
[0008] Existing blockchain systems generally use a full-copy data redundancy storage mechanism, which lacks sufficient storage scalability. In the field of distributed storage, erasure coding technology is often used to replace traditional multi-copy redundant storage mechanisms. Compared with multi-copy storage mechanisms, erasure coding can ensure that node storage pressure is reduced while providing the same data reliability. Jia et al. proposed a method for dynamically determining node storage tasks based on a duplication ratio adjustment algorithm. However, this task allocation method ignores the impact of node storage capacity on system storage efficiency, resulting in insufficient utilization of storage resources in scenarios with unbalanced resource distribution. Mingjun Dai et al. proposed a storage framework called NC-DS (Network Coded-Distributed Storage) based on erasure coding. The encoded blocks are randomly assigned to different nodes. This random code block allocation scheme ignores the impact of unbalanced storage resource distribution on system storage efficiency. Summary of the Invention
[0009] To address the shortcomings of existing technologies, this paper proposes a block encoding storage method and system based on erasure codes and a storage relationship model. The block synchronization algorithm, based on a tree structure and erasure codes, first organizes nodes through a tree structure to improve block search and transmission efficiency. Second, it encodes blocks using erasure codes, reducing the amount of ledger data exchanged between nodes and improving the storage performance of the blockchain system. A consistent hashing distribution strategy, based on improved node storage resource weights, distributes the encoded blocks stored by the current node to its child nodes, effectively sharing the storage pressure on resource-constrained nodes in scenarios with unbalanced resource distribution.
[0010] To achieve the above object, the present invention provides the following solutions:
[0011] The block coding storage method based on the erasure code and storage relationship model includes the following steps:
[0012] Obtaining nodes of a blockchain, wherein each of the nodes stores ledger data of the blockchain;
[0013] Organizing the nodes through a tree structure to obtain blocks;
[0014] Encoding and reconstructing the block to obtain a coded block;
[0015] Based on the consistent hash distribution strategy improved by the node storage resource weight, the coding block stored in the current node is distributed to the child nodes.
[0016] Preferably, the method of organizing the nodes through a tree structure includes:
[0017] Nodes are grouped based on their storage resources. Nodes in the same group have the same level of storage resources.
[0018] After grouping is completed, all components are sorted from largest to smallest according to the size of storage resources;
[0019] After the sorting is completed, starting from the first-layer nodes, each node selects a child node from the corresponding lower-layer node according to the number of network hops between the two nodes using a greedy algorithm.
[0020] Preferably, the method of organizing the nodes through a tree structure further includes:
[0021] Step 1: Based on the storage resource size, insert the new node into the sorted node set and determine the number of layers of the node;
[0022] Step 2: If the node is a leaf node, it only needs to find the parent node that meets the constraints in the corresponding upper-level node, and the newly added node registers with the corresponding parent node;
[0023] Step 3: If there are virtual nodes in the node layer, it is necessary to determine whether the storage resources of the newly added node meet the storage resource requirements of the virtual node;
[0024] Step 4: If the storage resources of the newly added node are greater than the storage resources required by the virtual node, the virtual node is replaced, and the corresponding parent and child node information is updated, and the coding blocks are synchronized according to the corresponding child nodes;
[0025] Step 5: If there is no virtual node in the layer where the newly added node is located, or the storage capacity of the newly added node is less than the storage capacity required by the virtual node, then find a parent node that can accommodate the node in the corresponding upper layer node and register with the parent node;
[0026] Step 6: Complete the node joining operation.
[0027] Preferably, the method of organizing the nodes through a tree structure further includes:
[0028] Step 1: After the node exits, determine whether the remaining coding blocks of the parent node and the corresponding sibling node can restore the complete block;
[0029] Step 2: If the remaining coded blocks cannot be restored to form a complete block, the parent node re-encodes and reallocates the blocks;
[0030] Step 3: If the remaining coded blocks can restore a complete block, it is necessary to determine whether the exit node is a non-leaf node;
[0031] Step 4: If the node is a leaf node, only the corresponding parent node information needs to be updated;
[0032] Step 5: If the node is not a leaf node, it is necessary to replace the exit node with a virtual node and update the information of the parent node and all child nodes.
[0033] Preferably, the method for encoding the block includes: encoding the block using RS code, and the specific process is:
[0034] When node N (i) Encode a block B j When the block B j Divide into k data blocks;
[0035] Node N (i) Divide k data blocks into k fragments
[0036] Preferably, the method for reconstructing the block includes:
[0037] Block B j After being block-encoded, it is stored in a distributed manner. Node N (i) From multiple encoding nodes Download the encoded chunks y0,...,y k-1 ;
[0038] Assuming that multiple coded blocks are requested from the same node, after downloading a number of coded blocks that meet the preset requirements, the node will recover k original data blocks from the coded blocks.
[0039] Preferably, based on the consistent hash distribution strategy improved by the node storage resource weight, the method for distributing the coding block stored by the current node to the child nodes includes:
[0040] Step 1: Calculate the hash value of all child nodes and compare the obtained hash value to 2 32 Take the remainder to get the remainder of each node;
[0041] Step 2: Allocate a certain number of virtual nodes to the remainder through a positioning algorithm according to the storage resource weight of each child node;
[0042] Step 3: Take the hash value of each block and a certain coding block of the block, and then compare the hash value to 2 32 Take the remainder to get the remainder of each coding block;
[0043] Step 4: After obtaining the remainder of the coding node and the coding block, store the coding block in the physical node to which the tth (t=1) child node or virtual node that is larger than the remainder in the clockwise direction;
[0044] Step 5: Node B i After the coding block distribution operation is completed, the correspondence between the child nodes and the coding blocks is updated.
[0045] The present invention also provides a block coding storage system based on an erasure code and storage relationship model, comprising: an acquisition module, an organization module, an encoding module, and a distribution module;
[0046] The acquisition module is used to acquire nodes of the blockchain, wherein each of the nodes stores the ledger data of the blockchain;
[0047] The organizing module is used to organize the nodes through a tree structure to obtain blocks;
[0048] The encoding module is used to encode and reconstruct the block to obtain a coded block;
[0049] The distribution module is used to distribute the coding blocks stored in the current node to the child nodes based on the consistent hash distribution strategy improved by the node storage resource weight.
[0050] Compared with the prior art, the present invention has the following beneficial effects:
[0051] The present invention proposes a block synchronization algorithm based on tree structure and erasure code, which organizes nodes through the tree structure and improves the efficiency of block search and transmission.
[0052] The present invention proposes a block synchronization algorithm based on tree structure and erasure code, which encodes blocks through erasure code, reduces the amount of ledger data exchanged between nodes, and improves the storage performance of the blockchain system.
[0053] The present invention proposes a consistent hash distribution strategy based on the improvement of node storage resource weight, which effectively shares the storage pressure of storage resource-constrained nodes in the scenario of unbalanced resource distribution by distributing the coding blocks stored in the current node to the child nodes. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] In order to more clearly illustrate the technical solution of the present invention, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0055] Figure 1 Flowchart of a block coding storage method based on an erasure code and storage relationship model in an embodiment of the present invention;
[0056] Figure 2 BSTEC model diagram in an embodiment of the present invention;
[0057] Figure 3 This is a schematic diagram of coding block distribution in an embodiment of the present invention;
[0058] Figure 4 Schematic diagram of the block coding principle in an embodiment of the present invention;
[0059] Figure 5Schematic diagram showing the effect of block size on disk utilization of minimum disk space node in an embodiment of the present invention;
[0060] Figure 6 Schematic diagram showing the effect of block size on disk utilization of the node with the largest disk space in an embodiment of the present invention;
[0061] Figure 7 Schematic diagram showing the effect of block size on total disk utilization of the system in an embodiment of the present invention;
[0062] Figure 8 This is a schematic diagram showing the effect of block size on the maximum number of blocks that can be stored in the system in an embodiment of the present invention;
[0063] Figure 9 This is a diagram showing the overall framework of a block coding storage system based on an erasure code and storage relationship model in an embodiment of the present invention. DETAILED DESCRIPTION
[0064] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0065] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0066] Example 1
[0067] like Figure 1 As shown, the present invention provides a block encoding storage method based on an erasure code and storage relationship model, comprising the following steps: obtaining blockchain nodes, wherein each node stores blockchain ledger data; organizing the nodes through a tree structure to obtain blocks; encoding and reconstructing the blocks to obtain coded blocks; and distributing the coded blocks stored by the current node to child nodes based on a consistent hash distribution strategy improved by node storage resource weights. Specifically, the method includes: a block synchronization algorithm based on tree structure and erasure code (BSTEC) and a consistent hash distribution strategy improved by node storage resource weights.
[0068] In this embodiment, the BSTEC model is shown in FIG. Figure 2As shown in the figure. The basic idea of the BSTEC storage algorithm is to first improve the correlation of storage content between nodes through a tree-like node organization method, reduce the network-wide broadcast overhead caused by incomplete nodes when requesting block data, and thus improve the performance of the blockchain system. Secondly, the blocks are sharded and encoded using an erasure coding algorithm. During the node synchronization process, only the coded blocks need to be transmitted. Compared with traditional block storage optimization solutions, each node block synchronization requires the transmission of complete block data. This method can effectively reduce block transmission latency and improve the overall performance of the system during the storage process. RS code is used to encode blocks during the block encoding and reconstruction process. The coded block synchronization process adopts a consistent hash distribution strategy based on the node storage resource weight, which reduces the storage pressure on nodes with limited storage resources.
[0069] Furthermore, the storage tree is initialized as a preparatory step before each round of storage. Completing the initialization of the storage tree is a prerequisite for the blockchain system's subsequent block encoding and reconstruction, block distribution, and node recovery. This process requires the participation of all types of nodes within the blockchain system.
[0070] The core of the storage tree initialization algorithm is to group nodes based on their storage resources. Nodes within the same group possess the same order of magnitude of storage resources. Once grouped, all components are sorted from largest to smallest based on storage resource size. Once sorted, starting with the first-tier nodes (the root node is located at tier 0), each node selects child nodes from its lower-tier nodes using a greedy algorithm based on the number of network hops between them. The constraint is that the sum of the child nodes' storage resources cannot exceed the node's own storage resources. Supernodes are designated from candidate nodes (tier 1 nodes) using a consistent hashing algorithm. Table 1 shows the storage tree initialization algorithm.
[0071] Table 1
[0072]
[0073]
[0074] Furthermore, new nodes often request to join the blockchain system. The storage tree needs to use a node joining algorithm to maintain its stability. The steps are as follows:
[0075] Step 1: According to the storage resource size, insert the node into the sorted node set and determine the layer number of the node.
[0076] Step 2: If the node is a leaf node, it only needs to find a parent node that meets the constraints among its upper-level nodes. The newly added node registers with its parent node.
[0077] Step 3: If there are virtual nodes in the node layer, it is necessary to determine whether the storage resources of the newly added node meet the storage resource requirements of the virtual node.
[0078] Step 4: If the storage resources of the newly added node are greater than the storage resources required by the virtual node, the virtual node is replaced, and its parent and child node information is updated, and the coding blocks are synchronized according to its child nodes.
[0079] Step 5: If there is no virtual node in the layer where the newly added node is located, or the storage capacity of the newly added node is less than the storage capacity required by the virtual node, a parent node that can accommodate it is found in its upper layer node and registered with its parent node.
[0080] Step 6: Complete the node joining operation. The node joining algorithm is shown in Table 2.
[0081] Table 2
[0082]
[0083]
[0084] Furthermore, node exits due to problems such as downtime often occur in blockchain systems. The storage tree needs to use a node exit algorithm to maintain its stability. The steps are as follows:
[0085] Step 1: Determine whether the remaining coding blocks of the parent node and its sibling nodes can restore a complete block after the node is pushed out.
[0086] Step 2: If the remaining coded blocks cannot be restored to form a complete block, the parent node re-encodes and reallocates the block.
[0087] Step 3: If the remaining coded blocks can restore a complete block, it is necessary to determine whether the exit node is a non-leaf node.
[0088] Step 4: If the node is a leaf node, only its parent node information needs to be updated.
[0089] Step 5: If the node is not a leaf node, it is necessary to replace the exit node with a virtual node and update the information of its parent node and all child nodes. The node exit algorithm is shown in Table 3.
[0090] Table 3
[0091]
[0092]
[0093] Furthermore, the present invention uses RS code to encode the block, and the encoding principle is as follows: Figure 4 shown.
[0094] When encoding block data, use N (i) Represents a super node in the network, where i is a unique identifier that characterizes each node. j Indicates the jth block of the blockchain, the genesis block is B 0 . Using C Block To represent the block size of the blockchain. When a node wants to encode a block B j When , it first divides the block into k data blocks, and then applies linear operations to obtain r check blocks. j Generate n coding blocks, node N (i) First, divide the block into k fragments The whole process is to have a fixed fragment size C Block / k, you can fill block B with 0 before splitting the block j .
[0095] The block reconstruction process is the opposite of the encoding process. In the block recovery phase, it is necessary to read and request the encoded block from its child node or parent node for reconstruction. j After being block-encoded, it is stored in a distributed manner. Node N (i) From multiple encoding nodes Download the encoded chunks y0,...,y k-1 Assume that multiple encoded blocks can be requested from the same node. After downloading a sufficient number of encoded blocks, the node will recover k original data blocks from the encoded blocks.
[0096] Furthermore, in the storage tree, after the block encoding operation of the super node is completed, it will distribute the stored encoding blocks to its child nodes according to certain rules. After the child node completes the storage of the received encoding blocks, it will also distribute the stored encoding blocks to its own child nodes. The encoding block distribution process is as follows: Figure 3 shown.
[0097] exist Figure 3 Based on the distribution of code blocks, a placement strategy based on node resource weights is employed to find a suitable method to arrive at the final allocation solution. This allows determining the code block storage task of a node based on its storage resource size. In the parent-child node transfer method, the parent node is required to maintain the correspondence between code blocks and child nodes. This invention adopts a hash table-based information maintenance method.
[0098] Non-leaf node B i The specific steps for distributing the encoding block to its child nodes are as follows:
[0099] Step 1: Calculate the hash value of all child nodes and compare the obtained hash value to 2 32 Take the remainder to get the remainder of each node.
[0100] Step 2: According to the storage resource weight of each child node, a certain number of virtual nodes are allocated to it through the positioning algorithm.
[0101] Step 3: Take the hash value of each block and a certain coding block of the block, and then compare the hash value to 2 32 The remainder of each coding block is obtained by taking the remainder.
[0102] Step 4: After obtaining the remainder of the coding node and coding block through steps 1-3, store the coding block in the physical node to which the tth (t=1) child node or virtual node that is larger than the remainder in the clockwise direction.
[0103] Step 5: Node B i After the coding block distribution operation is completed, the correspondence between its child nodes and coding blocks is updated.
[0104] After the five steps above, each non-leaf node in the storage tree successfully distributes the coded block to its child node. If the child node is also a non-leaf node, the above algorithm is recursively performed. The coded block distribution strategy is shown in Table 4.
[0105] Table 4
[0106]
[0107]
[0108] This paper sets the Traditional algorithm, EC-LSN (Erasure Code-Based Low Storage Blockchain Node) algorithm, and SOS-RS (AB Blockchain Storage Optimization Scheme Based OnRS Erasure Code) algorithm as control groups for experimental comparison. Using the control variable method, when the blockchain system running time and the proportion of storage resource-constrained nodes are the same, the TBSA blockchain storage algorithm proposed in this paper has a significant improvement in disk space minimum / maximum node disk utilization, system total disk utilization, and the maximum number of blocks that the system can store compared with the control group algorithm under different block sizes. This improvement is able to be maintained over a wider range of experimental parameter sets.
[0109] according to Figure 5As shown, for the same system runtime and proportion of resource-constrained nodes, the disk utilization of the minimum disk space node for the Traditional algorithm initially increases and then remains constant as the block size increases. The EC-LSN and SOS-RS algorithms, which use code blocks as the basic unit of storage and refine the storage granularity, are able to maintain the upward trend in disk utilization of the minimum storage space node over a wider range of block sizes. The EC-LSN and SOS-RS algorithms maintain an upward trend in disk utilization for the first five parameter groups, but after reaching their respective bottlenecks, they no longer increase. The proposed TBSA algorithm maintains this upward trend in disk utilization of the minimum disk space node across all parameter groups selected in this experiment. At a block size of 700 transactions per block, it achieves a 23.7% improvement over the Traditional algorithm, a 19.3% improvement over the EC-LSN algorithm, and an 18.5% improvement over the SOS-RS algorithm.
[0110] according to Figure 6 As can be seen, the disk utilization of the node with the largest disk space: The Traditional algorithm's disk utilization of the node with the largest disk space first increases and then remains constant as the block size increases. The EC-LSN and SOS-RS algorithms both use code blocks as the basic unit of storage. As the block size increases, the disk utilization of the node with the largest disk space for these two algorithms continues to increase within the first four parameter groups, and then stops increasing after reaching their respective bottlenecks. The TBSA algorithm proposed in this paper is able to maintain a continuously increasing disk utilization of the node with the largest disk space within all parameter groups selected in this experiment. When the block size is 700 transactions per block, it improves by 32.1% compared to the Traditional algorithm, 27.8% compared to the EC-LSN algorithm, and 26.9% compared to the SOS-RS algorithm.
[0111] according to Figure 7 Regarding total system disk utilization, the Traditional algorithm's total disk space node utilization initially increases and then remains constant as block size increases. The EC-LSN and SOS-RS algorithms, which use code blocks as the basic unit of storage, are able to maintain this upward trend in total system disk utilization over a wider range of block sizes. EC-LSN and SOS-RS algorithms maintain an upward trend in the first five parameter groups, reaching their respective bottlenecks and then stopping. The TBSA algorithm maintains this upward trend in total system disk utilization across all parameter groups. At a block size of 700 transactions per block, it achieves a 29.8% improvement over the Traditional algorithm, a 21.3% improvement over the EC-LSN algorithm, and a 19.4% improvement over the SOS-RS algorithm.
[0112] according to Figure 8As shown, for the same system runtime and the same proportion of resource-constrained nodes, the number of blocks that the Traditional algorithm can store decreases as the block size increases. For the EC-LSN and SOS-RS algorithms, the maximum number of blocks that can be stored initially increases with increasing block size, but after reaching the storage bottleneck, the maximum number of blocks that can be stored stops increasing. The TBSA algorithm proposed in this paper more effectively organizes nodes for code block storage than the EC-LSN and SOS-RS algorithms. Within the parameter range of this experiment, the number of blocks that can be stored consistently increases. Because the Traditional algorithm uses different basic units of storage than the other three algorithms, TBSA is only compared with EC-LSN and SOS-RS in terms of the maximum number of blocks that can be stored. When the block size is 700 transactions per block, TBSA achieves a 29.8% improvement over EC-LSN and a 27.6% improvement over SOS-RS.
[0113] Example 2
[0114] like Figure 9 As shown, the present invention also provides a block coding storage system based on an erasure code and storage relationship model, including: an acquisition module, an organization module, an encoding module and a distribution module;
[0115] The acquisition module is used to obtain nodes of the blockchain, wherein each of the nodes stores the ledger data of the blockchain;
[0116] The organization module is used to organize nodes through a tree structure to obtain blocks;
[0117] The encoding module is used to encode and reconstruct the blocks to obtain the encoded blocks;
[0118] The distribution module is used to distribute the coding blocks stored in the current node to the child nodes based on the consistent hash distribution strategy improved by the node storage resource weight.
[0119] The embodiments described above are merely descriptions of preferred embodiments of the present invention and are not intended to limit the scope of the present invention. Without departing from the spirit of the present invention, various modifications and improvements made to the technical solutions of the present invention by persons skilled in the art should fall within the scope of protection defined by the claims of the present invention.
Claims
1. A block coding storage method based on an erasure code and storage relationship model, characterized in that: The following steps are involved: Obtaining nodes of a blockchain, wherein each of the nodes stores ledger data of the blockchain; Organizing the nodes through a tree structure to obtain blocks; Encoding and reconstructing the block to obtain a coded block; Distribute the coding blocks stored in the current node to the child nodes based on the improved consistent hash distribution strategy of the node storage resource weight; The method of organizing the nodes in a tree structure includes: Step 1: Based on the storage resource size, insert the new node into the sorted node set and determine the number of layers of the node; Step 2: If the node is a leaf node, it only needs to find the parent node that meets the constraints in the corresponding upper-level node, and the newly added node registers with the corresponding parent node; Step 3: If there are virtual nodes in the node layer, it is necessary to determine whether the storage resources of the newly added node meet the storage resource requirements of the virtual node; Step 4: If the storage resources of the newly added node are greater than the storage resources required by the virtual node, the virtual node is replaced, and the corresponding parent and child node information is updated, and the coding blocks are synchronized according to the corresponding child nodes; Step 5: If there is no virtual node in the layer where the newly added node is located, or the storage capacity of the newly added node is less than the storage capacity required by the virtual node, then find a parent node that can accommodate the node in the corresponding upper layer node and register with the parent node; Step 6: Complete the node joining operation.
2. The block coding storage method based on the erasure code and storage relationship model according to claim 1, characterized in that: The method of organizing the nodes in a tree structure includes: Nodes are grouped based on their storage resources. Nodes in the same group have the same level of storage resources. After grouping is completed, all components are sorted from largest to smallest according to the size of storage resources; After the sorting is completed, starting from the first-layer nodes, each node selects a child node from the corresponding lower-layer node according to the number of network hops between the two nodes using a greedy algorithm.
3. The block coding storage method based on the erasure code and storage relationship model according to claim 2, characterized in that: The method of organizing the nodes through a tree structure also includes: Step 1: After the node exits, determine whether the remaining coding blocks of the parent node and the corresponding sibling node can restore the complete block; Step 2: If the remaining coded blocks cannot be restored to form a complete block, the parent node re-encodes and reallocates the blocks; Step 3: If the remaining coded blocks can restore a complete block, it is necessary to determine whether the exit node is a non-leaf node; Step 4: If the node is a leaf node, only the corresponding parent node information needs to be updated; Step 5: If the node is not a leaf node, it is necessary to replace the exit node with a virtual node and update the information of the parent node and all child nodes.
4. The block coding storage method based on the erasure code and storage relationship model according to claim 1, characterized in that: The method for encoding the block includes: encoding the block using RS code, and the specific process is: When the node Encode a block When the block Divide data blocks; node Will Data blocks are divided into fragments .
5. The block coding storage method based on the erasure code and storage relationship model according to claim 1, characterized in that: The method for reconstructing the block includes: Block After being encoded in blocks, it is stored in a distributed manner. From multiple encoding nodes Download the code block ; Assuming that multiple coded blocks are requested from the same node, after downloading the number of coded blocks that meet the preset requirements, the node will recover from the coded blocks. A block of original data.
6. The block coding storage method based on the erasure code and storage relationship model according to claim 1, characterized in that: The method for distributing the coding block stored by the current node to the child nodes based on the improved consistent hash distribution strategy of the node storage resource weight includes: Step 1: Calculate the hash value of all child nodes and compare the obtained hash value to 2 32 Take the remainder to get the remainder of each node; Step 2: Allocate a certain number of virtual nodes to the remainder through a positioning algorithm according to the storage resource weight of each child node; Step 3: Take the hash value of each block and a certain coding block of the block, and then compare the hash value to 2 32 Take the remainder to get the remainder of each coding block; Step 4: After obtaining the remainder of the coding node and coding block, store the coding block in the first position larger than the remainder in the clockwise direction. On the physical node to which the child node or virtual node belongs; Step 5: Node After the coding block distribution operation is completed, the correspondence between the child nodes and the coding blocks is updated.
7. A block coding storage system based on an erasure code and storage relationship model, the system being used to implement the method of any one of claims 1 to 6, characterized in that: include: Acquisition module, organization module, encoding module and distribution module; The acquisition module is used to acquire nodes of the blockchain, wherein each of the nodes stores the ledger data of the blockchain; The organizing module is used to organize the nodes through a tree structure to obtain blocks; The encoding module is used to encode and reconstruct the block to obtain a coded block; The distribution module is used to distribute the coding blocks stored in the current node to the child nodes based on the consistent hash distribution strategy improved by the node storage resource weight.
Citation Information
Patent Citations
Block chain account book distributed storage technology based on erasure code
CN109359223A
Dynamic blockchain data storage based on error correction code
CN111386519A