Transaction packaging and deduplication method and system suitable for asynchronous consensus protocol

Through the transaction packaging and deduplication optimization model constructed by the convex optimization mathematical model and KKT conditions, the probability of transaction selection is dynamically calculated, which solves the high throughput and market incentive problems of blockchain transaction processing solutions and realizes an efficient and universal transaction packaging solution.

CN120653712APending Publication Date: 2025-09-16SHANGHAI TREE-GRAPH BLOCKCHAIN INST
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510680259.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-26
Publication Date
2025-09-16

AI Technical Summary

Technical Problem

Existing blockchain transaction processing solutions cannot meet high throughput and real-time requirements, and the market incentive mechanism is ineffective and cannot adapt to new asynchronous consensus protocols, resulting in repeated transaction packaging and low efficiency.

Method used

A convex optimization mathematical model combined with KKT conditions is used to construct a weak consensus-dependent transaction packaging and deduplication optimization model. By collecting transaction attribute information in real time, the probability of transaction selection is dynamically calculated, and the optimal transaction set weighted by unit fuel price is generated to ensure that high-value transactions are packaged first.

Benefits of technology

It achieves optimality and high efficiency of transaction packaging under asynchronous consensus protocols, reduces duplicate packaging, improves system throughput and market efficiency, adapts to multiple consensus protocols, and responds to market fluctuations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120653712A_ABST
    Figure CN120653712A_ABST
Patent Text Reader

Abstract

The invention discloses a transaction packaging de-duplication method and system suitable for an asynchronous consensus protocol, and constructs a transaction packaging de-duplication optimization model with weak consensus dependence by adopting a convex optimization mathematical model in combination with a KKT condition. The model only depends on transaction attribute information as input, does not need to modify a bottom-layer consensus protocol, quickly calculates the transaction selection probability by calling cached public parameters, solves the problem that high-value transactions in a transaction pool are repeatedly packaged due to the fact that the high-value transactions are simultaneously selected by multiple nodes, effectively improves the packaging efficiency and the system throughput, and reduces the cost. And meanwhile, various consensus protocols including a novel asynchronous protocol are universally adapted. The system sequentially executes the four steps of transaction attribute collection, probability updating, dynamic packaging, block confirmation and uplink in the method, it can be ensured that the high-value transaction obtains the preferential packaging opportunity, the optimality of the transaction packaging strategy under the Pareto meaning is proved for the first time, and theoretical support with verifiability and interpretability is provided for the industry.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of blockchain technology, and in particular to a transaction packaging and deduplication method and system applicable to an asynchronous consensus protocol. Background Art

[0002] In the blockchain system, the transaction processing solutions currently used mainly include three categories: shard-dependent solutions, solutions using random packaging strategies, and solutions based on linear optimization models.

[0003] 1. Sharding-dependent solutions Sharding-dependent solutions, represented by Mir-BFT and HoneyBadgerBFT, utilize transaction hash sharding as their core technology. By mapping transactions to specific replica groups based on their hash values, they combine BFT (Byzantine Fault Tolerance) consensus protocols to achieve intra-shard transaction ordering and global deduplication. Core modules include a node grouping manager, an inter-shard state synchronization interface, and a multi-round voting verification process.

[0004] 2. Using random packaging strategy Solutions that adopt a random packaging strategy, represented by Conflux and Avalanche, rely on probabilistic algorithms, record reference relationships by building a TDAG (Transaction Dependency Graph), generate conflict-free transaction sequences based on Markov chain random sampling, and use a global hash index table to filter confirmed transactions.

[0005] 3. Solutions based on linear optimization models Solutions based on linear optimization models, represented by Gasper and Algorand, adopt a static priority queue structure, aiming to maximize block rewards. They use a greedy algorithm to select the transaction combination with the highest unit price under the constraint of block capacity, and rely on a fixed weight distribution mechanism to complete packaging decisions.

[0006] In the process of implementing the technical solution of the present invention, the inventor of this patent discovered at least the following technical problems in the prior art: The workflow of the shard-dependent solution begins with transaction hash sharding. Multiple rounds of BFT-style consensus protocols are then used within replica groups to determine transaction order. Finally, the cross-group distribution module synchronizes the global state. While this solution achieves strong consistency, its technical implementation is deeply tied to a specific consensus protocol. For example, sharding rules require a pre-defined node grouping strategy, and cross-group verification relies on the consensus layer's message broadcast mechanism and the multi-round voting mechanism of BFT-style consensus protocols. This deep binding creates a strong consensus dependency, making it difficult to adapt to new asynchronous consensus protocols such as DAG-rider and GHAST (Greedy Heaviest Adaptive Subtree Tree), severely limiting the technology's versatility. Furthermore, the high network overhead incurred by inter-shard state synchronization leads to high latency. For example, transaction pool updates can take over 500ms, failing to meet the real-time requirements of high-throughput scenarios.

[0007] Second, a randomized packaging strategy achieves deduplication by dynamically constructing a TDAG. Its core steps include random walk sampling and hash collision detection. However, the randomness of this strategy results in equal probability of high-value and low-value transactions being packaged. The difference in probability between high-value and low-value transactions is less than 20%, resulting in a lack of motivation for users to increase the unit price of fuel, and the market incentive mechanism is therefore ineffective.

[0008] Third, the linear optimization model, based on a greedy algorithm, selects high-value transaction combinations by sorting the queue by unit price. Although simple to implement and computationally efficient, the static, rigid linear priority cannot respond to real-time market fluctuations. When the unit price of a transaction changes dynamically, the block revenue drops significantly.

[0009] Fourth, traditional solutions rely on empirical rule-based design and fail to address core issues such as optimality and incentive compatibility. Furthermore, during the implementation of traditional solutions, high-value transactions in the market are likely to be selected by multiple nodes simultaneously, leading to duplicate packaging and inefficient markets.

[0010] In summary, the existing blockchain transaction processing solutions cannot meet actual usage needs. Summary of the Invention

[0011] The present invention provides a transaction packaging and deduplication method and system suitable for asynchronous consensus protocols, which solves the problem that existing blockchain transaction processing solutions cannot meet actual usage requirements.

[0012] In a first aspect, the present invention provides a transaction packaging and deduplication method applicable to asynchronous consensus protocols. The method uses a convex optimization mathematical model combined with the KKT condition to construct a weak consensus-dependent transaction packaging and deduplication optimization model. The transaction packaging and deduplication optimization model relies solely on transaction attribute information as input, without modifying the underlying consensus protocol. The probability of a transaction being selected can be calculated by retrieving cached public parameters. The method includes: Transaction attribute collection step: Real-time collection of attribute information for each transaction in the transaction pool, including fuel unit price, fuel usage, and sequence number. The fuel unit price reflects the fee the user is willing to pay for the exchange, the fuel usage reflects the maximum amount of resources the user is willing to pay for the exchange, and the sequence number serves as an identifier to distinguish each transaction. Probability update step: When the collected attribute information changes, the transaction packaging and deduplication optimization model is triggered to retrieve public parameters. Based on the weighted calculation of the existing model structure and the changed attribute information, the probability of selection of each transaction is updated to reflect the market value of each transaction and its resource allocation; Dynamic Packaging Steps: Based on the probability of each transaction being selected, a transaction set with the optimal unit fuel price weighting is generated to ensure that high-value transactions are given priority in packaging. Each consensus node uses a probabilistic prefix and sampling mechanism to construct a candidate transaction set and generate candidate blocks respectively. Block confirmation and chain-up steps: Candidate blocks are confirmed by each consensus node and finally uploaded to the chain.

[0013] Optionally, the process of using a convex optimization mathematical model combined with KKT conditions to construct a weak consensus-dependent transaction packaging and deduplication optimization model specifically includes: Independently obtain current transaction attribute information from the transaction pool, perform standardization processing, and use the standardized transaction attribute information as input variables to construct a convex optimization mathematical model; Construct a convex optimization objective function with the probability of transaction selection as the decision variable. The goal is to maximize the total expected benefits of all transactions being selected at least once in multiple consensus nodes, while satisfying the transaction pool's fuel resource constraints. Set the upper limit of the transaction pool's total gas usage as a linear constraint; Applying the KKT condition to solve the convex optimization objective function with linear constraints, we obtain a closed-form solution for the optimal probability of selection for each transaction. The closed-form solution is a functional relationship between the unit fuel price and the fuel constraint Lagrange multiplier, in the form of an exponential fractional power. The closed-form solution expression is calculated by interpolation and caching to obtain the transaction packaging and deduplication optimization model.

[0014] Optionally, the public parameters include the total number of transactions, the upper limit of fuel usage, transaction distribution statistics and power function results; the changes in the attribute information include the addition of serial numbers, deletion of serial numbers, increase in fuel unit price, decrease in fuel unit price, increase in fuel usage, and decrease in fuel usage.

[0015] Optionally, the transaction pool is managed by a spreading tree structure, which places frequently accessed transaction nodes close to the root of the tree to reduce operation delays.

[0016] Optionally, the calculation formula for the selection probability is specifically: , , Where, The identifier of the transaction, Indicates the The unit price weight of the transaction, Indicates the number of nodes that can be packaged at the same time, Indicates the number of The unit price of fuel for each transaction, Indicates the The probability of a transaction being selected, represents the cutoff threshold, Indicates the upper limit of gas usage in the transaction pool. Indicates the The amount of gas used for each transaction.

[0017] In a second aspect, the present invention provides a transaction packaging and deduplication system applicable to an asynchronous consensus protocol, the system comprising: The transaction attribute collection unit is used to collect the attribute information of each transaction in the transaction pool in real time. The attribute information includes the fuel unit price, fuel usage, and sequence number. The fuel unit price reflects the fee the user is willing to pay for the exchange, the fuel usage reflects the maximum amount of resources the user is willing to pay for the exchange, and the sequence number serves as an identifier to distinguish each transaction. The weak consensus-based transaction packaging and deduplication optimization model is constructed using a convex optimization mathematical model combined with KKT conditions. It relies solely on transaction attribute information as input and does not require modification of the underlying consensus protocol. The probability of a transaction being selected can be calculated by retrieving cached public parameters. When the collected attribute information changes, the transaction packaging and deduplication optimization model retrieves public parameters and, based on the weighted calculation of the changed attribute information within the existing model structure, updates the probability of each transaction being selected to reflect the market value of each transaction and its resource allocation. A data buffer, used to cache the public parameters obtained by the transaction packaging and deduplication optimization model when calculating the probability of a transaction being selected for the first time; The dynamic packaging unit generates the optimal transaction set weighted by unit fuel price based on the probability of each transaction being selected, ensuring that high-value transactions are given priority packaging opportunities. Each consensus node uses a probabilistic prefix and sampling mechanism to construct a candidate transaction set and generate candidate blocks respectively. The block confirmation and chain-up unit is used to complete the candidate block confirmation through each consensus node and finally upload it to the chain.

[0018] Optionally, the transaction pool is managed by a spreading tree structure, which places frequently accessed transaction nodes close to the root of the tree to reduce operation delays.

[0019] Optionally, the public parameters include the total number of transactions, the upper limit of fuel usage, transaction distribution statistics and power function results; the changes in the attribute information include the addition of serial numbers, deletion of serial numbers, increase in fuel unit price, decrease in fuel unit price, increase in fuel usage, and decrease in fuel usage.

[0020] Optionally, the system further includes a model building unit, wherein the model building unit includes: The first module is configured to receive the current transaction attribute information independently obtained by the transaction attribute collection unit from the transaction pool, perform standardization processing on the current transaction attribute information, and use the standardized transaction attribute information as an input variable to construct a convex optimization mathematical model; The second module is used to construct a convex optimization objective function with the probability of transaction selection as the decision variable. The goal is to maximize the total expected benefits of all transactions being selected at least once in multiple consensus nodes, while satisfying the gas resource constraints of the transaction pool. The third module is used to set the upper limit of the total gas usage of the transaction pool as a linear constraint; The fourth module is used to apply the KKT condition to solve the optimization objective function with linear constraints and obtain a closed-form solution expression for the optimal selection probability of each transaction. The closed-form solution expression is a functional relationship between the unit fuel price and the fuel constraint Lagrange multiplier, in the form of an exponential fractional power. The fifth module is used to calculate the closed-form solution expression through interpolation and caching to obtain the transaction packaging and deduplication optimization model.

[0021] Optionally, the calculation formula for the selection probability is specifically: , , Where, The identifier of the transaction, Indicates the The unit price weight of the transaction, Indicates the number of nodes that can be packaged at the same time, Indicates the number of The unit price of fuel for each transaction, Indicates the The probability of a transaction being selected, represents the cutoff threshold, Indicates the upper limit of gas usage in the transaction pool. Indicates the The amount of gas used for each transaction.

[0022] One or more technical solutions provided by the present invention have at least the following technical effects or advantages: 1. This paper utilizes a convex optimization mathematical model combined with KKT conditions to construct a weakly consensus-dependent transaction bundling and deduplication optimization model. This demonstrates for the first time the optimality of transaction bundling strategies in the Pareto sense. Specifically, if a single Pareto-optimal strategy satisfies system constraints, then adjusting the order of transactions cannot increase the benefits of some transactions without compromising the benefits of others. In other words, there is no alternative strategy that prioritizes certain transactions for bundling (resulting in better returns or faster confirmation times) without compromising the benefits of others. This theoretical result provides verifiable and explainable theoretical support for the industry, overcoming the shortcomings of traditional approaches that rely on empirical rules and lack optimality guarantees.

[0023] 2. Compared with the strong consensus dependency of traditional solutions, the present invention only needs to use transaction attributes as the input of the weak consensus-dependent optimization model, without modifying the underlying consensus protocol. It can be widely adapted to a variety of consensus protocols, including new asynchronous protocols such as DAG-rider and GHAST, significantly improving the versatility and adaptability of the technology. At the same time, the weak consensus-dependent transaction packaging and deduplication optimization model of the present invention only relies on transaction attributes as input, and updates the probability of transaction selection in real time in the dynamic trading market, solving the problem of repeated packaging of high-value transactions caused by repeated selection by multiple nodes, effectively improving packaging efficiency and system throughput, and at the same time widely adapting to a variety of consensus protocols including new asynchronous protocols. Therefore, the present invention can provide a transaction packaging solution that is both efficient and versatile.

[0024] 3. Compared with the traditional solution of equalizing transaction probabilities or static, rigid linear priorities, the present invention collects the attribute information of each transaction in the transaction pool in real time, including fuel unit price, fuel usage, and serial number. When the collected attribute information changes, the transaction packaging and deduplication optimization model is triggered to dynamically calculate the selection probability of each transaction, ensuring that the updated selection probability of each transaction can reflect the market value of each transaction and its resource allocation in real time. This real-time and dynamic adjustment of the selection probability mechanism ensures that high-value transactions are packaged first, and the transaction set with the optimal unit fuel price weighting always remains optimal, thereby improving the overall efficiency of the market. For example: when the fuel unit price of a transaction suddenly rises, its selection probability can be quickly calculated, so that it obtains a higher priority in the packaging process.

[0025] 4. The present invention caches the public parameters required to calculate the selection probability of each transaction. When market fluctuations cause changes in fuel unit prices, the public parameters are promptly used to update the selection probability of each transaction, avoiding repeated calculations, saving a large amount of computing resources, shortening computing time, improving computing efficiency, and enhancing system responsiveness. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] Figure 1 This is a flow chart of the transaction packaging and deduplication method applicable to the asynchronous consensus protocol of the present invention; Figure 2 This is a structural diagram of the transaction packaging and deduplication system applicable to the asynchronous consensus protocol of the present invention. DETAILED DESCRIPTION

[0027] The present invention provides a transaction packaging and deduplication method and system suitable for asynchronous consensus protocols, which solves the problem that existing blockchain transaction processing solutions cannot meet actual usage requirements.

[0028] First, some terms of the present invention are explained.

[0029] Pareto optimality, also known as "Pareto efficiency," is a concept in game theory and optimization theory. It refers to a state of resource allocation or strategy in which it is impossible to change the resource allocation to improve the situation of at least one participant without making any other participant worse off. In other words, a Pareto optimal state means that there is no room for improvement that would increase overall efficiency without harming the interests of others. For example, in transaction bundling, if a strategy is Pareto optimal, it means that there is no other strategy that would prioritize certain transactions for bundling (resulting in better returns or faster confirmation) without affecting the interests of other transactions.

[0030] The probabilistic prefix sum sampling mechanism is an efficient method for sampling discrete probability distributions. Its core idea is to construct a prefix sum array through preprocessing and combine it with binary search to achieve fast sampling. It is suitable for scenarios that require frequent sampling from discrete distributions, and its advantages are particularly significant when the distribution scale is large.

[0031] In its first aspect, the present invention provides a transaction deduplication and bundling method for asynchronous consensus protocols. Prior to executing the method, a weak consensus-dependent transaction deduplication and bundling optimization model is constructed using a convex optimization mathematical model combined with the Karush–Kuhn–Tucker (KKT) condition. This model relies solely on transaction attribute information as input, without modifying the underlying consensus protocol. It calculates the probability of a transaction being selected by accessing cached public parameters.

[0032] Among them, the process of using a convex optimization mathematical model combined with KKT conditions to construct a weak consensus-dependent transaction packaging and deduplication optimization model mainly includes steps S1 to S5.

[0033] Step S1: independently obtain the current transaction attribute information from the transaction pool, perform standardization processing, and use the standardized transaction attribute information as input variables to construct a convex optimization mathematical model.

[0034] Step S2: Construct a convex optimization objective function with the probability of transaction selection as the decision variable. The goal is to maximize the expected return of all transactions being selected at least once across multiple consensus nodes, while satisfying the transaction pool's fuel resource constraints. This goal aims to increase the probability of high-value transactions being selected while reducing duplication and resource waste between transactions, thereby optimizing transaction packaging efficiency and fairness.

[0035] Step S3: Set the upper limit of the total gas usage of the transaction pool as a linear constraint.

[0036] Step S4: Apply the KKT condition to solve the convex optimization objective function with linear constraints, and obtain a closed-form solution for the optimal probability of selection for each transaction. The closed-form solution is a functional relationship between the unit fuel price and the fuel constraint Lagrange multiplier, in the form of an exponential fractional power.

[0037] Step S5: Calculate the closed-form solution expression through interpolation and caching to obtain the transaction packaging and deduplication optimization model.

[0038] After obtaining the transaction bundling and deduplication optimization model, the public parameters obtained from the initial calculation of the transaction selection probability by the transaction bundling and deduplication optimization model are cached for subsequent retrieval when recalculating the transaction selection probability. These public parameters include the total number of transactions, the upper limit of fuel usage, transaction distribution statistics, and the power function result.

[0039] For ease of understanding, the following description will be provided in detail with reference to the accompanying drawings and specific implementation methods. Obviously, the embodiments described herein are only a portion of the embodiments of the present invention, not all of them. All other embodiments derived by persons of ordinary skill in the art based on the embodiments of the present invention without inventive effort are also within the scope of protection of the present invention.

[0040] When a user initiates a transaction through a blockchain client or application, each transaction includes information such as the fuel price, fuel usage, sequence number, and transaction data. The fuel price, fuel usage, and sequence number are transaction attributes. Changes to these attributes include the addition or deletion of a sequence number, an increase or decrease in the fuel price, an increase or decrease in fuel usage, and a unique identifier for each transaction. The sequence number is typically unchanged, serving as a unique identifier for each transaction. Within the transaction pool, sequence numbers are added or deleted as new transactions are introduced and some transactions are packaged. The fuel price reflects the fee a user is willing to pay for the exchange, while the fuel usage reflects the maximum amount of resources a user is willing to contribute. Users can specify specific values ​​for the fuel price and fuel usage of each transaction to change the priority of a transaction for inclusion. For example, a user could increase the fuel price to increase the priority of a transaction for inclusion. Once a transaction is initiated, it is broadcast to all nodes in the blockchain network. Upon receiving the transaction, the node temporarily stores it in the transaction pool managed by the splay tree, awaiting further processing. The splay tree structure, a self-balancing binary tree, is an efficient data structure that supports fast insertion and query operations, allowing transactions to enter the transaction pool and be processed promptly, ensuring efficient insertion and query. The splay tree structure can dynamically adjust its structure, placing frequently accessed transaction nodes closer to the root of the tree, thereby reducing operational latency.

[0041] Please refer to the following Figure 1 After a transaction enters the transaction pool managed by the splay tree, the transaction attribute collection unit begins executing the transaction attribute collection process: It collects attribute information for each transaction in the transaction pool in real time, including fuel price, fuel usage, and serial number. The act of collecting attribute information itself does not directly trigger the transaction bundling and deduplication optimization model to calculate the transaction selection probability. The collected attribute information must be analyzed and judged. Only when the judgment indicates that the attribute information has changed will the transaction bundling and deduplication optimization model be triggered to recalculate the transaction selection probability. Otherwise, a new round of transaction attribute information collection is repeated.

[0042] When the collected attribute information changes, the transaction packaging and deduplication optimization model is triggered to execute the probability update step: the transaction packaging and deduplication optimization model calls the public parameters stored in the data cache, combines the changed attribute information, and performs weighted calculations based on the existing model structure to update the selection probability of each transaction to reflect the market value of each transaction and its resource allocation.

[0043] Among them, changes in attribute information include the addition of serial numbers, deletion of serial numbers, increase in fuel unit price, decrease in fuel unit price, increase in fuel usage, decrease in fuel usage, etc.

[0044] The calculation formula for the probability of being selected is: , , Where, The identifier of the transaction, Indicates the The unit price weight of the transaction, Indicates the number of nodes that can be packaged at the same time, Indicates the number of The unit price of fuel for each transaction, Indicates the The probability of a transaction being selected, represents the cutoff threshold, Indicates the upper limit of gas usage in the transaction pool. Indicates the The amount of gas used for each transaction.

[0045] It should be noted that It is mainly used to control the probability of a transaction being selected. The smaller the value, the more "cost-effective" the transaction is and the more likely it is to be selected.

[0046] For example, when the unit price of fuel for a transaction suddenly rises, the calculated probability of the transaction being selected will increase, and the priority of the transaction will be adjusted to give it a higher priority in the packaging process.

[0047] Subsequently, the dynamic packaging unit performs the dynamic packaging steps: based on the probability of each transaction being selected, it generates the optimal transaction set weighted by the unit fuel price to ensure that high-value transactions have priority packaging opportunities; each consensus node uses a probabilistic prefix and sampling mechanism to construct a candidate transaction set and generate candidate blocks respectively.

[0048] Among them, the candidate block includes the following: High-value transaction list: A combination of high-value transactions selected based on the probability of being selected.

[0049] Block header information: including block hash, previous block hash, timestamp, etc.

[0050] Finally, the block confirmation and chain-up steps are executed: the candidate blocks are confirmed by each consensus node and finally uploaded to the chain.

[0051] It should be noted that in the probability update step and the dynamic packaging step, the calculation of the selection probability of each transaction and the collaborative processing of the dynamic packaging strategy are as follows: (1) Dynamic packaging strategy. N Each node packages transactions simultaneously, using the same dynamic packaging strategy. If a transaction is packaged at least once, the block reward is obtained (block reward = fuel price × fuel usage); otherwise, the block reward is 0.

[0052] In blockchain, gas price and gas usage are two key parameters used to calculate block revenue and available resources. The gas limit represents the maximum gas consumption (measured in gas units) set by the user for a single transaction, representing the upper limit of the gas consumption estimated by the user for the transaction. The gas price, representing the price per unit of gas, determines the priority of transactions packaged by node operators. Node operators tend to prioritize transactions with higher gas prices to generate higher revenue. Users can control transaction confirmation speed by adjusting the gas price; higher gas prices result in faster confirmations.

[0053] (2) Description of key parameters.

[0054] : The number of nodes that can be packaged at the same time, currently 3-5.

[0055] : The total number of transactions in the transaction pool.

[0056] : In the trading pool The unit price of gas for each transaction, assuming descending order .

[0057] : In the trading pool The gas usage of each transaction (Gas Limit).

[0058] : The upper limit of gas usage of the transaction pool (Total Gas Limit).

[0059] and : More than two nodes in the transaction pool package transactions at the same time and the cumulative fuel usage exceeds the transaction pool's fuel usage limit, which means that the transaction pool's fuel is insufficient.

[0060] (3) Optimization objective. The objective is to maximize the expected total benefits of all transactions being selected at least once in multiple consensus nodes, while satisfying the transaction pool's fuel resource constraints. This objective can achieve the following: high-value transactions (e.g., transactions with significantly higher fuel prices than other transactions) have a higher probability of being selected; when transaction prices are close, the probability control can be used to reduce the duplicate packaging rate and improve overall resource utilization efficiency.

[0061] Assume that the package i The probability of a transaction is , then the convex optimization objective function is as follows: .

[0062] At the same time, the upper limit of the gas usage of a transaction pool is used as a linear constraint. The linear constraint is expressed as follows: .

[0063] (4) Solving the process of probability of being selected: According to the KKT constraints, the following formula is obtained: , Where, is the fuel constraint Lagrange multiplier.

[0064] according to , will i The probability of a transaction is The formula is simplified to: .

[0065] Without loss of generality, let , where represents the fuel constraint Lagrange multiplier and the number of nodes packaged simultaneously The normalization constant constructed by the two, and .

[0066] make , where Indicates the The unit price weight of the transaction.

[0067] So we get the following formula: .

[0068] In addition, according to the KKT constraint, hour, ; hour, ; obviously The case is an empty set. Therefore,i The probability of a transaction is Transformed into the following expression: .

[0069] At the same time, if , which easily leads to a contradiction. Therefore, let ,set up for For all indices that are not 0, the following expression is obtained: , , because ,therefore .

[0070] according to The requirements are as follows: , , Notice Follow Monotonically increasing, so are consecutive integers starting from 1, assuming .in, represents the cutoff threshold, is satisfied The maximum integer of the condition, that is, in the transaction pool sorted in descending order by transaction unit price, the cumulative fuel consumption does not exceed the upper limit of the transaction pool's fuel usage The maximum consecutive transaction number threshold. It is used to divide the boundaries of transactions that can be packaged in a block, so the above formula is transformed into the following expression: , , because The monotonicity of , the above formula is equivalent to the following expression: .

[0071] In particular, if , then there is no constraint on the right side. .

[0072] The following proves Existence of: set up For minimum satisfaction If the integer is , then the following expression is available: , where Indicates the The dynamic weight value of the transaction, Indicates the The gas consumption of a transaction, that is, the amount of computing resources required to execute the transaction.

[0073] The following proves Uniqueness: If there is

[0074] According to the sugar-water inequality, we get the following expression: .

[0075] According to mathematical induction, we get the following formula: , where Indicates the verification cutoff threshold Auxiliary variables for correctness.

[0076] (5) Find the optimal solution.

[0077] make , Determine the cutoff position and find the largest Satisfies the following expression: , where Indicates the Dynamic weight of each transaction.

[0078] Finally, the fuel price is No. The probability of a transaction being selected The expression is as follows: , Where, is satisfied The maximum integer for the condition.

[0079] Second, as Figure 2 As shown, the present invention also provides a transaction packaging and deduplication system applicable to an asynchronous consensus protocol, the system comprising: The transaction attribute collection unit is used to collect the attribute information of each transaction in the transaction pool in real time. The attribute information includes the fuel unit price, fuel usage, and sequence number. The fuel unit price reflects the fee the user is willing to pay for the exchange, the fuel usage reflects the maximum amount of resources the user is willing to pay for the exchange, and the sequence number serves as an identifier to distinguish each transaction. The weak consensus-based transaction packaging and deduplication optimization model is constructed using a convex optimization mathematical model combined with KKT conditions. It relies solely on transaction attribute information as input and does not require modification of the underlying consensus protocol. The probability of a transaction being selected can be calculated by retrieving cached public parameters. When the collected attribute information changes, the transaction packaging and deduplication optimization model retrieves public parameters and, based on the weighted calculation of the changed attribute information within the existing model structure, updates the probability of each transaction being selected to reflect the market value of each transaction and its resource allocation. The data buffer is used to cache the public parameters obtained by the transaction packaging and deduplication optimization model when calculating the probability of transaction selection for the first time; The dynamic packaging unit generates the optimal transaction set weighted by unit fuel price based on the probability of each transaction being selected, ensuring that high-value transactions are given priority packaging opportunities. Each consensus node uses a probabilistic prefix and sampling mechanism to construct a candidate transaction set and generate candidate blocks respectively. Block confirmation and chain upload are used to complete the candidate block confirmation through each consensus node and finally upload it to the chain.

[0080] Among them, the transaction pool is managed through a stretching tree structure, which places frequently accessed transaction nodes close to the root of the tree to reduce operation delays.

[0081] Among them, public parameters include the total number of transactions, the upper limit of fuel usage, transaction distribution statistics and power function results; changes in attribute information include the addition of serial numbers, deletion of serial numbers, increase in fuel unit price, decrease in fuel unit price, increase in fuel usage and decrease in fuel usage.

[0082] The system further includes a model building unit, which includes: The first module is used to receive the current transaction attribute information independently obtained by the transaction attribute collection unit from the transaction pool, perform normalization processing on it, and use the normalized transaction attribute information as input variables to construct a convex optimization mathematical model; The second module is used to construct a convex optimization objective function with the probability of transaction selection as the decision variable. The goal is to maximize the total expected benefits of all transactions being selected at least once in multiple consensus nodes, while satisfying the gas resource constraints of the transaction pool. The third module is used to set the upper limit of the total gas usage of the transaction pool as a linear constraint; The fourth module is used to apply the KKT condition to solve the optimization objective function with linear constraints, and obtain the closed-form solution expression for the optimal selection probability of each transaction. The closed-form solution expression is the functional relationship between the unit fuel price and the fuel constraint Lagrange multiplier, which has an exponential fractional power form; The fifth module is used to calculate the closed-form solution expression through interpolation and caching to obtain the transaction packaging and deduplication optimization model.

[0083] The calculation formula for the probability of being selected is: , , Where, The identifier of the transaction, Indicates the The unit price weight of the transaction, Indicates the number of nodes that can be packaged at the same time, Indicates the number of The unit price of fuel for each transaction, Indicates the The probability of a transaction being selected, represents the cutoff threshold, Indicates the upper limit of gas usage in the transaction pool. Indicates the The amount of gas used for each transaction.

[0084] Obviously, those skilled in the art may make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if such changes and modifications fall within the scope of the claims and their equivalents, the present invention is intended to include such changes and modifications.

Claims

1. A transaction packaging and deduplication method applicable to asynchronous consensus protocols, characterized in that: A convex optimization mathematical model combined with KKT conditions is used to construct a weak consensus-dependent transaction packaging and deduplication optimization model. The transaction packaging and deduplication optimization model only relies on transaction attribute information as input, without modifying the underlying consensus protocol, and can calculate the probability of transaction selection by calling cached public parameters. The method includes: Transaction attribute collection step: Real-time collection of attribute information for each transaction in the transaction pool, including fuel unit price, fuel usage, and sequence number. The fuel unit price reflects the fee the user is willing to pay for the exchange, the fuel usage reflects the maximum amount of resources the user is willing to pay for the exchange, and the sequence number serves as an identifier to distinguish each transaction. Probability update step: When the collected attribute information changes, the transaction packaging and deduplication optimization model is triggered to retrieve public parameters. Based on the weighted calculation of the existing model structure and the changed attribute information, the probability of selection of each transaction is updated to reflect the market value of each transaction and its resource allocation; Dynamic Packaging Steps: Based on the probability of each transaction being selected, a transaction set with the optimal unit fuel price weighting is generated to ensure that high-value transactions are given priority in packaging. Each consensus node uses a probabilistic prefix and sampling mechanism to construct a candidate transaction set and generate candidate blocks respectively. Block confirmation and chain-up steps: Candidate blocks are confirmed by each consensus node and finally uploaded to the chain.

2. The method according to claim 1, wherein The process of using the convex optimization mathematical model combined with the KKT condition to construct a weak consensus-dependent transaction packaging and deduplication optimization model specifically includes: Independently obtain current transaction attribute information from the transaction pool, perform standardization processing, and use the standardized transaction attribute information as input variables to construct a convex optimization mathematical model; Construct a convex optimization objective function with the probability of transaction selection as the decision variable. The goal is to maximize the total expected benefits of all transactions being selected at least once in multiple consensus nodes, while satisfying the transaction pool's fuel resource constraints. Set the upper limit of the transaction pool's total gas usage as a linear constraint; Applying the KKT condition to solve the convex optimization objective function with linear constraints, we obtain a closed-form solution for the optimal probability of selection for each transaction. The closed-form solution is a functional relationship between the unit fuel price and the fuel constraint Lagrange multiplier, in the form of an exponential fractional power. The closed-form solution expression is calculated by interpolation and caching to obtain the transaction packaging and deduplication optimization model.

3. The method according to claim 1, wherein The public parameters include the total number of transactions, the upper limit of fuel usage, transaction distribution statistics and power function results; the changes in the attribute information include the addition of serial numbers, deletion of serial numbers, increase in fuel unit price, decrease in fuel unit price, increase in fuel usage, and decrease in fuel usage.

4. The method according to claim 1, wherein The transaction pool is managed through a stretching tree structure, which places frequently accessed transaction nodes close to the root of the tree to reduce operation latency.

5. The method according to claim 1, wherein The calculation formula of the selected probability is specifically: , , Where, The identifier of the transaction, Indicates the The unit price weight of the transaction, Indicates the number of nodes that can be packaged at the same time, Indicates the number of The unit price of fuel for each transaction, Indicates the The probability of a transaction being selected, represents the cutoff threshold, Indicates the upper limit of gas usage in the transaction pool. Indicates the The amount of gas used for each transaction.

6. A transaction packaging and deduplication system suitable for asynchronous consensus protocols, characterized by: The system comprises: The transaction attribute collection unit is used to collect the attribute information of each transaction in the transaction pool in real time. The attribute information includes the fuel unit price, fuel usage, and sequence number. The fuel unit price reflects the fee the user is willing to pay for the exchange, the fuel usage reflects the maximum amount of resources the user is willing to pay for the exchange, and the sequence number serves as an identifier to distinguish each transaction. The weak consensus-based transaction packaging and deduplication optimization model is constructed using a convex optimization mathematical model combined with KKT conditions. It relies solely on transaction attribute information as input and does not require modification of the underlying consensus protocol. The probability of a transaction being selected can be calculated by retrieving cached public parameters. When the collected attribute information changes, the transaction packaging and deduplication optimization model retrieves public parameters and, based on the weighted calculation of the changed attribute information within the existing model structure, updates the probability of each transaction being selected to reflect the market value of each transaction and its resource allocation. A data buffer, used to cache the public parameters obtained by the transaction packaging and deduplication optimization model when calculating the probability of a transaction being selected for the first time; The dynamic packaging unit generates the optimal transaction set weighted by unit fuel price based on the probability of each transaction being selected, ensuring that high-value transactions are given priority packaging opportunities. Each consensus node uses a probabilistic prefix and sampling mechanism to construct a candidate transaction set and generate candidate blocks respectively. The block confirmation and chain-up unit is used to complete the candidate block confirmation through each consensus node and finally upload it to the chain.

7. The system according to claim 6, wherein: The transaction pool is managed through a stretching tree structure, which places frequently accessed transaction nodes close to the root of the tree to reduce operation latency.

8. The system according to claim 6, wherein: The public parameters include the total number of transactions, the upper limit of fuel usage, transaction distribution statistics and power function results; the changes in the attribute information include the addition of serial numbers, deletion of serial numbers, increase in fuel unit price, decrease in fuel unit price, increase in fuel usage, and decrease in fuel usage.

9. The system according to claim 6, wherein: The system further includes a model building unit, wherein the model building unit includes: The first module is configured to receive the current transaction attribute information independently obtained by the transaction attribute collection unit from the transaction pool, perform standardization processing on the current transaction attribute information, and use the standardized transaction attribute information as an input variable to construct a convex optimization mathematical model; The second module is used to construct a convex optimization objective function with the probability of transaction selection as the decision variable. The goal is to maximize the total expected benefits of all transactions being selected at least once in multiple consensus nodes, while satisfying the gas resource constraints of the transaction pool. The third module is used to set the upper limit of the total gas usage of the transaction pool as a linear constraint; The fourth module is used to apply the KKT condition to solve the optimization objective function with linear constraints and obtain a closed-form solution expression for the optimal selection probability of each transaction. The closed-form solution expression is a functional relationship between the unit fuel price and the fuel constraint Lagrange multiplier, in the form of an exponential fractional power. The fifth module is used to calculate the closed-form solution expression through interpolation and caching to obtain the transaction packaging and deduplication optimization model.

10. The system according to claim 6, wherein: The calculation formula of the selected probability is specifically: , , Where, The identifier of the transaction, Indicates the The unit price weight of the transaction, Indicates the number of nodes that can be packaged at the same time, Indicates the number of The unit price of fuel for each transaction, Indicates the The probability of a transaction being selected, represents the cutoff threshold, Indicates the upper limit of gas usage in the transaction pool. Indicates the The amount of gas used for each transaction.