A blockchain-based trading platform data trusted storage method and system
By calculating the storage key coefficients and correlation values, filtering and optimizing the storage location of platform subdata, and designing an optimized data storage strategy, the problem of excessive energy consumption caused by node synchronization data in the blockchain is solved, and efficient data storage and energy management are achieved.
Patent Information
- Application Number
- CN202510081931.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-20
- Publication Date
- 2025-04-01
- Estimated Expiration
- 2045-01-20
AI Technical Summary
The distributed characteristics of blockchain technology lead to each node needing to synchronize all transaction data, which increases energy consumption. How to reduce unnecessary energy consumption by optimizing data storage strategies and reasonably allocating nodes while ensuring the integrity of transaction data has become a current technical problem.
Filter important platform subdata by calculating and storing key coefficients to reduce unnecessary data transmission; calculate the correlation value to optimize the storage location of highly correlated platform subdata, improve access efficiency and reduce energy consumption; design and optimize data storage strategies, and use natural heuristic algorithms to optimize the data storage process to minimize total energy consumption.
It effectively solves the problem of excessive energy consumption caused by the need to synchronize all data in the blockchain. Through data segmentation, storage optimization and energy optimization management, storage performance and resource utilization efficiency are improved.
Smart Images

Figure CN119512473B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data storage technology, and more specifically, to a blockchain-based trading platform data trusted storage method and system. Background Art
[0002] Trade platform data refers to various information and data generated and processed on an online or e-commerce trade platform. Blockchain is a distributed ledger technology characterized by its decentralization, transparency, immutability and security. It records transactions or data on multiple nodes (computers) through encryption algorithms and consensus mechanisms to ensure the security and consistency of data. Blockchain technology has gradually been integrated into trade and supply chain systems in recent years to enhance data transparency, traceability and security. Many companies, especially in industries such as logistics, finance and retail, use blockchain to create immutable and transparent transaction records.
[0003] For example, the patent application with publication number CN109063016A provides a blockchain data storage method, device, electronic device, and storage medium. The patent application generates a transaction relationship table in the transaction data structure, records the historical position of key-value pairs, and uses the most recent transaction table to update the position of the latest key-value pairs on the chain, thereby achieving rapid query and traceability optimization of assets in the blockchain.
[0004] Although existing technologies provide a better transaction data storage method on the blockchain, the distributed nature of blockchain technology requires each node to synchronize all transaction data, which increases energy consumption. How to reduce unnecessary energy consumption by optimizing data storage strategies and reasonably allocating nodes while ensuring the relative integrity of transaction data is a technical problem that needs to be solved at present.
[0005] In view of this, the present invention proposes a blockchain-based trade platform data trusted storage method and system to solve the above problems. Summary of the invention
[0006] In order to overcome the above-mentioned defects of the prior art, the present invention provides a blockchain-based trading platform data trusted storage method and system.
[0007] To achieve the above object, the present invention provides the following technical solutions:
[0008] In the first aspect, a blockchain-based trading platform data trusted storage method includes:
[0009] Obtain the trade platform data, divide the trade platform data into W platform sub-data according to preset rules, obtain storage key information of the W platform sub-data respectively, calculate the storage key coefficient according to the storage key information, and select S platform sub-data from the W platform sub-data based on the storage key coefficient, where W>S;
[0010] Calculate the association values between the S platform sub-data, construct a sub-data association graph according to the association values, and determine Q data storage strategies based on the sub-data association graph and a preset number of M storage nodes, where the storage nodes are network nodes in the blockchain;
[0011] Traverse Q data storage strategies, store S platform sub-data in M storage nodes according to the data storage strategies, calculate the total energy consumption value corresponding to the M storage nodes, optimize the Q data storage strategies based on the total energy consumption value and the nature-inspired algorithm, and determine the optimal storage strategy.
[0012] Furthermore, the storage key information includes access frequency value, access restriction number and update frequency value, the platform sub-data includes G sub-data categories, and the storage key coefficient is calculated based on the access frequency value, access restriction number and update frequency value.
[0013] Furthermore, the method for calculating the correlation value between the S platform sub-data includes:
[0014] ;
[0015] in, For the The platform sub-data and The correlation value between the sub-data of each platform, For the The platform sub-data and The number of common fields between the sub-data of each platform, For the The number of fields of platform sub-data, For the The number of fields of platform sub-data, For the The platform sub-data and The number of common access frequencies between sub-data on each platform, For the The access frequency of each platform sub-data, For the The access frequency of each platform sub-data, For the The platform sub-data and The number of common update frequencies between the sub-data of each platform, For the The update frequency of each platform sub-data, For the The update frequency of each platform sub-data, , , are all weight factors.
[0016] Furthermore, the method of constructing a sub-data association graph according to the association value includes:
[0017] The S platform sub-data are used as the associated nodes of the sub-data association graph, and the association values between the S platform sub-data are used as the associated edges of the sub-data association graph, so as to construct the sub-data association graph.
[0018] Furthermore, the method for determining the data storage strategy includes:
[0019] S201: respectively obtaining storage capacities and reading speeds corresponding to M storage nodes, clustering S associated nodes to obtain H associated node sets, and obtaining the sum of storage coefficients corresponding to each associated node set, where the sum of storage coefficients is the sum of storage key coefficients corresponding to each associated node in the associated node set;
[0020] S202: Arrange the M storage nodes in descending order according to the read speed, and arrange the H associated node sets in descending order according to the sum of the storage coefficients;
[0021] S203: preferentially allocating the associated node set with the largest sum of storage coefficients to the storage node with the highest reading speed, ensuring that during the allocation process, the remaining capacity of each storage node can accommodate the currently allocated associated node set; if the remaining capacity is insufficient, skip the storage node and continue to allocate to the next storage node;
[0022] S204: Continue to execute the above S203 for the remaining associated node sets until all associated node sets are allocated.
[0023] Furthermore, the method for calculating the total energy consumption value includes:
[0024] ;
[0025] in, is the total energy consumption value, For the The energy consumption value of each storage node is No. Storage nodes The number of fields of platform sub-data, No. Storage nodes The access frequency value of each platform sub-data, For the The unit energy consumption of a storage node when performing read and write operations is To be the first The platform sub-data is transmitted to the The energy consumption required in each storage node is For the The total number of platform sub-data in the storage node.
[0026] Furthermore, the Q data storage strategies are optimized and a method for determining an optimal storage strategy includes:
[0027] S301: Randomly generate Q sparrow individuals, each sparrow individual represents a data storage strategy, and randomly generate an initial position for each sparrow individual , that is, the initial position Characterized as data storage strategy;
[0028] S302: Construct the fitness function value F of each sparrow individual ( ):
[0029] F( )= ;
[0030] In the formula, It is characterized by the total energy consumption value corresponding to the data storage strategy;
[0031] S303: Perform exploration operations on some sparrow individuals to update the positions of some sparrow individuals;
[0032] ;
[0033] In the formula, For the A sparrow in the The position of the generation, For the A sparrow in The position of the generation, is the maximum number of iterations, is a random angle, It is an exponential function with e as the base, where e is a natural constant;
[0034] S304: performing a following operation on the remaining sparrow individuals to update the positions of the remaining sparrow individuals;
[0035] S305: Calculate the fitness function value F of each sparrow individual after the update ( ), update the current optimal solution, the current optimal solution refers to the data storage strategy corresponding to the current minimum total energy consumption value;
[0036] S306: Repeat the above S303-S305 until the preset maximum number of iterations is reached. Stop searching when the optimal solution is reached, and output the data storage strategy corresponding to the current optimal solution, which is the optimal storage strategy.
[0037] Further, the method for updating the positions of the remaining sparrow individuals includes:
[0038] ;
[0039] In the formula, is a random number between 0 and 1. is the location of the current optimal solution.
[0040] In a second aspect, a blockchain-based trade platform data trusted storage system is used to implement the above-mentioned blockchain-based trade platform data trusted storage method, including:
[0041] Data processing module: used to obtain trade platform data, divide the trade platform data into W platform sub-data according to preset rules, obtain storage key information of the W platform sub-data respectively, calculate the storage key coefficient according to the storage key information, and select S platform sub-data from the W platform sub-data based on the storage key coefficient, where W>S;
[0042] Strategy generation module: used to calculate the association values between S platform sub-data, build a sub-data association graph according to the association values, and determine Q data storage strategies based on the sub-data association graph and a preset number of M storage nodes, where the storage nodes are network nodes in the blockchain;
[0043] Strategy optimization module: used to traverse Q data storage strategies, store S platform sub-data in M storage nodes according to the data storage strategies, calculate the total energy consumption value corresponding to the M storage nodes, optimize the Q data storage strategies based on the total energy consumption value and the nature-inspired algorithm, and determine the optimal storage strategy.
[0044] In a third aspect, an electronic device comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned blockchain-based trading platform data trusted storage method when executing the computer program.
[0045] Compared with the prior art, the present invention has the following beneficial effects:
[0046] The present invention first calculates the storage key coefficient to screen important platform sub-data, reducing unnecessary data transmission. Then, by calculating the correlation value, the storage location of highly correlated platform sub-data is optimized, the access efficiency is improved and the energy consumption of transmission across storage nodes is reduced. Finally, by designing and optimizing Q data storage strategies and optimizing the data storage process using a nature-inspired algorithm, the total energy consumption corresponding to the data storage strategy is minimized. The present invention effectively solves the problem of excessive energy consumption caused by the need for each node in the existing blockchain to synchronize all data through data segmentation, storage optimization and energy optimization management of the data storage process. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 This is a flowchart of a blockchain-based trading platform data trusted storage method in the present invention;
[0048] Figure 2 This is a schematic diagram of the structure of a blockchain-based trading platform data trusted storage system in the present invention;
[0049] Figure 3 It is a structural schematic diagram of the neutron data association graph of the present invention;
[0050] Figure 4 It is a schematic diagram of transmitting platform sub-data to the storage node in the present invention.
[0051] Reference numerals:
[0052] 10. Associated nodes; 20. Associated edges; 30. Trading platform; 40. Storage nodes; 401. First node; 402. Second node; 403. Third node; 404. Fourth node. DETAILED DESCRIPTION
[0053] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0054] Example 1
[0055] See also Figure 1 As shown, this embodiment discloses a blockchain-based trading platform data trusted storage method, including:
[0056] S10: Acquire the trade platform data, divide the trade platform data into W platform sub-data according to a preset rule, respectively acquire storage key information of the W platform sub-data, calculate the storage key coefficient according to the storage key information, and select S platform sub-data from the W platform sub-data based on the storage key coefficient, where W>S;
[0057] In this embodiment, trade platform data refers to various information and data generated and processed on an online or e-commerce trade platform. Trade platform data includes transaction data, user data, market data, feedback data, etc. Transaction data includes but is not limited to order information, payment records, and product information, etc. User data includes but is not limited to registration information, login history, etc. Market data includes but is not limited to commodity price fluctuations and changes in market supply and demand, etc. Feedback data includes but is not limited to user evaluations, complaints and suggestions on commodities and services. The above-mentioned preset rules refer to rules for dividing and screening trade platform data according to specific standards or conditions. By way of example, this embodiment divides the trade platform data according to data function rules, and divides the trade platform data into transaction data, user data, market data, and feedback data.
[0058] It should be noted that the storage of key information includes but is not limited to access frequency value, access limit number and update frequency value. The access frequency value represents the frequency of access to a certain platform sub-data within a preset time period. The higher the access frequency value, the more frequently the data is accessed, and faster and more efficient storage is required to ensure access performance. The access limit number refers to the number of times a certain platform sub-data can be accessed within a preset time period. Usually, sensitive data will have access limit values. The smaller the access limit number, the higher the sensitivity and security requirements of the data. The update frequency value represents the number of times a certain platform sub-data is updated within a preset time period. The higher the update frequency value, the more frequently the data changes, and it needs to be efficiently stored and quickly synchronized to ensure the timeliness of the data during system processing and query.
[0059] The platform sub-data includes G sub-data categories. The method for calculating the storage key coefficient according to the storage key information includes:
[0060] ;
[0061] Among them, SKC is the storage critical coefficient, For the The number of access restrictions corresponding to each sub-data category, For the The update frequency value corresponding to each sub-data category, For the The access frequency value corresponding to each sub-data category, is the hyperbolic cosine function, is the minimum function, is the maximum value function, is a logarithmic function with base 5, is the inverse cotangent function.
[0062] It is not difficult to understand that the platform sub-data includes G sub-data categories, each sub-data category represents a specific type of data set. For example, the platform sub-data can be transaction data, then the transaction data includes three sub-data categories, namely order information, payment records and product information. It can be seen from the above content that the higher the access frequency value, the more frequently the data is accessed, and faster and more efficient storage is required to ensure access performance. The higher the update frequency value, the more frequently the data changes, and it needs to be stored efficiently. Therefore, in this embodiment, the storage critical coefficient is positively correlated with the importance of data storage, that is, the larger the storage critical coefficient corresponding to the platform sub-data, the greater the storage importance of the platform sub-data.
[0063] Methods for screening out S platform sub-data include:
[0064] The storage key coefficients corresponding to the W platform sub-data are arranged in descending order, and the platform sub-data with storage key coefficients less than a preset key coefficient threshold are eliminated, so as to obtain S platform sub-data.
[0065] It should be added that the above screening method is only an example description. This embodiment does not limit the screening method. The storage key coefficient is calculated based on the storage key information (such as access frequency, access restriction number, update frequency, etc.), and the more important S platform sub-data are screened out. This can ensure that high-priority data is preferentially stored on storage nodes with better performance, thereby optimizing the allocation of storage resources and reducing resource waste.
[0066] S20: Calculate the association values between the S platform sub-data, construct a sub-data association graph according to the association values, and determine Q data storage strategies based on the sub-data association graph and a preset number of M storage nodes, where the storage nodes are network nodes in the blockchain;
[0067] In this embodiment, the network nodes in the blockchain refer to the distributed participants in the blockchain network, which are responsible for storing, verifying, and disseminating data in the network and ensuring the decentralization and security of the system.
[0068] The method for calculating the correlation value between S platform sub-data includes:
[0069] ;
[0070] in, For the The platform sub-data and The correlation value between the sub-data of each platform, For the The platform sub-data and The number of common fields between the sub-data of each platform, For the The number of fields of platform sub-data, For the The number of fields of platform sub-data, For the The platform sub-data and The number of common access frequencies between sub-data on each platform, For the The access frequency of each platform sub-data, For the The access frequency of each platform sub-data, For the The platform sub-data and The number of common update frequencies between the sub-data of each platform, For the The update frequency of each platform sub-data, For the The update frequency of each platform sub-data, , , are all weight factors.
[0071] It is understood that the common field number refers to the The platform sub-data and The number of shared fields between the sub-data of each platform. The number of common access frequencies refers to the The platform sub-data and The number of times the sub-data of a platform is accessed together in the same query or access operation. The number of times the common update frequency refers to the The platform sub-data and The number of times the sub-data of a platform is updated in the same time period.
[0072] It is worth noting that For the The access frequency value corresponding to each sub-data category, and For the The access frequency of each platform sub-data is not exactly the same. For example, The platform sub-data includes G sub-data categories. It is the sum of the access frequency values corresponding to the G sub-data categories.
[0073] The method of constructing a sub-data association graph according to the association value includes:
[0074] The S platform sub-data are used as the associated nodes of the sub-data association graph, and the association values between the S platform sub-data are used as the associated edges of the sub-data association graph, so as to construct the sub-data association graph.
[0075] like Figure 3 As shown, Figure 3 The associated nodes 10 and the associated edges 20 are shown. The associated nodes 10 with higher association values may be connected by thicker associated edges 20, indicating that they are more strongly associated.
[0076] Methods for determining data storage strategies include:
[0077] S201: respectively obtaining storage capacities and reading speeds corresponding to M storage nodes, clustering S associated nodes to obtain H associated node sets, and obtaining the sum of storage coefficients corresponding to each associated node set, where the sum of storage coefficients is the sum of storage key coefficients corresponding to each associated node in the associated node set;
[0078] S202: Arrange the M storage nodes in descending order according to the read speed, and arrange the H associated node sets in descending order according to the sum of the storage coefficients;
[0079] S203: preferentially allocating the associated node set with the largest sum of storage coefficients to the storage node with the highest reading speed, ensuring that during the allocation process, the remaining capacity of each storage node can accommodate the currently allocated associated node set; if the remaining capacity is insufficient, skip the storage node and continue to allocate to the next storage node;
[0080] S204: Continue to execute the above S203 for the remaining associated node sets until all associated node sets are allocated.
[0081] It should be added that the above content is only one of the Q data storage strategies. Determining the Q data storage strategies requires changes. For example, when the remaining capacity is insufficient, instead of skipping, the associated node set is split and stored in different storage nodes to form another storage strategy, or the M storage nodes are arranged in descending order according to the storage capacity, or in the process of clustering the S associated nodes, the parameters in the clustering algorithm are changed to form different associated node sets. Exemplarily, the clustering algorithm can be a K-Means clustering algorithm, which generates multiple different associated node sets by adjusting the K value or changing the initial center point, thereby generating different data storage strategies. The K-Means clustering algorithm is a prior art and this embodiment will not go into details.
[0082] This embodiment first screens the platform sub-data and selects the platform sub-data with greater storage importance. This screening ensures that the platform sub-data with high access frequency and high update frequency are processed first. Further, by calculating the correlation values between these platform sub-data and constructing a sub-data correlation graph, this combination means that only important platform sub-data will participate in the subsequent correlation analysis and storage optimization, reducing unnecessary data processing and waste of storage resources. In addition, through the screening of S10, the system focuses on more critical platform sub-data, and S20 constructs a sub-data correlation graph, clusters and allocates storage strategies based on the correlation value. This sequential combination ensures that not only important platform sub-data are processed first, but also highly correlated platform sub-data are stored on appropriate storage nodes, reducing the overhead of accessing across storage nodes, thereby improving storage performance and resource utilization efficiency.
[0083] S30: traverse Q data storage strategies, store S platform sub-data in M storage nodes according to the data storage strategies, calculate the total energy consumption value corresponding to the M storage nodes, optimize the Q data storage strategies based on the total energy consumption value and the natural inspiration algorithm, and determine the optimal storage strategy;
[0084] like Figure 4 As shown, Figure 4 The trading platform 30, storage node 40, first node 401, second node 402, third node 403 and fourth node 404 are shown. The trading platform 30 uploads S platform sub-data to the first node 401, second node 402, third node 403 and fourth node 404 in sequence according to the data storage strategy.
[0085] Methods for calculating total energy expenditure values include:
[0086] ;
[0087] in, is the total energy consumption value, For the The energy consumption value of each storage node is No. Storage nodes The number of fields of platform sub-data, No. Storage nodes The access frequency value of each platform sub-data, For the The unit energy consumption of a storage node when performing read and write operations is To be the first The platform sub-data is transmitted to the The energy consumption required in each storage node is For the The total number of platform sub-data in the storage node.
[0088] It should be noted that the total energy consumption value is divided into two parts: transmission consumption value and read-write consumption value. This embodiment estimates the total energy consumption value in future practical applications by analyzing the historical data of the platform sub-data (such as access frequency value and number of fields, etc.). This evaluation method can quantify the energy consumption of M storage nodes, providing data support for subsequent optimization, and ensuring that the system is more efficient and accurate in energy consumption management.
[0089] The method for optimizing Q data storage strategies and determining the optimal storage strategy includes:
[0090] S301: Randomly generate Q sparrow individuals, each sparrow individual represents a data storage strategy, and randomly generate an initial position for each sparrow individual , that is, the initial position Characterized as data storage strategy;
[0091] S302: Construct the fitness function value F of each sparrow individual ( ):
[0092] F( )= ;
[0093] In the formula, It is characterized by the total energy consumption value corresponding to the data storage strategy.
[0094] S303: Perform exploration operations on some sparrow individuals to update the positions of some sparrow individuals;
[0095] ;
[0096] In the formula, For the A sparrow in The position of the generation, For the A sparrow in The position of the generation, is the maximum number of iterations, is a random angle, It is an exponential function with e as base, where e is a natural constant.
[0097] In this embodiment, it is shown that the exploration operation updates the position of the sparrow individuals through exponential decay and angle random factors. As the number of iterations increases, the movement range of the individuals gradually decreases, so that the algorithm has a greater exploration ability in the early stage and gradually concentrates on the possible optimal solution area. In this embodiment, some sparrow individuals refer to those individuals selected for "exploration operation" during the iteration process of the sparrow algorithm. These individuals will update their positions according to the influence of exponential decay and random angles in each generation of iteration. Through this mechanism, the individuals have a larger search range in the early stage. As the iteration proceeds, the movement range gradually decreases, so that these individuals are finally concentrated in the possible optimal solution area.
[0098] S304: performing a following operation on the remaining sparrow individuals to update the positions of the remaining sparrow individuals;
[0099] The above-mentioned following operation means that the remaining sparrow individuals will follow the direction of the current optimal solution for update. By continuously following the optimal solution, the follower individuals have the opportunity to gradually approach the optimal solution, thereby improving the overall fitness of the population.
[0100] S305: Calculate the fitness function value F of each sparrow individual after the update ( ), update the current optimal solution, the current optimal solution refers to the data storage strategy corresponding to the current minimum total energy consumption value;
[0101] It should be noted that the current optimal solution refers to the data storage strategy with the smallest total energy consumption value found after calculating the fitness function in each iteration process. Specifically, the current optimal solution refers to the individual with the lowest total energy consumption value among the sparrow individuals in a certain generation or round (that is, the data storage strategy). This individual represents the most optimized solution under the current circumstances.
[0102] S306: Repeat the above S303-S305 until the preset maximum number of iterations is reached. Stop searching when the optimal solution is reached, and output the data storage strategy corresponding to the current optimal solution, which is the optimal storage strategy.
[0103] The methods for updating the positions of the remaining sparrow individuals include:
[0104] ;
[0105] In the formula, is a random number between 0 and 1. is the location of the current optimal solution.
[0106] In this embodiment, the above steps indicate that the individual sparrows follow and update based on the current optimal solution. In this way, the individual sparrows will gradually move closer to the optimal solution and converge to a better solution.
[0107] In this embodiment, the storage key coefficient is first calculated to screen important platform sub-data, reducing unnecessary data transmission. Then, by calculating the correlation value, the storage location of highly correlated platform sub-data is optimized, which improves access efficiency and reduces the energy consumption of transmission across storage nodes. Finally, by designing and optimizing Q data storage strategies and optimizing the data storage process using a nature-inspired algorithm, the total energy consumption corresponding to the data storage strategy is minimized. This embodiment effectively solves the problem of excessive energy consumption caused by the need for each node in the existing blockchain to synchronize all data through data segmentation, storage optimization, and energy optimization management of the data storage process.
[0108] Example 2
[0109] See also Figure 2 As shown, based on the same inventive concept, this embodiment discloses a blockchain-based trading platform data trusted storage system. For details not provided in this embodiment, please refer to the description of the relevant parts in Embodiment 1. The system includes:
[0110] Data processing module: used to obtain trade platform data, divide the trade platform data into W platform sub-data according to preset rules, obtain storage key information of the W platform sub-data respectively, calculate the storage key coefficient according to the storage key information, and select S platform sub-data from the W platform sub-data based on the storage key coefficient, where W>S;
[0111] In this embodiment, trade platform data refers to various information and data generated and processed on an online or e-commerce trade platform. Trade platform data includes transaction data, user data, market data, feedback data, etc. Transaction data includes but is not limited to order information, payment records, and product information, etc. User data includes but is not limited to registration information, login history, etc. Market data includes but is not limited to commodity price fluctuations and changes in market supply and demand, etc. Feedback data includes but is not limited to user evaluations, complaints and suggestions on commodities and services. The above-mentioned preset rules refer to rules for dividing and screening trade platform data according to specific standards or conditions. By way of example, this embodiment divides the trade platform data according to data function rules, and divides the trade platform data into transaction data, user data, market data, and feedback data.
[0112] The platform sub-data includes G sub-data categories. The method for calculating the storage key coefficient according to the storage key information includes:
[0113] ;
[0114] Among them, SKC is the storage critical coefficient, For the The number of access restrictions corresponding to each sub-data category, For the The update frequency value corresponding to each sub-data category, For the The access frequency value corresponding to each sub-data category, is the hyperbolic cosine function, is the minimum function, is the maximum value function, is a logarithmic function with base 5, is the inverse cotangent function.
[0115] Methods for screening out S platform sub-data include:
[0116] The storage key coefficients corresponding to the W platform sub-data are arranged in descending order, and the platform sub-data with storage key coefficients less than a preset key coefficient threshold are eliminated, so as to obtain S platform sub-data.
[0117] It should be added that the above screening method is only an example description. This embodiment does not limit the screening method. The storage key coefficient is calculated based on the storage key information (such as access frequency, access restriction number, update frequency, etc.), and the more important S platform sub-data are screened out. This can ensure that high-priority data is preferentially stored on storage nodes with better performance, thereby optimizing the allocation of storage resources and reducing resource waste.
[0118] Strategy generation module: used to calculate the association values between S platform sub-data, build a sub-data association graph according to the association values, and determine Q data storage strategies based on the sub-data association graph and a preset number of M storage nodes, where the storage nodes are network nodes in the blockchain;
[0119] In this embodiment, the network nodes in the blockchain refer to the distributed participants in the blockchain network, which are responsible for storing, verifying, and disseminating data in the network and ensuring the decentralization and security of the system.
[0120] The method for calculating the correlation value between S platform sub-data includes:
[0121] ;
[0122] in, For the The platform sub-data and The correlation value between the sub-data of each platform, For the The platform sub-data and The number of common fields between the sub-data of each platform, For the The number of fields of platform sub-data, For the The number of fields of platform sub-data, For the The platform sub-data and The number of common access frequencies between sub-data on each platform, For the The access frequency of each platform sub-data, For the The access frequency of each platform sub-data, For the The platform sub-data and The number of common update frequencies between the sub-data of each platform, For the The update frequency of each platform sub-data, For the The update frequency of each platform sub-data, , , are all weight factors.
[0123] The method of constructing a sub-data association graph according to the association value includes:
[0124] The S platform sub-data are used as the associated nodes of the sub-data association graph, and the association values between the S platform sub-data are used as the associated edges of the sub-data association graph, so as to construct the sub-data association graph.
[0125] Strategy optimization module: used to traverse Q data storage strategies, store S platform sub-data in M storage nodes according to the data storage strategies, calculate the total energy consumption value corresponding to the M storage nodes, optimize the Q data storage strategies based on the total energy consumption value and the natural inspiration algorithm, and determine the optimal storage strategy;
[0126] Methods for calculating total energy expenditure values include:
[0127] ;
[0128] in, is the total energy consumption value, For the The energy consumption value of each storage node is No. Storage nodes The number of fields of platform sub-data, No. Storage nodes The access frequency value of each platform sub-data, For the The unit energy consumption of a storage node when performing read and write operations is To be the first The platform sub-data is transmitted to the The energy consumption required in each storage node is For the The total number of platform sub-data in the storage node.
[0129] Example 3
[0130] This embodiment provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, a blockchain-based trusted storage method for trading platform data provided by the above methods is implemented.
[0131] Since the electronic device introduced in this embodiment is an electronic device used to implement a blockchain-based trading platform data trusted storage method in the embodiment of the present application, based on the blockchain-based trading platform data trusted storage method introduced in the embodiment of the present application, technical personnel in this field can understand the specific implementation method of the electronic device of this embodiment and its various variations, so how the electronic device implements the method in the embodiment of the present application is no longer introduced in detail. As long as technical personnel in this field implement the electronic device used in the blockchain-based trading platform data trusted storage method in the embodiment of the present application, it belongs to the scope of protection of this application.
[0132] Example 4
[0133] This embodiment discloses a computer-readable storage medium, on which a computer program is stored. When the computer program is executed, the above-mentioned blockchain-based trading platform data trusted storage method is implemented.
[0134] The above formulas are all dimensionless and numerical calculations. The formula is a formula for the most recent real situation obtained by collecting a large amount of data and performing software simulation. The preset parameters, weights and thresholds in the formula are set by technicians in this field according to actual conditions.
[0135] The above embodiments may be implemented in whole or in part by software, hardware, firmware or any other combination thereof. When implemented by software, the above embodiments may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from one website, computer, server or data center to another website, computer, server or data center via a wired network or a wireless network. The computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more available media sets. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD) or a semiconductor medium. The semiconductor medium may be a solid-state hard disk.
[0136] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed in the present invention can be implemented in electronic hardware or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0137] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0138] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of the units is only one, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0139] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0140] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0141] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
[0142] Finally: The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A blockchain-based trading platform data trusted storage method, characterized in that: include: Obtain the trade platform data, divide the trade platform data into W platform sub-data according to preset rules, obtain storage key information of the W platform sub-data respectively, calculate the storage key coefficient according to the storage key information, and select S platform sub-data from the W platform sub-data based on the storage key coefficient, where W>S; Calculate the association values between the S platform sub-data, construct a sub-data association graph according to the association values, and determine Q data storage strategies based on the sub-data association graph and a preset number of M storage nodes, where the storage nodes are network nodes in the blockchain; Traverse Q data storage strategies, store S platform sub-data in M storage nodes according to the data storage strategies, calculate the total energy consumption value corresponding to the M storage nodes, optimize the Q data storage strategies based on the total energy consumption value and the natural inspiration algorithm, and determine the optimal storage strategy; The method for constructing a sub-data association graph according to the association degree value comprises: The S platform sub-data are used as the associated nodes of the sub-data association graph, and the association values between the S platform sub-data are used as the associated edges of the sub-data association graph, so as to construct the sub-data association graph; Methods for determining data storage strategies include: S201: respectively obtaining storage capacities and reading speeds corresponding to M storage nodes, clustering S associated nodes to obtain H associated node sets, and obtaining the sum of storage coefficients corresponding to each associated node set, where the sum of storage coefficients is the sum of storage key coefficients corresponding to each associated node in the associated node set; S202: Arrange the M storage nodes in descending order according to the read speed, and arrange the H associated node sets in descending order according to the sum of the storage coefficients; S203: preferentially allocating the associated node set with the largest sum of storage coefficients to the storage node with the highest reading speed, ensuring that during the allocation process, the remaining capacity of each storage node can accommodate the currently allocated associated node set; if the remaining capacity is insufficient, skip the storage node and continue to allocate to the next storage node; S204: Continue to execute the above S203 for the remaining associated node sets until all associated node sets are allocated.
2. According to a blockchain-based trading platform data trusted storage method according to claim 1, it is characterized in that: The storage key information includes access frequency value, access restriction number and update frequency value, the platform sub-data includes G sub-data categories, and the storage key coefficient is calculated according to the access frequency value, access restriction number and update frequency value.
3. According to a blockchain-based trading platform data trusted storage method according to claim 2, it is characterized in that: The method for calculating the association value between S platform sub-data includes: = ; in, For the The platform sub-data and The correlation value between the sub-data of each platform, For the The platform sub-data and The number of common fields between the sub-data of each platform, For the The number of fields of platform sub-data, For the The number of fields of platform sub-data, For the The platform sub-data and The number of common access frequencies between sub-data on each platform, For the The access frequency of each platform sub-data, For the The access frequency of each platform sub-data, For the The platform sub-data and The number of common update frequencies between the sub-data of each platform, For the The update frequency of each platform sub-data, For the The update frequency of each platform sub-data, , , are all weight factors.
4. According to a blockchain-based trading platform data trusted storage method according to claim 3, it is characterized in that: Methods for calculating total energy expenditure values include: ; in, is the total energy consumption value, For the The energy consumption value of each storage node is No. Storage nodes The number of fields of platform sub-data, No. Storage nodes The access frequency value of each platform sub-data, For the The unit energy consumption of a storage node when performing read and write operations is To be the first The platform sub-data is transmitted to the The energy consumption required in each storage node is For the The total number of platform sub-data in the storage node.
5. According to a blockchain-based trading platform data trusted storage method according to claim 4, it is characterized in that: The method for optimizing Q data storage strategies and determining the optimal storage strategy includes: S301: Randomly generate Q sparrow individuals, each sparrow individual represents a data storage strategy, and randomly generate an initial position for each sparrow individual , that is, the initial position Characterized as data storage strategy; S302: Construct the fitness function value F of each sparrow individual ( ): F( )= ; In the formula, It is characterized by the total energy consumption value corresponding to the data storage strategy; S303: Perform exploration operations on some sparrow individuals to update the positions of some sparrow individuals; = ; In the formula, For the A sparrow in the The position of the generation, For the A sparrow in the The position of the generation, is the maximum number of iterations, is a random angle, It is an exponential function with e as base, where e is a natural constant; S304: performing a following operation on the remaining sparrow individuals to update the positions of the remaining sparrow individuals; S305: Calculate the fitness function value F of each sparrow individual after the update ( ), update the current optimal solution, the current optimal solution refers to the data storage strategy corresponding to the current minimum total energy consumption value; S306: Repeat the above S303-S305 until the preset maximum number of iterations is reached. Stop searching when the optimal solution is reached, and output the data storage strategy corresponding to the current optimal solution, which is the optimal storage strategy.
6. According to a blockchain-based trading platform data trusted storage method according to claim 5, it is characterized in that: The method for updating the positions of the remaining sparrow individuals comprises: = ; In the formula, is a random number between 0 and 1. is the location of the current optimal solution.
7. A blockchain-based trade platform data trusted storage system, which is used to implement a blockchain-based trade platform data trusted storage method according to any one of claims 1 to 6, characterized in that: include: Data processing module: used to obtain trade platform data, divide the trade platform data into W platform sub-data according to preset rules, obtain storage key information of the W platform sub-data respectively, calculate the storage key coefficient according to the storage key information, and select S platform sub-data from the W platform sub-data based on the storage key coefficient, where W>S; Strategy generation module: used to calculate the association values between S platform sub-data, build a sub-data association graph according to the association values, and determine Q data storage strategies based on the sub-data association graph and a preset number of M storage nodes, where the storage nodes are network nodes in the blockchain; Strategy optimization module: used to traverse Q data storage strategies, store S platform sub-data in M storage nodes according to the data storage strategies, calculate the total energy consumption value corresponding to the M storage nodes, optimize the Q data storage strategies based on the total energy consumption value and the nature-inspired algorithm, and determine the optimal storage strategy.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method for trusted storage of trading platform data based on blockchain as described in any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Block-link data storage method, device, electronic device, and storage medium
CN109063016A
Stepped data storage method and system capable of reducing block chain storage overhead
CN112988073A
Block chain storage optimization method and device based on distributed network coding
CN115292340A