Blockchain parallel transaction method, device, equipment and storage medium

The method improves blockchain transaction parallel processing by analyzing smart contract transactions to generate mutual exclusion variable behaviors, enhancing precision and accuracy, thus improving parallel processing efficiency and completeness.

CN115578096BActive Publication Date: 2025-07-15HANGZHOU QULIAN TECHNOLOGY CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211083577.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-06
Publication Date
2025-07-15
Estimated Expiration
2042-09-06

AI Technical Summary

Technical Problem

The existing blockchain parallel transaction processing methods have low analysis precision and accuracy, making it difficult to meet transaction needs.

Method used

By obtaining transaction configuration information and contract methods of smart contract transactions, determining the target field operation information, generating mutex variable behaviors, and performing dependency analysis to identify parallel contract transactions and implementing parallel execution.

Benefits of technology

It improves the precision and accuracy of trading behavior analysis, ensuring the parallel processing and completeness of contract transactions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115578096B_ABST
    Figure CN115578096B_ABST
Patent Text Reader

Abstract

The present application provides a blockchain parallel transaction method, apparatus, device, and storage medium. The method in the present application includes: obtaining each smart contract transaction to be processed and the transaction configuration information of the smart contract transaction; obtaining the transaction contract and smart contract method corresponding to the smart contract transaction, and determining the target field operation information of the smart contract transaction according to the transaction contract and the smart contract method; generating the mutex variable behavior of the smart contract transaction according to the target field operation information and the transaction configuration information; performing dependency analysis on each smart contract transaction according to the mutex variable behavior of each smart contract transaction to obtain each parallel contract transaction in each smart contract transaction, and executing each parallel contract transaction in parallel. The technical solution in the present application can improve the granularity of transaction behavior analysis, improve the accuracy of dependency analysis, and thus ensure the parallel degree and completeness of parallel processing of contract transactions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing, and in particular, to a blockchain parallel transaction method, apparatus, device, and storage medium. Background Art

[0002] Currently, with the rapid development of blockchain technology, more and more users upload transaction data to the blockchain and perform transaction processing on the blockchain. This application scenario requires the blockchain to be able to process transaction data in parallel to improve transaction efficiency. However, the existing blockchain parallel processing methods have the disadvantages of low analysis fineness and low accuracy of analysis results when processing transaction data in parallel, and it is difficult to meet the requirements of the existing blockchain transaction scenarios for blockchain parallel transactions. Summary of the Invention

[0003] Embodiments of this application provide a blockchain parallel transaction method, apparatus, device, and storage medium, aiming to solve the technical problems of low analysis fineness and low accuracy in blockchain parallel transactions in the prior art.

[0004] On the one hand, embodiments of this application provide a blockchain parallel transaction method, and the blockchain parallel transaction method includes the following steps:

[0005] Obtain each smart contract transaction to be processed and the transaction configuration information of the smart contract transaction;

[0006] Obtain the transaction contract and smart contract method corresponding to the smart contract transaction, and determine the target field operation information of the smart contract transaction according to the transaction contract and the smart contract method;

[0007] Generate the mutually exclusive variable behavior of the smart contract transaction according to the target field operation information and the transaction configuration information;

[0008] Perform dependency analysis on each smart contract transaction according to the mutually exclusive variable behavior of each smart contract transaction to obtain each parallel contract transaction in each smart contract transaction, and execute each parallel contract transaction in parallel.

[0009] In a possible implementation manner of this application, the step of obtaining the transaction contract and smart contract method corresponding to the smart contract transaction, and determining the target field operation information of the smart contract transaction according to the transaction contract and the smart contract method includes:

[0010] Obtain the contract address information associated with the smart contract transaction and the transaction contract corresponding to the contract address information;

[0011] Query the transaction contract to obtain the smart contract method corresponding to the function identifier of the smart contract transaction;

[0012] Analyze the smart contract method to obtain the target field operation information in the smart contract method, where the target field operation information includes a target field and a field operation identifier.

[0013] In a possible implementation manner of this application, the analyzing the smart contract method to obtain the target field operation information in the smart contract method includes:

[0014] Analyze the instructions of the smart contract method to obtain the target field, the target field operation identifier, and the contract call information in the smart contract method;

[0015] If the target field is a collection type field, perform a reaching definition analysis on the smart contract method to obtain the source of the target field parameters of the target field;

[0016] Summarize the target field operation identifier, the target field, the source of the target field parameters, and the contract call information to obtain the target field operation information in the smart contract method.

[0017] In a possible implementation manner of this application, the generating the mutually exclusive variable behavior of the smart contract transaction according to the target field operation information and the transaction configuration information includes:

[0018] Obtain the contract transaction type of the smart contract transaction;

[0019] If the contract transaction type is a contract call transaction type, obtain the cross - contract address information associated with the smart contract method, and the second contract corresponding to the cross - contract address information;

[0020] Obtain the cross - contract field operation information associated with the smart contract method in the second contract, and generate a cross - contract call strategy according to the second contract and the cross - contract operation field information;

[0021] Generate the mutually exclusive variable behavior of the smart contract transaction according to the target field operation information, the cross - contract call strategy, and the transaction configuration information.

[0022] In a possible implementation manner of this application, the generating the mutually exclusive variable behavior of the smart contract transaction according to the target field operation information, the cross - contract call strategy, and the transaction configuration information includes:

[0023] Construct a mutually exclusive variable template according to the target field in the target field operation information and the contract address information of the smart contract transaction, and input the transaction configuration information into the mutually exclusive variable template to obtain the first mutually exclusive variable of the smart contract transaction;

[0024] Generate a second mutex variable for the smart contract transaction according to the cross-contract address information in the cross-contract call policy;

[0025] Obtain the field operation identifier in the target field operation information, and generate the mutex variable behavior of the smart contract transaction according to the field operation identifier, the first mutex variable, and the second mutex variable.

[0026] In a possible implementation manner of this application, generating the second mutex variable of the smart contract transaction according to the cross-contract address information in the cross-contract call policy and the transaction configuration information includes:

[0027] Obtain the cross-contract interface file corresponding to the cross-contract address information;

[0028] Traverse the cross-contract interface file according to the cross-contract signature array in the cross-contract call policy to obtain cross-contract field operation information;

[0029] Generate a second mutex variable for the smart contract transaction based on the cross-contract field operation identifier and the cross-contract field in the field operation information.

[0030] In a possible implementation manner of this application, the generating the mutex variable behavior of the smart contract transaction according to the target field operation information and the transaction configuration information includes:

[0031] Obtain the contract transaction type of the smart contract transaction;

[0032] If the contract transaction type is a contract deployment transaction type, obtain the contract account to be deployed according to the transaction configuration information, read the random value in the target field operation information, perform a hash operation on the random value to obtain the target contract address;

[0033] Generate the mutex variable behavior of the contract deployment transaction according to the contract account to be deployed, the target contract address, and the field operation identifier.

[0034] In a possible implementation manner of this application, the performing a dependency analysis on each smart contract transaction according to the mutex variable behavior of each smart contract transaction to obtain each parallel contract transaction in each smart contract transaction, and executing each parallel contract transaction in parallel includes:

[0035] Obtain the mutex variables of the mutex variable behaviors corresponding to each smart contract transaction;

[0036] If there is a target mutex variable behavior group with matching mutex variables, obtain the target field operation identifiers of each target mutex variable behavior in the target mutex variable behavior group;

[0037] Perform dependency analysis on the target smart contract transactions corresponding to the target mutex variable behaviors according to the target field operation identifier, obtain the parallel contract transactions in each of the target smart contract transactions, and execute each of the parallel contract transactions in parallel.

[0038] In a possible implementation manner of the present application, the performing dependency analysis on the smart contract transactions according to the target field operation identifier, obtaining the parallel contract transactions in each of the smart contract transactions, and executing each of the parallel contract transactions in parallel includes:

[0039] If the target field operation identifier of the target mutex variable behavior is a read-only operation identifier, set the target smart contract transaction corresponding to the target mutex variable behavior carrying the read-write operation identifier and the write operation identifier as a dependent contract transaction;

[0040] If there is a target mutex variable behavior carrying a write operation identifier, determine the target smart contract transaction corresponding to the mutex variable behavior that matches the target mutex variable of the target mutex variable behavior as a dependent contract transaction;

[0041] Group the smart contract transactions according to the dependent contract transactions, obtain the parallel contract transactions in each of the smart contract transactions, and execute each of the parallel contract transactions in parallel.

[0042] On the other hand, the present application provides a blockchain parallel transaction device, and the blockchain parallel transaction device includes:

[0043] A transaction acquisition module, configured to acquire each smart contract transaction to be processed and the transaction configuration information of the smart contract transaction;

[0044] A contract query module, configured to acquire the transaction contract and the smart contract method corresponding to the smart contract transaction, and determine the target field operation information of the smart contract transaction according to the transaction contract and the smart contract method;

[0045] A behavior confirmation module, configured to generate the mutex variable behavior of the smart contract transaction according to the target field operation information and the transaction configuration information;

[0046] A parallel confirmation module, configured to perform dependency analysis on each of the smart contract transactions according to the mutex variable behaviors of each of the smart contract transactions, obtain the parallel contract transactions in each of the smart contract transactions, and execute each of the parallel contract transactions in parallel.

[0047] On the other hand, the present application further provides a blockchain parallel transaction device, and the blockchain parallel transaction device includes:

[0048] One or more processors;

[0049] A memory; and

[0050] One or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the processor to implement the blockchain parallel transaction method described above.

[0051] On the other hand, the present application also provides a computer-readable storage medium, on which a computer program is stored. The computer program is loaded by a processor to execute the steps in the blockchain parallel transaction method described above.

[0052] In the present application, by obtaining each smart contract transaction to be processed and the transaction configuration information of each smart contract transaction; and obtaining the transaction contract and the smart contract method corresponding to each smart contract, determining the target field operation information of the smart contract transaction according to the transaction contract and the smart contract method; after obtaining the target field operation information, generating the mutex variable behavior of the smart contract transaction according to the target field operation information and the transaction configuration information, and performing dependency analysis on each smart contract transaction according to the mutex variable behavior of each smart contract transaction, so as to determine each parallel contract transaction in each smart contract transaction, and performing parallel execution on the parallel contract transactions, realizing by determining the mutex variable behavior of the smart contract transaction and performing dependency analysis according to the mutex variable behavior, improving the granularity of transaction behavior analysis, improving the accuracy of dependency analysis, and further ensuring the parallel degree and completeness of parallel processing of contract transactions. Description of the Drawings

[0053] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.

[0054] Figure 1 It is a schematic diagram of the scenario of the blockchain parallel transaction method in the embodiment of the present application;

[0055] Figure 2 It is a schematic diagram of the process of an embodiment of the blockchain parallel transaction method in the embodiment of the present application;

[0056] Figure 3 It is a schematic diagram of the scenario of an embodiment of the mutex variable tree in the embodiment of the present application;

[0057] Figure 4 It is a schematic diagram of the process of an embodiment of generating the mutex variable behavior by generating cross-contract address information in the blockchain parallel transaction method provided by the embodiment of the present application;

[0058] Figure 5A flowchart showing an embodiment of the dependency analysis of smart contract transactions and determination of parallel contract transactions in the blockchain parallel transaction method provided by an embodiment of the present application;

[0059] Figure 6 A flowchart showing an embodiment of the parallel processing of each parallel contract transaction in the blockchain parallel transaction method provided by an embodiment of the present application;

[0060] Figure 7 A structural diagram showing an embodiment of the blockchain parallel transaction device provided by an embodiment of the present application;

[0061] Figure 8 A structural diagram showing an embodiment of the blockchain parallel transaction device provided by an embodiment of the present application. Detailed implementation manners

[0062] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative efforts belong to the protection scope of the present invention.

[0063] In the description of the present invention, it should be understood that the terms "center", "longitudinal", "transverse", "length", "width", "thickness", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", etc. indicate the orientation or positional relationship based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and thus cannot be understood as a limitation of the present invention. In addition, the terms "first" and "second" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include one or more of the described features. In the description of the present invention, "a plurality" means two or more, unless otherwise specifically defined.

[0064] In this application, the term "exemplary" is used to mean "serving as an example, illustration, or instance". Any embodiment described as "exemplary" in this application is not necessarily to be construed as more preferred or advantageous than other embodiments. The following description is provided to enable any person skilled in the art to make and use the invention. In the following description, details are set forth for purposes of explanation. It should be understood that those of ordinary skill in the art can recognize that the invention can be practiced without these specific details. In other instances, well-known structures and processes are not elaborated in detail to avoid obscuring the description of the invention with unnecessary detail. Therefore, the invention is not intended to be limited to the embodiments shown, but is to be accorded the widest scope consistent with the principles and features disclosed in this application.

[0065] Currently, with the rapid development of technologies in the blockchain field, more and more users upload transaction data to the blockchain and conduct transaction processing on the blockchain. And this application scenario requires the blockchain to be able to perform parallel processing on transaction data to improve transaction efficiency. However, the existing blockchain parallel processing methods have the disadvantages of low analysis fineness and low accuracy of analysis results when performing parallel processing on transaction data, and it is difficult to meet the scenario requirements of existing blockchain parallel transactions.

[0066] Based on this, this application proposes a blockchain parallel transaction method, device, equipment, and computer-readable storage medium to solve the technical problems of low analysis fineness and low accuracy in existing blockchain parallel transactions.

[0067] The blockchain parallel transaction method in the embodiments of the present invention is applied to a blockchain parallel transaction device, and the blockchain parallel transaction device is set in a blockchain parallel transaction device. One or more processors, memories, and one or more application programs are provided in the blockchain parallel transaction device. One or more application programs are stored in the memory and are configured to be executed by the processor to implement the blockchain parallel transaction method; wherein, the blockchain parallel transaction device can be a smart terminal, such as a mobile phone, a tablet computer, a smart TV, a network device, and a smart computer, etc.; optionally, the blockchain parallel transaction device can also be a server, or a service cluster composed of multiple servers.

[0068] The blockchain parallel transaction device 100 in the embodiments of this application is mainly used for: obtaining each smart contract transaction to be processed, and the transaction configuration information of the smart contract transaction;

[0069] obtaining the transaction contract and the smart contract method corresponding to the smart contract transaction, and determining the target field operation information of the smart contract transaction according to the transaction contract and the smart contract method;

[0070] Generate the mutually exclusive variable behavior of the smart contract transaction according to the target field operation information and the transaction configuration information;

[0071] Perform dependency analysis on each smart contract transaction according to the mutually exclusive variable behavior of each smart contract transaction to obtain each parallel contract transaction in each smart contract transaction, and execute each parallel contract transaction in parallel.

[0072] In the embodiment of the present application, the blockchain parallel transaction device 100 may be an independent blockchain-based blockchain parallel transaction device, or a blockchain-based blockchain parallel transaction device network or a blockchain-based blockchain parallel transaction device cluster composed of blockchain-based blockchain parallel transaction devices. For example, the blockchain-based blockchain parallel transaction device 100 described in the embodiment of the present application includes, but is not limited to, a computer, a network host, a single network blockchain-based blockchain parallel transaction device, a set of multiple network blockchain-based blockchain parallel transaction devices, or a cloud blockchain-based blockchain parallel transaction device composed of multiple blockchain-based blockchain parallel transaction devices. Among them, the cloud blockchain-based blockchain parallel transaction device is composed of a large number of computers or network blockchain-based blockchain parallel transaction devices based on cloud computing (Cloud Computing).

[0073] Those skilled in the art can understand that Figure 1 the application environment shown in is only one application scenario of the solution of the present application, and does not constitute a limitation on the application scenario of the solution of the present application. Other application environments may also include more or fewer blockchain-based blockchain parallel transaction devices than those shown in Figure 1 or the network connection relationship of blockchain-based blockchain parallel transaction devices. For example Figure 1 only 1 blockchain-based blockchain parallel transaction device is shown in. It can be understood that the scenario of this blockchain-based blockchain parallel transaction may also include one or more other blockchain-based blockchain parallel transaction devices, which are not specifically limited here; the blockchain-based blockchain parallel transaction device 100 may also include a memory.

[0074] In addition, in the scenario of blockchain parallel transactions based on blockchain in this application, the blockchain parallel transaction device 100 based on blockchain may be provided with a display device, or the display device is not provided in the blockchain parallel transaction device 100 based on blockchain and is communicatively connected to an external display device 200. The display device 200 is used to output the result of the execution of the blockchain parallel transaction method in the blockchain parallel transaction device based on blockchain. The blockchain parallel transaction device 100 based on blockchain can access the background database 300 (the background database can be in the local memory of the blockchain parallel transaction device based on blockchain, and the background database can also be set in the cloud). Information related to blockchain parallel transactions based on blockchain is stored in the background database 300.

[0075] It should be noted that Figure 1 The schematic diagram of the scenario of blockchain parallel transactions based on blockchain shown is merely an example. The scenario of blockchain parallel transactions based on blockchain described in the embodiments of this application is for more clearly illustrating the technical solutions of the embodiments of this application, and does not constitute a limitation on the technical solutions provided by the embodiments of this application.

[0076] Based on the above scenario of blockchain parallel transactions based on blockchain, embodiments of the blockchain parallel transaction method based on blockchain are proposed.

[0077] As Figure 2 shown, Figure 2 It is a flowchart of an embodiment of the blockchain parallel transaction method in the embodiments of this application. The image processing method includes the following steps 201 to step 204:

[0078] 201. Obtain each smart contract transaction to be processed, and the transaction configuration information of the smart contract transaction;

[0079] In this embodiment, the blockchain parallel transaction method is applied to a blockchain parallel transaction device, which is a node device in the blockchain. Among them, the type of the blockchain parallel transaction device is not specifically limited. For example, the blockchain parallel transaction device can be a smart terminal or a server. In this embodiment, a smart terminal is used as an example for illustration.

[0080] Specifically, the blockchain parallel transaction device is configured to receive the smart contract transaction to be processed, and determine the mutex variable behavior of the smart contract transaction according to the transaction configuration information, transaction contract, and smart contract method of the smart contract transaction, and determine the parallel contract transactions in the smart contract transaction by performing dependency analysis on the mutex variable behavior, and perform parallel execution on the parallel contract transactions. Among them, the parallel contract transaction is a smart contract transaction that has no dependency relationship with other smart contract transactions.

[0081] Specifically, during the operation of the blockchain parallel transaction device, it receives a transaction parallel request and responds to the transaction parallel request to perform transaction parallel processing on smart contract transactions. Among them, the transaction parallel request can be actively triggered by the user. For example, the user actively triggers the transaction parallel request by clicking the transaction parallel button in the blockchain parallel transaction device. Optionally, the transaction parallel request can also be automatically triggered by the blockchain parallel transaction device. For example, the blockchain parallel transaction device pre-sets a transaction parallel process, real-time detects smart contract transactions in the blockchain, and automatically triggers the transaction parallel request after the smart contract transaction meets the preset parallel transaction strategy.

[0082] Specifically, after the blockchain parallel transaction device receives the parallel transaction request, it obtains the block in the parallel transaction request, parses the smart contract transaction in the block, obtains each smart contract transaction corresponding to the parallel transaction request, and obtains the transaction configuration information in each smart contract transaction. Among them, the transaction configuration information is the transaction parameters output by each node device for generating the smart contract transaction. Optionally, the transaction configuration information includes contract address information, function identifier of the smart contract method, and transaction input parameters.

[0083] 202. Obtain the transaction contract and smart contract method corresponding to the smart contract transaction, and determine the target field operation information of the smart contract transaction according to the transaction contract and the smart contract method;

[0084] After the blockchain parallel transaction device obtains the transaction configuration information, it obtains the transaction contract and smart contract method corresponding to the smart contract transaction through the transaction configuration information, and determines the target field operation information of the smart contract transaction according to the transaction contract and the smart contract method. Among them, the transaction contract is a specific smart contract in the blockchain; the smart contract method is the contract method called by the current smart contract transaction in the transaction contract; the target field operation information is the operation identifier of the target field and the mutex variable associated with the smart contract transaction.

[0085] Specifically, the blockchain parallel transaction device pre-obtains the transaction type of the smart contract transaction, and determines the transaction contract and target field operation information of the smart contract transaction through the transaction type of the smart contract transaction and the contract address information associated with the smart contract transaction. Optionally, the transaction types of the smart contract transaction include contract deployment transaction type, contract life cycle management transaction type, and contract call transaction type.

[0086] Specifically, the blockchain parallel transaction device obtains the contract transaction type of the smart contract transaction. If it is determined that the contract transaction type of the smart contract transaction is a contract deployment transaction, then according to the read transaction configuration information, the contract account to be deployed is determined, and the random value in the target field of the contract account to be deployed is read. The hash operation is performed on the random value to obtain the updated smart contract address, and the value of the target field is incremented by 1. And according to the contract account to be deployed, the target contract address, and the field operation identifier, the mutex variable behavior of the contract deployment transaction is generated. Among them, the contract account to be deployed is the from account, and the contract deployment transaction is a smart contract transaction that modifies the target field (nonce value) in the from account and creates the ledger data of the new contract; the transaction configuration information is the contract account address to be deployed.

[0087] Specifically, the blockchain parallel transaction device obtains the transaction type of the smart contract. If it is determined that the contract transaction type of the smart contract transaction is a contract lifecycle management transaction, where the contract lifecycle management contract transaction is a transaction behavior that modifies the ledger data in the to account. Therefore, the contract lifecycle management contract transaction will affect the account execution logic of the contract called by the to contract, that is, it is regarded as mutually exclusive with all transactions that call the to contract. Therefore, the blockchain parallel transaction device obtains the field operation identifier corresponding to the contract lifecycle management transaction and the transaction configuration information, and generates the mutex variable behavior of the lifecycle management transaction. Among them, the transaction configuration information is the contract address information of the to contract.

[0088] Specifically, after the blockchain parallel transaction device determines that the transaction type of the smart contract transaction is a contract call transaction type, it queries the contract interface files of each smart contract through the contract address information of the smart contract transaction, so as to obtain the contract interface file that matches the contract address information, and thus obtain the transaction contract corresponding to the smart contract transaction.

[0089] After the blockchain parallel transaction device obtains the transaction contract corresponding to the smart contract transaction, it also analyzes the transaction contract to determine the contract methods included in the transaction contract, and compares the method identifiers of each contract method with the function identifier of the smart contract transaction, so as to obtain the target contract method with a successful comparison, and determine that the target contract method is the smart contract method of the smart contract transaction.

[0090] After the blockchain parallel transaction device obtains the smart contract method, it also performs instruction analysis on the smart contract method to obtain the target field and the field operation identifier operated in the smart contract method, so as to obtain the target field operation information in the smart contract method.

[0091] Optionally, the target field operation information can be obtained when the user constructs a smart contract transaction based on the client, or after the smart contract transaction is uploaded to the blockchain. After obtaining the target field operation information, the blockchain parallel transaction encodes the target field operation information into the contract interface file of the transaction contract.

[0092] 203. Generate the mutex variable behavior of the smart contract transaction according to the target field operation information and the transaction configuration information;

[0093] After obtaining the target field operation information of the smart contract transaction, the blockchain parallel transaction device generates the mutex variable behavior of the smart contract according to the target field operation information and the transaction input parameters in the transaction configuration information. The mutex variable behavior is behavior information representing the mutex variable of the smart contract transaction and the operations on the mutex variable. The mutex variable behavior includes a mutex variable and a field operation identifier.

[0094] Specifically, the blockchain parallel transaction device constructs a mutex variable template according to the target field and contract address information in the target field operation information, and inputs the transaction input parameters in the transaction configuration information into the mutex variable template to obtain the mutex variable of the smart contract transaction. The mutex variable includes any one or more of an account address and a mutex field. The account address is used by the mutex variable to identify the scope of operating ledger data, that is, the transaction contract address of the smart contract transaction. The account address can be represented by a string array. From front to back, the scope of operating ledger data is gradually narrowed. The smaller the scope, the higher the degree of concurrency that can be achieved. The mutex field is used to limit the scope of the ledger to be operated to a certain field under the transaction contract account.

[0095] Optionally, the elements in the mutex variable generated by the blockchain parallel transaction device can be one or more. If there is only one element in the mutex variable, that is, the mutex variable only includes the account address element, it means that the ledger modification scope of the mutex variable includes all data under the account specified by the ledger address; if there are two elements in the mutex variable identifier, that is, it includes the account address element and the mutex field, then it is determined that the ledger modification scope of the mutex variable is all data of the specified mutex field under the account address. If the number of elements in the mutex variable is greater than or equal to three, that is, the mutex variable also includes the element key corresponding to the transaction input parameter, it means that the ledger modification scope of the mutex variable is some data of the specified mutex field under the account address.

[0096] Specifically, after generating the mutex variable, the blockchain parallel transaction device also obtains the field operation identifier corresponding to the mutex variable in the field operation information, and associates the mutex variable with the field operation identifier to obtain the mutex variable behavior of the smart contract transaction.

[0097] 204. According to the mutually exclusive variable behaviors of each of the smart contract transactions, perform dependency analysis on each of the smart contract transactions to obtain each parallel contract transaction in each smart contract transaction, and execute each of the parallel contract transactions in parallel.

[0098] After obtaining all the mutually exclusive variable behaviors of the smart contract transactions to be processed, the blockchain parallel transaction device also performs dependency analysis on each smart contract transaction according to the mutually exclusive variable behaviors of each smart contract transaction, so as to determine whether each smart contract transaction can be processed in parallel, obtain the parallel contract transactions that can be processed in parallel in the smart contract transactions, and execute the parallel contract transactions in parallel.

[0099] Specifically, as Figure 3 shown, Figure 3 This is a scenario schematic diagram of an embodiment of the mutually exclusive variable tree in the embodiment of the present application. In this proposal, the mutually exclusive variable behaviors of smart contract transactions can be represented by a tree structure, and dependency analysis is performed on each smart contract transaction according to the tree structure and the mutually exclusive variable behaviors to form a mutually exclusive variable tree, so as to determine the dependency relationships in each smart contract transaction according to the mutually exclusive variable tree.

[0100] Among them, the initialized mutually exclusive variable tree has only one root node, and the root node represents the data of the entire ledger. In the mutually exclusive variable tree, any node that can be reached starting from the root node can be called a path, and the string array composed of the edges on the path is actually a mutually exclusive variable. The construction of the mutually exclusive variable tree is based on the mutually exclusive variable behaviors. Adding a mutually exclusive variable behavior to the mutually exclusive variable tree can be regarded as constructing a path in the mutually exclusive variable tree. After the blockchain parallel transaction device constructs the mutually exclusive variable tree according to the mutually exclusive variable behaviors of the smart contract transactions to be processed, it determines the dependency relationships of each smart contract transaction through the mutually exclusive variable tree, so as to obtain the parallel contract transactions that have no dependency relationship with each smart contract transaction.

[0101] After the blockchain parallel transaction device obtains the parallel contract transactions in the smart contract transactions, it inputs the parallel contract transactions into a preset transaction parallel execution model, and the transaction parallel execution model performs parallel processing on each of the parallel contract transactions, and serially processes the smart contract transactions with dependency relationships according to the preset transaction order.

[0102] In this embodiment, the blockchain parallel transaction device obtains each smart contract transaction to be processed and the transaction configuration information of each smart contract transaction; and obtains the transaction contract and the smart contract method corresponding to each smart contract, and determines the target field operation information of the smart contract transaction according to the transaction contract and the smart contract method; after obtaining the target field operation information, generates the mutex variable behavior of the smart contract transaction according to the target field operation information and the transaction configuration information, and performs dependency analysis on each smart contract transaction according to the mutex variable behavior of each smart contract transaction, so as to determine each parallel contract transaction in each smart contract transaction, and perform parallel execution on the parallel contract transactions, realizing to improve the granularity of transaction behavior analysis and the accuracy of dependency analysis by determining the mutex variable behavior of the smart contract transaction and performing dependency analysis according to the mutex variable behavior, and further ensuring the parallel degree and completeness of the parallel processing of contract transactions.

[0103] As Figure 4 shown, Figure 4 It is a schematic flowchart of an embodiment for generating the mutex variable behavior of cross-contract address information in the blockchain parallel transaction method provided by the embodiment of the present application.

[0104] In this embodiment, if a cross-contract call behavior is detected in the smart contract transaction, mutex variable behavior analysis is also performed on the cross-contract call behavior. Specifically, it includes steps 301 to 304:

[0105] 301. Obtain the contract transaction type of the smart contract transaction;

[0106] 302. If the contract transaction type is a contract call transaction type, obtain the cross-contract address information associated with the smart contract method and the second contract corresponding to the cross-contract address information;

[0107] 303. Obtain the cross-contract field operation information associated with the smart contract method in the second contract, and generate a cross-contract call strategy according to the second contract and the cross-contract operation field information;

[0108] 304. Generate the mutex variable behavior of the smart contract transaction according to the target field operation information, the cross-contract call strategy, and the transaction configuration information.

[0109] After the blockchain parallel transaction device obtains the contract address information associated with each smart contract transaction, if the contract address information is multiple, it is determined that the smart contract transaction has a cross-contract call behavior, and the blockchain parallel transaction device also determines the mutex variable behavior of the smart contract transaction according to the cross-contract call behavior.

[0110] Specifically, the blockchain parallel transaction device obtains the cross - contract address information associated with the intelligent contract transaction method, and obtains the second contract corresponding to the cross - contract address information and the contract interface file corresponding to the second contract according to the cross - contract address information.

[0111] After obtaining the contract interface file, the blockchain parallel transaction device also obtains the cross - contract call signature array in the intelligent contract method, and obtains the mutex field information in the second contract according to the cross - contract call signature array, so as to obtain the cross - contract field operation information associated with the intelligent contract method in the second contract.

[0112] Specifically, after obtaining the cross - contract call signature array, the blockchain parallel transaction device parses the cross - contract call signature array to obtain each method signature in the cross - contract call signature array, traverses the contract interface file corresponding to the second contract through the method signature, and obtains the cross - contract field operation information corresponding to the method signature in the contract interface file. Among them, the cross - contract field operation information includes cross - contract fields and cross - contract operation identifiers. The blockchain parallel transaction device generates a cross - contract call policy according to the obtained second contract and the cross - contract operation fields.

[0113] After obtaining the cross - contract call policy, the blockchain parallel transaction device also constructs a mutex variable template according to the target field and contract address information in the target field operation information of the intelligent contract transaction, inputs the transaction configuration information into the mutex variable template to obtain the first mutex variable of the intelligent contract transaction; and generates the second mutex variable of the intelligent contract transaction according to the cross - contract address information in the cross - contract call policy.

[0114] After obtaining the first mutex variable and the second mutex variable, the blockchain parallel transaction device generates the mutex variable behavior of the intelligent contract according to the field operation identifier, the first mutex variable and the second mutex variable.

[0115] Optionally, in a specific embodiment, the blockchain parallel transaction device obtains the smart contract transaction tx1, determines that the contract address information of the smart contract transaction is addrCC, the function identifier of the smart contract transaction is func4, and the transaction input parameters in the transaction configuration information are ["cc1", "cc2"]. The blockchain parallel transaction device obtains the transaction contract CC and the corresponding interface file ABI_CC file of the transaction contract according to the contract address information. The blockchain parallel transaction device obtains the mutex field information corresponding to the function identifier func4 in the ABI_CC file, and determines the first mutex variable [addrCC, fd, cc1] corresponding to the smart transaction method func4, that is, determines that the mutex field information indicates that the data in the range of fd[cc1] under the addrCC address will be operated on. The blockchain parallel transaction device also obtains the field operation identifier R corresponding to the first mutex variable in the smart transaction method func4, and determines that the first mutex variable indicates that the data in the range of fd[cc1] under the addrCC address will be read.

[0116] The blockchain parallel transaction device also obtains the cross-contract address information addrCB in the smart contract method func4, obtains the second contract CB according to the cross-contract address information, and the corresponding cross-contract interface file ABI_CB of the second contract CB. According to the cross-contract signature array [(addrCB, ["func3"])], the blockchain parallel transaction device obtains the second mutex variable [addrCB, fc] in the ABI_CB file, and the field operation identifier RW corresponding to the second mutex variable, and determines that the second mutex variable indicates that the data in the range of fc under the addrCB address will be read and written.

[0117] After the blockchain parallel transaction device obtains the first mutex variable [addrCC, fd, cc1], the second mutex variable [addrCB, fc] and the corresponding field operation identifiers, it generates the mutex variable behavior corresponding to the smart contract transaction. Among them, the mutex variable behavior of the smart contract transaction tx1 is shown in the following table:

[0118]

[0119]

[0120] After the blockchain parallel transaction device obtains the mutex variable behavior corresponding to each smart contract transaction through the above method, it performs dependency analysis on each smart contract transaction according to the mutex variable behavior, so as to determine the dependency relationship of each smart contract transaction.

[0121] In this embodiment, the blockchain parallel transaction device obtains the cross-contract address information associated with the smart contract method and the second contract corresponding to the cross-contract address information; obtains the cross-contract field operation information associated with the smart contract method in the second contract, and generates a cross-contract call policy according to the second contract and the cross-contract operation field information; generates a mutually exclusive variable behavior for the smart contract transaction according to the target field operation information, the cross-contract call policy, and the transaction configuration information. By analyzing the mutually exclusive variable behavior generated by the cross-contract call, the accuracy and analysis granularity of the analysis of the mutually exclusive variable behavior of each smart contract transaction are improved, thereby improving the accuracy of subsequent dependency analysis.

[0122] As Figure 5 shown, Figure 5 FIG. is a schematic flowchart of an embodiment for performing dependency analysis on a smart contract transaction in the blockchain parallel transaction method provided by an embodiment of the present application to determine a parallel contract transaction.

[0123] Based on the above embodiment, in this proposal, after the blockchain parallel transaction device obtains the mutually exclusive variable behavior of each smart contract transaction, it performs dependency analysis on each smart contract transaction according to the mutually exclusive variable behavior, so as to determine the parallel contract transactions that can be executed in parallel. Specifically, it includes steps 401 to 403:

[0124] 401. Obtain the mutually exclusive variables of the mutually exclusive variable behavior corresponding to each of the smart contract transactions;

[0125] 402. If there is a target mutually exclusive variable behavior group with matching mutually exclusive variables, obtain the target field operation identifiers of each target mutually exclusive variable behavior in the target mutually exclusive variable behavior group;

[0126] 403. Perform dependency analysis on the target smart contract transactions corresponding to the target mutually exclusive variable behavior according to the target field operation identifiers, obtain the parallel contract transactions in each of the target smart contract transactions, and execute each of the parallel contract transactions in parallel.

[0127] In this embodiment, after the blockchain parallel transaction device obtains the mutually exclusive variable behavior corresponding to each smart contract transaction, it performs dependency analysis on each smart contract transaction according to the mutually exclusive variable behavior.

[0128] Specifically, the blockchain parallel transaction device generates an initialized mutually exclusive variable tree, enters each mutually exclusive variable behavior into the mutually exclusive variable tree, and analyzes the dependency relationship of each smart contract transaction through the mutually exclusive variable tree and the mutually exclusive variable behavior.

[0129] The blockchain parallel transaction device performs a dependency analysis on some of the mutually exclusive variable behaviors in advance, and enters the mutually exclusive variable behaviors of the part without dependency relationships into the initialized mutually exclusive variable tree to generate the initial branch nodes of the mutually exclusive variable tree.

[0130] After generating the initial branch nodes, the blockchain parallel transaction device performs a dependency analysis on the remaining mutually exclusive variable behaviors, obtains the mutually exclusive variables of the remaining mutually exclusive variable behaviors, and compares the mutually exclusive variables to obtain the mutually exclusive variable comparison result.

[0131] Optionally, if the mutually exclusive variable comparison result is that the mutually exclusive variable is different from other mutually exclusive variables, that is, the mutually exclusive variable of the mutually exclusive variable behavior of the mutually exclusive variable does not match other mutually exclusive variables, the blockchain parallel transaction device generates a new branch node of the mutually exclusive variable tree and enters the mutually exclusive variable behavior into the branch node.

[0132] Optionally, if the mutually exclusive variable comparison result is that there are mutually exclusive variables identical to the mutually exclusive variable, that is, there are mutually exclusive variable behaviors with matching mutually exclusive variables, the blockchain parallel transaction device sets the mutually exclusive variable behaviors with matching mutually exclusive variables as the target mutually exclusive variable behaviors, associates and stores them in the corresponding target mutually exclusive variable behavior group, and simultaneously generates the mutually exclusive sub-branches corresponding to the target mutually exclusive variable behavior group.

[0133] Specifically, after generating the target mutually exclusive variable behavior group, the blockchain parallel transaction device also obtains the target field operation identifiers in the target mutually exclusive variable behavior group, and determines whether there are dependency relationships among the target mutually exclusive variable behaviors through the target field operation identifiers, so as to obtain the parallel contract transactions in the target smart contract transaction.

[0134] Optionally, the blockchain parallel transaction device obtains the target field operation identifiers in the target mutually exclusive variable behavior group. If the target field operation identifier of the target mutually exclusive variable behavior is a read-only operation identifier, the blockchain parallel transaction device traverses the target branches associated with the target mutually exclusive variable in the mutually exclusive variable tree. If the target field operation identifier corresponding to the target branch is a read-write operation identifier or a write operation identifier, it is determined that the target smart contract transaction corresponding to the target branch and the smart contract transaction corresponding to the target mutually exclusive variable behavior are mutually dependent contract transactions.

[0135] Optionally, the blockchain parallel transaction device obtains the target field operation identifiers in the target mutually exclusive variable behavior group. If the target field operation identifier is a write operation identifier, the blockchain parallel transaction device obtains the target branches associated with the target mutually exclusive variable in the mutually exclusive variable tree, and determines that the target smart contract transactions corresponding to the target branches are all mutually dependent contract transactions with the smart contract transaction corresponding to the target mutually exclusive variable behavior corresponding to the write operation identifier.

[0136] The blockchain parallel transaction device groups each smart contract according to the dependency relationship of each smart contract transaction, obtains each parallel contract transaction in the smart contract transactions, and inputs each parallel contract transaction into the grouped parallel model to execute each parallel contract transaction in parallel.

[0137] Optionally, in a specific embodiment, the mutually exclusive variable behaviors corresponding to the smart contract transactions obtained by the blockchain parallel transaction device are shown in the following table:

[0138]

[0139] After the blockchain parallel transaction device constructs a mutually exclusive variable tree based on the mutually exclusive variable behaviors of each smart contract transaction, it performs dependency analysis through the mutually exclusive variable behaviors and the mutually exclusive variable tree.

[0140] The blockchain parallel transaction device traverses the mutually exclusive variable tree and determines target mutually exclusive variable behavior groups [tx1, tx5], [tx2], [tx3, tx7], and [tx4, tx6] in the mutually exclusive variable tree that have the same mutually exclusive variable. After the blockchain parallel transaction device obtains the target mutually exclusive variable behavior groups, it also obtains the target field operation identifiers in the target mutually exclusive variable behavior groups, and determines whether there is a dependency relationship between the target mutually exclusive variable behaviors in the target mutually exclusive variable behavior groups through the target field operation identifiers.

[0141] Specifically, the blockchain parallel transaction device obtains that the target field operation identifier of the target mutually exclusive variable behavior tx5 is a read-only operation identifier. The blockchain parallel transaction device obtains the target field operation identifier of another target mutually exclusive variable behavior tx1, and determines that the operation of tx1 is also a read-only operation. Then the blockchain parallel transaction device determines that there is no dependency relationship between the target mutually exclusive variable behaviors tx1 and tx5, and determines that the target mutually exclusive variable behaviors tx1 and tx5 are parallel contract transactions.

[0142] Specifically, the blockchain parallel transaction device obtains that the target field operation identifier of the target mutually exclusive variable behavior tx6 is a read-only operation identifier. The blockchain parallel transaction device obtains the target field operation identifier of another target mutually exclusive variable behavior tx4, and determines that the operation of tx4 is a write operation, that is, the target field operation identifier of tx4 is a write operation identifier. The blockchain parallel transaction device determines that there is a dependency relationship between the target mutually exclusive variable behaviors tx4 and tx6, and sets tx4 and tx6 to the same mutually exclusive variable branch of the mutually exclusive variable tree.

[0143] Specifically, the blockchain parallel transaction device obtains that the target field operation identifier of the target mutex variable behavior tx7 is a read-only operation identifier. The blockchain parallel transaction device obtains the target field operation identifier of another target mutex variable behavior tx3, and determines that the operation of tx3 on the mutex variable is a read-write operation, that is, the target field operation identifier of tx3 is a read-write operation identifier. The blockchain parallel transaction device determines that there is a dependency relationship between the target mutex variable behaviors tx3 and tx7, and sets tx3 and tx7 to the same mutex variable branch of the mutex variable tree.

[0144] The blockchain parallel transaction device executes the smart contract transactions of different mutex variable branches in the mutex variable tree in parallel.

[0145] In this embodiment, the blockchain parallel transaction device obtains the mutex variables of the mutex variable behaviors corresponding to each of the smart contract transactions; if there is a target mutex variable behavior group with matching mutex variables, it obtains the target field operation identifiers of each target mutex variable behavior in the target mutex variable behavior group; performs dependency analysis on the target smart contract transactions corresponding to the target mutex variable behaviors according to the target field operation identifiers, obtains the parallel contract transactions in each of the target smart contract transactions, and executes each of the parallel contract transactions in parallel. It realizes dependency analysis of each smart contract transaction through mutex variable behaviors, and improves the accuracy of dependency analysis.

[0146] As Figure 6 shown, Figure 6 FIG. is a schematic flowchart of an embodiment of parallel processing of each parallel contract transaction in the blockchain parallel transaction method provided by the embodiment of the present application.

[0147] Based on the above embodiment, in this embodiment, the blockchain parallel transaction device performs union-find set grouping on each parallel contract transaction, and executes the parallel contract transactions in parallel according to the grouping result. Specifically, it includes steps 501-step 502:

[0148] 501. Perform union-find set grouping on the smart contract transactions according to the dependency relationship identifiers in the smart contract transactions to obtain each contract transaction group and the grouping numbers, where the grouping numbers of the dependent contract transactions with the same dependency relationship identifier are the same;

[0149] 502. Traverse the grouping numbers of each smart contract transaction, set the smart contract transactions with different grouping numbers as parallel contract transactions, and execute the parallel contract transactions in parallel.

[0150] In this embodiment, after the blockchain parallel transaction device performs dependency analysis on each smart contract according to the mutex variable behavior and generates the dependency relationship identifier of each smart contract, the blockchain parallel transaction device performs union-find set grouping on each smart contract transaction through the dependency relationship identifier, so as to obtain each contract transaction group and the grouping number. Among them, there is a dependency relationship among the smart contract transactions in the same contract transaction group, that is, the grouping numbers of the dependent contract transactions with the same dependency relationship identifier are the same.

[0151] After the blockchain parallel transaction device obtains the grouping numbers of each smart contract, it traverses the grouping numbers of each smart contract transaction, sets the smart contract transactions with different grouping numbers as parallel contract transactions, and inputs the parallel contract transactions into the parallel execution model to drive the parallel execution model to perform parallel execution on the parallel contract transactions.

[0152] In this embodiment, the blockchain parallel transaction device performs union-find set grouping on the smart contract transactions according to the dependency relationship identifier in the smart contract transactions to obtain each contract transaction group and the grouping number. Among them, the grouping numbers of the dependent contract transactions with the same dependency relationship identifier are the same; it traverses the grouping numbers of each smart contract transaction, sets the smart contract transactions with different grouping numbers as parallel contract transactions, and performs parallel execution on the parallel contract transactions. The parallel processing of each parallel contract transaction without a dependency relationship is realized.

[0153] In order to better implement the blockchain parallel transaction method in the embodiments of the present application, on the basis of the blockchain parallel transaction method, an embodiment of the present application also provides a blockchain parallel transaction device, as Figure 7 shown, Figure 7 is a schematic structural diagram of an embodiment of the blockchain parallel transaction device provided by the embodiment of the present application. The blockchain parallel transaction device 600 includes:

[0154] A transaction acquisition module 601, configured to acquire each smart contract transaction to be processed and the transaction configuration information of the smart contract transaction;

[0155] A contract query module 602, configured to acquire the transaction contract and the smart contract method corresponding to the smart contract transaction, and determine the target field operation information of the smart contract transaction according to the transaction contract and the smart contract method;

[0156] A behavior confirmation module 603, configured to generate the mutex variable behavior of the smart contract transaction according to the target field operation information and the transaction configuration information;

[0157] A parallel confirmation module 604, configured to perform dependency analysis on each of the smart contract transactions according to the mutex variable behavior of each of the smart contract transactions, obtain each parallel contract transaction in each smart contract transaction, and execute each of the parallel contract transactions in parallel.

[0158] In some embodiments of the present application, the blockchain parallel transaction device obtains the transaction contract and the smart contract method corresponding to the smart contract transaction, and determines the target field operation information of the smart contract transaction according to the transaction contract and the smart contract method, including:

[0159] Obtain the contract address information associated with the smart contract transaction, and the transaction contract corresponding to the contract address information;

[0160] Query the transaction contract to obtain the smart contract method corresponding to the function identifier of the smart contract transaction;

[0161] Analyze the smart contract method to obtain the target field operation information in the smart contract method, where the target field operation information includes a target field and a field operation identifier.

[0162] In some embodiments of the present application, the blockchain parallel transaction device analyzes the smart contract method to obtain the target field operation information in the smart contract method, including:

[0163] Perform instruction analysis on the smart contract method to obtain the target field, the target field operation identifier, and the contract call information in the smart contract method;

[0164] If the target field is a set type field, perform reaching definition analysis on the smart contract method to obtain the source of the target field parameters of the target field;

[0165] Summarize the target field operation identifier, the target field, the source of the target field parameters, and the contract call information to obtain the target field operation information in the smart contract method.

[0166] In some embodiments of the present application, the blockchain parallel transaction device generates the mutex variable behavior of the smart contract transaction according to the target field operation information and the transaction configuration information, including:

[0167] Obtain the contract transaction type of the smart contract transaction;

[0168] If the contract transaction type is a contract call transaction type, obtain the cross-contract address information associated with the smart contract method, and the second contract corresponding to the cross-contract address information;

[0169] Obtain the cross - contract field operation information associated with the smart contract method in the second contract, and generate a cross - contract call policy based on the second contract and the cross - contract operation field information;

[0170] Generate the mutually exclusive variable behavior of the smart contract transaction according to the target field operation information, the cross - contract call policy, and the transaction configuration information.

[0171] In some embodiments of the present application, the blockchain parallel transaction device generates the mutually exclusive variable behavior of the smart contract transaction according to the target field operation information, the cross - contract call policy, and the transaction configuration information, including:

[0172] Construct a mutually exclusive variable template according to the target field and contract address information in the target field operation information, and input the transaction configuration information into the mutually exclusive variable template to obtain the first mutually exclusive variable of the smart contract transaction;

[0173] Generate the second mutually exclusive variable of the smart contract transaction according to the cross - contract address information in the cross - contract call policy;

[0174] Obtain the field operation identifier in the target field operation information, and generate the mutually exclusive variable behavior of the smart contract transaction according to the field operation identifier, the first mutually exclusive variable, and the second mutually exclusive variable.

[0175] In some embodiments of the present application, the blockchain parallel transaction device generates the second mutually exclusive variable of the smart contract transaction according to the cross - contract address information in the cross - contract call policy and the transaction configuration information, including:

[0176] Obtain the cross - contract interface file corresponding to the cross - contract address information;

[0177] Traverse the cross - contract interface file according to the cross - contract signature array in the cross - contract call policy to obtain the cross - contract field operation information;

[0178] Generate the second mutually exclusive variable of the smart contract transaction based on the cross - contract field operation identifier and cross - contract field in the field operation information.

[0179] In some embodiments of the present application, the blockchain parallel transaction device generates the mutually exclusive variable behavior of the smart contract transaction according to the target field operation information and the transaction configuration information, including:

[0180] Obtain the contract transaction type of the smart contract transaction;

[0181] If the contract transaction type is a contract deployment transaction type, obtain the contract account to be deployed according to the transaction configuration information, read the random value in the target field operation information, perform a hash operation on the random value to obtain the target contract address;

[0182] Generate the mutex variable behavior of the contract deployment transaction according to the contract account to be deployed, the target contract address, and the field operation identifier.

[0183] In some embodiments of the present application, the blockchain parallel transaction device performs a dependency analysis on each of the smart contract transactions according to the mutex variable behavior of each of the smart contract transactions, obtains each parallel contract transaction in each of the smart contract transactions, and executes each of the parallel contract transactions in parallel, including:

[0184] Obtain the mutex variables of the mutex variable behaviors corresponding to each of the smart contract transactions;

[0185] If there is a target mutex variable behavior group with matching mutex variables, obtain the target field operation identifiers of each target mutex variable behavior in the target mutex variable behavior group;

[0186] Perform a dependency analysis on the target smart contract transactions corresponding to the target mutex variable behaviors according to the target field operation identifiers, obtain the parallel contract transactions in each of the target smart contract transactions, and execute each of the parallel contract transactions in parallel.

[0187] In some embodiments of the present application, the blockchain parallel transaction device performs a dependency analysis on the smart contract transactions according to the target field operation identifiers, obtains the parallel contract transactions in each of the smart contract transactions, and executes each of the parallel contract transactions in parallel, including:

[0188] If the target field operation identifier of the target mutex variable behavior is a read-only operation identifier, set the target smart contract transaction corresponding to the target mutex variable behavior carrying the read-write operation identifier and the write operation identifier as a dependent contract transaction;

[0189] If there is a target mutex variable behavior carrying a write operation identifier, determine that the target smart contract transaction corresponding to the mutex variable behavior matching the target mutex variable of the target mutex variable behavior is a dependent contract transaction;

[0190] Group the smart contract transactions according to the dependent contract transactions, obtain each parallel contract transaction in each of the smart contract transactions, and execute each of the parallel contract transactions in parallel.

[0191] In some embodiments of the present application, the blockchain parallel transaction device identifies the smart contract transactions according to the dependent contract transactions, obtains each parallel contract transaction in each smart contract transaction, and executes each of the parallel contract transactions in parallel, including:

[0192] Group the smart contract transactions by union find according to the dependency relationship identifiers in the smart contract transactions to obtain each contract transaction group and the grouping numbers, where the grouping numbers of the dependent contract transactions with the same dependency relationship identifier are the same;

[0193] Traverse the grouping numbers of each smart contract transaction, set the smart contract transactions with different grouping numbers as parallel contract transactions, and execute the parallel contract transactions in parallel.

[0194] An embodiment of the present invention also provides a blockchain parallel transaction device, as Figure 8 shown, Figure 8 which is a schematic structural diagram of an embodiment of the blockchain parallel transaction device provided in the embodiments of the present application.

[0195] The blockchain parallel transaction device integrates any one of the blockchain parallel transaction devices provided in the embodiments of the present invention. The blockchain parallel transaction device includes:

[0196] One or more processors;

[0197] A memory; and

[0198] One or more applications, where the one or more applications are stored in the memory and are configured to be executed by the processor to perform the steps in the blockchain parallel transaction method in any one of the embodiments of the above-mentioned blockchain parallel transaction method embodiments.

[0199] Specifically: The blockchain parallel transaction device may include a processor 701 with one or more processing cores, a memory 702 with one or more computer-readable storage media, a power supply 703, an input unit 704, and other components. Those skilled in the art can understand that Figure 7 the structure of the blockchain parallel transaction device shown in

[0200] The processor 701 is the control center of the blockchain parallel transaction device. It connects various parts of the entire blockchain parallel transaction device through various interfaces and circuits. By running or executing software programs and / or modules stored in the memory 702, and by invoking the data stored in the memory 702, it executes various functions of the blockchain parallel transaction device and processes data, thereby monitoring the entire blockchain parallel transaction device. Optionally, the processor 701 may include one or more processing cores; preferably, the processor 701 may integrate an application processor and a modem processor. Among them, the application processor mainly processes the operating system, user interface, application programs, etc., and the modem processor mainly processes wireless communication. It can be understood that the above-mentioned modem processor may not be integrated into the processor 701 either.

[0201] The memory 702 can be used to store software programs and modules. The processor 701 executes various functional applications and data processing by running the software programs and modules stored in the memory 702. The memory 702 mainly includes a program storage area and a data storage area. Among them, the program storage area can store the operating system, application programs required for at least one function (such as the sound playback function, image playback function, etc.); the data storage area can store the data created according to the use of the blockchain parallel transaction device. In addition, the memory 702 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage devices. Correspondingly, the memory 702 may also include a memory controller to provide the processor 701 with access to the memory 702.

[0202] The blockchain parallel transaction device further includes a power supply 703 for powering each component. Preferably, the power supply 703 can be logically connected to the processor 701 through a power management system, so as to realize functions such as management of charging, discharging, and power consumption management through the power management system. The power supply 703 may also include any components such as one or more DC or AC power supplies, a recharge system, a power failure detection circuit, a power converter or inverter, and a power status indicator.

[0203] The blockchain parallel transaction device may further include an input unit 704. The input unit 704 can be used to receive input digital or character information, and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function controls.

[0204] Although not shown, the blockchain parallel transaction device may further include a display unit and the like, which will not be elaborated herein. Specifically, in this embodiment, the processor 701 in the blockchain parallel transaction device will load the executable files corresponding to the processes of one or more application programs into the memory 702 according to the following instructions, and the processor 701 will run the application programs stored in the memory 702 to implement various functions as follows:

[0205] Obtain each smart contract transaction to be processed, as well as the transaction configuration information of the smart contract transaction;

[0206] Obtain the transaction contract and smart contract method corresponding to the smart contract transaction, and determine the target field operation information of the smart contract transaction according to the transaction contract and the smart contract method;

[0207] Generate the mutex variable behavior of the smart contract transaction according to the target field operation information and the transaction configuration information;

[0208] Perform dependency analysis on each smart contract transaction according to the mutex variable behavior of each smart contract transaction to obtain each parallel contract transaction in each smart contract transaction, and execute each parallel contract transaction in parallel.

[0209] In the above embodiments, the descriptions of the respective embodiments have their own emphases. For the parts not elaborated in a certain embodiment, reference may be made to the detailed descriptions of other embodiments above, which will not be elaborated herein.

[0210] Specifically in implementation, the above-mentioned each unit or structure may be implemented as an independent entity, or may be combined arbitrarily to be implemented as the same or several entities. The specific implementation of the above-mentioned each unit or structure may refer to the method embodiments above, which will not be elaborated herein.

[0211] Therefore, an embodiment of the present invention provides a computer-readable storage medium, which may include: read-only memory (ROM, Read Only Memory), random access memory (RAM, Random Access Memory), a magnetic disk or an optical disc, etc. A computer program is stored thereon, and the computer program is loaded by a processor to execute the steps in any of the blockchain parallel transaction methods provided by the embodiments of the present invention. For example, when the computer program is loaded by the processor, the following steps may be executed:

[0212] Obtain each smart contract transaction to be processed, as well as the transaction configuration information of the smart contract transaction;

[0213] Obtain the transaction contract and smart contract method corresponding to the smart contract transaction, and determine the target field operation information of the smart contract transaction according to the transaction contract and the smart contract method;

[0214] Generate the mutex variable behavior of the smart contract transaction according to the target field operation information and the transaction configuration information;

[0215] Perform dependency analysis on each smart contract transaction according to the mutex variable behavior of each smart contract transaction, obtain each parallel contract transaction in each smart contract transaction, and execute each parallel contract transaction in parallel.

[0216] For this reason, an embodiment of the present invention provides a computer-readable storage medium, which may include: read-only memory (ROM, Read Only Memory), random access memory (RAM, Random Access Memory), a magnetic disk or an optical disc, etc. A computer program is stored thereon, and the computer program is loaded by a processor to execute the steps in any one of the blockchain parallel transaction methods provided by the embodiments of the present invention. For example, when the computer program is loaded by the processor, the following steps may be executed:

[0217] Obtain each smart contract transaction to be processed, and the transaction configuration information of the smart contract transaction;

[0218] Obtain the transaction contract and smart contract method corresponding to the smart contract transaction, and determine the target field operation information of the smart contract transaction according to the transaction contract and the smart contract method;

[0219] Generate the mutex variable behavior of the smart contract transaction according to the target field operation information and the transaction configuration information;

[0220] Perform dependency analysis on each smart contract transaction according to the mutex variable behavior of each smart contract transaction, obtain each parallel contract transaction in each smart contract transaction, and execute each parallel contract transaction in parallel.

[0221] For the specific implementation of each of the above operations, reference may be made to the previous embodiments, which will not be elaborated here.

[0222] The above has introduced in detail a blockchain parallel transaction method provided by an embodiment of the present application. In this article, specific embodiments are used to elaborate on the principle and implementation manner of the present invention. The description of the above embodiments is only used to help understand the method and its core idea of the present invention; at the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation manner and application scope. In summary, the content of this specification should not be construed as a limitation to the present invention.

Claims

1. A blockchain parallel transaction method, characterized in that, The blockchain parallel transaction method includes: Obtaining each smart contract transaction to be processed and the transaction configuration information of the smart contract transaction; Obtaining the transaction contract and the smart contract method corresponding to the smart contract transaction, and determining the target field operation information of the smart contract transaction according to the transaction contract and the smart contract method; Obtaining the contract transaction type of the smart contract transaction; If the contract transaction type is a contract call transaction type, obtaining the cross-contract address information associated with the smart contract method and the second contract corresponding to the cross-contract address information; Obtaining the cross-contract field operation information associated with the smart contract method in the second contract, and generating a cross-contract call strategy according to the second contract and the cross-contract field operation information; Generating the mutex variable behavior of the smart contract transaction according to the target field operation information, the cross-contract call strategy, and the transaction configuration information; If the contract transaction type is a contract deployment transaction type, obtaining the contract account to be deployed according to the transaction configuration information, reading the random value in the target field operation information, and performing a hash operation on the random value to obtain the target contract address; Generating the mutex variable behavior of the smart contract transaction according to the contract account to be deployed, the target contract address, and the field operation identifier; Obtaining the mutex variables of the mutex variable behaviors corresponding to each smart contract transaction; If there is a target mutex variable behavior group with matching mutex variables, obtaining the target field operation identifiers of each target mutex variable behavior in the target mutex variable behavior group; Performing a dependency analysis on the target smart contract transactions corresponding to the target mutex variable behaviors according to the target field operation identifiers, obtaining the parallel contract transactions in each target smart contract transaction, and executing each parallel contract transaction in parallel.

2. The blockchain parallel transaction method according to claim 1, characterized in that, The obtaining the transaction contract and the smart contract method corresponding to the smart contract transaction, and determining the target field operation information of the smart contract transaction according to the transaction contract and the smart contract method includes: Obtaining the contract address information associated with the smart contract transaction and the transaction contract corresponding to the contract address information; Querying the transaction contract to obtain the smart contract method corresponding to the function identifier of the smart contract transaction; Analyzing the smart contract method to obtain the target field operation information in the smart contract method, where the target field operation information includes a target field and a field operation identifier.

3. The blockchain parallel transaction method according to claim 2, characterized in that, The analyzing the smart contract method to obtain the target field operation information in the smart contract method includes: Performing an instruction analysis on the smart contract method to obtain the target field, the target field operation identifier, and the contract call information in the smart contract method; If the target field is a set-type field, performing a reaching definition analysis on the smart contract method to obtain the source of the target field parameters of the target field; Summarizing the target field operation identifier, the target field, the source of the target field parameters, and the contract call information to obtain the target field operation information in the smart contract method.

4. The blockchain parallel transaction method according to claim 1, wherein, Generating the mutex variable behavior of the smart contract transaction according to the target field operation information, the cross - contract call policy, and the transaction configuration information includes: Constructing a mutex variable template based on the target field in the target field operation information and the contract address information of the smart contract transaction, and inputting the transaction configuration information into the mutex variable template to obtain the first mutex variable of the smart contract transaction; Generating the second mutex variable of the smart contract transaction according to the cross - contract address information in the cross - contract call policy; Obtaining the field operation identifier in the target field operation information, and generating the mutex variable behavior of the smart contract transaction according to the field operation identifier, the first mutex variable, and the second mutex variable.

5. The blockchain parallel transaction method according to claim 4, wherein The generating the second mutex variable of the smart contract transaction according to the cross - contract address information in the cross - contract call policy includes: Obtaining the cross - contract interface file corresponding to the cross - contract address information; Traversing the cross - contract interface file according to the cross - contract signature array in the cross - contract call policy to obtain the cross - contract field operation information; Generating the second mutex variable of the smart contract transaction based on the cross - contract field operation identifier and the cross - contract field in the field operation information.

6. The blockchain parallel transaction method according to claim 1, wherein, The performing a dependency analysis on the target smart contract transaction corresponding to the target mutex variable behavior according to the target field operation identifier to obtain the parallel contract transactions in each of the target smart contract transactions, and executing each of the parallel contract transactions in parallel includes: If the target field operation identifier of the target mutex variable behavior is a read - only operation identifier, setting the target smart contract transaction corresponding to the target mutex variable behavior carrying the read - write operation identifier and the write operation identifier as a dependent contract transaction; If there is a target mutex variable behavior carrying the write operation identifier, determining the target smart contract transaction corresponding to the mutex variable behavior that matches the target mutex variable of the target mutex variable behavior as a dependent contract transaction; Grouping the smart contract transactions according to the dependent contract transactions to obtain the parallel contract transactions in each of the smart contract transactions, and executing each of the parallel contract transactions in parallel.

7. The blockchain parallel transaction method according to claim 6, wherein, The grouping the smart contract transactions according to the dependent contract transactions to obtain the parallel contract transactions in each of the smart contract transactions, and executing each of the parallel contract transactions in parallel includes: Grouping the smart contract transactions by union - find according to the dependency relationship identifier in the smart contract transaction to obtain each contract transaction group and the grouping number, where the grouping numbers of the dependent contract transactions with the same dependency relationship identifier are the same; Traversing the grouping numbers of each smart contract transaction, setting the smart contract transactions with different grouping numbers as parallel contract transactions, and executing the parallel contract transactions in parallel.

8. A blockchain parallel transaction device, characterized in that, The blockchain parallel transaction device includes: A transaction acquisition module configured to acquire each smart contract transaction to be processed and the transaction configuration information of the smart contract transaction; A contract query module configured to acquire the transaction contract and the smart contract method corresponding to the smart contract transaction, and determine the target field operation information of the smart contract transaction according to the transaction contract and the smart contract method; The behavior confirmation module is configured to obtain the contract transaction type of the smart contract transaction; if the contract transaction type is a contract call transaction type, obtain the cross-contract address information associated with the smart contract method and the second contract corresponding to the cross-contract address information; obtain the cross-contract field operation information associated with the smart contract method in the second contract, and generate a cross-contract call strategy according to the second contract and the cross-contract field operation information; generate the mutually exclusive variable behavior of the smart contract transaction according to the target field operation information, the cross-contract call strategy and the transaction configuration information; if the contract transaction type is a contract deployment transaction type, obtain the contract account to be deployed according to the transaction configuration information, read the random value in the target field operation information, perform a hash operation on the random value to obtain the target contract address; generate the mutually exclusive variable behavior of the smart contract transaction according to the contract account to be deployed, the target contract address and the field operation identifier. The parallel confirmation module is configured to obtain the mutually exclusive variables of the mutually exclusive variable behaviors corresponding to each of the smart contract transactions; if there is a target mutually exclusive variable behavior group with matching mutually exclusive variables, obtain the target field operation identifiers of each target mutually exclusive variable behavior in the target mutually exclusive variable behavior group; perform a dependency analysis on the target smart contract transactions corresponding to the target mutually exclusive variable behaviors according to the target field operation identifiers to obtain the parallel contract transactions in each of the target smart contract transactions, and execute each of the parallel contract transactions in parallel.

9. A blockchain parallel transaction device, characterized in that, The blockchain parallel transaction device includes: One or more processors; A memory; and One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the processor to implement the blockchain parallel transaction method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, A computer program is stored thereon, and the computer program is loaded by the processor to execute the steps of the blockchain parallel transaction method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Intelligent contract formal verification method and system suitable for combined transaction

    CN114047928A