Hierarchical storage method of blockchain
Name and field:
Name: Hierarchical storage method and device based on blockchain, electronic device.
Technical field: It relates to the field of blockchain technology, especially the hierarchical storage solution based on blockchain.
Method overview:
Core idea: Use Merkle state tree to manage the account status data of blockchain, and realize data hierarchical storage through multi-level storage structure.
Data storage form: The data nodes on the Merkle state tree are stored in the database in the form of Key-Value key-value pairs, where the Key consists of node ID and block number.
Hierarchical storage logic: When a certain level of storage meets the migration conditions, the block number interval of the data node to be migrated is determined, and the migration critical value is determined based on the interval, and the historical data node is migrated to the next level of storage.
Specific implementation steps:
Step 1: Determine the migration block number interval and critical value. When a certain level of storage in the database meets the migration conditions, determine the block number interval corresponding to the data node to be migrated in the storage at this level, and determine the migration critical value based on the interval.
Step 2: Find the target data node. Iterate through the binary tuples stored in the target storage and search for the target data node whose block number is less than the migration threshold.
Step 3: Determine and migrate the data node. Further check whether the target storage stores other data nodes with the same node ID as the target data node and whose block number is greater than the target data node and less than the migration threshold. If so, migrate the target data node to the next level of storage; otherwise, keep it in the current storage.
Technical details and optimization:
Node reuse: Introduces the reuse mechanism of nodes in the Merkle state tree and how to manage node status by marking block numbers.
Multi-level storage performance differences: Storage media of different levels have different read and write performance, and high-level storage media perform better than low-level ones.
Actual application scenarios: Applicable to various blockchain projects, especially those application scenarios that require efficient management and access to large amounts of historical data.
Device and electronic device:
Device structure: A hierarchical storage device based on blockchain is proposed, including a determination module, a search module and a migration module, which are used to implement the above-mentioned hierarchical storage method.
Electronic device application: The device can be applied to various electronic devices to implement hierarchical storage functions by executing corresponding instructions.
Effects and advantages:
Improve storage efficiency: Through the hierarchical storage mechanism, historical data is migrated to low-cost storage media, freeing up space for high-performance storage media and improving overall storage efficiency.
Reducing storage costs: Treat data at different block heights differently to reduce overall storage costs.
Optimize data access: Ensure that the latest data is always stored in high-performance storage media and optimize data access speed.
This document is about the invention specification of a hierarchical storage method and device based on blockchain, and an electronic device. The following is a summary of its core content in the form of a short answer question:
What is the name?
Answer: The name is "hierarchical storage method and device based on blockchain, and electronic device".
What problems does it mainly solve?
Answer: It mainly solves the storage efficiency, cost and access performance problems faced by blockchain technology when processing large amounts of data, and optimizes data management and access through a hierarchical storage mechanism.
What role does the Merkle state tree play in?
Answer: The Merkle state tree is used to organize the account status data of the blockchain. These data nodes are stored in the database in the form of Key-Value pairs, where the Key contains the node ID and the block number.
What are the conditions and process of data migration?
A: When a certain level of storage in the database meets the migration conditions (such as the storage capacity reaches the threshold), the block number interval of the data node to be migrated will be determined, and the migration threshold will be determined based on the interval. Then it iterate through the data nodes in the target storage, find and migrate the qualified historical data nodes to the next level of storage.
How is node reuse achieved?
A: Node reuse is achieved by marking the block number of each data node. Each newly generated block in the blockchain will update the corresponding MPT state tree, and the historical state data can be reused or migrated through the node ID and block number.
What are the main modules of the device structure?
A: The device structure mainly includes the determination module, the search module and the migration module. The determination module is responsible for determining the migration conditions and data intervals; the search module is responsible for finding the target data node; the migration module is responsible for migrating qualified data nodes to the next level of storage.
What are the application scenarios of?
A: It is suitable for various blockchain projects, especially those application scenarios that require efficient management and access to a large amount of historical data, such as finance, supply chain management, the Internet of Things and other fields.
What are the main advantages of?
Answer: The main advantages include improving storage efficiency, reducing storage costs, optimizing data access speed, and achieving refined and efficient data management through a tiered storage mechanism.