Data storage method and device based on block chain, equipment and storage medium
By optimizing blockchain storage strategies through redundant computing and anomaly detection, the problems of high storage costs, performance bottlenecks, and insufficient security are resolved, and an efficient, secure, and high-performance dual-blockchain architecture for data storage is achieved, which is suitable for scenarios such as financial transactions and IoT data storage.
Patent Information
- Application Number
- CN202511026768.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-24
- Publication Date
- 2025-09-30
AI Technical Summary
Existing blockchain technology has problems in data storage and management, such as high storage costs, performance bottlenecks, insufficient security, load imbalance, and data privacy protection, making it difficult to meet the needs of large-scale applications.
A redundant computing strategy is used to generate redundant data sets, anomaly detection functions and genetic algorithms are combined to optimize storage strategies, consensus nodes are elected through a proof-of-stake mechanism, and a dual blockchain architecture and encryption matrix are used for data partitioning and encryption processing.
It reduces storage costs, improves data security and reliability, balances node loads, improves read and write performance, and reduces business delays. It is suitable for large-scale application scenarios such as financial transactions and IoT data storage.
Smart Images

Figure CN120723943A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data storage technology, and in particular to a blockchain-based data storage method, apparatus, device, and storage medium. Background Art
[0002] With the widespread application of blockchain technology, it faces many challenges in data storage and management. In the mode of full data on-chain, since all data needs to be stored on-chain, the storage cost increases significantly. At the same time, the frequent reading and writing of massive data also causes performance bottlenecks, which makes it difficult to meet the needs of large-scale applications. In terms of data security and reliability, the existing blockchain system lacks effective anomaly detection and data repair mechanisms. Once an anomaly occurs during data storage or transmission, it is difficult to detect and repair it in time, which may lead to data loss or damage, affecting the integrity and credibility of the system. At the same time, the load distribution of storage nodes is unreasonable, some nodes are overloaded, while some nodes are idle. This load imbalance This phenomenon has seriously affected the overall stability of the system. In addition, in the public chain environment, the issue of data privacy protection is particularly prominent. The openness and transparency of on-chain data exposes user privacy data to the risk of leakage, making it difficult to effectively protect user rights and interests. In terms of consensus mechanism, traditional consensus algorithms are inefficient and difficult to cope with high-concurrency scenarios. In high-concurrency transactions or data processing, the system will have problems such as excessive latency and long transaction confirmation time, which greatly limits the application of blockchain technology in high-frequency transactions, real-time data processing and other fields. Therefore, there is an urgent need for an improved blockchain data storage and management solution to solve the above problems, improve the performance, security and reliability of the blockchain system, and meet the growing application needs. Summary of the Invention
[0003] In order to overcome the shortcomings of the prior art, the purpose of the present invention is to provide a blockchain-based data storage method, device, equipment and storage medium.
[0004] In order to solve the above technical problems, the technical solutions adopted by the present invention are as follows: The present invention provides a blockchain-based data storage method, comprising: obtaining local intrusion log data and an original data set; performing redundancy calculation on the original data set according to a preset basic coding formula and a preset adjustment coefficient to obtain a redundant data set; constructing an anomaly detection function based on the local intrusion log data and a preset federated proximal algorithm; performing anomaly detection on the original data set according to the redundant data set and the anomaly detection function to obtain an anomaly detection result; obtaining a storage network, and storing the original data set in the storage network according to the anomaly detection result to obtain a primary storage blockchain and a candidate storage blockchain.
[0005] Furthermore, storing the original data set in the storage network according to the anomaly detection result to obtain a primary storage blockchain and a candidate storage blockchain includes: selecting a consensus node set from the storage network according to a preset proof-of-stake mechanism; obtaining a first blockchain and a second blockchain from the storage network according to the consensus node set and the anomaly detection result; generating optimization parameters according to the anomaly detection result; generating a storage strategy according to a preset genetic algorithm, optimization parameters and a preset storage cost model; dividing the original data set according to the storage strategy to obtain a primary storage data set and a candidate storage data set; and storing the primary storage data set and the candidate storage data set in the first blockchain and the second blockchain, respectively, to obtain a primary storage blockchain and a candidate storage blockchain.
[0006] Furthermore, obtaining the first blockchain and the second blockchain from the storage network based on the consensus node set and the anomaly detection result includes: obtaining a consensus master node from the consensus node set; obtaining the first blockchain from the storage network based on the consensus master node; performing equity analysis on the original data set based on the anomaly detection result to obtain an equity analysis result; and obtaining the second blockchain from the storage network based on the equity analysis result.
[0007] Furthermore, the storage strategy is generated according to the preset genetic algorithm, optimization parameters and preset storage cost model, including: generating an initial chromosome population according to the optimization parameters; calculating the fitness of each chromosome in the initial chromosome population according to the storage cost model and preset reliability constraints to obtain a fitness set; obtaining the optimal fitness from the fitness set; obtaining the parent chromosome population from the initial chromosome population according to the optimal fitness; performing crossover processing on the parent chromosome population to obtain a child chromosome population; performing mutation processing on the child chromosome population according to a preset mutation probability and a preset number of iterations to obtain an adapted chromosome population; and generating a storage strategy according to the genetic algorithm and the adapted chromosome population.
[0008] Furthermore, storing the primary storage dataset and the candidate storage dataset in the first blockchain and the second blockchain, respectively, to obtain the primary storage blockchain and the candidate storage blockchain, includes: analyzing the primary storage dataset and the candidate storage dataset to obtain storage requirements and a storage resource set; generating an encryption matrix based on a preset on-chain storage cost coefficient, the storage resource set, and the storage requirements; The primary storage data set and the candidate storage data set are encrypted according to the encryption matrix to obtain an encrypted primary storage data set and an encrypted candidate storage data set; the encrypted primary storage data set and the encrypted candidate storage data set are stored in the first blockchain and the second blockchain respectively to obtain a primary storage blockchain and a candidate storage blockchain.
[0009] Furthermore, the encryption matrix is generated according to the preset on-chain storage cost coefficient, storage resource set and storage requirement, including: calculating the storage resource set and storage requirement according to a preset verifiable random function to obtain a random number and a symmetric key; splitting the symmetric key according to a preset key splitting method and a random number to obtain a fragment recovery key set; and constructing the encryption matrix according to the on-chain storage cost coefficient and the fragment recovery key set.
[0010] Furthermore, the method performs redundancy calculation on the original data set according to a preset basic coding formula and a preset adjustment coefficient to obtain a redundant data set, including: obtaining network environment information and analyzing the storage network according to the network environment information to obtain node activity; encoding the node activity according to the basic coding formula to obtain an active quantum state; generating a basic redundancy factor according to the active quantum state, a preset standard quantum state and the adjustment coefficient; and performing redundancy calculation on the original data set according to the basic redundancy factor to obtain a redundant data set.
[0011] Furthermore, the anomaly detection function is constructed based on the local intrusion log data and a preset federated proximal algorithm, including: performing a federated aggregation calculation on the local intrusion log data according to the federated proximal algorithm to obtain a federated aggregation coefficient; and constructing an anomaly detection function based on the federated aggregation coefficient and the local intrusion log data.
[0012] Furthermore, a blockchain-based data storage device includes: a data acquisition module for acquiring local intrusion log data and an original data set; a redundancy calculation module for performing redundancy calculation on the original data set according to a preset basic coding formula and a preset adjustment coefficient to obtain a redundant data set; a function construction module for constructing an anomaly detection function based on the local intrusion log data and a preset federated proximal algorithm; a result detection module for performing anomaly detection on the original data set based on the redundant data set and the anomaly detection function to obtain an anomaly detection result; a storage module for acquiring a storage network and storing the original data set to the storage network according to the anomaly detection result to obtain a primary storage blockchain and a candidate storage blockchain.
[0013] Furthermore, a blockchain-based data storage device includes: a memory and at least one processor, wherein the memory stores instructions; at least one processor calls the instructions in the memory so that the blockchain-based data storage device performs the various steps of a blockchain-based data storage method as described in any one of the above.
[0014] Furthermore, a computer-readable storage medium stores instructions, which, when executed by a processor, implement the steps of any one of the above-described blockchain-based data storage methods.
[0015] In the technical solution of the present invention, in terms of storage cost control, the redundant computing strategy abandons the full-chain mode and uses coding technology to generate redundant data sets, which reduces the actual storage capacity on the chain, makes the storage cost show a more reasonable growth trend with the data scale, and avoids the waste of resources caused by linear or superlinear growth; in terms of data security and reliability, redundant data can not only be used to automatically repair hacked or damaged data and ensure data integrity, but also optimize reading efficiency through pre-calculation, quickly reconstruct abnormal data, and reduce node load; the anomaly detection function constructed by combining local intrusion log data with the federal proximal algorithm can identify anomalies in data storage and transmission, and timely prevent security risks. In terms of performance improvement, the main storage block, candidate storage blockchain architecture and data dynamic allocation mechanism effectively disperse data reading and writing pressure, achieve storage node load balancing, improve the read and write performance of the blockchain system, reduce business processing delays in large-scale data reading and writing scenarios, and reduce the risk of business interruption caused by performance bottlenecks. It can be widely used in large-scale application scenarios such as financial transactions and Internet of Things data storage. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The above and / or additional aspects and advantages of the present invention will become apparent and readily understood from the following description of the embodiments with reference to the accompanying drawings, in which: Figure 1 A first flow chart of a blockchain-based data storage method provided by an embodiment of the present invention; Figure 2 A second flow chart of a blockchain-based data storage method provided in an embodiment of the present invention; Figure 3 A third flow chart of a blockchain-based data storage method provided in an embodiment of the present invention; Figure 4 A fourth flow chart of a blockchain-based data storage method provided in an embodiment of the present invention; Figure 5 A fifth flow chart of a blockchain-based data storage method provided in an embodiment of the present invention; Figure 6 A sixth flow chart of a blockchain-based data storage method provided in an embodiment of the present invention; Figure 7 A seventh flow chart of a blockchain-based data storage method provided in an embodiment of the present invention; Figure 8 An eighth flow chart of a blockchain-based data storage method provided in an embodiment of the present invention; Figure 9 A schematic diagram of the structure of a blockchain-based data storage device provided by an embodiment of the present invention; Figure 10 A schematic diagram of the structure of a blockchain-based data storage device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0017] The present invention provides a blockchain-based data storage method, system, device and storage medium. By integrating operator behavior data and device status data, and combining paragraph division analysis and multi-level verification, it achieves a comprehensive and accurate assessment of device operation compliance, improves the compliance analysis effect of device operation, and reduces the operational risks and safety hazards caused by traditional compliance analysis methods.
[0018] The terms "first," "second," "third," "fourth," and so on (if any) in the description and claims of the present invention and in the accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a particular order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate, so that the embodiments described herein can be implemented in an order other than that shown or described herein. In addition, the terms "including" or "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus that includes a series of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, product, or apparatus.
[0019] For ease of understanding, the specific process of the embodiment of the present invention is described below. Figure 1 , an embodiment of a data storage method based on blockchain in an embodiment of the present invention includes: 101. Obtain local intrusion log data and original data sets; 102. Perform redundancy calculation on the original data set according to a preset basic coding formula and a preset adjustment coefficient to obtain a redundant data set; In this embodiment, a redundant computing strategy is adopted to change the full data on-chain mode, and coding technology is used to generate redundant data sets, thereby reducing the amount of data actually stored on-chain. For example, for some data that can be restored through redundancy checks, there is no need to store multiple complete copies on-chain. As a result, storage costs can show a more reasonable growth trend as data scale increases, rather than the linear or super-linear growth when full data is on-chain. 103. An anomaly detection function is constructed based on local intrusion log data and a preset federated proximal algorithm; In this embodiment, if a node in a blockchain storage network is hacked and data becomes corrupted, the system can automatically repair it using redundant data from other nodes without manual intervention, ensuring data integrity. Redundant data pre-computation optimizes reading efficiency: the redundant data set splits the original data into multiple small blocks, which can be distributed and stored on different nodes to prevent a single node from storing excessive data. When a data anomaly is detected, it can be quickly rebuilt directly from the redundant blocks, avoiding full data retransmission, improving data repair speed and reducing node load. Local intrusion log data contains records of various historical data anomalies (such as data tampering and data corruption caused by illegal intrusion). The federated proximal algorithm (an algorithm that aggregates multi-source data features to optimize the model while protecting data privacy. From a formulaic perspective, this algorithm, through a federated learning framework, aggregates and trains the local log data features of multiple participants to construct a global anomaly detection function, where the input is the local intrusion log data to be detected) can fully utilize this historical anomaly information to construct an anomaly detection function that is tailored to actual application scenarios. Compared with traditional blockchain systems that lack targeted detection mechanisms, this approach can better identify anomalies that occur during data storage and transmission, and promptly detect potential data security risks. 104. Perform anomaly detection on the original data set according to the redundant data set and the anomaly detection function to obtain an anomaly detection result; 105. Obtain a storage network and store the original data set in the storage network according to the anomaly detection result to obtain a primary storage blockchain and a candidate storage blockchain; In this embodiment, the data allocation storage mechanism after redundant calculation, as well as the architecture of the primary storage blockchain and the candidate storage blockchain, disperses the pressure of data reading and writing. Data reading and writing are no longer concentrated on a few nodes, and the storage node load is more balanced, thereby improving the read and write performance of the blockchain system. In scenarios where large-scale data is frequently read and written, the system response speed is faster and the business processing delay is lower. It can better meet the performance requirements of large-scale applications for blockchain systems, such as financial transaction chain storage and large-scale IoT data evidence storage, and can effectively reduce business interruptions or delays caused by performance bottlenecks. In this embodiment, in terms of storage cost control, the redundant computing strategy abandons the full-data chain mode and uses coding technology to generate redundant data sets, which reduces the actual storage capacity on the chain, making the storage cost show a more reasonable growth trend with the data scale, avoiding the waste of resources caused by linear or super-linear growth; in terms of data security and reliability, redundant data can not only be used to automatically repair hacked or damaged data and ensure data integrity, but also optimize reading efficiency through pre-calculation, quickly reconstruct abnormal data, and reduce node load; the anomaly detection function constructed by combining local intrusion log data with the federal proximal algorithm can identify anomalies in data storage and transmission, and timely prevent security risks. In terms of performance improvement, the main storage block, candidate storage blockchain architecture and data dynamic allocation mechanism effectively disperse data reading and writing pressure, achieve storage node load balancing, improve the read and write performance of the blockchain system, reduce business processing delays in large-scale data reading and writing scenarios, and reduce the risk of business interruption caused by performance bottlenecks. It can be widely used in large-scale application scenarios such as financial transactions and Internet of Things data storage.
[0020] See also Figure 2 A second embodiment of a data storage method based on blockchain in an embodiment of the present invention includes: 201. A consensus node set is selected from the storage network based on the preset proof-of-stake mechanism. In this embodiment, the Proof of Stake (PoS) mechanism uses the stake held by nodes (such as the number of tokens, data storage duration, network contribution, etc.) as the basis for election. The stake value of each node is calculated through weighted calculation. Compared with Proof of Work (PoW), this mechanism reduces energy consumption and ensures the security and consensus efficiency of the blockchain system. 202. Obtaining the first blockchain and the second blockchain from the storage network according to the consensus node set and the anomaly detection result; In this embodiment, the first blockchain stores core data with high integrity and strong security (such as financial transaction records and user identity information), which is maintained by high-performance consensus nodes to ensure fast reading and writing and data security. The second blockchain stores data to be verified, infrequently accessed data, or abnormal data (such as temporary backups and suspicious transaction logs), which is managed by standby or low-load nodes to achieve risk isolation and rational resource utilization. 203. Generate optimization parameters based on the anomaly detection results; In this embodiment, the optimization parameters include: data redundancy parameters, storage location parameters, data shard size, node load threshold and security policy parameters; 204. Generate a storage strategy based on a preset genetic algorithm, optimization parameters, and a preset storage cost model; In this embodiment, the genetic algorithm simulates the natural evolution process (selection, crossover, and mutation) and iteratively searches for the optimal storage strategy using optimization parameters and a storage cost model as input. The storage cost model comprehensively considers storage capacity cost, read and write energy consumption cost, maintenance and management cost, and risk repair cost. 205. Divide the original data set according to the storage strategy to obtain a primary storage data set and a candidate storage data set; 206. Store the primary storage dataset and the candidate storage dataset in the first blockchain and the second blockchain respectively to obtain a primary storage blockchain and a candidate storage blockchain; In this embodiment, the primary storage dataset contains frequently accessed and highly important data and is stored in the first blockchain to ensure rapid business response. The candidate storage dataset covers low-frequency data, temporary data, or abnormal data to be processed and is stored in the second blockchain to reduce the use of core storage resources. In this embodiment, a proof-of-stake mechanism is used to elect consensus nodes, which reduces energy consumption compared to proof-of-work while ensuring system security and consensus efficiency. The dual-blockchain architecture partitions and stores data based on data characteristics to achieve risk isolation. Core data is maintained by high-performance nodes to ensure read and write efficiency and security, while data to be verified or low-frequency data is managed by standby nodes to achieve rational resource utilization. Optimization parameters are generated based on anomaly detection, and a genetic algorithm and a storage cost model are combined to dynamically generate the optimal storage strategy, comprehensively considering multiple types of costs and reducing resource waste. Data sets are divided and stored in categories, so that high-frequency and important data can quickly respond to business needs, and low-frequency or abnormal data can reduce core storage pressure, thereby improving system performance, reducing costs, enhancing security and flexibility, and being suitable for multi-scenario applications.
[0021] See also Figure 3 A third embodiment of a blockchain-based data storage method according to an embodiment of the present invention includes: 301. Obtain the consensus master node from the consensus node set; In this embodiment, the consensus master node is obtained from the consensus node set. The consensus node set is elected by a preset proof-of-stake mechanism. These nodes are qualified to participate in the blockchain consensus process. The consensus master node, as the core node, is selected from the consensus node set through further screening (e.g., the highest stake value, the best network stability, etc.); 302. The master node obtains the first blockchain from the storage network according to the consensus; In this embodiment, the first blockchain is primarily used to store critical, frequently accessed data, such as core records of financial transactions and important user identity information. Due to the leadership and management of the consensus masternode, data storage and reading and writing on the first blockchain are ensured to be highly efficient and reliable, providing solid data support for important businesses. 303. Perform equity analysis on the original data set according to the anomaly detection result to obtain an equity analysis result; In this embodiment, anomaly detection results reflect information such as the security status and integrity of the data. When conducting rights and interests analysis, this anomaly information is combined to clarify the ownership of rights, circulation rules, and usage restrictions associated with the data. For example, for data that is found to be at risk of tampering due to anomaly detection, the rights (such as requesting data recovery and accountability) and obligations (such as cooperating with investigations) of the equity holder are analyzed. For complete and secure data, the rights and benefits distribution rules of the equity holder are determined. This analysis makes the data rights and interests relationship clearer and more explicit. 304. Obtain a second blockchain from the storage network based on the equity analysis results; In this embodiment, the results of the equity analysis provide a basis for data storage on the second blockchain. Data with complex equity relationships, contentious issues, or pending verification is stored on the second blockchain. The second blockchain can be composed of relatively weak or standby nodes specifically designed to handle this type of special data. This design enables classified storage and differentiated management of data, preventing interference between data of different natures. It also enables the adoption of targeted storage and management strategies based on the equity characteristics of the data. In this embodiment, in terms of node management, consensus master nodes are selected from the consensus nodes elected by the proof-of-stake mechanism, and their core position is ensured based on the equity value and network stability. They then take the lead in building the first blockchain, ensuring the efficiency and reliability of key high-frequency data storage, and building a solid data foundation for important businesses. In terms of data equity processing, data security and integrity are analyzed based on the results of anomaly detection, and the ownership, transfer and use rules of equity are clarified to make the data equity relationship clearly identifiable. Based on the equity analysis results, complex, controversial or to-be-verified data are stored in the second blockchain composed of candidate nodes to achieve data classification storage and differentiated management. This not only avoids data interference, but also formulates storage strategies based on the characteristics of data equity, optimizes resource allocation, enhances data security and system adaptability, and meets the needs of diverse business scenarios.
[0022] See also Figure 4 A fourth embodiment of a blockchain-based data storage method according to an embodiment of the present invention includes: 401. Generate an initial chromosome population according to the optimized parameters; 402. Calculate the fitness of each chromosome in the initial chromosome population according to the storage cost model and the preset reliability constraint to obtain a fitness set; In this embodiment, the fitness is calculated for each chromosome, and the comprehensive advantages and disadvantages of the storage strategy can be evaluated to form a fitness set; 403. Obtain the optimal fitness from the fitness set; 404. Obtaining a parent chromosome population from the initial chromosome population according to the optimal fitness; 405. Performing crossover processing on the parent chromosome population to obtain the offspring chromosome population; 406. Perform mutation processing on the offspring chromosome population according to a preset mutation probability and a preset number of iterations to obtain an adapted chromosome population; In this embodiment, a crossover operation is performed on the parent population to integrate the advantages of different strategies; mutation is performed according to a preset mutation probability and number of iterations, a new strategy may be introduced, and a progeny population is generated, and an adaptive chromosome population is obtained through iteration; 407. Generate a storage strategy based on a genetic algorithm and an adapted chromosome population; In this embodiment, based on the genetic algorithm, the final storage strategy is extracted from the adaptive chromosome population, which can guide the data storage allocation; In this embodiment, the initial chromosome population is constructed by optimizing parameters, the fitness is calculated using a storage cost model and reliability constraints, the comprehensive advantages and disadvantages of the strategies are evaluated, high-quality parents are screened, and new possibilities are introduced through cross-integration advantages and mutations to iterate the adapted population; the ultimately refined storage strategy can dynamically balance cost and reliability, adapt to diverse scenarios, efficiently discover high-quality solutions, optimize resource allocation, and provide intelligent, efficient, and adaptive strategy support for blockchain storage, helping to make data storage allocation more scientific and achieve better performance.
[0023] See also Figure 5 A fifth embodiment of a data storage method based on blockchain in an embodiment of the present invention includes: 501. Analyze the primary storage data set and the candidate storage data set to obtain storage requirements and storage resource sets; In this embodiment, the primary storage dataset and candidate storage datasets are deeply analyzed to extract storage requirements (such as data access frequency, security level, and storage capacity requirements). At the same time, the storage resource set (node storage capacity, bandwidth, computing performance, etc.) is sorted out to lay the foundation for subsequent storage adaptation. 502. Generate an encryption matrix based on the preset on-chain storage cost coefficient, storage resource set, and storage requirements; In this embodiment, the encryption matrix considers cost and resource adaptability, determines parameters such as encryption algorithm, key length, encryption partition, etc., and realizes the coordination between encryption strategy and storage scenario; 503. Encrypt the primary storage data set and the candidate storage data set according to the encryption matrix to obtain an encrypted primary storage data set and an encrypted candidate storage data set; In this embodiment, the primary and candidate storage datasets are encrypted in a targeted manner based on the encryption matrix. The primary dataset is related to core business, and the encryption strength and algorithm are adapted to its high security requirements. The candidate datasets are appropriately encrypted as needed, balancing security and storage costs to generate encrypted primary and candidate storage datasets. 504. Store the encrypted primary storage dataset and the encrypted candidate storage dataset in the first blockchain and the second blockchain, respectively, to obtain a primary storage blockchain and a candidate storage blockchain; In this embodiment, the distributed and tamper-proof characteristics of blockchain are utilized, combined with encryption to ensure data storage security, and storage is divided into different chains according to demand to optimize resource utilization and access efficiency; In this embodiment, by deeply analyzing the access frequency, security level and other storage requirements of the main storage data set and the candidate storage data set, combined with the current resource status of node storage capacity, bandwidth and other resources, the resource supply and business needs are matched; an encryption matrix is generated based on the on-chain storage cost coefficient, and parameters such as the encryption algorithm and key length are dynamically determined. A high-intensity encryption strategy is adopted for core business data, and lightweight processing is performed on ordinary data, effectively balancing security protection and storage costs; at the same time, relying on the distributed storage and tamper-proof characteristics of blockchain, the differentially encrypted data is stored in the dual blockchains respectively, realizing data classification storage and fast access, optimizing resource allocation efficiency, and improving system response speed, providing a flexible, efficient and secure full-process solution for blockchain storage.
[0024] See also Figure 6 A sixth embodiment of a blockchain-based data storage method according to an embodiment of the present invention includes: 601. Calculate the storage resource set and storage requirements according to a preset verifiable random function to obtain a random number and a symmetric key; In this embodiment, the characteristics of the verifiable random function ensure that the calculation results are verifiable and unpredictable. The generated random numbers and symmetric keys are random and secure, laying the foundation for subsequent encryption. 602. Split the symmetric key according to a preset key splitting method and a random number to obtain a fragment recovery key set; In this embodiment, the symmetric key can be split using the Lagrange interpolation algorithm and random numbers. Based on mathematical principles, this algorithm converts the symmetric key into a polynomial constant term. By generating a random polynomial and evaluating it at different points, the key is split into multiple fragments. Only when a certain number of fragments are collected can the original key be restored. This feature enhances key security. Even if some fragments are leaked, the key cannot be restored, effectively resisting attacks. At the same time, its flexible threshold setting can adapt to different security requirements. In the blockchain multi-node collaborative environment, it can not only ensure decentralized key management, but also ensure rapid recovery when necessary. The introduction of random numbers further enhances the randomness and unpredictability of the splitting process, laying a solid security foundation for subsequent encryption matrix construction and data storage encryption, significantly improving the overall security and reliability of the blockchain storage system. 603. Construct an encryption matrix based on the on-chain storage cost coefficient and the fragment recovery key set; In this embodiment, the encryption matrix intelligently adjusts encryption strategies based on the cost of storage resources, incorporating the on-chain storage cost coefficient. For example, it uses lightweight encryption algorithms for data on high-cost storage nodes to reduce computing overhead and storage costs, while moderately increasing encryption strength for low-cost nodes to improve security. This dynamic adaptation based on the dual dimensions of cost and security maximizes resource utilization while ensuring data security, providing a cost-effective, secure, and reliable encryption solution for blockchain storage systems. In this embodiment, a verifiable random function is used to generate random numbers and symmetric keys based on storage resources and needs, ensuring the randomness and verifiability of the keys and protecting encryption security from the source. Secondly, the symmetric keys are split with the help of the Lagrange interpolation algorithm, and key shard management is achieved through polynomial mathematical principles. The recovery threshold is flexibly set to prevent the risk of single-point leakage and adapt to the needs of multi-node collaboration. Finally, an encryption matrix is constructed by combining the on-chain storage cost coefficient and key fragments, and the encryption strategy is dynamically adjusted. Lightweight encryption is used to reduce overhead in high-cost nodes and to enhance encryption strength in low-cost nodes. This balances resource utilization and data security, providing an integrated solution for blockchain storage that takes into account performance, cost, and security.
[0025] See also Figure 7 A seventh embodiment of a data storage method based on blockchain in an embodiment of the present invention includes: 701. Obtain network environment information and analyze the storage network based on the network environment information to obtain node activity. In this embodiment, by collecting and storing network environment information (such as node online time, data transmission rate, response delay, packet loss rate, etc.) in real time, the complex state of the network environment is converted into a quantitative activity value, providing a data basis for subsequent decision-making; 702. Encode the node activity according to the basic encoding formula to obtain the active quantum state; In this embodiment, the basic encoding formula used in this embodiment is such as a normalization function, a Sigmoid function, etc. When the normalization function is used, the basic encoding formula is expressed as follows: ,This encoding process eliminates the dimensional differences in the activity values of different nodes, making the states of each node comparable, and at the same time converts the network state of the physical world into digital features that are easy to calculate; 703. Generate a basic redundancy factor based on the active quantum state, the preset standard quantum state, and the adjustment coefficient; In this embodiment, the basic redundancy factor can be generated by the above formula: ,in, is the adjustment coefficient ( >0), n is the number of active quantum states. When the actual active quantum state is lower than the standard quantum state, the basic redundancy factor automatically increases, and vice versa, it decreases, thus realizing the dynamic association between redundancy and network environment; 704. Perform redundancy calculation on the original data set according to the basic redundancy factor to obtain a redundant data set; In this embodiment, the generated redundant data set can add redundant check blocks when the network environment is poor to improve data fault tolerance; reduce redundancy when the network is stable, reduce storage costs, and achieve dynamic optimization of redundancy strategy; In this embodiment, network environment information such as node online time and transmission rate is collected in real time and quantified into node activity values to provide data support for decision-making; encoding methods such as normalization functions are used to eliminate dimensional differences and convert physical network states into computable digital features; based on active quantum states, standard quantum states and adjustment coefficients, basic redundancy factors are dynamically generated to achieve intelligent linkage between redundancy and network environment; when the network environment is poor, redundant check blocks are automatically added to improve data fault tolerance; when the network is stable, redundancy is reduced to reduce storage costs; this solution effectively avoids the waste of resources of traditional fixed redundancy, and while ensuring data reliability, it has environmental adaptability and scenario versatility.
[0026] See also Figure 8 An eighth embodiment of a blockchain-based data storage method according to an embodiment of the present invention includes: 801. Perform federation aggregation calculation on the local intrusion log data according to the federation proximal algorithm to obtain a federation aggregation coefficient; 802. Construct an anomaly detection function based on the federation aggregation coefficient and the local intrusion log data; In this embodiment, the anomaly detection function expression is: ,in, This is the process of obtaining the federation aggregation coefficient by performing federation aggregation calculation on local intrusion log data through the federation proximal algorithm. is the global model parameter of the tth iteration, is the coefficient to be solved, is the preset proximal term coefficient, For the The model parameters of the client after the t+1th iteration; is the anomaly detection function; In this embodiment, the advantages of federated learning are utilized to perform federated aggregate computing while protecting data privacy, thereby improving detection accuracy. This enables the constructed anomaly detection function to effectively identify anomalies, build a strong defense line for data storage security, balance privacy and detection efficiency, and assist in anomaly prevention in blockchain storage scenarios.
[0027] The above describes a data storage method based on blockchain in an embodiment of the present invention. The following describes a data storage device based on blockchain in an embodiment of the present invention. Figure 9 In one embodiment of the present invention, a data storage device based on blockchain includes: Data acquisition module 1, used to obtain local intrusion log data and original data sets; Redundancy calculation module 2, used to perform redundancy calculation on the original data set according to a preset basic encoding formula and a preset adjustment coefficient to obtain a redundant data set; Function construction module 3, used to construct an anomaly detection function based on local intrusion log data and a preset federated proximal algorithm; Result detection module 4, used to perform anomaly detection on the original data set according to the redundant data set and the anomaly detection function to obtain an anomaly detection result; Storage module 5, used to obtain a storage network and store the original data set in the storage network according to the anomaly detection results to obtain a primary storage blockchain and a candidate storage blockchain; In this embodiment, in terms of storage cost control, the redundant computing strategy abandons the full-data chain mode and uses coding technology to generate redundant data sets, which reduces the actual storage capacity on the chain, making the storage cost show a more reasonable growth trend with the data scale, avoiding the waste of resources caused by linear or super-linear growth; in terms of data security and reliability, redundant data can not only be used to automatically repair hacked or damaged data and ensure data integrity, but also optimize reading efficiency through pre-calculation, quickly reconstruct abnormal data, and reduce node load; the anomaly detection function constructed by combining local intrusion log data with the federal proximal algorithm can identify anomalies in data storage and transmission, and timely prevent security risks. In terms of performance improvement, the main storage block, candidate storage blockchain architecture and data dynamic allocation mechanism effectively disperse data reading and writing pressure, achieve storage node load balancing, improve the read and write performance of the blockchain system, reduce business processing delays in large-scale data reading and writing scenarios, and reduce the risk of business interruption caused by performance bottlenecks. It can be widely used in large-scale application scenarios such as financial transactions and Internet of Things data storage.
[0028] Figure 10 Figure 9 is a schematic diagram of the structure of a blockchain-based data storage device provided by an embodiment of the present invention. This blockchain-based data storage device 900 may vary significantly due to different configurations or performance. It may include one or more processors (central processing units, CPUs) 910 (e.g., one or more processors), memory 920, and one or more storage media 930 (e.g., one or more mass storage devices) storing applications 933 or data 932. The memory 920 and storage medium 930 may be either ephemeral or persistent storage. The program stored in the storage medium 930 may include one or more modules (not shown), each of which may include a series of instructions operating on the blockchain-based data storage device 900. Furthermore, the processor 910 may be configured to communicate with the storage medium 930 to execute the series of instructions stored in the storage medium 930 on the blockchain-based data storage device 900, thereby implementing the steps of the blockchain-based data storage method provided in the aforementioned method embodiments.
[0029] A blockchain-based data storage device 900 may also include one or more power supplies 940, one or more wired or wireless network interfaces 950, one or more input and output interfaces 960, and / or one or more operating systems 931, such as Windows Server, Mac OS X, Unix, Linux, FreeBSD, etc. It will be understood by those skilled in the art that Figure 10The structure of a blockchain-based data storage device shown does not constitute a limitation of a blockchain-based data storage device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0030] The present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium. The computer-readable storage medium stores instructions that, when executed on a computer, cause the computer to execute steps of a blockchain-based data storage method.
[0031] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described systems, devices, and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0032] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the portion that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes various media that can store program code, such as a USB flash drive, a mobile hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0033] Finally, it should be noted that the above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art will be able to modify the technical solutions described in the aforementioned embodiments or substitute equivalents for some of the technical features. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention shall be included within the scope of protection of the present invention.
Claims
1. A data storage method based on blockchain, characterized in that: include: Obtain local intrusion log data and original datasets; Performing redundancy calculation on the original data set according to a preset basic coding formula and a preset adjustment coefficient to obtain a redundant data set; An anomaly detection function is constructed based on local intrusion log data and the preset federated proximal algorithm; Perform anomaly detection on the original data set according to the redundant data set and the anomaly detection function to obtain an anomaly detection result; Obtain a storage network, and store the original data set in the storage network according to the anomaly detection results to obtain the primary storage blockchain and the candidate storage blockchain.
2. A data storage method based on blockchain according to claim 1, characterized in that: The method of storing the original data set in the storage network according to the anomaly detection results to obtain the primary storage blockchain and the candidate storage blockchain includes: A consensus node set is elected from the storage network based on the preset proof-of-stake mechanism; Obtaining the first blockchain and the second blockchain from the storage network based on the consensus node set and the anomaly detection result; Generate optimization parameters based on anomaly detection results; Generate a storage strategy based on a preset genetic algorithm, optimization parameters, and a preset storage cost model; Divide the original data set according to the storage strategy to obtain the primary storage data set and the candidate storage data set; The primary storage data set and the candidate storage data set are stored in the first blockchain and the second blockchain respectively to obtain the primary storage blockchain and the candidate storage blockchain.
3. A data storage method based on blockchain as claimed in claim 2, characterized in that: The obtaining of the first blockchain and the second blockchain from the storage network according to the consensus node set and the anomaly detection result includes: Obtain the consensus master node from the consensus node set; The master node obtains the first blockchain from the storage network according to the consensus; Perform equity analysis on the original data set based on the anomaly detection results to obtain equity analysis results; The second blockchain is obtained from the storage network based on the equity analysis results.
4. A data storage method based on blockchain as claimed in claim 2, characterized in that: The generating of the storage strategy according to the preset genetic algorithm, optimization parameters and the preset storage cost model includes: Generate an initial chromosome population according to the optimized parameters; The fitness of each chromosome in the initial chromosome population is calculated according to the storage cost model and the preset reliability constraints to obtain a fitness set; Obtain the optimal fitness from the fitness set; Obtain the parent chromosome population from the initial chromosome population according to the optimal fitness; Perform crossover processing on the parent chromosome population to obtain the offspring chromosome population; The offspring chromosome population is mutated according to a preset mutation probability and a preset number of iterations to obtain an adapted chromosome population; Generate storage strategies based on genetic algorithms and adapt chromosome populations.
5. A data storage method based on blockchain as claimed in claim 2, characterized in that: The storing the primary storage data set and the candidate storage data set in the first blockchain and the second blockchain respectively to obtain the primary storage blockchain and the candidate storage blockchain includes: Analyze the primary storage data set and the candidate storage data set to obtain storage requirements and storage resource sets; Generate an encryption matrix based on the preset on-chain storage cost coefficient, storage resource set, and storage requirements; Encrypting the primary storage data set and the candidate storage data set according to the encryption matrix to obtain an encrypted primary storage data set and an encrypted candidate storage data set; The encrypted primary storage data set and the encrypted candidate storage data set are stored in the first blockchain and the second blockchain respectively to obtain the primary storage blockchain and the candidate storage blockchain.
6. A data storage method based on blockchain according to claim 5, characterized in that: Generating an encryption matrix based on a preset on-chain storage cost coefficient, a storage resource set, and storage requirements includes: Calculate the storage resource set and storage requirements based on a preset verifiable random function to obtain a random number and a symmetric key; Split the symmetric key according to the preset key splitting method and random number to obtain a fragment recovery key set; The encryption matrix is constructed based on the in-chain storage cost coefficient and the fragment recovery key set.
7. A data storage method based on blockchain according to claim 1, characterized in that: The redundancy calculation of the original data set according to the preset basic encoding formula and the preset adjustment coefficient to obtain the redundant data set includes: Obtain network environment information and analyze the storage network based on the network environment information to obtain node activity; Encode the node activity according to the basic encoding formula to obtain the active quantum state; Generate a basic redundancy factor according to the active quantum state, the preset standard quantum state and the adjustment coefficient; The redundancy calculation is performed on the original data set according to the basic redundancy factor to obtain a redundant data set.
8. The data storage method based on blockchain according to claim 1, characterized in that: The anomaly detection function constructed based on local intrusion log data and a preset federated proximal algorithm includes: Perform federation aggregation calculation on local intrusion log data according to the federation proximal algorithm to obtain the federation aggregation coefficient; The anomaly detection function is constructed based on the federation aggregation coefficient and local intrusion log data.
9. A data storage device based on blockchain, characterized in that: include: Data acquisition module, used to obtain local intrusion log data and original data sets; A redundancy calculation module, configured to perform redundancy calculation on the original data set according to a preset basic encoding formula and a preset adjustment coefficient to obtain a redundant data set; Function construction module, used to construct anomaly detection function based on local intrusion log data and preset federated proximal algorithm; A result detection module is used to perform anomaly detection on the original data set based on the redundant data set and the anomaly detection function to obtain an anomaly detection result; The storage module is used to obtain the storage network and store the original data set in the storage network according to the anomaly detection results to obtain the main storage blockchain and the candidate storage blockchain.
10. A data storage device based on blockchain, characterized in that: include: a memory and at least one processor, wherein instructions are stored in the memory; At least one of the processors calls the instructions in the memory to enable the blockchain-based data storage device to perform the various steps of the blockchain-based data storage method as described in any one of claims 1 to 8.