Credible adaptive file distribution method based on block chain
By reading the registration information of nodes on the blockchain and selecting an appropriate allocation model, the files are allocated and stored, and the problem that the trustworthiness of storage units in the prior art is not considered is solved, and efficient and secure data storage and allocation are achieved.
Patent Information
- Application Number
- CN202411737055.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2024-08-16
- Filing Date
- 2024-11-29
- Publication Date
- 2025-03-21
AI Technical Summary
The existing distributed file storage system fails to effectively consider the trust of the storage unit, resulting in the system being vulnerable to security attacks and lacks efficient data allocation algorithms to enhance the system's disaster recovery capabilities.
A trusted adaptive file allocation method based on blockchain is proposed. By reading the registration information of nodes, a registration information form is generated, the number of registration nodes is compared with the preset initial demand quantity, a scattered or centralized allocation model is selected, the files are allocated, and the file distribution form is uploaded to the blockchain network.
It improves the efficiency and security of data storage, reduces the risks of data leakage and privacy violations, and enhances the system's disaster recovery capabilities.
Smart Images

Figure CN119676255A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of blockchain, and in particular relates to a trusted adaptive file allocation method based on blockchain. Background Art
[0002] Distributed storage technology refers to a data storage technology that distributes data on multiple independent devices or nodes to provide flexible storage services and form a unified resource pool that can be accessed by users and applications. It is used to solve the problem of the rapid growth of computer storage data in the era of big data, but the lack of efficient data storage methods. Blockchain technology is a decentralized distributed ledger that is tamper-proof, secure and reliable, and its decentralized characteristics provide a new solution to the needs of distributed storage systems. However, the current distributed file storage system does not take the trustworthiness of the storage unit into consideration, which may increase the risk of the system being attacked by security attacks, such as data leakage and privacy infringement. Nowadays, there is a lack of a reliable and efficient data allocation algorithm that can enhance the disaster recovery capability of the system. Therefore, in response to this problem, the present invention proposes a trusted adaptive file allocation method based on blockchain to improve the efficiency and security of data storage. Summary of the invention
[0003] The purpose of the present invention is to propose a trusted adaptive file distribution method based on blockchain.
[0004] The technical solution of the present invention is: a trusted adaptive file allocation method based on blockchain, characterized in that it includes the following steps:
[0005] S1: Read the registration information of the node to generate a registration information form;
[0006] S2: Compare the number of registration nodes in the registration information form with the preset initial demand number to obtain the size relationship;
[0007] S3: Select a decentralized allocation model or a centralized allocation model as the file allocation strategy based on different size relationships;
[0008] S4: Allocate files according to the determined file allocation strategy to generate a file distribution form;
[0009] S5: Upload the file distribution form to the blockchain network.
[0010] Furthermore, step S1 includes the following sub-steps:
[0011] S11. The situation selection unit reads the registration information of the data storage node on the blockchain.
[0012] Among them, the situation selection unit is a module in the trusted adaptive file allocation method, which is responsible for reading the registration information of the data custodian node on the blockchain and selecting different file allocation strategies according to different situations. The data custodian node is a node that is qualified to participate in file storage activities. The registration information includes the ID of each registered data custodian node and three indicators to determine the trustworthiness of the data custodian node: reputation, load situation and credit points.
[0013] Among them, reputation is an indicator to measure the long-term trustworthiness of data storage nodes. Load is an indicator to measure the ability of data storage nodes to store file information completely, and it is also an important indicator to promote the balanced distribution of system file information. Credit points are an indicator to measure the short-term trustworthiness of data storage nodes;
[0014] S12. After reading is completed, the situation selection unit counts the registration information and generates a registration information form.
[0015] Furthermore, step S2 includes the following sub-steps:
[0016] S21. The situation selection unit reads the number of registration nodes in the registration information form and the preset initial demand number.
[0017] The initial required quantity is a value preset within the algorithm, which determines the number of copies of the file that need to be stored.
[0018] N R =S×K
[0019] Among them, S is the number of copies of the file. The file exists in the form of divided file blocks before being allocated for storage; K is the number of redundant copies of the file initially set, that is, the number of copies of the file;
[0020] S22. Through comparison, the situation selection unit obtains the size relationship between the number of registered nodes and the initial demand number.
[0021] Furthermore, step S3 includes the following sub-steps:
[0022] S31. If the number of registered nodes is greater than the initial required number, the situation selection unit selects a decentralized allocation mode as the file allocation strategy;
[0023] S32: If the number of registered nodes is less than or equal to the initial required number, the situation selection unit selects a centralized allocation mode as the file allocation strategy.
[0024] Furthermore, step S4 includes the following sub-steps:
[0025] S41, the situation selection unit allocates files using a decentralized allocation model to generate a file distribution form;
[0026] S42. The situation selection unit allocates files using a centralized allocation model to generate a file distribution form.
[0027] Further, step S41 includes the following sub-steps:
[0028] S411, the situation selection unit reads the three attributes of the reputation, load situation and credit points of each node in the registration information form;
[0029] S412. Randomly initialize weights ω1, ω2, ω3.
[0030] Among them, ω1, ω2, and ω3 are the weights corresponding to the reputation, load condition, and credit point attributes respectively;
[0031] S413. Calculate the score of each data storage node:
[0032] Score=ω1·credibility+ω2·loadState+ω3·Deposit
[0033] Among them, Score represents the score of a data storage node, credibility refers to the reputation, loadState refers to the load status, and Deposit refers to the credit points;
[0034] S414. Based on the node score, the algorithm uses the Softmax function to calculate the probability of each node being selected:
[0035]
[0036] Among them, the Softmax function is a special function used to map a set of real numbers into a probability distribution. P(i) is the probability of node i being selected, s i is the score of node i, T is the temperature parameter, ∑ j It means summing all nodes.
[0037] The temperature parameter T is used to control randomness. When T is large, the increase in T will make the probability distribution flatter, making the selection process close to uniform randomness. When T is small, the decrease in T will make the probability distribution sharper, making high-scoring nodes more likely to be selected;
[0038] S415 . Divide the nodes into S groups based on the probability of each node being selected, thereby forming an initial node allocation scheme.
[0039] Among them, S represents the number of copies the file is divided into;
[0040] S416. Calculate the fitness score of the initial allocation scheme:
[0041] FitnessScore=tanh(α·(Sum-S·Mean))+Penalty
[0042] Among them, FitnessScore refers to the fitness score, which reflects the quality of a grouping scheme; α is the amplification factor; Sum is the sum of the three attributes of reputation, load, and credit points in each group; S is the number of file divisions, which is also the number of groups; Mean is the average of the sum of the three attributes of reputation, load, and credit points of all data storage nodes participating in this storage activity; Penalty is a penalty term based on constraints to ensure the credibility of the allocation scheme; tanh is the hyperbolic tangent function;
[0043] S417, when the current fitness score is better, the current grouping scheme and the current weight are updated to the optimal grouping scheme and the optimal weight;
[0044] S418, based on the current optimal weight, add random disturbance and normalize, keep the weight sum to 1, and obtain a new weight;
[0045] S419, based on the new weights, by selecting, crossing and compiling individuals of the grouping scheme, iterating continuously to gradually approach the optimal allocation scheme and generate a file distribution form.
[0046] Further, step S42 includes the following sub-steps:
[0047] S421. Calculate a new redundancy number K' using a dynamic redundancy factor counter.
[0048] The dynamic redundancy factor counter is a calculation module in the centralized allocation model of the algorithm, which is used to generate and dynamically adjust a new redundancy factor K';
[0049] S422. Based on the new redundancy factor K', use the intelligent node selector to screen and group the nodes to generate a file distribution form.
[0050] Among them, the intelligent node selector is a module in the centralized allocation model of the proposed algorithm, which is used to screen and group nodes to obtain the best allocation plan.
[0051] Furthermore, step S421 includes the following sub-steps:
[0052] S4211. The dynamic redundancy factor counter reads the registration information form to initialize the value range of the new redundancy number K'.
[0053] Among them, the value range of the new redundant number K' is [K min , K max ].
[0054] Among them, K min = K, and K max = M * N E / S. K is the initially set redundant quantity, and S is the number of sub - files after file splitting. M is the maximum number of times a node can store a file, meaning that a node can have at most M sub - files split from the same file. 0 < M ≤ S, and both M and S are integers. N E is the number of registered nodes;
[0055] S4212. The dynamic redundancy factor counter initializes the proportion of the number of low - credibility nodes:
[0056]
[0057] Among them, LC racio refers to the proportion of the number of low - credibility nodes, which is the proportion of the number of low - credibility nodes among the registered nodes calculated based on the information in the registration information form. N LC represents the number of nodes with a credibility value lower than the passing credibility value;
[0058] S4213. The dynamic redundancy factor counter initializes the DQN algorithm network.
[0059] Among them, the DQN algorithm (Deep Q - Network, DQN) is a reinforcement learning algorithm that combines the Q - Learning algorithm and a deep neural network and can make effective decisions in a complex environment. The Q - Learning algorithm is a value - based reinforcement learning method that finds the optimal policy by iteratively updating the Q - value to maximize the cumulative future reward;
[0060] S4214. The dynamic redundancy factor counter optimizes the selection strategy of the redundant copies through the DQN network, and uses the evaluation function f(K′, λ, σ, μ b ) to select the best redundant copy number K';
[0061] Among them, the evaluation function is used to evaluate the effect of the current redundant copy number K' relative to the optimal redundant copy number μ b , and the evaluation function is:
[0062]
[0063] Among them, μ b = K max ·(1 - exp{-λ·LC racio}); λ reflects the sensitivity to LC racio ; σ controls the convergence speed of the evaluation function; μ b is the optimal redundant copy number that dynamically adjusts as LC racio increases.
[0064] Further, step S422 includes the following sub-steps:
[0065] S4221. The intelligent node selector initializes weights ω1, ω2, ω3 to calculate the score Score of each data custodian node participating in the storage.
[0066] Among them, ω1, ω2, and ω3 are the weights corresponding to the reputation, load, and credit point attributes. Data custody node score
[0067] Score=ω1·credibility+ω2·loadState+ω3·Deposit
[0068] Score represents the score of a data storage node, credibility refers to the reputation, loadState refers to the load status, and Deposit refers to the credit points;
[0069] S4222. Based on the new redundancy factor K′, the intelligent node selector screens according to the score of each node to form a grouping scheme;
[0070] S4223, calculating how many times each node in the grouping scheme stores the file;
[0071] S4224, the intelligent node selector continuously iterates to form a new grouping scheme until no node has a file storage count higher than the node's maximum file storage count M;
[0072] S4225, calculating the fitness score FitnessScore of the new grouping scheme;
[0073] S4226, when the current fitness score FitnessScore is better, update the best grouping scheme and the best fitness score;
[0074] S4227. The intelligent node selector changes the current weight, continuously iterates to form the optimal allocation plan and generates a file distribution form. BRIEF DESCRIPTION OF THE DRAWINGS
[0075] Figure 1 The present invention is a flow chart of the method.
[0076] Figure 2 It is the average reputation of the nodes screened out by the method proposed in the present invention under the conditions of different proportions of nodes with medium reputation.
[0077] Figure 3 The paper demonstrates how the method proposed in the present invention can effectively maintain the stability of the average reputation of nodes when the number of registered nodes is less than or equal to the initial required number.
[0078] Figure 4 Shows N E >N R With N E ≤N R In the two cases, the method proposed in the present invention screens out the load conditions of the nodes.
[0079] Figure 5 Shows N E >N R With N E ≤N R In the two cases, the method proposed in the present invention screens out the credit points of the node.
[0080] Figure 6 Shown in N R / N E =20% and N R / N E =120% Under the two conditions, how does the load balancing factor of nodes in different reputation intervals change as the number of files processed increases?
[0081] Figure 7 Shows N E >N R With N E ≤N R In the two cases, facing different proportions of malicious nodes, the method proposed in this invention and other four distributed file storage solutions (HDFS, CRUSH, DHT, CH) have the ability to successfully recover files. DETAILED DESCRIPTION
[0082] The embodiments of the present invention will be further described below in conjunction with the accompanying drawings.
[0083] like Figure 1 As shown, the present invention provides a trusted adaptive file allocation method based on blockchain, comprising the following steps:
[0084] S1. Read the registration information of the node to generate a registration information form;
[0085] S2: Compare the number of registration nodes in the registration information form with the preset initial demand number to obtain the size relationship;
[0086] S3: Select a decentralized allocation model or a centralized allocation model as the file allocation strategy based on different size relationships;
[0087] S4: Allocate files according to the determined file allocation strategy to generate a file distribution form;
[0088] S5: Upload the file distribution form to the blockchain network.
[0089] In an embodiment of the present invention, if a computer node on the blockchain wants to participate in this storage activity, it needs to register and pay a membership fee to become a data custodian node to obtain activity qualifications. In consideration of the security and stability of file storage, it is necessary to set indicators of different dimensions to measure the trustworthiness and storage capacity of data custodian nodes in many aspects, and screen the data custodian nodes based on this. Based on the above problems, an embodiment of the present invention sets three indicators when registering computer nodes on the blockchain: credibility, load conditions and credit points to measure node performance. An embodiment of the present invention also sets a situation selection unit to collect indicators of data custodian nodes, and collects these indicators as registration information to complete the registration information preparation work before the start of the file storage activity. Based on the above ideas, the following registration information statistics method is proposed.
[0090] In the embodiment of the present invention, step S1 includes the following sub-steps:
[0091] S11. The situation selection unit reads the registration information of the data storage node on the blockchain.
[0092] Among them, the situation selection unit is a module in the trusted adaptive file allocation method, which is responsible for reading the registration information of the data custodian node on the blockchain and selecting different file allocation strategies according to different situations. The data custodian node is a node that is qualified to participate in file storage activities. Ordinary nodes pay a membership fee exceeding the set threshold value to become a data custodian node. The registration information includes the ID of each registered data custodian node and three indicators to determine the trustworthiness of the data custodian node: reputation, load situation and credit points.
[0093] Among them, reputation is an indicator to measure the long-term trustworthiness of data storage nodes. Load is an indicator to measure the ability of data storage nodes to store file information completely, and it is also an important indicator to promote the balanced distribution of system file information. Credit points are an indicator to measure the short-term trustworthiness of data storage nodes;
[0094] The embodiment of the present invention evaluates the trustworthiness of data storage nodes from multiple dimensions by setting three indicators: credibility, load status and credit points, clearly and specifically depicts the long-term and short-term trustworthiness and file storage capacity of the nodes, and provides a basis for file distribution.
[0095] S12, after the reading is completed, the situation selection unit counts the registration information and generates a registration information form;
[0096] In an embodiment of the present invention, in order to protect the security of files during storage and to more fully and flexibly call storage resources, the files to be stored should be copied, split and encrypted into encrypted file blocks before being allocated, and the files actually stored should also be encrypted file blocks. The allocation strategy adopted by the current general distributed file storage method lacks flexibility in facing different storage environments in actual platform applications. The inability of the file allocation strategy to dynamically adapt to the storage environment will lead to uneven utilization of system resources and cannot guarantee the fault tolerance of the system and the security of the files. The embodiment of the present invention clarifies the basis for the adoption of different file allocation strategies by setting a threshold - the initial demand quantity, that is, the number of pre-stored encrypted file blocks. Based on the above ideas, the following adaptive file allocation strategy adjustment method is proposed.
[0097] Furthermore, step S2 includes the following sub-steps:
[0098] S21. The situation selection unit reads the number of registration nodes in the registration information form and the preset initial demand number.
[0099] The initial required quantity is a value preset within the algorithm, which determines the number of copies of the file block that needs to be stored.
[0100] N R =S×K
[0101] Among them, S is the number of copies of the file. The file exists in the form of divided file blocks before being allocated for storage; K is the initial set number of redundant copies of the file, that is, the number of copies of the file.
[0102] S22, through comparison, the situation selection unit obtains the size relationship between the number of registered nodes and the initial demand number;
[0103] Furthermore, step S3 includes the following sub-steps:
[0104] S31. If the number of registered nodes is greater than the initial required number, the situation selection unit selects a decentralized allocation mode as the file allocation strategy;
[0105] S32. If the number of registered nodes is less than or equal to the initial required number, the situation selection unit selects a centralized allocation mode as the file allocation strategy;
[0106] The embodiment of the present invention comprehensively considers the efficiency and security of file storage, and adaptively adjusts the file allocation strategy according to the actual situation during storage. When the number of registered nodes is greater than the initial required number, due to abundant storage resources, the embodiment of the present invention tends to store file blocks as dispersedly as possible in data storage nodes, reducing the risk of malicious nodes stealing complete files and improving the fault tolerance of file blocks to restore complete files; when the number of registered nodes is less than the initial required number, due to tight storage resources, the embodiment of the present invention will give priority to the credibility of storage nodes, ensure the security and stability of file storage, and then consider decentralization. Based on the above ideas, the following adaptive file allocation strategy is proposed.
[0107] Furthermore, step S4 includes the following sub-steps:
[0108] S41, the situation selection unit allocates files using a decentralized allocation model to generate a file distribution form;
[0109] S42, the situation selection unit allocates the files using a centralized allocation model to generate a file distribution form;
[0110] Further, step S41 includes the following sub-steps:
[0111] S411. The situation selection unit reads the three attributes of the reputation, load situation and credit points of each node in the registration information form.
[0112] The registration information form is obtained by sorting the registration information of the nodes on the blockchain by the situation selection unit. The registration information form records the ID and reputation of each registered data storage node, the load situation and the number of credit points, which are the three indicators to determine the trustworthiness of the data storage node.
[0113] S412. Randomly initialize weights ω1, ω2, ω3.
[0114] Among them, ω1, ω2, and ω3 are the weights corresponding to the reputation, load condition, and credit point attributes respectively.
[0115] S413. Calculate the score of each data storage node:
[0116] Score=ω1·credibility+ω2·loadState+ω3·Deposit
[0117] Among them, Score represents the score of a data storage node, credibility refers to the credibility, loadState refers to the load situation, and Deposit refers to the credit points.
[0118] The present invention establishes a mathematical model of data storage node scores
[0119] Score=ω1·credibility+ω2·loadState+ω3·Deposit
[0120] The three attributes of the data custodian node are comprehensively considered: credibility, loadState, and credit points Deposit. The role they play in the evaluation process of the trustworthiness of the data custodian node itself is also comprehensively considered. The weights are adjusted through continuous feedback to obtain the optimal composition ratio of the attributes in the score Score.
[0121] S414. Based on the node score, the algorithm uses the Softmax function to calculate the probability of each node being selected:
[0122]
[0123] Among them, the Softmax function is a special function used to map a set of real numbers into a probability distribution. P(i) is the probability of node i being selected, s i is the score of node i, T is the temperature parameter, ∑ j It means summing all nodes.
[0124] The temperature parameter T is used to control randomness. When T is large, the increase in T will make the probability distribution flatter, making the selection process close to uniform randomness. When T is small, the decrease in T will make the probability distribution sharper, making high-scoring nodes more likely to be selected.
[0125] S415: Group the nodes based on the probability of each node being selected to form an initial node allocation plan.
[0126] S416. Calculate the fitness score of the initial allocation scheme:
[0127] FitnessScore=tanh(α·(Sum-N·Mean))+Penalty
[0128] Among them, FitnessScore refers to the fitness score, which reflects the quality of a grouping scheme; α is the amplification factor; Sum is the sum of group attributes; N is the number of groups; Mean is the average value of group attributes; Penalty is a penalty term based on constraints to ensure the credibility of the allocation scheme; tanh is the hyperbolic tangent function.
[0129] The group attributes include reputation, load, and credit points.
[0130] S417: When the current fitness score is better, the current grouping scheme and the current weight are updated to the optimal grouping scheme and the optimal weight.
[0131] S418. Based on the current optimal weight, add random disturbance and normalize, keep the sum of the weights to 1, and obtain a new weight.
[0132] S419, based on the new weights, by selecting, crossing and compiling individuals of the grouping scheme, continuously iterating to gradually approach the optimal allocation scheme and generate a file distribution form;
[0133] The embodiment of the present invention quantifies the quality of the allocation plan by constructing a fitness score FitnessScore, and based on the existing best allocation plan, continuously iterates and generates a new best plan by changing the weights, fully exploring the solution space of the optimal allocation problem and ensuring the dispersion and security of file distribution.
[0134] Further, step S42 includes the following sub-steps:
[0135] S421. Calculate a new redundancy number K' using a dynamic redundancy factor counter.
[0136] The dynamic redundancy factor counter is an algorithm module in the centralized allocation model of the algorithm, and is used to generate and dynamically adjust a new redundancy factor K'.
[0137] In an embodiment of the present invention, when the number of registered nodes is less than the initial required number, storage resources are limited, and the pre-set number of redundant copies K needs to be increased to ensure the file security in this case. Increasing the number of redundant copies K requires dynamic adjustment based on the comprehensive situation of the nodes to fully utilize the storage resources. Therefore, the method proposed in the present invention sets a dynamic redundancy factor counter to adaptively adjust the number of redundant copies of files.
[0138] S422. Based on the new redundancy factor K', use the intelligent node selector to screen and group the nodes to generate a file distribution form.
[0139] Among them, the intelligent node selector is an algorithm module in the centralized allocation model of the proposed algorithm, which is used to screen and group nodes to obtain the best allocation plan.
[0140] After the embodiment of the present invention obtains the redundancy number K' to ensure the security of files under limited storage resources, it is necessary to determine the distribution plan of file blocks according to the comprehensive situation of the nodes. Therefore, the embodiment of the present invention sets up an intelligent node selector to consider multiple dimensions such as credibility, load situation, credit points, etc., and screens and groups nodes based on the node's maximum file storage number M and the number of file splits S.
[0141] Furthermore, step S421 includes the following sub-steps:
[0142] S4211. The dynamic redundancy factor counter reads the registration information form to initialize the value range of the new redundancy quantity K'.
[0143] Among them, the value range of the new redundancy quantity K' is [K min , K max .
[0144] Among them, K min = K, K max = M * N E / S. K is the initially set redundancy quantity, S is the number of sub-files after file segmentation. M is the maximum number of file storage times of a node, meaning that a node can have at most M sub-files segmented from the same file. 0 < M ≤ S, and both M and S are integers. N E is the number of registered nodes.
[0145] S4212. The dynamic redundancy factor counter initializes the proportion of the number of low-reputation nodes:
[0146]
[0147] Among them, LC racio refers to the proportion of the number of low-reputation nodes, which is the proportion of the number of low-reputation nodes in the registered nodes calculated based on the information in the registration information form. N LC represents the number of nodes with a credibility value lower than the passing credibility value.
[0148] S4213. The dynamic redundancy factor counter initializes the DQN algorithm network.
[0149] Among them, the DQN algorithm (Deep Q-Network, DQN) is a reinforcement learning algorithm that combines the Q-Learning algorithm and a deep neural network and can make effective decisions in a complex environment. The Q-Learning algorithm is a value-based reinforcement learning method that finds the optimal strategy by iteratively updating the Q value to maximize the cumulative future reward.
[0150] S4214. The dynamic redundancy factor counter optimizes the selection strategy of the redundancy copy number through the DQN network and selects the best redundancy copy number K' using the evaluation function f(K′, λ, σ, μ b );
[0151] Among them, the evaluation function is used to evaluate the effect of the current redundancy copy number K' relative to the optimal redundancy copy number μ, and the evaluation function is:
[0152]
[0153] Among them, μ = K max ·(1 - exp{-λ·LCracio}), is along with LC racio The optimal number of redundant copies is dynamically adjusted by increasing; σ controls the convergence speed of the evaluation function; λ reflects μ b For LC racio sensitivity.
[0154] A larger λ will result in a target redundant number μ b With LC racio Therefore, for the same LC racio , a higher λ value will push the dynamic redundancy factor selector to select more redundant copies to deal with potential risks, but it will also waste resources and reduce the overall average performance. A smaller λ means that μ b For LC racio The dynamic redundancy factor selector may tend to select fewer redundant copies, which may improve storage efficiency, but may also reduce data security and fault tolerance, especially in LC racio Therefore, λ needs to strike a balance between improving storage efficiency and ensuring data security.
[0155] The embodiment of the present invention continuously learns through the DQN algorithm network to continuously update the λ value, thereby continuously optimizing the selection strategy of the number of redundant copies to achieve optimal storage efficiency and data security.
[0156] Further, step S422 includes the following sub-steps:
[0157] S4221. The intelligent node selector initializes weights ω1, ω2, ω3 to calculate the score Score of each data custodian node participating in the storage.
[0158] Among them, ω1, ω2, and ω3 are the weights corresponding to the reputation, load, and credit point attributes. Data custody node score
[0159] Score=ω1·credibility+ω2·loadState+ω3·Deposit
[0160] Score represents the score of a data storage node, credibility refers to credibility, loadState refers to load status, and Deposit refers to credit points.
[0161] S4222, based on the new redundancy factor K ′ ,The intelligent node selector filters each node according to the score to form a grouping scheme.
[0162] S4223. Calculate how many times each node in the grouping scheme stores the file.
[0163] S4224. The intelligent node selector continuously iterates to form a new grouping scheme until no node has a file storage count higher than the node's maximum file storage count M.
[0164] S4225. Calculate the fitness score FitnessScore of the new grouping scheme.
[0165] S4226. When the current fitness score FitnessScore is better, update the best grouping scheme and the best fitness score.
[0166] S4227. The intelligent node selector changes the current weight, continuously iterates to form the optimal allocation plan and generates a file distribution form.
[0167] In the embodiment of the present invention, for a trusted adaptive file allocation method based on blockchain created by the present invention, we designed a large number of experimental scenarios to verify various indicators such as the effectiveness and load balancing of the method proposed in the present invention from multiple angles. The results show that the method proposed in the present invention has good effectiveness, load balancing and the ability to resist malicious nodes.
[0168] In the examples of the present invention, in order to reduce the resource consumption of file migration and increase the security of files, we measure the node reliability from three aspects: reputation, load, and credit points. In the experiment, we set the initial reputation of the DC node to 100. When the node reputation is greater than 75, we consider the node to be a high-reputation node. When the node reputation is between 75 and 50, we identify it as a medium-reputation node. When the node reputation is lower than 50, the node is identified as a low-reputation node and is removed when the system performs maintenance. The load of the node is expressed as a percentage. The higher the value, the greater the current load of the node. Credit points are the amount of money submitted by the data custodian node when participating in storage activities. In the experiment, the credit points are set between 0-100. In the experiment, we define nodes with higher reputation, smaller load, and more credit points as high-quality nodes with higher reliability. We respectively set N E >N R , N E ≤N R The node screening ability of the method proposed in this invention is investigated in two cases.
[0169] Among them, N E Represents the number of registered nodes, N R Represents the initial number of people required.
[0170] We set the number of file splits S = 10, the preset redundancy number K = 5, and the initial required number N R =S×K=50.
[0171] In N E >N R hour, Figure 2 The average reputation of the nodes selected by the method of the present invention is shown under different proportions of medium-reputation nodes. It can be observed from the figure that no matter whether the initial demand quantity accounts for 20%, 40%, 60%, or 80% of the number of registered nodes, the method of the present invention can consistently select a subset whose average reputation is higher than the average reputation of the overall registered nodes. In particular, even when the proportion of medium-reputation nodes is as high as 60% and the number of demand people accounts for 80% of the number of registered people, the method of the present invention can still select nodes with high reputation (reputation>75) to undertake file storage tasks. When N E ≤N R The method proposed in the present invention ensures the reliability of the file by adaptively calculating the new redundancy number and high-quality node reuse. The maximum number of files that a node can store is set to M=8. That is to say, a node can store at most 8 of the 10 sub-files. This effectively ensures the decentralization of the file and improves the privacy security of the file data. Figure 3 Shows that when N E ≤N R The results show that even when the required number is 100% to 180% of the registered number, the method of the present invention can still consistently select a group of nodes with high credibility by adjusting the required number of redundancies.
[0172] Figure 4 Shows N E >N R With N E ≤N R In the case of , the method proposed in the present invention screens out the load of the node. The experimental results intuitively show that under different proportions of medium-reputation nodes, the method proposed in the present invention prefers to select nodes with lower load. Figure 4 Left is N R / N E =20%, the load heat map of the selected nodes. Figure 4 N on the right R / N E =120%, the load heat map of the selected nodes. The darker colors in the two figures are concentrated in the lower load percentage area, indicating that the proposed method tends to select nodes with smaller current loads when selecting nodes. This selection strategy helps to balance the workload of the entire network and also reduces the potential failure risk caused by node overload.
[0173] Figure 5 Shows N E >N R With NE ≤N R In this case, the method proposed in the present invention filters out the credit points of the node. Figure 5 Left is N R / N E =20%, heat map of the credit points of the selected nodes. Figure 5 N on the right R / N E =120%, the heat map of the credit points of the selected nodes. The darker areas in the two figures are concentrated in the higher credit points range, which shows that the method proposed in the present invention tends to select nodes with higher credit points to ensure the reliability of the nodes during the node selection process.
[0174] Experimental results show that the proposed method can effectively screen out high-reputation nodes under various node supply-demand ratios, and by considering the node load and credit points, the proposed method optimizes resource allocation and improves the data security of the system. E >N R When the node has a higher reputation than the average, the method proposed in the present invention can consistently select nodes with higher reputation than the average, and can maintain the selection standard even when the proportion of nodes with medium reputation is high. E ≤N R When the method proposed in the present invention is used, the required redundancy and the reuse of high-quality nodes are adaptively calculated to ensure the reliability of the file and data security. At the same time, the method proposed in the present invention shows a clear preference for the credit points and load of the node, tending to select nodes with lower load and higher credit points, which helps to optimize resource allocation.
[0175] Load balancing is crucial in distributed file storage methods. Load balancing helps improve storage efficiency, reduce latency and failure risks caused by local overload, and promote optimal resource utilization. We measure load balancing through Load Balance Factor (LBF).
[0176]
[0177] If the load balancing factor is 1, it means that the load on each node is equal, achieving perfect load balancing. A load balancing factor greater than 1 means that at least one node has a higher load than the average, indicating that the solution may cause some nodes to be overloaded while other nodes may be idle. Therefore, the closer the load balancing factor is to 1, the more evenly the load is distributed.
[0178] Figure 6 The left shows N R / N E=20%, the file proportion carried by nodes in different credibility intervals changes with the increase of the number of files. The results show that as the number of files increases, the file carrying ratio of nodes in each credibility interval tends to be stable and average, reflecting good load balancing. At the same time, nodes in higher credibility intervals carry a larger proportion of files, which further illustrates that the method proposed in the present invention prefers to select nodes with higher credibility when storing files.
[0179] Figure 6 The right side reveals N R / N E =120%, the proportion of files carried by nodes in each credibility interval. In this scenario, the proportion of files carried by nodes in each credibility interval does not change much, which reflects good load balancing. In this case, high-quality nodes are repeatedly selected, so some nodes may carry more files than other nodes. Despite this repeated selection, high-credibility nodes still undertake more file storage tasks, showing better load balancing overall. The above results show that regardless of whether the number of applicants exceeds or falls short of demand, the method proposed in the present invention can effectively allocate file storage tasks among nodes, give priority to nodes with high credibility, and ensure load balancing.
[0180] Distributed systems are often attacked by malicious nodes, which may cause file corruption, deletion or tampering, posing a serious threat to the data integrity and reliability of the system. Whether the algorithm in the system has the ability to effectively resist these attacks and successfully recover files is an important indicator for evaluating the performance of a distributed file storage method. This is not only related to the stability of the system and the security of user data, but also involves the robustness of the system design and the flexibility to deal with emergencies.
[0181] Figure 7 Shows N E >N R With N E ≤N R In the two cases, facing different proportions of malicious nodes, the method proposed in this invention and other four distributed file storage solutions (HDFS, CRUSH, DHT, CH) have the ability to successfully recover files.
[0182] Among them, HDFS is a distributed file system that is specifically designed to handle the storage and management of large data sets. CRUSH is a data placement algorithm for distributed storage systems that determines the storage location of data blocks by calculation rather than table lookup, thereby improving the scalability and performance of the storage system. DHT is a decentralized distributed storage structure used to distribute and find data in a peer-to-peer network. CH, or consistent hashing, is a distributed storage hash algorithm used to solve the problem of data distribution and load balancing between nodes.
[0183] Experimental results show that the method proposed in the present invention performs best in resisting malicious nodes. Even under extreme conditions where the proportion of malicious nodes is as high as 90%, when the number of applicants is greater than the required number, the number of files successfully recovered by the method proposed in the present invention is 30% of the total number of files, which is about three times that of other solutions; at the same time, when the number of applicants is less than the required number, the method proposed in the present invention effectively resists the attack of malicious nodes by dynamically adjusting the number of redundancies and reusing high-quality nodes. The number of files successfully recovered by the method proposed in the present invention is 57% of the total number of files, which is about 5.7 times that of other solutions. This is because compared with other solutions, the method proposed in the present invention takes into account the reliability of storage nodes, effectively screens trusted node storage files through intelligent file allocation strategies, and improves file security.
[0184] The above experimental results show that the algorithm proposed in this invention can effectively promote storage efficiency, reduce local overload risks, and optimize resource utilization, and effectively enhance the ability to resist malicious nodes. Compared with other traditional data placement algorithms, it has obvious advantages in ensuring long-term system availability and reliable storage, and shows stronger robustness and resilience.
[0185] The working principle and process of the present invention are as follows: reading the registration information of the node to generate a registration information form; comparing the number of registration nodes in the registration information form with the preset initial demand number to obtain the size relationship; according to different size relationships, selecting a decentralized allocation model or a centralized allocation model as a file allocation strategy; allocating files through a determined file allocation strategy to generate a file distribution form; uploading the file distribution form to the blockchain network.
[0186] The beneficial effects of the present invention are as follows: a trusted adaptive file allocation method based on blockchain is proposed, through which the efficiency and security of data processing are effectively ensured, and the risk of data leakage is significantly reduced.
[0187] Those skilled in the art will appreciate that the embodiments described herein are intended to help readers understand the principles of the present invention, and should be understood that the protection scope of the present invention is not limited to such specific statements and embodiments. Those skilled in the art can make various other specific variations and combinations that do not deviate from the essence of the present invention based on the technical revelations disclosed by the present invention, and these variations and combinations are still within the protection scope of the present invention.
Claims
1. A trusted adaptive file distribution method based on blockchain, characterized in that: The following steps are involved: S1: Read the registration information of the node to generate a registration information form; S2: Compare the number of registration nodes in the registration information form with the preset initial demand number to obtain the size relationship; S3: Select a decentralized allocation model or a centralized allocation model as the file allocation strategy based on different size relationships; S4: Allocate files according to the determined file allocation strategy to generate a file distribution form; S5: Upload the file distribution form to the blockchain network. Wherein, the step S1 includes the following sub-steps: S11. The situation selection unit reads the registration information of the data storage node on the blockchain. Among them, the situation selection unit is a module in the trusted adaptive file allocation method, which is responsible for reading the registration information of the data custodian node on the blockchain and selecting different file allocation strategies according to different situations. The data custodian node is a node that is qualified to participate in file storage activities. The registration information includes the ID of each registered data custodian node and three indicators to determine the trustworthiness of the data custodian node: reputation, load situation and credit points. Among them, reputation is an indicator to measure the long-term trustworthiness of data storage nodes. Load is an indicator to measure the ability of data storage nodes to store file information completely, and it is also an important indicator to promote the balanced distribution of system file information. Credit points are an indicator to measure the short-term trustworthiness of data storage nodes; S12. After reading is completed, the situation selection unit counts the registration information and generates a registration information form. Wherein, the step S2 includes the following sub-steps: S21. The situation selection unit reads the number of registration nodes in the registration information form and the preset initial demand number. The initial required quantity is a value preset within the algorithm, which determines the number of copies of the file that need to be stored. N R =S×K Among them, S is the number of copies of the file. The file exists in the form of divided file blocks before being allocated for storage; K is the number of redundant copies of the file initially set, that is, the number of copies of the file; S22. Through comparison, the situation selection unit obtains the size relationship between the number of registered nodes and the initial demand number. Wherein, the step S3 includes the following sub-steps: S31. If the number of registered nodes is greater than the initial required number, the situation selection unit selects a decentralized allocation mode as the file allocation strategy; S32: If the number of registered nodes is less than or equal to the initial required number, the situation selection unit selects a centralized allocation mode as the file allocation strategy. Wherein, the step S4 includes the following sub-steps: S41, the situation selection unit allocates files using a decentralized allocation model to generate a file distribution form; S42. The situation selection unit allocates files using a centralized allocation model to generate a file distribution form. Wherein, the step S41 includes the following sub-steps: S411, the situation selection unit reads the three attributes of the reputation, load situation and credit points of each node in the registration information form; S412. Randomly initialize weights ω1, ω2, ω3. Among them, ω1, ω2, and ω3 are the weights corresponding to the attributes of reputation, load, and credit points, respectively; S413. Calculate the score of each data storage node: Score=ω1·credibility+ω2·loadState+ω3·Deposit Among them, Score represents the score of a data storage node, credibility refers to the reputation, loadState refers to the load status, and Deposit refers to the credit points; S414. Based on the node score, the algorithm uses the Softmax function to calculate the probability of each node being selected: Among them, the Softmax function is a special function used to map a set of real numbers into a probability distribution. P(i) is the probability of node i being selected, s i is the score of node i, T is the temperature parameter, ∑ j It means summing all nodes. The temperature parameter T is used to control randomness. When T is large, the increase in T will make the probability distribution flatter, making the selection process close to uniform randomness. When T is small, the decrease in T will make the probability distribution sharper, making high-scoring nodes more likely to be selected; S415 . Divide the nodes into S groups based on the probability of each node being selected, thereby forming an initial node allocation scheme. Among them, S represents the number of copies the file is divided into; S416. Calculate the fitness score of the initial allocation scheme: FitnessScore=tanh(α·(Sum-S·Mean))+Penalty Among them, FitnessScore refers to the fitness score, which reflects the quality of a grouping scheme; α is the amplification factor; Sum is the sum of the three attributes of reputation, load, and credit points in each group; S is the number of file divisions, which is also the number of groups; Mean is the average of the sum of the three attributes of reputation, load, and credit points of all data storage nodes participating in this storage activity; Penalty is a penalty term based on constraints to ensure the credibility of the allocation scheme; tanh is the hyperbolic tangent function; S417, when the current fitness score is better, the current grouping scheme and the current weight are updated to the optimal grouping scheme and the optimal weight; S418, based on the current optimal weight, add random disturbance and normalize, keep the weight sum to 1, and obtain a new weight; S419, based on the new weights, by selecting, crossing and compiling individuals of the grouping scheme, iterating continuously to gradually approach the optimal allocation scheme and generate a file distribution form. Wherein, the step S42 includes the following sub-steps: S421. Calculate a new redundancy number K' using a dynamic redundancy factor counter. The dynamic redundancy factor counter is a calculation module in the centralized allocation model of the algorithm, which is used to generate and dynamically adjust a new redundancy factor K'; S422. Based on the new redundancy factor K', use the intelligent node selector to screen and group the nodes to generate a file distribution form. Among them, the intelligent node selector is a module in the centralized allocation model of the proposed algorithm, which is used to screen and group nodes to obtain the best allocation plan. Wherein, the step S421 includes the following sub-steps: S4211. The dynamic redundancy factor counter reads the registration information form to initialize the value range of the new redundancy number K'. Among them, the value range of the new redundant number K' is [K min , K max ]. Among them, K min = K, K max = M * N E / S. K is the initially set redundancy quantity, and S is the number of sub - files after file segmentation. M is the maximum number of times a node can store a file, meaning that a node can have at most M sub - files split from the same file. 0 < M ≤ S, and both M and S are integers. N E is the number of registered nodes; S4212. The dynamic redundancy factor counter is initialized to calculate the percentage of low-reputation nodes: Among them, LC racio Refers to the proportion of low-reputation nodes, which is the proportion of low-reputation nodes among the registered nodes calculated based on the registration information form information. LC Indicates the number of nodes whose credibility value is lower than the passing credibility value; S4213, the dynamic redundancy factor counter initializes the DQN algorithm network. Among them, the DQN algorithm (Deep Q-Network, DQN) is a reinforcement learning algorithm that combines the Q-Learning algorithm and deep neural network, and can make effective decisions in complex environments. The Q-Learning algorithm is a value-based reinforcement learning method that finds the optimal strategy by iteratively updating the Q value to maximize the accumulated future rewards; S4214, dynamic redundancy factor counter optimizes the selection strategy of the number of redundant copies through the DQN network, using the evaluation function f(K′,λ,σ,μ b ) Select the optimal number of redundant copies K'; The evaluation function is used to evaluate the current number of redundant copies K' relative to the optimal number of redundant copies μ b The effect of the evaluation function is: Among them, μ b =K max ·(1-exp{-λ·LC racio });λ reflects the effect of LC racio The sensitivity of the evaluation function; σ controls the convergence speed of the evaluation function; μ b With LC racio The optimal number of redundant copies is increased and adjusted dynamically. Wherein, the step S422 includes the following sub-steps: S4221. The intelligent node selector initializes weights ω1, ω2, ω3 to calculate the score Score of each data custodian node participating in the storage. Among them, ω1, ω2, and ω3 are the weights corresponding to the reputation, load, and credit point attributes. Data custody node score Score=ω1·credibility+ω2·loadState+ω3·Deposit Score represents the score of a data storage node, credibility refers to the reputation, loadState refers to the load status, and Deposit refers to the credit points; S4222, based on the new redundancy factor K ′ ,The intelligent node selector screens each node according to the score to form a grouping scheme; S4223, calculating how many times each node in the grouping scheme stores the file; S4224, the intelligent node selector continuously iterates to form a new grouping scheme until no node has a file storage count higher than the node's maximum file storage count M; S4225, calculating the fitness score FitnessScore of the new grouping scheme; S4226, when the current fitness score FitnessScore is better, update the best grouping scheme and the best fitness score; S4227. The intelligent node selector changes the current weight, continuously iterates to form the optimal allocation plan and generates a file distribution form.