Storage control method based on block chain
By designing management modules, analysis and processing modules and management control modules in the blockchain storage control method, combining DHT and Chord protocols, the problems of data tampering and operating costs in traditional data storage methods and the storage pressure of blockchain nodes are solved, and efficient and stable data storage processing is achieved.
Patent Information
- Application Number
- CN202510232181.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-20
- Publication Date
- 2025-06-20
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The traditional data storage method has the problems of data tampering and high operating costs, and storing a complete ledger for each node in the blockchain has caused huge storage pressure.
A blockchain-based storage control method is designed, using management module, analysis and processing module and management control module, and optimizing data storage and query between nodes through DHT and Chord protocols to reduce the storage pressure of each node.
Effectively manage and control blockchain node ledgers, store query processing that meets different needs of users, solves the problem of mismatch between node performance and storage pressure, and improves the system's data storage processing efficiency and stability.
Smart Images

Figure CN120179730A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of storage technology, and specifically to a storage control method based on blockchain. Background Art
[0002] Currently, a vast amount of data generated by various network applications every day is mostly stored in relational databases and data warehouses commonly used in the industry. These data may include various behavior records of users on a certain website and users' privacy information. However, in recent years, there have been continuous news reports of hackers tampering with relevant website systems, and the security issue of data still cannot be ignored. Traditional data storage mostly relies on storage services provided by trusted third-party service institutions. This centralized storage method has certain disadvantages, such as data tampering and high operating costs. The characteristics of blockchain, such as decentralization, security and trustworthiness, and collective maintenance, have enabled blockchain technology to be applied in many fields such as healthcare, supply chain, Internet of Things, information sharing, and copyright protection law. However, each node in the blockchain stores a complete ledger, and this high-redundancy storage brings huge storage pressure to the nodes in the blockchain. Therefore, it is necessary to design a storage control method based on blockchain with efficient management and control and strong stability. Summary of the Invention
[0003] The purpose of the present invention is to provide a storage control method based on blockchain to solve the problems raised in the above background art.
[0004] To solve the above technical problems, the present invention provides the following technical solution: A storage control method based on blockchain, which adopts a storage control system based on blockchain, including: a design management module, an analysis and processing module, and a management and control module. The design management module is network-connected to the analysis and processing module, and the analysis and processing module is network-connected to the management and control module. The design management module is used for designing and managing the storage query of the blockchain. The analysis and processing module is used for analyzing, optimizing, and processing the storage of blockchain data. The management and control module is used for managing and controlling the database and users.
[0005] According to the above technical solution, the design management module includes an overall design module, a transmission and query module, and a network management module. The overall design module is network-connected to the transmission and query module, and the transmission and query module is network-connected to the network management module. The overall design module is used for overall framework design of blockchain storage. The transmission and query module is used for managing the transmission and query of data information. The network management module is used for network management and control of blockchain storage.
[0006] According to the above technical solution, the analysis and processing module includes an authentication and analysis module, an initialization module, and a read / write management module. The authentication and analysis module is network-connected to the initialization module, and the initialization module is network-connected to the read / write management module. The authentication and analysis module is used for managing the authentication and analysis of block heat, the initialization module is used for controlling and processing node initialization, and the read / write management module is used for controlling the reading and writing of blockchain storage.
[0007] According to the above technical solution, the management and control module includes a database module and a user management module. The database module is network-connected to the user management module. The database module is used for controlling database storage, and the user management module is used for managing user permission control.
[0008] According to the above technical solution, a blockchain-based storage control method includes the following steps:
[0009] Step S1: When a user stores data generated by network operation and use, data storage can be performed by designing a blockchain data storage and query system;
[0010] Step S2: After completing the overall design of the blockchain data storage and query system, control and manage the transmission and query of network and data information therein;
[0011] Step S3: Further optimize and analyze the blockchain data storage and query;
[0012] Step S4: Manage the database and user permissions of the blockchain data storage and query system.
[0013] According to the above technical solution, Step S1 further includes the following steps:
[0014] After data is generated by network operation and use, perform an overall design on the stored blockchain data storage and query system, including a view layer, an interface layer, a logic layer, a security layer, and a data layer. The view layer is the front-end user interface presented to the system users, which is an intuitive display of all functions of the blockchain data storage and query system and is responsible for displaying the functions and data of the system. The interface layer is the connection between the view layer and the lower-layer logic implementation functions, and provides an encapsulation of the logic layer capabilities to the view layer.
[0015] According to the above technical solution, Step S2 further includes the following steps:
[0016] Step S21: When a user uploads data to the blockchain data storage and query system for data storage, the data information uploaded by the user is identified by a unique identifier, and the ID of the data uploader is recorded. The binary stream obtained after serializing the data is further sliced and associated and enumerated. Specifically, the data information is sliced into ciphertext shards and encoding slices. The ciphertext shards are used to associate ciphertext data objects, recording the binary bits and index data within the shard. The encoding slices are used to associate specific data objects and user objects. At the same time, to meet the data access interface of the data access object (DAO) of the ORM framework MyBatis, the interface encapsulates the operations of adding, deleting, modifying, and querying the underlying database. This interface will read the Mapper object entity mapping file in XML format corresponding to the class name at runtime to generate the implementation class of the interface;
[0017] Step S22: For the nodes in the system blockchain that need to optimize storage, they cooperate with each other by establishing a DHT (Distributed Hash Table). Specifically: Using the Chord protocol, according to the IP address and port number of each node, after determining the position of the node in the Chord ring network using the hash algorithm, the performance P of each node is calculated. Then, by introducing virtual nodes, according to the preset number of virtual nodes, the relationship information between each entity blockchain node and the virtual nodes is obtained. When a new block is generated, each node calculates the corresponding hash value according to the block body, and then judges whether it is within its responsible range. If the block address matches its own position in the Chord, the block is stored locally. At the same time, a notification R and the new block are sent to the successor node. After receiving the notification R, the successor node stores the block locally and then sends the block and notification (R - 1) to the successor node. Repeat this step until it is zero to achieve R - copy redundancy of the block;
[0018] Step S23: The calculation formula for the performance P of each node is as follows:
[0019] P = k1Smi + k2Comi + k3Swi + k4Wi
[0020] In the formula, ki is the weight coefficient corresponding to each set data, Smi is the maximum storage capacity of the node, Comi represents the computing power data of the node, Swi is the storage size that the node can undertake, and Wi is the network bandwidth of the node.
[0021] According to the above technical solution, step S3 further includes the following steps:
[0022] Step S31: Identify different historical blocks and determine the corresponding storage processing. When each node in the current blockchain joins the Chord network, thresholds Z and Y are set to represent the hot block data threshold near the genesis block and the hot block data threshold near the latest block respectively;
[0023] Step S32: When a new node joins the blockchain, first set the size of the node's participation in the local storage of the blockchain. After initializing the synchronization status to false, set the threshold pre-interval and post-interval respectively. Then traverse the block numbers. If the current block is identified as a hot block and is the successor node of the position where the hash value of this block is located, then request the block data from the successor node of this node. If the successor node stores this block locally, directly return it to the new node. Otherwise, search for the block in the Chord ring through the local pointer table and return it to the new node. In this step, if none of the nodes store this block locally, synchronize it from IPFS. If the current block is identified as cold data, then the new node only needs to request the index of this block in the PFS system from other nodes in the network;
[0024] Step S33: When a node receives a read / write request for a block, the node first increments the access count of this block in the local pointer table. Then check if this block exists in the local storage of the node. If it exists, directly return the block data through the local storage. If it does not exist, determine whether the requested block is hot block data or cold block data. If it is cold block data, read the block data file from the PFS. Otherwise, request the data file from the node with the largest flag and less than the target block identifier in the local pointer table, and repeat this step until the target node is found in the DHT (Distributed Hash Table). If the target node determines that this data is cold block data, obtain the data file. If it is hot block data, directly return it to the requesting node.
[0025] According to the above technical solution, step S4 further includes the following steps:
[0026] Step S41: In the database of the blockchain data storage query system, use the user information table to record the basic information of users, including user ID, user nickname, user password, user mobile phone number, and user type. Among them, a unique index is established according to the user ID, and the data table records the data ID, creation time, data uploader ID, data type, data hash value, and data sharding parameters;
[0027] Step S42: Divide the users in the system into data owners, authorized viewers, and unauthorized viewers, so that users with different roles have different levels of rights to data resources, and the administrator can view the identity roles of ordinary users for specific data resources.
[0028] Compared with the prior art, the beneficial effects achieved by the present invention are as follows: In the present invention, through the provision of a design management module, an analysis and processing module, and a management control module, the node ledgers in the blockchain can be effectively managed and controlled. The storage and query of data information can be processed according to different personal needs of users, effectively meeting the needs of users, making the system processing more intelligent and comprehensive. It effectively solves the problem of introducing virtual nodes to address the mismatch between node performance and storage pressure, and reduces the storage pressure of each node itself, making the system data storage and processing more efficient and stable, and avoiding the generation of errors. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] The accompanying drawings are used to provide a further understanding of the present invention, and constitute a part of the specification. They are used together with the embodiments of the present invention to explain the present invention, and do not constitute a limitation to the present invention. In the drawings:
[0030] Figure 1 is a schematic diagram of the system module composition of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0031] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
[0032] Please refer to Figure 1 , the present invention provides a technical solution: A storage control method based on blockchain, including: a design management module, an analysis and processing module, and a management control module. The design management module is network-connected to the analysis and processing module, and the analysis and processing module is network-connected to the management control module. The design management module is used for the design management of blockchain storage and query, the analysis and processing module is used for the analysis, optimization and processing of blockchain data storage, and the management control module is used for the management and control of the database and users.
[0033] The design management module includes an overall design module, a transmission and query module, and a network management module. The overall design module is network-connected to the transmission and query module, and the transmission and query module is network-connected to the network management module. The overall design module is used for the overall framework design of blockchain storage, the transmission and query module is used for the management of data information transmission and query, and the network management module is used for the network management and control of blockchain storage.
[0034] The analysis and processing module includes an authentication and analysis module, an initialization module, and a read / write management module. The authentication and analysis module is network-connected to the initialization module, and the initialization module is network-connected to the read / write management module. The authentication and analysis module is used to manage the authentication and analysis of block heat, the initialization module is used to control the node initialization process, and the read / write management module is used to control the read and write of blockchain storage.
[0035] The management and control module includes a database module and a user management module. The database module is network-connected to the user management module. The database module is used to control the database storage, and the user management module is used to manage the user permissions.
[0036] According to the above technical solution, a storage control method based on blockchain includes the following steps:
[0037] Step S1: When a user stores data generated by network operation and use, the data can be stored through a designed blockchain data storage and query system;
[0038] Step S2: After completing the overall design of the blockchain data storage and query system, control and manage the transmission and query of network and data information therein;
[0039] Step S3: Further optimize and analyze the blockchain data storage and query;
[0040] Step S4: Manage the database and user permissions of the blockchain data storage and query system.
[0041] Step S1 further includes the following steps:
[0042] After data is generated by network operation and use, conduct an overall design of the stored blockchain data storage and query system, including a view layer, an interface layer, a logic layer, a security layer, and a data layer. The view layer is the front-end user interface presented to the system users, which is an intuitive display of all functions of the blockchain data storage and query system and is responsible for the display of the system functions and data. The interface layer is the connection between the view layer and the lower-layer logic implementation functions, providing an encapsulation of the logic layer capabilities to the view layer. In this step, the interface layer is divided into a system integration interface and a unified open API interface. The system integration interface encapsulates the business functions such as user management, data transmission and query, and data storage in this system. The logic layer splits the specific functions according to the security layer technology and the storage layer technology, constructs highly cohesive, low-coupling, and reusable logic components for the interface layer to call. The security layer mainly includes security technologies such as encryption algorithms, hash algorithms, sharing protocols, and access control. The data layer includes a relational database, a blockchain network, and an IPFS system, and provides the ability of data interaction for the upper layer.
[0043] Step S2 further includes the following steps:
[0044] Step S21: When a user uploads data to the blockchain data storage and query system for data storage, the data information uploaded by the user is identified by a unique identifier, and the ID of the data uploader is recorded. The binary stream obtained after serializing the data is further sliced and associated and enumerated. Specifically, the data information is sliced into ciphertext shards and encoding slices. The ciphertext shards are used to associate ciphertext data objects, record the binary bits and index data within the shard, and the encoding slices are used to associate specific data objects and user objects. At the same time, to meet the data access interface of the data access object (DAO) of the ORM framework MyBatis, the interface encapsulates the operations of adding, deleting, modifying, and querying the underlying database. This interface will read the Mapper object entity mapping file in XML format corresponding to the class name at runtime to generate the implementation class of the interface. In this step, when a data user hopes to store data files securely personally, first, an upload request is sent from the front-end interface to the back-end controller. Then, the controller encrypts the data, and then performs erasure code sharding on the ciphertext. Finally, the controller completes the entire process of data on the chain. When a user hopes to view this data, the applicant sends an apply request to the back-end controller. After receiving the request, the controller will call the responsible sharing service controller, which will forward the request to the uploader of this data. If the uploader does not want the data to be accessed or viewed by the outside world, the application will be rejected; otherwise, the application will be approved. Through this step, the storage and query of data information can be processed differently according to different personal needs of users, effectively meeting the needs of users and making the system processing more intelligent and comprehensive;
[0045] Step S22: For the nodes in the system blockchain that need storage optimization, they cooperate with each other by establishing a DHT (Distributed Hash Table). Specifically: Using the Chord protocol, based on the IP address and port number of each node, after determining the position of the node in the Chord ring network using the hash algorithm, calculate the performance P of each node. Then, by introducing virtual nodes and according to the preset number of virtual nodes, obtain the relationship information between each entity blockchain node and the virtual nodes. When a new block is generated, each node calculates the corresponding hash value based on the block body, and then determines whether it is within its own responsible range. If the block address matches the position of its own Chord, locally store the block. At the same time, send a notification R and the new block to the successor node. After receiving the notification R, the successor node locally stores the block and then sends the block and the notification (R - 1) to the successor node. Repeat this step until it reaches zero to achieve R - copy redundancy of the block. Since each node maps its position in the Chord ring through a random determination by the hash algorithm, the distance between adjacent nodes has no association with their hardware limitations. The storage pressure borne by nodes with weaker storage capabilities is much greater than that of nodes with stronger storage capabilities. Therefore, nodes with relatively higher hardware levels are only responsible for a small part, while nodes with weak computing power and small storage space are responsible for storage tasks over a large distance. Therefore, through this step, it effectively solves the problem of introducing virtual nodes to address the mismatch between node performance and storage pressure, and reduces the storage pressure on each node itself, making the system data storage and processing more efficient and stable, and avoiding the generation of errors;
[0046] Step S23: The calculation formula for the performance P of each node is as follows:
[0047] P = k1Smi + k2Comi + k3Swi + k4Wi
[0048] In the formula, ki is the set weight coefficient corresponding to each data, Smi is the maximum storage capacity of the node, Comi represents the computing power data of the node, Swi is the storage size that the node can undertake, and Wi is the network bandwidth of the node.
[0049] Step S3 further includes the following steps:
[0050] Step S31: Identify different historical blocks and determine the corresponding storage processing. When each node in the current blockchain joins the Chord network, set thresholds Z and Y to represent the hot block data threshold near the genesis block and the hot block data threshold near the latest block, respectively;
[0051] Step S32: When a new node joins the blockchain, first set the size of the node's participation in the local storage of the blockchain. After initializing the synchronization status to false, set the threshold pre-interval and post-interval respectively. Then traverse the block numbers. If the current block is identified as a hot block and is the successor node of the position where the hash value of this block is located, then request the block data from the successor node of this node. If the successor node stores this block locally, directly return it to the new node. Otherwise, search for the block in the Chord ring through the local pointer table and return it to the new node. In this step, if none of the nodes locally store this block, synchronize it from IPFS. If the current block is identified as cold data, then the new node only needs to request the index of this block in the PFS system from other nodes in the network;
[0052] Step S33: When a node receives a read / write request for a block, the node first increments the access count of this block in the local pointer table. Then check if this block exists in the local storage of the node. If it exists, directly return the block data through the local storage. If it does not exist, determine whether the requested block is hot block data or cold block data. If it is cold block data, read the block data file from the PFS. Otherwise, request the data file from the node marked as the largest and less than the target block identifier in the local pointer table. Repeat this step until the target node is found in the DHT (Distributed Hash Table). If the target node determines that this data is cold block data, obtain the data file. If it is hot block data, directly return it to the requesting node.
[0053] Step S4 further includes the following steps:
[0054] Step S41: In the database of the blockchain data storage query system, use the user information table to record the basic information of users, including user ID, user nickname, user password, user mobile phone number, and user type. Among them, a unique index is established based on the user ID, so that the data table records the data ID, creation time, data uploader ID, data type, data hash value, and data sharding parameters;
[0055] Step S42: Divide the users in the system into data owners, authorized viewers, and unauthorized viewers, so that users with different roles have different levels of rights to data resources, and the administrator can view the identity roles of ordinary users for specific data resources.
[0056] It should be noted that, in this text, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, such that a process, method, article or device comprising a series of elements not only includes those elements but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or device.
[0057] Finally, it should be noted that the above are only the preferred embodiments of the present invention and are not used to limit the present invention. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions recorded in the foregoing embodiments or perform equivalent replacements for some of the technical features. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.
Claims
1. A storage control method based on blockchain, the method adopts a storage control system based on blockchain, comprising: Design management module, analysis and processing module and management control module, characterized in that: the design management module is connected to the analysis and processing module through a network, the analysis and processing module is connected to the management control module through a network, the design management module is used to design and manage blockchain storage queries, the analysis and processing module is used to optimize the storage analysis of blockchain data, and the management control module is used to manage and control databases and users; The blockchain-based storage control method comprises the following steps: Step S1: When the user stores the data generated by the network operation, the data is stored by designing a blockchain data storage query system; Step S2: After completing the overall design of the blockchain data storage query system, control and manage the transmission query of the network and data information therein; Step S3: further optimizing and analyzing the blockchain data storage query; Step S4: Perform database and user authority management on the blockchain data storage query system; The step S1 further comprises the following steps: After the network is running and generating data, the overall design of the blockchain data storage query system is carried out, including the view layer, interface layer, logic layer, security layer and data layer. The view layer is the front-end user interface displayed to system users. It is an intuitive display of all functions of the blockchain data storage query system and is responsible for the display of system functions and data. The interface layer is the connection between the view layer and the lower-layer logic implementation function, providing the view layer with the encapsulation of the logic layer capabilities; The step S2 further comprises the following steps: Step S21: When the user uploads data to the blockchain data storage query system for data storage, the data information uploaded by the user is identified by a unique identifier, and the data uploader ID is recorded. The binary stream obtained after the data is serialized is further sliced and associated enumerated. Specifically, the data information is sliced into ciphertext slices and coded slices. The ciphertext slices are used to associate ciphertext data objects, and the binary bits and index data in the slices are recorded. The coded slices are used to associate specific data objects and user objects. At the same time, in order to meet the data access interface of the data access object (DAO) of the ORM framework MyBatis, the interface encapsulates the addition, deletion, modification and query operations of the underlying database. The interface will read the XML format Mapper object entity mapping file corresponding to the class name to generate the interface implementation class at runtime; Step S22: For nodes in the system blockchain that need to be optimized for storage, they cooperate with each other by establishing a DHT (distributed hash table), specifically: the Chord protocol is used to determine the position of the node in the Chord ring network using a hash algorithm based on the IP address and port number of each node, and then the performance P of each node is calculated. Then, by introducing virtual nodes, the relationship information between each physical blockchain node and the virtual node is obtained according to the preset number of virtual nodes. When a new block is generated, each node calculates the corresponding hash value based on the block body, and then determines whether it is within the interval it is responsible for. If the block address matches the position of the Chord where it is located, the block is stored locally. At the same time, a notification R and a new block are sent to the successor node. After receiving the notification R, the successor node stores the block locally, and then sends the block and notification (R-1) to the successor node. This step is repeated until it is zero, achieving R copies of the block redundancy; Step S23: The calculation formula of each node performance P is as follows: P=k1Smi+k2Comi+k3Swi+k4Wi In the formula, ki is the corresponding weight coefficient of each set data, Smi is the maximum storage capacity of the node, Comi represents the computing power data of the node, Swi is the storage size that the node can bear, and Wi is the network bandwidth of the node; The step S3 further comprises the following steps: Step S31: Identify different historical blocks and determine the corresponding storage processing. When each node in the current blockchain joins the Chord network, the thresholds Z and Y are set to represent the hot block data threshold close to the genesis block and the hot block data threshold close to the latest block respectively; Step S32: When a new node joins the blockchain, first set the size of the local storage of the node participating in the blockchain, and after initializing the synchronization state to false, set the threshold pre-interval and post-interval respectively, and then traverse the block number. If the current block is identified as a hot block and is the successor node of the hash value of the block, then request the block data from the successor node of the node. If the successor node stores the block locally, it is directly returned to the new node. Otherwise, search for the block in the Chord ring through the local pointer table and return it to the new node; Step S33: When a node receives a read or write request for a block, the node first adds one to the number of accesses to the block in the local pointer table, and then searches the local storage of the node for the existence of the block. If it exists, the block data is directly returned through the local storage. If it does not exist, it is determined whether the requested block is hot block data or cold block data. If it is cold block data, the block data file is read from the PFS. Otherwise, the data file is requested from the node with the largest and less than target block identifier in the local pointer table. This step is repeated until the target node is found in the DHT (distributed hash table). If the target node determines that the data is cold block data, the data file is obtained. If it is hot block data, it is directly returned to the requesting node.