A storage control method based on blockchain
Through a blockchain-based storage control system, DHT and Chord protocols are used to optimize node storage, virtual node management is introduced, and combined with user permission control and data slicing technology, the problems of data tampering risks, high operating costs and high storage pressure in blockchain storage are solved, and efficient and stable data management and user personalized storage are achieved.
Patent Information
- Application Number
- CN202410624057.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-20
- Publication Date
- 2025-07-18
- Estimated Expiration
- 2044-05-20
AI Technical Summary
The existing blockchain storage methods have problems such as data tampering risks, high operating costs and high node storage pressure, especially in the case of high redundant storage, the node performance and storage pressure do not match.
The blockchain-based storage control system is adopted, including design management modules, analysis and processing modules, and management control modules. The node storage is optimized through DHT and Chord protocols, virtual node management is introduced, and combined with user permission control and data slicing technology to achieve efficient and stable data storage management.
It effectively solves the problem of mismatch between node performance and storage pressure, reduces the storage pressure of each node, realizes efficient and stable data storage processing, meets user personalized needs, and avoids the occurrence of data errors.
Smart Images

Figure CN118585581B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of storage, and in particular to a storage control method based on blockchain. Background Art
[0002] At present, a large 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 the privacy information of users. 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 the 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 medical care, 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 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 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 designing and managing the storage query of the blockchain. The analysis and processing module is used for analyzing, optimizing and processing the blockchain data storage. The management 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 to manage the authentication and analysis of block heat, the initialization module is used to control and process node initialization, and the read / write management module is used to control 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 to control database storage, and the user management module is used to manage 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 can be stored 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, the step S1 further includes the following steps:
[0014] 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. Among them, 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's functions and data. The interface layer is the connection between the view layer and the lower-layer logic to implement functions, and provides an encapsulation of the logic layer capabilities to the view layer.
[0015] According to the above technical solution, the 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. The 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 based on the block body, and then determines whether it is within its responsible range. If the block address matches the position of its own Chord, the block is locally stored. 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 locally stores the block and then sends the block and the 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 = k1Sm i +k2Com i +k3Sw i +k4W i
[0020] In the formula, k i is the set weight coefficient corresponding to each data, Sm i is the maximum storage capacity of this node, Com i represents the computing power data of this node, Sw i is the storage size that this node can bear, W i is the network bandwidth of this node.
[0021] According to the above technical solution, the 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, 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;
[0023] Step S32: When a new node joins the blockchain, first set the size of the node participating in the local storage of the blockchain, initialize the synchronization status to false, then set the threshold front interval and the back interval, and 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 the 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, find 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 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 the block in the local pointer table, and then checks whether the 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, then 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, and repeat this step until the target node is found in the DHT (Distributed Hash Table). If the target node determines that the 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, so that 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 ledger in the blockchain can be effectively managed and controlled. The storage and query of data information can be processed in different ways according to different needs of users, effectively meeting the user's needs, making the system processing more intelligent and comprehensive, effectively solving the problem of introducing virtual nodes to address the mismatch between node performance and storage pressure, and reducing 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. Together with the embodiments of the present invention, they are used to explain the present invention, and do not constitute a limitation to the present invention. In the accompanying drawings:
[0030] Figure 1 is a schematic diagram of the system module composition of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0031] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to 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 of the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the scope of protection 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 and optimization 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 database storage, and the user management module is used to manage user permissions.
[0036] According to the above technical solution, a blockchain-based storage control method includes the following steps:
[0037] Step S1: When a user stores data generated by network operation and use, data storage can be performed 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, perform 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's 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 business functions such as user management, data transmission and query, and data storage in this system. The logic layer splits specific functions according to security layer technologies and storage layer technologies to build 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 for data interaction with 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, then performs the work of erasure code sharding on the ciphertext, and finally, the controller completes the entire process of data uploading to 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, this 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, 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, 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 the range it is responsible for. 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 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 randomly through the hash algorithm, the distance between adjacent nodes has no association with their hardware limitations. Nodes with weaker storage capabilities bear much greater storage pressure than 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 = k1Sm i + k2Com i + k3Sw i + k4W i
[0048] In the formula, k i is the set weight coefficient corresponding to each data, Sm i is the maximum storage capacity of this node, Com i represents the computing power data of this node, Sw i is the storage size that this node can bear, and W i is the network bandwidth of this 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, initialize the synchronization status to false, then set the pre-threshold interval and post-threshold interval respectively, and then traverse the block numbers. If the current block is identified as a hot block and the successor node of the location 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 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, and then checks whether 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, then 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 and less than the target block identifier marked 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.
[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 according to 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 terms "comprising", "including" or any other variant thereof are intended to cover non-exclusive inclusion, so 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 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 described 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, which adopts a storage control system based on blockchain and includes: A design management module, an analysis and processing module, and a management and control module, characterized in that: the design management module is network-connected to the analysis and processing module, the analysis and processing module is network-connected to the management and control module, the design management module is used for the design management of blockchain storage query, the analysis and processing module is used for the analysis, optimization and processing of blockchain data storage, and the management and control module is used for the management and control of the database and users; 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 the transmission and query of data information, and the network management module is used for the network management and control of blockchain storage; 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 the authentication and analysis management of block heat, the initialization module is used for the initialization control processing of nodes, and the read-write management module is used for the read-write control of blockchain storage; 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 the storage control of the database, and the user management module is used for the control and management of user permissions; A storage control method based on blockchain includes the following steps: Step S1: When a user stores data generated by network operation and use, data is stored through a designed blockchain data storage and query system; Step S2: After completing the overall design of the blockchain data storage and query system, control and manage the transmission and query of the network and data information therein; Step S3: Further optimize and analyze the blockchain data storage and query; Step S4: Manage the database and user permissions of the blockchain data storage and query system; The step S1 further includes the following steps: After data is generated by network operation and use, an overall design of the stored blockchain data storage and query system is carried out, 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 user, is an intuitive display of all functions of the blockchain data storage and query system, and is responsible for the display of the functions and data of the system. The interface layer is the connection between the view layer and the lower-layer logic implementation function, and provides the encapsulation of the logic layer capabilities to the view layer; The step S2 further includes the following steps: 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; 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 based on the block body, and then determines whether it is within the range it is responsible for. If the block address matches the position of its own Chord, the block is locally stored. 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 locally stores the block 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; The calculation formula for the performance P of each node is as follows: P = k1Sm i + k2Com i + k3Sw i + k4W i where k i is the weight coefficient corresponding to each set of data, Sm i is the maximum storage capacity of this node, Com i represents the computing power data of this node, Sw i is the storage size that this node can bear, W i is the network bandwidth of this node; Step S3 further includes 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, 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; Step S32: When a new node joins the blockchain, first set the size of the node participating in the local storage of the blockchain and initialize the synchronization state to false. Then, set the threshold front - end interval and back - end interval respectively. Next, 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 the block is located, then request the block data from the successor node of this node. If the successor node locally stores the block, 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 / write request for a block, the node first increments the access count of the block in the local pointer table, and then checks if the block exists in the local storage of the node. 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 identifier and less than the target block identifier in the local pointer table, and 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; Step S4 further includes the following steps: Step S41: In the blockchain data storage query system database, the user information table is used 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; Step S42: Users in the system are divided 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.
Citation Information
Patent Citations
Block chain-based academic degree authentication system and authentication method
CN109934005A
Method for generating and managing multimodal identified network on the basis of consortium blockchain voting consensus algorithm
WO2020113545A1