An online data storage system and method based on blockchain
By using a main chain and side chain architecture and a recurrent neural network model, the problem of insufficient storage space for blockchain full nodes is solved, enabling efficient data management and rational utilization of storage space for main chain nodes, and ensuring the normal operation and data processing capabilities of nodes.
Patent Information
- Application Number
- CN202310605217.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-26
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2043-05-26
AI Technical Summary
The available storage space of a blockchain full node decreases as the number of blocks increases, leading to insufficient storage space when processing multiple data requests and affecting the normal operation of the node.
It adopts a main chain and side chain architecture. Block data is transferred to the side chain through the side chain protocol. The main chain proxy node monitors the storage space in real time, uses a recurrent neural network model to predict storage needs, and adjusts the threshold to transfer data reasonably. Light nodes only store relevant data and rely on full nodes to verify the legality.
This effectively frees up main chain storage space, ensures the normal operation of main chain nodes, and reasonably adjusts storage requirements, thereby improving the storage efficiency and data processing capabilities of the blockchain network.
Smart Images

Figure CN116546041B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of blockchain technology, specifically to an online data storage system and method based on blockchain. Background Technology
[0002] Blockchain is characterized by decentralization, openness, independence, security, and anonymity. It integrates computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and cryptographic algorithms. A full node in a blockchain needs to store all the data in all blocks. As the number of blocks increases, the available storage space of a full node gradually decreases, preventing it from functioning properly. When a full node processes online data requests, it may encounter situations where multiple data requests need to be processed simultaneously, as well as large-capacity data requests, which also places demands on the available storage space of the full node. Summary of the Invention
[0003] The purpose of this invention is to provide a blockchain-based online data storage system and method to solve the problems mentioned in the background art.
[0004] A blockchain-based online data storage system includes a main chain and side chains; the main chain includes full main chain nodes and light main chain nodes, and the side chains include full side chain nodes and light side chain nodes; the main chain and side chains transmit data through a side chain protocol; the full main chain nodes store all main chain block data, and the full side chain nodes store all side chain block data; the light main chain nodes store only the main chain block data related to themselves, and the light side chain nodes store only the side chain block data related to themselves.
[0005] The main chain proxy node determines whether its available capacity is less than a set threshold:
[0006] If it is less than, the main chain proxy node records the block numbers of all blocks between the start block and the end block to be transferred;
[0007] The main chain proxy node sends the data of all blocks to the side chain proxy node;
[0008] The sidechain proxy node performs consensus verification on all block data;
[0009] After the main chain proxy node detects that the data of all blocks has been verified through the consensus of the side chain proxy node, the main chain proxy node will broadcast the information of transferring all block data to all main chain nodes.
[0010] The node corresponding to the main chain deletes the data of all the blocks according to the broadcast;
[0011] If the value is greater than the specified value, the main chain proxy node will continue to store block data.
[0012] When the main chain agent node receives the request of querying data, the main chain agent node requests the side chain agent node to obtain block data; the side chain agent node sends the block data to the main chain agent node; the main chain agent node stores the block data on the node corresponding to the main chain according to the number of the block data on the main chain; the main chain agent node obtains the hash value of the end block and stores the hash value in the block header of the newly generated block.
[0013] The full nodes of the main chain and the side chain store all the block data, while the light nodes only store the block data related to themselves, and the price of running the full node is high, and the user can autonomously choose to become a full node or a light node, and the light node needs to rely on other full nodes when running, and the light node can become a full node by downloading complete and latest block data; the agent node is mainly responsible for verifying the legality of the newly generated block and synchronization, verifying the legality of the blockchain network transaction, and broadcasting the verified new block and transaction information to all blockchain nodes.
[0014] An online data storage method based on a blockchain includes the following steps:
[0015] S6-1, the main chain agent node judges whether the available storage space of the main chain agent node is less than a set threshold value; if less, go to S6-2, if greater, go to S6-7;
[0016] S6-2, the main chain agent node records the block numbers of all blocks between the start block and the end block;
[0017] S6-3, the main chain agent node sends the data of the all blocks to the side chain agent node;
[0018] S6-4, the side chain agent node performs consensus verification on the all block data;
[0019] S6-5, after the main chain agent node detects that the all block data passes the consensus verification of the side chain agent node, the main chain agent node broadcasts the information of transferring the all block data to all main chain nodes;
[0020] S6-6, the node corresponding to the main chain deletes the all block data according to the broadcast;
[0021] S6-7, the main chain agent node continues to store new block data.
[0022] The threshold value of the main chain agent node is obtained by the following method:
[0023] S7-1, according to the historical total online data volume, the peak value of the online data request times and the peak value of the single data volume, a recurrent neural network model is established to predict the future total online data volume, the peak value of the online data request times and the peak value of the single data volume;
[0024] S7-2, the sum of the remaining storage space of all main chain agent nodes and the predicted online data volume and the storage space required for the normal operation of the main chain agent nodes is obtained, and the minimum value is the threshold value of the main chain agent nodes;
[0025] S7-3, after the main chain agent node sends the block data to the side chain agent node, the new threshold value is generated by repeating steps S7-1 and S7-2.
[0026] The storage space required for the normal operation of the main chain agent node is obtained by the following method:
[0027] S8-1, the number of data requests is gradually increased by 1;
[0028] S8-2, starting from 1 data request with a capacity of 1G, the main chain agent node processes the data request, and the step S8-1 is repeated until the performance of the main chain agent node starts to decline, and the data request number and data capacity at this time are recorded;
[0029] S8-3, the data capacity is increased by 1G, and the step S8-2 is repeated until the performance of the main chain agent node starts to decline, and the data request number and data capacity at this time are recorded;
[0030] S8-4, repeat step S8-3 until the data request number is 1, and the performance of the main chain agent node starts to decline;
[0031] S8-5, the recorded multiple data request numbers and data capacities are made into a table, and the predicted peak value of the online data request times and the peak value of the single data volume are combined to determine the storage space required for the normal operation of the main chain agent node.
[0032] The total online data volume, the peak value of the online data request times and the peak value of the single data volume have certain correlation, and the present application uses one instead of three recurrent neural network models, and simultaneously predicts the three variables, which is in the form of multiple inputs and three outputs; the input is the historical k times of the total online data volume, the peak value of the online data request times and the peak value of the single data volume, and the output is the next time of the total online data volume, the peak value of the online data request times and the peak value of the single data volume; the recurrent neural network model adopts the PredRNN++ model to solve the deep time dilemma problem of time series prediction.
[0033] When the user issues a data query request to the main chain agent node, if the data has been transferred to the side chain, the query includes the following steps:
[0034] S9-1, when the main chain agent node receives the request for querying data, the main chain agent node requests the side chain agent node to obtain the block data;
[0035] S9-2, the side chain agent node sends the block data to the main chain agent node;
[0036] S9-3, the main chain agent node stores the block data on the node corresponding to the main chain according to the number of the block data on the main chain;
[0037] If the data is not transferred to the side chain, the user can directly obtain the required data from the corresponding light node or any full node.
[0038] The side chain agent node sends the block data to the main chain agent node, including:
[0039] S10-1, the side chain agent node converts the number of the block on the main chain into the number on the side chain through the smart contract according to the request sent by the main chain agent node;
[0040] S10-2, the side chain agent node takes out the corresponding block according to the number of the block on the side chain;
[0041] S10-3, the side chain agent node sends the block data to the main chain agent node.
[0042] Compared with the prior art, the beneficial effects achieved by the present application are: the available storage space of the main chain agent node is monitored in real time, when the available storage space is lower than the threshold value, the main chain transfers the block data to the side chain through the side chain protocol, the storage space of the main chain agent node is released in time, and the normal operation of the main chain agent node is ensured; the threshold storage space of the main chain agent node is adjusted according to the number of online data requests and the peak value of single data capacity, so as to ensure the necessity and rationality of block data transfer. BRIEF DESCRIPTION OF DRAWINGS
[0043] The accompanying drawings are used to provide a further understanding of the present application, and constitute a part of the specification, together with the embodiments of the present application, to explain the present application, and do not constitute a limitation on the present application. In the drawings:
[0044] Figure 1 is a flowchart of an online data storage method based on a block chain according to an embodiment of the present application;
[0045] Figure 2 is a flowchart of determining the storage space required for the normal operation of the main chain agent node according to an embodiment of the present application. DETAILED DESCRIPTION
[0046] With reference to the accompanying drawings, the technical solutions in the embodiments of the present application will be clearly and completely described below. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort belong to the scope of the present application.
[0047] The embodiment of the present application provides a kind of blockchain data management framework, including data layer, network layer, consensus layer and contract layer;Data layer stores data with chain block;Network layer includes data propagation mechanism and data verification mechanism, for synchronizing and verifying the block data between different nodes;Consensus layer stores consensus algorithm, the consensus algorithm of the embodiment of the present application adopts share authorization proof mechanism DPoS;Contract layer includes smart contract, script code and management system.
[0048] In the embodiment of the present application, the blockchain is composed of multiple blocks, each block is composed of a block header and a block body;The hash value of the block, the hash value of the previous block, the version number, the timestamp, the calculation difficulty and the Nonce value are stored in the block header;The blocks are connected in sequence by the hash values stored in the block header to form a blockchain;The block body is used to store the operation data record format, Merkle tree mechanism and record encryption mechanism.
[0049] The embodiment of the present application is a kind of online data storage system based on blockchain, including main chain and side chain, main chain and side chain pass through side chain protocol and carry out data transmission;Main chain includes main chain full node and main chain light node, side chain includes side chain full node and side chain light node;Main chain full node saves all main chain block data, side chain full node saves all side chain block data;Main chain light node only stores the main chain block data related to itself, and the side chain light node only stores the side chain block data related to itself;Main chain light node and main chain full node are connected with each other, and side chain light node and side chain full node are connected with each other;Light node needs to rely on other full node when running, and light node can become full node by downloading complete latest blockchain data;The nodes in main chain or side chain adopt point-to-point P2P communication mode, and the proxy node of main chain and the proxy node of side chain communicate with each other.
[0050] Figure 1 It is a flow chart of a kind of online data storage method based on blockchain of the embodiment of the present application, including the following steps:
[0051] S6-1, the main chain proxy node judges whether available storage space is less than the threshold value of itself;If less than, enter S6-2, if greater than, enter S6-7;
[0052] S6-2, the main chain proxy node records the block number of all blocks between start block and end block;
[0053] S6-3, the main chain agent node sends the data of all the blocks to the side chain agent node;
[0054] S6-4, the side chain agent node performs consensus verification on the data of all the blocks;
[0055] S6-5, after the main chain agent node detects that the data of all the blocks pass the consensus verification of the side chain agent node, the main chain agent node broadcasts the information of transferring the data of all the blocks to all the main chain nodes;
[0056] S6-6, the corresponding nodes of the main chain delete the data of all the blocks according to the broadcast;
[0057] S6-7, the main chain agent node continues to store new block data.
[0058] In the embodiment of the application, after the block data sent by the chain agent node to the side chain agent node passes the consensus verification of the side chain agent node, the side chain agent node sends the information of passing the consensus verification to the main chain agent node, and after the main chain agent node receives the information of passing the consensus verification, the main chain agent node broadcasts the information of transferring the block data on the whole main chain, and all the nodes and corresponding light nodes on the main chain delete the transferred block data; the main chain agent node releases the storage space of the main chain agent node by transferring the block data, so as to ensure that the main chain agent node can normally operate.
[0059] When the main chain agent node transfers the block data to the side chain agent node, the main chain agent node obtains the hash value of the end block, and stores the hash value into the block header of the newly generated block of the main chain; the side chain agent node executes the smart contract, converts the number of the transferred block on the main chain into the number on the side chain, and stores the transferred block data on all the nodes and corresponding light nodes of the side chain.
[0060] The threshold of the main chain agent node is obtained by the following method:
[0061] S7-1, a recurrent neural network model is established according to the total online data capacity, the peak value of the number of online data requests and the peak value of single data capacity, to predict the total online data capacity, the peak value of the number of online data requests and the peak value of single data capacity in the future;
[0062] S7-2, the sum of the remaining storage space of all the main chain agent nodes and the storage space required for the normal operation of the main chain agent node is subtracted from the predicted online data capacity, and the minimum value obtained is the threshold of the main chain agent node;
[0063] S7-3, after the main chain agent node sends the block data to the side chain agent node, the new threshold is generated by repeating steps S7-1 and S7-2.
[0064] Figure 2A flowchart of determining the storage space required for normal operation of the main chain agent node of the embodiment of the application, comprising:
[0065] S8-1, gradually increase the number of data requests in steps of 1;
[0066] S8-2, starting from 1 data request with a capacity of 1G, let the main chain agent node process the data request, repeat step S8-1 until the performance of the main chain agent node starts to decline, and record the number of data requests and the data capacity at this time;
[0067] S8-3, increase the data capacity by 1G, repeat step S8-2 until the performance of the main chain agent node starts to decline, and record the number of data requests and the data capacity at this time;
[0068] S8-4, repeat step S8-3 until the number of data requests is 1 and the performance of the main chain agent node starts to decline;
[0069] S8-5, make a table of the recorded multiple data request numbers and data capacities, and determine the storage space required for normal operation of the main chain agent node in combination with the predicted peak value of the number of online data requests and the peak value of the single data capacity.
[0070] The online data total capacity has certain correlation with the peak value of the number of online data requests and the peak value of the single data capacity, the application uses one instead of three recurrent neural network models, and simultaneously predicts the three variables, in the form of multiple inputs and three outputs; the input is the historical k times of the online data total capacity, the peak value of the number of online data requests and the peak value of the single data capacity data, and the output is the next 1 times of the online data total capacity, the peak value of the number of online data requests and the peak value of the single data capacity data; the recurrent neural network model adopts the PredRNN++ model, which is used to solve the deep time dilemma problem of time series prediction.
[0071] The user issues a data query request through the full node or the light node of the main chain, and if the data has not been transferred from the main chain to the side chain, the user can directly obtain it from the full node or the corresponding light node; if the data has been transferred from the main chain to the side chain, the main chain agent node issues a request for obtaining block data to the side chain agent node, the side chain agent node executes the smart contract to convert the number of the block on the main chain into the number on the side chain, the side chain agent node sends the block data corresponding to the number to the main chain agent node, and the main chain agent node stores the received block data on the corresponding node of the main chain for user query.
[0072] It is to be understood that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting; it is not intended to exclude myriad other embodiments of the present application that other inventors can develop based on the description herein. It must be stressed that any relationship specified by, for example, is for the purpose of providing a concrete example of a technical solution described herein and is not intended to exclude other technical solutions that can be developed based on the description herein. The use of the terms to include, include, including, and / or the like indicates that the herein described embodiment so
[0073] Finally, it should be noted that the above-described embodiments are merely exemplary of the application, and that therefore should not be taken as limiting the present application. Rather, it is the intent of the applicant(s) that all such modifications and embodiments and equivalents thereof that come within the spirit and scope of the application are to be included.
Claims
1. An online data storage system based on blockchain, characterized in that, The blockchain comprises a main chain and a side chain; the main chain comprises main chain full nodes and main chain light nodes, and the side chain comprises side chain full nodes and side chain light nodes; the main chain and the side chain perform data transmission through a side chain protocol; the main chain full nodes store all main chain block data, and the side chain full nodes store all side chain block data; the main chain light nodes only store main chain block data related to themselves, and the side chain light nodes only store side chain block data related to themselves; The main chain agent node determines whether the available capacity thereof is less than a set threshold value; If the available capacity is less than the threshold value, the main chain agent node records the block numbers of all blocks between a start block and an end block to be transferred; The main chain agent node sends the data of the all blocks to the side chain agent node; The side chain agent node performs consensus verification on the data of the all blocks; After detecting that the data of the all blocks pass the consensus verification of the side chain agent node, the main chain agent node broadcasts information about the transfer of the data of the all blocks to all main chain nodes; The nodes corresponding to the main chain delete the data of the all blocks according to the broadcast; If the available capacity is greater than the threshold value, the main chain agent node continues to store the block data; The threshold value of the main chain agent node is obtained in the following manner: S7-1. A recurrent neural network model is established according to historical online data total capacity, online data request frequency peak value and single data capacity peak value to predict future online data total capacity, online data request frequency peak value and single data capacity peak value; S7-2. The threshold value of the main chain agent node is obtained by subtracting the sum of the predicted online data capacity and the storage space required for normal operation of the main chain agent node from the remaining storage space of all main chain agent nodes; S7-3. When the main chain agent node sends block data to the side chain agent node, new threshold values are generated by repeating steps S7-1 and S7-2; The storage space required for normal operation of the main chain agent node is obtained in the following manner: S8-1. The number of data requests is gradually increased by 1; S8-2. Starting from 1 data request with a capacity of 1G, the main chain agent node processes the data request, and step S8-1 is repeated until the performance of the main chain agent node starts to decline, and the number of data requests and the data capacity at this time are recorded; S8-3. The data capacity is increased by 1G, and step S8-2 is repeated until the performance of the main chain agent node starts to decline, and the number of data requests and the data capacity at this time are recorded; S8-4. Step S8-3 is repeated until the performance of the main chain agent node starts to decline when the number of data requests is 1; S8-5. The recorded multiple data request numbers and data capacities are tabulated, and the storage space required for normal operation of the main chain agent node is determined in combination with the predicted online data request frequency peak value and single data capacity peak value.
2. The blockchain-based online data storage system of claim 1, wherein, When the main chain agent node receives a request for query data, the main chain agent node requests the side chain agent node to obtain block data; and the side chain agent node sends the block data to the main chain agent node; The main chain agent node stores the block data on the nodes corresponding to the main chain according to the hash value of the block data.
3. The blockchain-based online data storage system of claim 2, wherein, The main chain agent node acquires the number of the end block, and stores the hash value into the block header of the newly generated block.
4. An online data storage method based on a blockchain, characterized by, The method applied to the online data storage system based on the blockchain in any one of claims 1-3, comprising the following steps: S6-1, the main chain agent node judges whether the available storage space is less than the set threshold value; if less, enter S6-2, if greater, enter S6-7; S6-2, the main chain agent node records the block numbers of all blocks between the start block and the end block; S6-3, the main chain agent node sends the data of all blocks to the side chain agent node; S6-4, the side chain agent node performs consensus verification on the data of all blocks; S6-5, after the main chain agent node detects that the data of all blocks passes the consensus verification of the side chain agent node, the main chain agent node broadcasts the information of transferring the data of all blocks to all main chain nodes; S6-6, the corresponding node of the main chain deletes the data of all blocks according to the broadcast; S6-7, the main chain agent node continues to store new block data.
5. The blockchain-based online data storage method of claim 4, wherein, The query data comprises the following steps: S9-1, when the main chain agent node receives the request of query data, it requests the side chain agent node to acquire block data; S9-2, the side chain agent node sends the block data to the main chain agent node; S9-3, the main chain agent node stores the block data on the corresponding node of the main chain according to the number of the block data in the main chain.
6. The online data storage method based on blockchain according to claim 5, characterized in that, The side chain agent node sends the block data to the main chain agent node, comprising the following steps: S10-1, the side chain agent node converts the number of the block on the main chain to the number on the side chain through the smart contract according to the request sent by the main chain agent node; S10-2, the side chain agent node takes out the corresponding block according to the number of the block on the side chain; S10-3, the side chain agent node sends the block data to the main chain agent node.
Citation Information
Patent Citations
Data storage method and system based on block chain
CN109117097A
Block chain lightweight storage method based on data redistribution and dynamic node strategy
CN115037755A