A blockchain storage optimization method based on transaction aggregation and backward consensus
By constructing a directed graph and utilizing node reputation incentives, combining deterministic algorithms with iterative algorithms to simplify multilateral settlement and continuous transfers, the problem of blockchain storage expansion is solved, storage space optimization and transaction processing efficiency are improved, and system security and consistency are enhanced.
Patent Information
- Application Number
- CN202411043717.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-31
- Publication Date
- 2025-09-23
- Estimated Expiration
- 2044-07-31
AI Technical Summary
Blockchain storage expansion causes scalability and security issues. Existing technologies make it difficult to optimize storage space while ensuring transaction execution consistency, and there are risks to data integrity and consistency.
Through a method based on transaction aggregation and backward consensus, a directed graph is constructed, and the node reputation value is used to incentivize the search for transaction loops. Deterministic and iterative algorithms are used to simplify multilateral clearing and continuous transfers, thereby optimizing storage space.
On the premise of ensuring the consistency of transaction execution, it significantly reduces storage requirements, improves data processing efficiency and system security, enhances data integrity and consistency, and reduces the synchronization time and error risk of new nodes.
Smart Images

Figure CN119130458B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a blockchain storage optimization method based on transaction aggregation and backward consensus. Background Art
[0002] Blockchain technology is a distributed database that records and manages data in a decentralized manner. Its core features include immutability, traceability, and transparency, and it is widely used in a variety of fields, including cross-border payments, smart contracts, supply chain management, and identity verification.
[0003] Based on the characteristics of blockchain, the academic community has summarized three important features that are difficult to achieve simultaneously, which are also known as the "impossible triangle" of blockchain. That is, it is difficult for any blockchain system to simultaneously have high scalability, high security and strong decentralization.
[0004] Regarding the industry's "impossible triangle," the lack of certain elements will lead to imbalances in other dimensions, significantly reducing the availability of the entire blockchain system. For example, blockchain storage. The ledger size stored by full nodes on today's mainstream public blockchains has ballooned to levels that are unbearable for home computers. For example, running a full node requires at least 1.5TB of disk space and requires high-performance storage devices such as solid-state drives, posing significant scalability challenges. The lack of blockchain storage scalability will exacerbate network centralization, increasing the number of users capable of running a full node. This will raise the barrier to entry for blockchain networks, reduce the number of participants, and intensify the monopoly of block production and ledger-keeping rights. When decentralization falls below a certain threshold, network security is compromised, and simply considering network security becomes meaningless, turning trust in a small number of monopolists into a necessity. Therefore, research on blockchain storage scalability is crucial and will impact multiple aspects of the "impossible triangle."
[0005] Specifically, data accumulation on the blockchain is initially executed in the form of transactions in the consensus engine of the node, and the state changes caused by the transactions, the blocks formed by transaction packaging, and the completion of transactions are written to the database to form persistent storage. At the underlying database level, mainstream blockchain systems often use multi-level KV databases, such as levelDB, to verify the legitimacy of transactions and states. As the number of transactions continues to increase, the number of database read and write calls required for state construction and maintenance will further increase, leading to a degradation of disk access performance, which will ultimately slow down the speed of blockchain transaction processing and cause transaction congestion.
[0006] When the number of transactions in a blockchain reaches a certain level, the resulting storage burden will degrade the read and write performance of blockchain nodes, impacting the execution and verification of subsequent transactions. Effectively managing and optimizing storage in blockchain systems has become a key research topic. Storage optimization aims to reduce system operating costs and improve data processing efficiency, including but not limited to blockchain state data pruning and off-chain collaborative storage.
[0007] Blockchain state data pruning technology aims to reduce the overall storage requirements of a blockchain by removing unnecessary state data. In blockchains, full nodes need to store the world state at the time of each block generation to accommodate rollbacks in the event of smart contract execution failures, leading to rapid data expansion. State data pruning technology attempts to optimize storage space by removing older historical states and retaining only the most recent state information.
[0008] However, during the pruning process, data critical to understanding the blockchain's history and state transitions may be inadvertently removed. Once lost, this information cannot be recovered, compromising the blockchain's transparency and auditability. Furthermore, when new nodes join the network, lacking complete historical data, they may need to rely on other nodes to provide additional information to complete synchronization or replay all transactions to construct the latest state. This not only increases synchronization time but also the risk of errors during the synchronization process. Furthermore, data pruning potentially increases the risk of data tampering and the possibility of historical state forgery.
[0009] Off-chain collaborative storage involves storing some blockchain data in an off-chain system to reduce the burden on the main chain. This method allows only critical transaction verification information (such as transaction metadata) to remain on-chain, while larger data blocks are stored off-chain. This model is often used in applications that process large data sets or require frequent updates.
[0010] However, this approach may face issues with data availability, storage reliability, and consistency. Data stored off-chain may face accessibility and availability issues, especially if the external storage service experiences downtime or network issues, making it impossible for network participants to access the data in a timely manner. Furthermore, it relies on the stability and security of the external storage service. If the storage service is attacked or compromised, the integrity and security of the stored data may be compromised. Furthermore, updates and synchronization of off-chain data may be inconsistent with the on-chain state, leading to data inconsistencies and impacting the overall operational efficiency and security of the system. Summary of the Invention
[0011] The purpose of the present invention is to provide a blockchain storage optimization method based on transaction aggregation and backward consensus, which vacates blockchain storage space while ensuring the consistency of the final results of transaction execution, thereby improving the scalability of blockchain and improving transaction processing capabilities.
[0012] To this end, the present invention provides a blockchain storage optimization method based on transaction aggregation and backward consensus, comprising the following steps: S1. For historical transfer transactions that have been placed on the blockchain, a directed graph is constructed, and a clearing interval is defined, so that each node in the blockchain participates in the loop search in the directed graph, and the node reputation is used as an incentive to make each node compete, thereby finding more transaction loops in a shorter time; S2. For the competition results of the loop search, a deterministic algorithm is used to calculate the loop clearing order, and multilateral clearing of transactions is performed on all loops in sequence; S3. An iterative algorithm and a continuous transfer transaction simplification mechanism are used to carry out multiple rounds of clearing in the same interval, and the clearing results are used as aggregated transactions to replace the transactions before clearing, so as to free up blockchain storage space.
[0013] The present invention also provides a blockchain storage optimization device, including a computer program, which, when executed by a processor, implements the steps of the above-mentioned blockchain storage optimization method based on transaction aggregation and backward consensus.
[0014] The present invention also provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of the above-mentioned blockchain storage optimization method based on transaction aggregation and backward consensus.
[0015] This invention optimizes blockchain storage and processing through a built-in, efficient algorithm. Compared to existing technologies, it not only improves data processing efficiency and reduces storage requirements, but also enhances system security and data consistency. These improvements are particularly important for blockchain applications that need to process large amounts of transaction data, significantly improving system scalability and maintainability.
[0016] Advantages of this invention over blockchain data clipping technology:
[0017] 1. Preserving Key Semantic Information: Compared to data pruning techniques, this method effectively preserves key semantic information about transactions through intelligent aggregation rather than simple deletion. This ensures the integrity and auditability of the blockchain while optimizing storage space.
[0018] 2. Enhanced data integrity: Through loop detection and multilateral clearing, the present invention not only optimizes storage but also increases the organization and optimization of transaction data, thereby maintaining data integrity and consistency and reducing the risk of errors introduced by clipping.
[0019] 3. Optimized synchronization efficiency: By reducing the total amount of data rather than simply trimming it, the present invention makes the synchronization of new nodes more efficient because all nodes can obtain a complete and optimized data set without the need for additional data supplementation.
[0020] Advantages of this invention over off-chain collaborative storage:
[0021] 1. Improved data availability and reliability: This invention eliminates the need for off-chain storage solutions, thus avoiding issues with off-chain data availability and reliability. All data is stored on-chain in an optimized form, ensuring real-time accessibility and high reliability.
[0022] 2. Consistency and Security: Since all data processing and storage operations are performed on-chain, this invention maintains data consistency and the inherent security characteristics of blockchain. This eliminates synchronization delays and consistency issues that may be caused by off-chain storage.
[0023] 3. Reduced Dependency: This invention reduces dependence on external storage solutions, avoids security vulnerabilities and performance bottlenecks that may be caused by third-party services, and thus improves the overall stability and security of the system.
[0024] In addition to the above-described objects, features and advantages, the present invention has other objects, features and advantages. The present invention will be further described in detail below with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] The accompanying drawings, which constitute part of this application, are intended to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are intended to explain the present invention and do not constitute an undue limitation of the present invention. In the accompanying drawings:
[0026] Figure 1 This is a flowchart of the blockchain storage optimization method based on transaction aggregation and backward consensus of the present invention;
[0027] Figure 2 This is the execution flow chart of the loop detection competition consensus;
[0028] Figure 3 It is the execution flow chart of the consensus result verification logic;
[0029] Figure 4 This is an example of a transaction loop, and its clearing order is: 1. Loop ABD-A 2. Loop ABCD-A 3. Loop ACDA;
[0030] Figure 5 It is an example of a process for breaking the multilateral clearing loop;
[0031] Figure 6 This is an example of a simplified mechanism for equal-amount continuous transfers. DETAILED DESCRIPTION
[0032] The present invention will be described in detail below with reference to the accompanying drawings and in conjunction with embodiments.
[0033] The method according to the present invention is to perform multilateral clearing and aggregation of historical transfer transactions that have been placed on the blockchain. Without changing the final execution result of the transaction, the transaction process is cleaned and optimized, blockchain storage space is freed up, and performance expansion of blockchain storage and transaction execution is achieved.
[0034] Combined with reference Figures 1 to 6 The blockchain storage optimization method based on transaction aggregation and backward consensus of the present invention mainly includes the following steps S1-S3 when executed.
[0035] S1. Loop detection competition consensus: For historical transfer transactions that have been placed in the blockchain, they are constructed into a directed graph and intervals are demarcated. Each node in the blockchain is allowed to participate in the loop search in the directed graph. The node reputation value is used as an incentive to encourage each node to find more transaction loops in a shorter time, so as to carry out subsequent multilateral settlement and save more on-chain storage space.
[0036] S2. Transaction multilateral settlement aggregation: For the results of the loop detection competition consensus, a deterministic algorithm is used to calculate the loop settlement order, and multilateral settlement of transactions is performed on all loops in order.
[0037] S3. Use the continuous transfer transaction simplification mechanism and iterative algorithm to carry out multiple rounds of liquidation within the same interval, and use the liquidation results as aggregated transactions to replace the transactions before liquidation, thereby saving on-chain storage space.
[0038] Loop Detection Competitive Consensus
[0039] Reference Figure 1 For historical transactions that have entered the finalized state, the system selects a certain height interval, maps the hash values of all transfer transactions within the interval to prime numbers, and multiplies these prime values to form an accumulator ACC ALL. It then issues a loop detection task, which is to solicit blockchain nodes with a certain computing power to perform loop detection on the directed graph composed of all transfer transactions in the selected interval. The one with the earliest submission time and the largest number of detected loops will be rewarded. The reward can be used to increase the node's reputation value so that subsequent nodes can quickly connect to the node to synchronize data when joining the network.
[0040] Reference Figure 2, participating competitors will submit specific loop information, including the accumulator value ACC_CYCLE formed by all loop edges and the hash value of each transaction in the loop. The other blockchain nodes will use the prime number mapping algorithm to calculate ACC_CYCLE' based on the hash value of each transaction in the loop and compare it with the ACC_CYCLE value. If the two are equal, the ACC_CYCLE and ACC_ALL values will be verified to verify that the transactions in the loop exist within the specified interval. Subsequently, the loop will be topologically sorted based on the hash values of each transaction submitted in the loop. If the topological sorting fails, it means that the information submitted by the competitor is indeed a loop. The submission time is then compared. The one with the earliest submission time will be rewarded, and the detected loop will be input into the transaction multilateral settlement algorithm.
[0041] In this paper, nodes are incentivized to find and reach consensus through competition. This approach differs from traditional loop-finding methods based on community partitioning or high-complexity algorithms. It encourages participants to develop and use more efficient algorithms to find loops in directed graphs, potentially leading to more optimal solutions.
[0042] Multilateral clearing transaction aggregation
[0043] The specific steps for multilateral clearing transaction aggregation are as follows:
[0044] 1. Determine the order of clearing all loops found in the previous step according to the clearing sequencing method;
[0045] 2. Clear each loop in order and break the loop;
[0046] 3. After the loop is broken, the transaction graph is simplified by continuous transfers of equal amounts to complete transaction aggregation;
[0047] 4. Replace pre-clearance transactions with post-clearance aggregated transactions.
[0048] Among them, the idea of the liquidation sequencing method is as follows:
[0049] 1. Prioritize clearing the loop containing the edge with the smallest weight.
[0050] 2. If there are multiple cycles containing the minimum-weight edge, calculate the difference between the in-degree and out-degree of each node (out-degree - in-degree). This difference represents the node's net contribution to the liquidation process. A positive difference indicates that the node has more outgoing edges, while a negative difference indicates that the node has more incoming edges.
[0051] 3. Among all the loops containing the edge with the smallest weight, the loop with the largest positive net contribution node is selected for priority liquidation.
[0052] 4. If there are multiple loops containing the same maximum positive net contribution node, the loop with the largest number of maximum positive net contribution nodes will be selected for priority liquidation.
[0053] The reason for using this method to determine the liquidation order is: start from the cycle with the largest positive net contribution node, because the nodes in this cycle have more outgoing edges, so prioritizing the liquidation of this cycle may help reduce the number of edges in other cycles.
[0054] The in-degree of a node in a directed graph refers to the number of edges with the node as the end point of the directed edge, and the out-degree refers to the number of edges with the node as the starting point of the directed edge.
[0055] Loop breaking algorithm:
[0056] 1. Enter each loop in turn according to the order of liquidation
[0057] 2. After entering the loop, first find the edge with the smallest weight in the loop (representing the smallest transfer amount) and the corresponding minimum weight
[0058] 3. Deduct the weight of each edge of the loop. The deduction value is the minimum weight found in the previous step. Delete the edge with a weight of 0 after deduction to break the loop.
[0059] 4. For each loop, execute steps 2-3 in order to break the loop until all loops are broken.
[0060] The above provides an optimization algorithm for determining the liquidation order of multiple rings, namely a deterministic algorithm for liquidation order. This algorithm calculates the net contribution of each node (the difference between its out-degree and in-degree) and selects the ring with the largest positive net contribution node as the priority liquidation target. This ensures that liquidation is carried out in the order with the least amount of remaining transactions, which is crucial for achieving storage optimization for the entire system.
[0061] Simplified mechanism for equal-amount continuous transfers
[0062] For the settlement results obtained in the previous step, the transactions are grouped according to the transfer amount. Within each group, transactions with continuous transfer relationships are searched and merged into one transaction (i.e., from the initiator of the first transfer to the recipient of the last transfer).
[0063] After executing this step, new loops may be generated within the interval, so loop detection tasks can continue to be issued, loops can be opened to find competitive consensus, and then multilateral liquidation can be carried out, thus achieving iterative liquidation within the same interval.
[0064] After loop clearing is complete, this invention also introduces the aforementioned retrieval and simplification process for continuous transfer relationships (e.g., the A->B->C transfer pattern). This reduces the number of transactions by directly replacing them with A->C transactions, i.e., simplifying the continuous transfer relationship. This not only further optimizes storage space but also makes it possible to expose new loops after clearing, providing the possibility for deeper storage optimization.
[0065] In addition, this method allows transactions within the same interval to be liquidated multiple times, improving the effectiveness of liquidation and minimizing the number of transactions ultimately retained in the blockchain, thereby minimizing on-chain storage space usage.
[0066] The present invention also provides a blockchain transaction bilateral clearing storage optimization device, including a computer program, which, when executed by a processor, implements the steps of the above-mentioned blockchain storage optimization method based on transaction aggregation and backward consensus.
[0067] The present invention also provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of the above-mentioned blockchain storage optimization method based on transaction aggregation and backward consensus.
[0068] Compared with the prior art, the present invention has the following technical effects:
[0069] 1. Blockchain storage space optimization: Through effective transaction aggregation, the storage requirements of on-chain data are significantly reduced, making blockchain technology more sustainable and widely applicable. This is especially important for data-intensive blockchain applications.
[0070] 2. Improve blockchain transaction processing efficiency: The optimized transaction processing process reduces potential congestion risks, such as transaction congestion and delay issues, improves the overall efficiency and response speed of the system, and enhances the system's transaction processing capabilities.
[0071] 3. Improve blockchain scalability: Through simplified transaction structure and optimized storage management, this solution provides a better foundation for blockchain expansion and supports larger-scale network operations.
[0072] 4. The new methods and algorithms provided by this invention may stimulate further research and development in related fields and promote the advancement of blockchain technology as a whole.
[0073] This invention is suitable for payment systems and financial transaction platforms, particularly those requiring high transaction throughput and data integrity. It can also be used in supply chain management, tracking and recording transactions within complex supply chains and optimizing data storage and verification processes. Furthermore, it can be used in data management services, specifically in distributed database systems requiring large-scale data storage and processing.
[0074] The foregoing description is merely an embodiment of the present invention and is not intended to limit the present invention. Those skilled in the art will readily appreciate that various modifications and variations of the present invention are possible. Any modifications, substitutions, or improvements made within the spirit and principles of the present invention are intended to be within the scope of protection of the present invention.
Claims
1. A blockchain storage optimization method based on transaction aggregation and backward consensus, characterized in that: The following steps are involved: S1. For historical transfer transactions that have been placed on the blockchain, a directed graph is constructed and liquidation intervals are defined. Each node in the blockchain is allowed to participate in loop search in the directed graph. Node reputation is used as an incentive to encourage competition among nodes, thereby finding more transaction loops in a shorter time. S2. For the competition results of the loop search, a deterministic algorithm is used to calculate the loop clearing order, and transactions are multilaterally cleared for all loops in order; S3. Use the continuous transfer transaction simplification mechanism and iterative algorithm to carry out multiple rounds of liquidation in the same interval, and use the liquidation results as aggregated transactions to replace the transactions before liquidation to free up blockchain storage space. Step S2 includes: S21, determining the clearing order for all loops found in the previous step according to the clearing sequencing method; S22, clearing each loop in order to break the loop; S23, simplifying the transaction graph after breaking the loop by equal-amount continuous transfers to complete transaction aggregation; S24, replacing the transactions before clearing with the aggregated transactions after clearing; The liquidation sequencing method in step S21 includes: S211, giving priority to liquidating the loop containing the edge with the smallest weight; S212, if there are multiple loops containing the edge with the smallest weight, calculating the difference between the in-degree and out-degree of each node, and this difference represents the net contribution of the node in the liquidation process, where a positive difference indicates that the node has more out-edges, and a negative difference indicates that the node has more in-edges; S213, among all loops containing the edge with the smallest weight, selecting the loop with the largest positive net contribution node for priority liquidation; S214, if multiple loops contain the same maximum positive net contribution node, selecting the loop with the largest number of maximum positive net contribution nodes for priority liquidation; The loop breaking in step S22 includes: S221, entering each loop in sequence according to the order of liquidation; S222, after entering the loop, first finding the edge with the smallest weight in the loop and the corresponding minimum weight, where the minimum weight refers to the smallest transfer amount; S223, deducting the weight of each edge in the loop, the deduction value is the minimum weight found in the previous step, deleting the edges with a weight of 0 after deduction, and achieving loop breaking; S224, executing steps S222-S223 in order for each loop to break the loop until all loops are broken.
2. The blockchain storage optimization method based on transaction aggregation and backward consensus according to claim 1 is characterized in that: Step S1 includes: S11. For historical transfer transactions that have been placed on the blockchain, the blockchain system selects a certain height interval as the clearing interval, maps the hash values of all transfer transactions within the interval to prime numbers, multiplies these prime values to form the accumulator value ACC_ALL, and then issues a loop detection task. S12. The competing blockchain nodes construct a directed graph of all transfer transactions within the interval, perform a cycle search, and calculate the accumulator value ACC_CYCLE for each edge in the cycle found. S13. Other nodes in the blockchain calculate the accumulator value ACC_CYCLE' based on the hash value of each transaction in the loop through a prime number mapping algorithm. S14. Compare ACC_CYCLE' with the ACC_CYCLE value. If they are equal, determine whether ACC_CYCLE is divisible by ACC_ALL. If so, the existence verification is passed, that is, verifying that the transaction in the loop exists within the interval. S15. If the verification is passed, the reward given to the searcher is determined based on the result submission time, and each node updates the searcher's reputation value to reach a consensus.
3. The blockchain storage optimization method based on transaction aggregation and backward consensus according to claim 1 is characterized in that: The continuous transfer transaction simplification mechanism in step S3 is an equal-amount continuous transfer simplification mechanism, that is, for the settlement result, the transactions are grouped according to the transfer amount, and transactions with continuous transfer relationships are searched in each group and merged into one transaction.
4. The blockchain storage optimization method based on transaction aggregation and backward consensus according to claim 1 is characterized in that: The iterative algorithm in step S3 refers to continuing to issue loop detection tasks for new loops that may be generated in the interval after the transaction is cleared, thereby achieving iterative clearing in the same interval.
5. The blockchain storage optimization method based on transaction aggregation and backward consensus according to claim 1 is characterized in that: Used in payment systems and financial transaction platforms.
6. A blockchain storage optimization device, comprising a computer program, characterized in that: When executed by a processor, the program implements the steps of the blockchain storage optimization method based on transaction aggregation and backward consensus according to any one of claims 1 to 5.
7. A computer program product comprising a computer program, characterized in that When executed by a processor, the computer program implements the steps of the blockchain storage optimization method based on transaction aggregation and backward consensus according to any one of claims 1 to 5.
Citation Information
Patent Citations
Clearing system based on block chain and clearing method based on block chain
CN114785776A
Method and apparatus for processing transaction requests in blockchain, device and medium
US20210209567A1