Block chain concurrent transaction control method and system

By introducing the cache mechanism and improvement of read and write set representation method in the blockchain concurrent transaction control method, combined with the linkage relationship between execution, sorting and verification modules, the transaction conflict problem in the high data conflict rate scenario is solved, and the transaction efficiency and effectiveness are significantly improved.

CN119693147APending Publication Date: 2025-03-25SUN YAT SEN UNIV
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411971921.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-30
Publication Date
2025-03-25

AI Technical Summary

Technical Problem

In the scenario of high data conflict rate, existing blockchain concurrent transaction control methods cannot effectively resolve transaction conflict problems, resulting in high transaction suspension rate, high processing delay and low verification efficiency, which in turn affects transaction efficiency and effectiveness.

Method used

By designing the linkage relationship between the execution module, sorting module and verification module, combining the cache mechanism and improvements in read and write set representation methods, the write behavior is divided into effective write and ordinary write, and the transaction dependency and conflict graph processing are optimized to realize topological sorting and concurrent verification of transaction data.

Benefits of technology

It fundamentally solves the problem of transaction conflict, significantly improves transaction efficiency and effectiveness, and can increase transaction throughput by at least 4 times in high data conflict rate scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119693147A_ABST
    Figure CN119693147A_ABST
Patent Text Reader

Abstract

The invention provides a block chain concurrent transaction control method and system, and the method and system solve the transaction conflict problem from the mechanism of transaction conflict through the linkage relation among an execution module, a sorting module and a verification module, divide the writing behavior into effective writing and common writing, and modify the reading and writing set representation mode, so as to achieve the functions of each module. Specifically, processing and on-demand caching of transaction data are completed by designing an execution module with a caching function, a transaction dependency relationship is determined based on a read-write set representation mode through a sorting module, so that a transaction conflict graph is determined, the transaction conflict graph is processed to complete topological sorting of the transaction data, and the transaction data are verified through a verification module. And according to the target variable processed by each transaction data and the transaction type of each transaction data, performing transaction verification and obtaining a transaction result so as to complete a corresponding transaction behavior. Therefore, the transaction conflict problem of the block chain of the related framework in the transaction process is solved, so that the transaction efficiency and effectiveness are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of blockchain transactions, and in particular to a blockchain concurrent transaction control method and system. Background Art

[0002] In the blockchain field, transactions are usually executed in parallel to improve transaction efficiency. The execute-order-validate (EOV) framework is better suited for concurrent transaction scenarios because it does not consider the execution order of transactions in advance.

[0003] However, when the EOV framework is applied to scenarios with high data conflict rates, the current blockchain concurrent transaction control method cannot fundamentally solve the transaction conflict problem by optimizing blockchain transaction performance through aspects such as data access efficiency, transaction order, or conflict handling efficiency. The optimization effect is not good in scenarios with high data conflict rates, resulting in high transaction abort rate, high transaction processing delay, and low verification efficiency, which ultimately leads to low transaction efficiency and effectiveness. Therefore, a blockchain concurrent transaction control method is needed to improve transaction performance in scenarios with high data conflict rates. Summary of the invention

[0004] The purpose of this application is to solve at least one of the above-mentioned technical defects, especially the technical defects of low efficiency and effectiveness of blockchain transactions in scenarios with high data conflict rates in the prior art.

[0005] In a first aspect, the present application provides a blockchain concurrent transaction control method, the method comprising:

[0006] Process and cache transaction data to be submitted through the execution module;

[0007] Sorting the transaction data by a sorting module;

[0008] Through the verification module, transaction verification is performed according to the target variables corresponding to each of the transaction data, the transaction results of each of the target variables are obtained, and the transaction results are updated to the blockchain world state.

[0009] As an optional implementation manner, the transaction type corresponding to the transaction data includes a read-only transaction, a normal write transaction, and a valid write transaction;

[0010] The common write transaction includes modifying the target variable in the form of an initial value and an execution result, and the effective write transaction includes modifying the target variable in the form of a change amount.

[0011] As an optional implementation, the processing and caching of transaction data to be submitted by executing the module includes:

[0012] If a cache hit occurs during the execution of transaction data, the transaction process corresponding to the transaction data is executed according to the data status in the corresponding cache;

[0013] If no cache hit occurs during the execution of the transaction data, the transaction process corresponding to the transaction data is executed according to the data state in the blockchain world state.

[0014] As an optional implementation, the method further includes:

[0015] If the first transaction data is written into the target variable through a common write transaction and no cache hit occurs, the target variable and the first transaction data are added to the cache;

[0016] If the second transaction data is written into the target variable through a common write transaction and a cache hit occurs, the second transaction data obtains the processing permission of the target variable, updates the target variable in the cache, and overwrites the first transaction data with the second transaction data;

[0017] If the third transaction data is written into the target variable through a valid write transaction, the target variable is added to the valid write set of the third transaction data and saved;

[0018] If the fourth transaction data obtains the target variable through a read-only transaction, a cache hit occurs and the target variable is written to the cache through a normal write transaction, the fourth transaction data obtains the processing permission of the target variable, and performs data processing based on the target variable in the corresponding cache, and at the same time establishes a dependency relationship between the fourth transaction data and the target transaction data written to the target variable.

[0019] As an optional implementation manner, the sorting of each transaction data by a sorting module includes:

[0020] Determine the dependency relationship of each of the transaction data through a sorting module, and establish a first conflict graph;

[0021] According to the first conflict graph, double transactions and circular transactions are processed to obtain a second conflict graph;

[0022] A topological sorting of each of the transaction data is determined according to the second conflict graph.

[0023] As an optional implementation, the verification module performs transaction verification according to the target variables corresponding to each of the transaction data, obtains the transaction results of each of the target variables, and updates the transaction results to the blockchain world state, including:

[0024] Verifying fifth transaction data belonging to a read-only transaction among the transaction data;

[0025] Verifying sixth transaction data belonging to a common write transaction among the transaction data;

[0026] Verify the seventh transaction data belonging to the valid write transaction in each of the transaction data, divide the corresponding target variable into target sub-variables, map each of the seventh transaction data to each of the target independent variables and concurrently perform transaction verification, and after completing the transaction verification, add each of the target sub-variables to obtain a transaction result corresponding to each of the target variables, and update the transaction result to the blockchain world state.

[0027] In a second aspect, the present application provides a blockchain concurrent transaction control system, the system being used to execute the method according to the first aspect, the system comprising:

[0028] Execution module, sorting module and verification module;

[0029] Wherein, the execution module is used to process and cache the transaction data to be submitted;

[0030] The sorting module is used to sort the transaction data;

[0031] The verification module is used to perform transaction verification according to the target variables corresponding to each of the transaction data, obtain the transaction results of each of the target variables, and update the transaction results to the blockchain world state;

[0032] And, the transaction type corresponding to the transaction data includes a read-only transaction, a normal write transaction, and a valid write transaction;

[0033] The common write transaction includes modifying the target variable in the form of an initial value and an execution result, and the effective write transaction includes modifying the target variable in the form of a change amount.

[0034] As an optional implementation, the execution module is specifically used to: if a cache hit occurs during the execution of transaction data, execute the transaction process corresponding to the transaction data according to the data state in the corresponding cache;

[0035] If no cache hit occurs during the execution of the transaction data, the transaction process corresponding to the transaction data is executed according to the data state in the blockchain world state;

[0036] And, the sorting module is specifically used to: determine the dependency relationship of each of the transaction data through the sorting module, and establish a first conflict graph;

[0037] According to the first conflict graph, double transactions and circular transactions are processed to obtain a second conflict graph;

[0038] Determining a topological sorting of each of the transaction data according to the second conflict graph;

[0039] And, the verification module is specifically used for:

[0040] Verifying fifth transaction data belonging to a read-only transaction among the transaction data;

[0041] Verifying sixth transaction data belonging to a common write transaction among the transaction data;

[0042] Verify the seventh transaction data belonging to the valid write transaction in each of the transaction data, divide the corresponding target variable into target sub-variables, map each of the seventh transaction data to each of the target independent variables and concurrently perform transaction verification, and after completing the transaction verification, add each of the target sub-variables to obtain a transaction result corresponding to each of the target variables, and update the transaction result to the blockchain world state.

[0043] In a third aspect, the present application provides a computer device comprising one or more processors and a memory, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the one or more processors, the steps of the method described in the first aspect are performed.

[0044] In a fourth aspect, the present application provides a storage medium storing computer-readable instructions, which, when executed by one or more processors, causes the one or more processors to perform the steps of the method described in the first aspect.

[0045] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages:

[0046] Based on any of the above embodiments, the method provided by the present application solves the transaction conflict problem from the mechanism of transaction conflict through the linkage relationship between the execution module, the sorting module and the verification module. Further, the write behavior is divided into effective write and ordinary write, and the read-write set representation method is modified to realize the functions of each module. Specifically, by designing an execution module with a cache function, the transaction data is processed and cached on demand. Through the sorting module, the transaction dependency is determined based on the read-write set representation method, thereby determining the transaction conflict graph. The transaction conflict graph can be further processed based on the relationship between each transaction data represented by the transaction conflict graph to complete the topological sorting of the transaction data. Finally, through the verification module, according to the target variables processed by each transaction data and the transaction type of each transaction data, the transaction verification is performed to obtain the transaction results corresponding to each target variable, and the transaction results are updated to the blockchain world state to complete the corresponding transaction behavior. Thus, the transaction conflict problem that may be caused in the transaction process of the blockchain framework based on execution-sorting-verification is solved from the root, thereby improving transaction efficiency and effectiveness. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0048] Figure 1 A flowchart of a blockchain concurrent transaction control method provided by an embodiment of the present application;

[0049] Figure 2 A schematic diagram of an application scenario of a blockchain concurrent transaction control system provided for one embodiment of the present application;

[0050] Figure 3 A schematic diagram of a cache architecture of a blockchain concurrent transaction control system provided by an embodiment of the present application;

[0051] Figure 4 A schematic diagram of the transaction conflict graph principle of a blockchain concurrent transaction control method provided by an embodiment of the present application;

[0052] Figure 5 A schematic diagram of a concurrent verification process of a blockchain concurrent transaction control method provided by an embodiment of the present application;

[0053] Figure 6 This is a diagram of the internal structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0054] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0055] In order to improve the transaction throughput of blockchain, transactions will be executed in parallel. The Execution-Order-Verification (EOV) framework can execute transactions in parallel well because it does not consider the execution order of transactions in advance. However, when the current transaction concurrency control technology of the EOV framework is applied to high data conflict rate scenarios represented by fungible tokens (FT), non-fungible tokens (NFT), decentralized finance (DeFi), etc., there are problems such as high transaction abort rate, high transaction processing delay, and low verification efficiency. Specifically, if there are n transactions accessing the same variable, only one transaction can be successfully executed, and the transaction abort rate is 1-1 / n. In addition, since the sorting stage needs to analyze the transaction dependency graph, the number of rings increases exponentially with the number of transaction conflicts after de-looping, and the de-looping time complexity increases exponentially year-on-year. At the same time, transaction verification updates the blockchain state in serial verification, which is inefficient when the number of transactions is large.

[0056] The optimization of blockchain parallel execution can be mainly divided into the following three aspects.

[0057] In terms of improving data access efficiency, optimization is carried out at the implementation level of system components. Some feasible implementation methods include metadata separation, Go language multi-coroutine verification, world state hash table, block serialization cache, optimized implementation of role hardware separation, and real-time calculation of the load of endorsement nodes. Transactions are dynamically allocated based on the principle of load balancing to prevent performance degradation caused by endorsement node overload.

[0058] In terms of reducing concurrent transaction conflicts, system performance can be improved by reordering transactions, merging transaction contents, terminating transactions in advance, etc. For example, in the sorting phase, a concurrent control mechanism that uses the transaction conflict graph to reorder transactions can be used to successfully submit some conflicting transactions.

[0059] In terms of improving the efficiency of handling concurrent transaction conflicts, this type of work focuses on the data structure used by the system framework on the one hand, and on the optimization of the transaction process on the other hand. For example, the occurrence of conflicts can be detected at the beginning of the transaction, indexes can be added to the conflicting transaction data structure, temporary storage of the ledger can be achieved, and write-write conflicting transactions can be merged through secure chaincodes.

[0060] Therefore, the current transaction parallel execution technology for blockchain systems is based on transaction conflict analysis, with system throughput and transaction confirmation latency as optimization targets, and by quickly handling transaction conflicts, the purpose of improving overall performance is achieved. However, the method of improving data access efficiency does not essentially reduce transaction conflicts. It is effective in scenarios with fewer transaction conflicts, but the efficiency is still low in scenarios with more conflicts. The method of reducing concurrent transaction conflicts is essentially to reduce conflicts by reordering transactions, but in scenarios with high data conflict rates, facing multiple transactions accessing the same hot variable, reordering transactions cannot reduce conflicts, so the transaction abort rate is not optimized. The method of improving the efficiency of handling concurrent transaction conflicts mainly focuses on the efficiency of conflict handling, and does not solve the essential transaction conflicts. Especially when the transaction conflict rate rises rapidly, it is difficult to continue to ensure the efficiency of processing.

[0061] This application is based on the EOV framework blockchain, provides a concurrency control method in scenarios with high data conflict rates, proposes a transaction concurrency control technology optimization solution based on execution effects, and designs new execution, sorting and verification modules. In some actual scenarios, the overall transaction throughput can be improved by at least 4 times compared to the traditional EOV framework.

[0062] The technical concept of this application is to solve the transaction conflict problem from the mechanism of transaction conflict through the linkage relationship between the execution module, the sorting module and the verification module. Further, the write behavior is divided into effective write and ordinary write, and the read-write set representation is modified to realize the functions of each module. Specifically, by designing an execution module with a cache function, the transaction data is processed and cached on demand. Through the sorting module, the transaction dependency is determined based on the read-write set representation, thereby determining the transaction conflict graph. The transaction conflict graph can be further processed based on the relationship between the transaction data represented by the transaction conflict graph to complete the topological sorting of the transaction data. Finally, through the verification module, according to the target variables processed by each transaction data and the transaction type of each transaction data, the transaction verification is performed to obtain the transaction results corresponding to each target variable, and the transaction results are updated to the blockchain world state to complete the corresponding transaction behavior. Thus, the transaction conflict problem that may be caused in the transaction process of the blockchain framework based on execution-sorting-verification is solved from the root, thereby improving transaction efficiency and effectiveness.

[0063] See also Figure 1 , Figure 1 A flowchart of a blockchain concurrent transaction control method provided by an embodiment of the present application is shown in FIG. Figure 1 As shown, the method includes:

[0064] S101, processing and caching transaction data to be submitted through an execution module;

[0065] In this application, compared with the execution modules in some existing feasible implementations, the execution module introduces a cache mechanism, so that the execution module can determine the basis of the variable values ​​executed by the transaction data through the cache hits corresponding to the transaction data. When all transaction data are executed based on the current blockchain world state, only one transaction will be successfully executed in the end. After any transaction is submitted, the blockchain world state after submission will be inconsistent with the blockchain world state when other transactions are executed, causing other transactions to roll back and cause transaction conflicts. Therefore, a cache mechanism is designed to temporarily store the unsubmitted data generated by unverified transactions to realize the processing and caching of transaction data and optimize the data processing process. For details, please refer to the relevant content in other implementations.

[0066] S102, sorting the transaction data by a sorting module;

[0067] According to the transaction read-write set representation method re-set in this application, transaction dependencies can be established to generate a transaction conflict graph. After processing the conflict graph, the relationship between different transactions can be obtained, thereby determining the topological sorting of different transaction data. The changes in the read-write set representation method mainly include dividing write transactions into ordinary write transactions and valid write transactions. For details, please refer to the relevant implementation method.

[0068] S103. Through the verification module, transaction verification is performed according to the target variables corresponding to each of the transaction data, the transaction results of each of the target variables are obtained, and the transaction results are updated to the blockchain world state.

[0069] The verification module performs verification in sequence according to different types of transaction data, and divides the target variables corresponding to each transaction data, thereby realizing concurrent verification and improving the data processing efficiency of the verification process.

[0070] See also Figure 2 , Figure 2 A schematic diagram of an application scenario of a blockchain concurrent transaction control system provided by an embodiment of the present application. Correspondingly, the present application provides a blockchain concurrent transaction control system, including an execution module, a sorting module and a verification module;

[0071] The execution module, i.e. the execution module based on the cache mechanism in the figure, is used to process and cache the transaction data to be submitted, and add a cache in the node to temporarily store the unsubmitted data generated by the unverified transaction. If a cache hit occurs during the transaction execution process, the transaction will continue to execute according to the cache state, rather than the current world state of the blockchain;

[0072] The sorting module, i.e. the sorting module based on effective write EW in the figure, is used to sort each of the transaction data. Since the present application modifies the traditional read-write set representation, a transaction dependency graph is established based on the new read-write set representation and transaction conflicts are eliminated, which can reduce the transaction abort rate at this stage;

[0073] The verification module, i.e., the verification module based on partition variables in the figure, represents a new strategy for concurrent submission and update of blockchain status based on a new read-write set, which enables concurrent verification and submission of transactions without conflicts to update blockchain status, and is used to perform transaction verification according to the target variables corresponding to each of the transaction data, obtain the transaction results of each of the target variables, and update the transaction results to the blockchain world status;

[0074] And, the transaction type corresponding to the transaction data includes a read-only transaction, a normal write transaction, and a valid write transaction;

[0075] The common write transaction includes modifying the target variable in the form of an initial value and an execution result, and the effective write transaction includes modifying the target variable in the form of a change amount.

[0076] The method provided in this embodiment solves the transaction conflict problem from the mechanism of transaction conflict through the linkage relationship between the execution module, the sorting module and the verification module. Further, the write behavior is divided into effective write and ordinary write, and the read-write set representation method is modified to realize the functions of each module. Specifically, the execution module with a cache function is designed to complete the processing and on-demand caching of transaction data. The transaction dependency relationship is determined based on the read-write set representation method through the sorting module, thereby determining the transaction conflict graph. The transaction conflict graph can be further processed based on the relationship between each transaction data represented by the transaction conflict graph to complete the topological sorting of the transaction data. Finally, the verification module is used to perform transaction verification according to the target variables processed by each transaction data and the transaction type of each transaction data, thereby obtaining the transaction results corresponding to each target variable, and the transaction results are updated to the blockchain world state to complete the corresponding transaction behavior. Therefore, the transaction conflict problem that may be caused in the transaction process of the blockchain framework based on execution-sorting-verification is solved from the root, thereby improving transaction efficiency and effectiveness.

[0077] As an optional implementation manner, the transaction type corresponding to the transaction data includes a read-only transaction, a normal write transaction, and a valid write transaction;

[0078] The common write transaction includes modifying the target variable in the form of an initial value and an execution result, and the effective write transaction includes modifying the target variable in the form of a change amount.

[0079] Specifically, if and only if the modification amount of the variable is only related to the user's input and has nothing to do with the initial value of the variable, this form of access is called a valid write. For example, when a user trades in the market, he is mainly concerned about the execution effect of the transaction (for example, +10 units of income), rather than its execution result (for example, the balance changes from 100 units to 110 units). In scenarios with high data conflict rates, since multiple transactions will access and modify the same hotspot variable, there will be conflicts between transactions. The proposal of valid write can merge the execution effects of conflicting transactions and ultimately change the blockchain state.

[0080] In this implementation, the read-write set representation method of the present application is modified, and the write behavior is divided into effective write and ordinary write. The ordinary write transaction includes executing the modification of the target variable in the form of the initial value and the execution result, and the effective write transaction includes executing the modification of the target variable in the form of the change amount, that is, the execution effect of the transaction is indicated by the effective write, and the execution result of the transaction is indicated by the ordinary write. In the scenario with high data conflict rate, since multiple transactions will access and modify the same hot variable, there will be conflicts between transactions. The effective write transaction can merge the execution effects of the conflicting transactions, thereby changing the blockchain world state based on this, providing a basis for the working principles of the subsequent modules, and fundamentally solving the transaction conflict problems that may be caused in the transaction process of the blockchain framework based on execution-sorting-verification, thereby improving transaction efficiency and effectiveness.

[0081] As an optional implementation, the processing and caching of transaction data to be submitted by executing the module includes:

[0082] If a cache hit occurs during the execution of transaction data, the transaction process corresponding to the transaction data is executed according to the data status in the corresponding cache;

[0083] If no cache hit occurs during the execution of the transaction data, the transaction process corresponding to the transaction data is executed according to the data state in the blockchain world state.

[0084] If multiple transactions are executed based on the current blockchain state, only one transaction will be executed successfully in the end, because no matter which transaction is submitted, the blockchain state after submission will be inconsistent with the blockchain state when other transactions are executed, causing the rollback of other transactions. To solve this problem, a cache is added to the node to temporarily store uncommitted data generated by unverified transactions. If the cache hits, the transaction will continue to be executed based on the cached state instead of the current blockchain state.

[0085] See also Figure 3 , Figure 3A schematic diagram of the cache architecture of a blockchain concurrent transaction control system provided for an embodiment of the present application, wherein the transaction execution order in the figure is from the initialized T1 transaction indicating state A to the T2 transaction indicating state A, and other transactions have not yet been executed or stored in the cache, such as the T4 transaction indicating state B, which is currently only stored in the cache and has not been executed.

[0086] This implementation method determines the basis of the variable values ​​executed by the transaction data through the cache hit situation corresponding to the transaction data. If all the transaction data are executed based on the current blockchain world state, only one transaction will be successfully executed in the end. After any transaction is submitted, the blockchain world state after submission will be inconsistent with the blockchain world state when other transactions are executed, causing the rollback of other transactions and resulting in transaction conflicts. Therefore, in this implementation method, if a cache hit occurs during the execution of transaction data, the transaction process corresponding to the transaction data is executed according to the data state in the corresponding cache. If no cache hit occurs during the execution of transaction data, the transaction process corresponding to the transaction data is directly executed according to the data state in the blockchain world state. By adding a cache to the node, the conflict of multiple transactions can be avoided in principle, and the transaction conflict problem that may be caused by the transaction process of the blockchain framework based on execution-sorting-verification is solved from the root, thereby improving transaction efficiency and effectiveness.

[0087] As an optional implementation, the method further includes:

[0088] If the first transaction data is written into the target variable through a common write transaction and no cache hit occurs, the target variable and the first transaction data are added to the cache;

[0089] If the second transaction data is written into the target variable through a common write transaction and a cache hit occurs, the second transaction data obtains the processing permission of the target variable, updates the target variable in the cache, and overwrites the first transaction data with the second transaction data;

[0090] If the third transaction data is written into the target variable through a valid write transaction, the target variable is added to the valid write set of the third transaction data and saved;

[0091] If the fourth transaction data obtains the target variable through a read-only transaction, a cache hit occurs and the target variable is written to the cache through a normal write transaction, the fourth transaction data obtains the processing permission of the target variable, and performs data processing based on the target variable in the corresponding cache, and at the same time establishes a dependency relationship between the fourth transaction data and the target transaction data written to the target variable.

[0092] Allowing conflicting transactions to execute serially will slow down the execution phase compared to concurrent execution without any conflicts. In order to keep the processing speed as fast as possible during the execution phase, the following cache update rules and operations need to be designed in combination with the valid write set when a transaction has a cache hit.

[0093] In a specific application scenario, specific implementations of the first transaction data to the fourth transaction data may include:

[0094] If transaction Ti writes variable x, but not in a valid write format and there is no cache hit, add x and Ti to the cache;

[0095] If transaction Tj reads variable x, and there is a cache hit but not a valid write, Tj will obtain the lock of variable x and execute based on the value in the cache. Then, it will query which transaction corresponds to the version of x in the cache. For example, Tj will retain the cache record of sequential access to Tj at this time, and Ti will be generated when the conflict graph is generated. The sequential dependency edge of Tj;

[0096] If transaction Tk writes variable x, but not in a valid write form and there is a cache hit, then Tk will acquire the lock of x and update x directly in the cache. The transaction version corresponding to x will be updated from Ti to Tk without waiting for Ti to commit;

[0097] If transaction Ti writing variable x is a valid write, then Ti only needs to add x to its valid write set and save x.

[0098] This implementation is based on the principle of avoiding transaction conflicts in principle by adding caches in nodes. A specific cache data processing method is designed based on transaction types and cache hit situations. Transaction data is divided into four specific types, and a basis can be provided for the establishment of subsequent transaction conflict graphs. This fundamentally solves the transaction conflict problems that may arise in the transaction process of the blockchain framework based on execution-sorting-verification, thereby improving transaction efficiency and effectiveness.

[0099] As an optional implementation manner, the sorting of each transaction data by a sorting module includes:

[0100] Determine the dependency relationship of each of the transaction data through a sorting module, and establish a first conflict graph;

[0101] According to the first conflict graph, double transactions and circular transactions are processed to obtain a second conflict graph;

[0102] A topological sorting of each of the transaction data is determined according to the second conflict graph.

[0103] The process of establishing transaction dependencies can be analyzed according to the actual application scenario. In the application scenario corresponding to this application, conflict analysis of transactions can yield four types of transaction dependencies (where R represents read-only, W represents normal write, and EW represents effective write):

[0104] RW dependency: For a variable x, there is a transaction Ti that reads x first, and then a transaction Tj that writes x , then there is a RW dependency between transaction Ti and transaction Tj, expressed as Ti Tj.

[0105] R-EW dependency: For a variable x, there is a transaction Ti that reads x first, and then a transaction Tj effectively writes x. Then there is an R-EW dependency between transactions Ti and Tj, expressed as Ti Tj.

[0106] WW dependency: For a variable x, there is a transaction Ti that writes x first, and then a transaction Tj also writes x. Then there is a WW dependency between transactions Ti and Tj, expressed as Ti Tj, note that WW dependency is bidirectional.

[0107] W-EW dependency: For a variable x, there is a transaction Ti that writes x first, and then a transaction Tj effectively writes x. Then there is a W-EW dependency between transactions Ti and Tj, expressed as Ti Tj, note that the W-EW dependency is bidirectional.

[0108] See also Figure 4 , Figure 4 A schematic diagram of the transaction conflict graph principle of the blockchain concurrent transaction control method provided by an embodiment of the present application. After analyzing the transaction dependencies, it is necessary to de-loop and topologically sort the conflict graph in the following order: Figure 4 First, the first conflict graph is constructed, specific dependency edges are eliminated and dependency loops in the conflict graph are detected. The dependency loops and the dependency relationships corresponding to the bidirectional transactions are processed to obtain the second conflict graph. Then, the eliminated dependency edges are added back to the conflict graph in a unilateral manner according to their actual significance, and finally topological sorting is achieved.

[0109] Dependency loop detection and elimination: When detecting and eliminating dependency loops, the dependency relationships between WW dependency and W-EW dependency need to be ignored.

[0110] Topological sorting, sorting transactions with WW, W-EW dependency, and adding the dependency back to the graph according to the sorting. It should be noted that the WW, W-EW relationship added back to the graph will be converted to a one-way dependency according to the sorting.

[0111] This embodiment uses a sorting module to determine the original first conflict graph based on the target variables and transaction types processed by each transaction data, and further determines and processes the double transactions and circular transactions represented in the first conflict graph to obtain a processed second conflict graph. Based on the transaction sequence indicated in the second conflict graph, the topological sorting of the transaction data is completed, thereby realizing the deduplication and sorting process of each transaction data based on the dependency relationship, thereby improving transaction efficiency and effectiveness.

[0112] As an optional implementation, the verification module performs transaction verification according to the target variables corresponding to each of the transaction data, obtains the transaction results of each of the target variables, and updates the transaction results to the blockchain world state, including:

[0113] Verifying fifth transaction data belonging to a read-only transaction among the transaction data;

[0114] Verifying sixth transaction data belonging to a common write transaction among the transaction data;

[0115] Verify the seventh transaction data belonging to the valid write transaction in each of the transaction data, divide the corresponding target variable into target sub-variables, map each of the seventh transaction data to each of the target independent variables and concurrently perform transaction verification, and after completing the transaction verification, add each of the target sub-variables to obtain a transaction result corresponding to each of the target variables, and update the transaction result to the blockchain world state.

[0116] The idea of ​​partition variables comes from lazy counter technology, which is widely used in Linux operating systems to record the management of system resources by CPU cores, thereby solving the bottleneck problem of shared counters. In the Linux operating system, a lazy counter consists of a global counter and a group of local counters. More specifically, the global counter is a shared central counter used by all cores, and the local counter is a group of single core counters used by different cores. When a thread on a core needs to access the global counter, it will first access the local counter on its own core. Each core has its own local counter, and threads on different cores will not compete, so the counter update operation has good scalability. In order to keep the global counter updated, the value of the local counter is regularly added to the global counter. This realizes the relevant principles of the target sub-variable division in this application.

[0117] See also Figure 5 , Figure 5 A schematic diagram of a concurrent verification process of a blockchain concurrent transaction control method provided by an embodiment of the present application,

[0118] First, verify the read-only type transactions, then verify the read-only and normal write type transactions, and then verify the valid write type transactions. Divide the hot variables into different sub-variables, and map the modifications of the valid write type transactions to different sub-variables for concurrent execution. After completing the transaction verification of the entire block, add the values ​​of the sub-variables to get the final result and update it to the blockchain status.

[0119] This implementation uses a verification module to sequentially perform validity verification of transaction data corresponding to read-only transactions, ordinary write transactions, and valid write transactions, and in each valid write transaction, the corresponding target variable is divided into target sub-variables, and then based on the situation of each target sub-variable, each transaction data is mapped, thereby realizing concurrent execution of transaction verification, and after completing the transaction verification, each target sub-variable is added to obtain the transaction result corresponding to each target variable, and the transaction result is updated to the blockchain world state, thereby realizing concurrent verification of transaction data, and fundamentally solving the transaction conflict problem that may be caused in the transaction process of the blockchain framework based on execution-sorting-verification, thereby improving transaction efficiency and effectiveness.

[0120] Based on the methods corresponding to each implementation method, in the blockchain concurrent transaction control system, the execution module is specifically used to: if a cache hit occurs during the execution of transaction data, execute the transaction process corresponding to the transaction data according to the data status in the corresponding cache;

[0121] If no cache hit occurs during the execution of the transaction data, the transaction process corresponding to the transaction data is executed according to the data state in the blockchain world state;

[0122] And, the sorting module is specifically used to: determine the dependency relationship of each of the transaction data through the sorting module, and establish a first conflict graph;

[0123] According to the first conflict graph, double transactions and circular transactions are processed to obtain a second conflict graph;

[0124] Determining a topological sorting of each of the transaction data according to the second conflict graph;

[0125] And, the verification module is specifically used for:

[0126] Verifying fifth transaction data belonging to a read-only transaction among the transaction data;

[0127] Verifying sixth transaction data belonging to a common write transaction among the transaction data;

[0128] Verify the seventh transaction data belonging to the valid write transaction in each of the transaction data, divide the corresponding target variable into target sub-variables, map each of the seventh transaction data to each of the target independent variables and concurrently perform transaction verification, and after completing the transaction verification, add each of the target sub-variables to obtain a transaction result corresponding to each of the target variables, and update the transaction result to the blockchain world state.

[0129] The implementation method proposed in this application proposes a system for parallel execution of blockchain transactions under scenarios with high data conflict rates and high requirements for transaction real-time performance. Based on the transaction execution status, the concept of effective writing is proposed to merge the execution effects of conflicting transactions, reduce transaction conflicts, and support concurrent verification of transactions through effective writing, thereby further improving the system throughput.

[0130] Correspondingly, in scenarios with high data conflict rates, transactions with conflicts can be successfully submitted, which not only reduces transaction conflicts but also reduces transaction abort rates. The identification of valid writes is very simple and does not require the introduction of additional overhead, thus realizing the complete EOV transaction pre-execution framework from transaction execution to conflict management to transaction submission.

[0131] Indicatively, Figure 6 As shown, Figure 6 This is a schematic diagram of the internal structure of a computer device provided in an embodiment of the present application. The computer device 300 may be provided as a server. Figure 6 The computer device 300 includes a processing component 302, which further includes one or more processors, and a memory resource represented by a memory 301 for storing instructions executable by the processing component 302, such as an application. The application stored in the memory 301 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 302 is configured to execute the instructions to perform the text recognition method of any of the above embodiments.

[0132] The computer device 300 may further include a power supply component 303 configured to perform power management of the computer device 300, a wired or wireless network interface 304 configured to connect the computer device 300 to a network, and an input / output (I / O) interface 305. The computer device 300 may operate based on an operating system stored in the memory 301, such as Windows Server TM, Mac OS X TM, Unix TM, Linux TM, Free BSD TM, or the like.

[0133] Those skilled in the art will understand that Figure 6The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0134] An embodiment of the present application provides a storage medium, in which computer-readable instructions are stored. When the computer-readable instructions are executed by one or more processors, the one or more processors execute a method provided in any embodiment.

[0135] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0136] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The various embodiments can be combined as needed, and the same or similar parts can refer to each other.

[0137] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A blockchain concurrent transaction control method, characterized in that: The method comprises: Process and cache transaction data to be submitted through the execution module; Sorting the transaction data by a sorting module; Through the verification module, transaction verification is performed according to the target variables corresponding to each of the transaction data, the transaction results of each of the target variables are obtained, and the transaction results are updated to the blockchain world state.

2. The method according to claim 1, characterized in that The transaction types corresponding to the transaction data include read-only transactions, ordinary write transactions, and valid write transactions; The common write transaction includes modifying the target variable in the form of an initial value and an execution result, and the effective write transaction includes modifying the target variable in the form of a change amount.

3. The method according to claim 2, characterized in that The execution module processes and caches the transaction data to be submitted, including: If a cache hit occurs during the execution of transaction data, the transaction process corresponding to the transaction data is executed according to the data status in the corresponding cache; If no cache hit occurs during the execution of the transaction data, the transaction process corresponding to the transaction data is executed according to the data state in the blockchain world state.

4. The method according to claim 3, characterized in that The method further comprises: If the first transaction data is written into the target variable through a common write transaction and no cache hit occurs, the target variable and the first transaction data are added to the cache; If the second transaction data is written into the target variable through a common write transaction and a cache hit occurs, the second transaction data obtains the processing permission of the target variable, updates the target variable in the cache, and overwrites the first transaction data with the second transaction data; If the third transaction data is written into the target variable through a valid write transaction, the target variable is added to the valid write set of the third transaction data and saved; If the fourth transaction data obtains the target variable through a read-only transaction, a cache hit occurs and the target variable is written to the cache through a normal write transaction, the fourth transaction data obtains the processing permission of the target variable, and performs data processing based on the target variable in the corresponding cache, and at the same time establishes a dependency relationship between the fourth transaction data and the target transaction data written to the target variable.

5. The method according to claim 2, characterized in that: The step of sorting the transaction data by a sorting module includes: Determine the dependency relationship of each of the transaction data through a sorting module, and establish a first conflict graph; According to the first conflict graph, double transactions and circular transactions are processed to obtain a second conflict graph; A topological sorting of each of the transaction data is determined according to the second conflict graph.

6. The method according to claim 2, characterized in that The verification module performs transaction verification according to the target variables corresponding to each of the transaction data, obtains the transaction results of each of the target variables, and updates the transaction results to the blockchain world state, including: Verifying fifth transaction data belonging to a read-only transaction among the transaction data; Verifying sixth transaction data belonging to a common write transaction among the transaction data; Verify the seventh transaction data belonging to the valid write transaction in each of the transaction data, divide the corresponding target variable into target sub-variables, map each of the seventh transaction data to each of the target independent variables and concurrently perform transaction verification, and after completing the transaction verification, add each of the target sub-variables to obtain a transaction result corresponding to each of the target variables, and update the transaction result to the blockchain world state.

7. A blockchain concurrent transaction control system, characterized in that: The system is used to execute the method according to any one of claims 1 to 6, and the system comprises: Execution module, sorting module and verification module; Wherein, the execution module is used to process and cache the transaction data to be submitted; The sorting module is used to sort the transaction data; The verification module is used to perform transaction verification according to the target variables corresponding to each of the transaction data, obtain the transaction results of each of the target variables, and update the transaction results to the blockchain world state; And, the transaction type corresponding to the transaction data includes a read-only transaction, a normal write transaction, and a valid write transaction; The common write transaction includes modifying the target variable in the form of an initial value and an execution result, and the effective write transaction includes modifying the target variable in the form of a change amount.

8. The system according to claim 7, characterized in that The execution module is specifically used to: if a cache hit occurs during the execution of transaction data, execute the transaction process corresponding to the transaction data according to the data state in the corresponding cache; If no cache hit occurs during the execution of the transaction data, the transaction process corresponding to the transaction data is executed according to the data state in the blockchain world state; And, the sorting module is specifically used to: determine the dependency relationship of each of the transaction data through the sorting module, and establish a first conflict graph; According to the first conflict graph, double transactions and circular transactions are processed to obtain a second conflict graph; Determining a topological sorting of each of the transaction data according to the second conflict graph; And, the verification module is specifically used for: Verifying fifth transaction data belonging to a read-only transaction among the transaction data; Verifying sixth transaction data belonging to a common write transaction among the transaction data; Verify the seventh transaction data belonging to the valid write transaction in each of the transaction data, divide the corresponding target variable into target sub-variables, map each of the seventh transaction data to each of the target independent variables and concurrently perform transaction verification, and after completing the transaction verification, add each of the target sub-variables to obtain a transaction result corresponding to each of the target variables, and update the transaction result to the blockchain world state.

9. A computer device, characterized in that: The method comprises one or more processors and a memory, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the one or more processors, the steps of the method according to any one of claims 1 to 6 are performed.

10. A storage medium, characterized in that: The storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the method according to any one of claims 1 to 6.

Citation Information

Cited By

  • Blockchain parallel transaction processing method based on sharding technology

    CN122654218A