CN115578096A - Block chain parallel transaction method, device, equipment and storage medium - Google Patents

Block chain parallel transaction method, device, equipment and storage medium Download PDF

Info

Publication number
CN115578096A
CN115578096A CN202211083577.4A CN202211083577A CN115578096A CN 115578096 A CN115578096 A CN 115578096A CN 202211083577 A CN202211083577 A CN 202211083577A CN 115578096 A CN115578096 A CN 115578096A
Authority
CN
China
Prior art keywords
transaction
contract
intelligent contract
parallel
intelligent
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211083577.4A
Other languages
Chinese (zh)
Inventor
胡麦芳
黄方蕾
卢益铭
陶烨琪
张珂杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Qulian Technology Co Ltd
Original Assignee
Hangzhou Qulian Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Qulian Technology Co Ltd filed Critical Hangzhou Qulian Technology Co Ltd
Priority to CN202211083577.4A priority Critical patent/CN115578096A/en
Publication of CN115578096A publication Critical patent/CN115578096A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/389Keeping log of transactions for guaranteeing non-repudiation of a transaction
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/30Decision processes by autonomous network management units using voting and bidding
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/104Peer-to-peer [P2P] networks

Landscapes

  • Business, Economics & Management (AREA)
  • Engineering & Computer Science (AREA)
  • Accounting & Taxation (AREA)
  • Finance (AREA)
  • Theoretical Computer Science (AREA)
  • General Business, Economics & Management (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • Strategic Management (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Development Economics (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Technology Law (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The application provides a block chain parallel transaction method, a device, equipment and a storage medium, wherein the method comprises the following steps: acquiring each intelligent contract transaction to be processed and transaction configuration information of the intelligent contract transaction; acquiring a trading contract and an intelligent contract method corresponding to the intelligent contract trade, and determining target field operation information of the intelligent contract trade according to the trading contract and the intelligent contract method; generating a mutually exclusive variable behavior of the intelligent contract transaction according to the target field operation information and the transaction configuration information; and performing dependency analysis on each intelligent contract transaction according to the mutually exclusive variable behavior of each intelligent contract transaction to obtain each parallel contract transaction in each intelligent contract transaction, and executing each parallel contract transaction in parallel. According to the technical scheme, the transaction behavior analysis granularity can be improved, the dependency analysis accuracy is improved, and the parallel degree and completeness of parallel processing of contract transactions are further ensured.

Description

Block chain parallel transaction method, device, equipment and storage medium
Technical Field
The application relates to the field of data processing, in particular to a block chain parallel transaction method, a device, equipment and a storage medium.
Background
At present, with the rapid development of the technology in the field of blockchain, more and more users uplink transaction data and perform transaction processing on the blockchain. However, the existing block chain parallel processing mode has the defects of low analysis fineness and low accuracy of analysis results when the transaction data is processed in parallel, and the scene requirement of the existing block chain transaction block chain parallel transaction is difficult to meet.
Disclosure of Invention
The embodiment of the application provides a block chain parallel transaction method, a block chain parallel transaction device, a block chain parallel transaction equipment and a storage medium, and aims to solve the technical problems of low block chain parallel transaction analysis fineness and accuracy in the prior art.
In one aspect, an embodiment of the present application provides a blockchain parallel transaction method, where the blockchain parallel transaction method includes the following steps:
acquiring each intelligent contract transaction to be processed and transaction configuration information of the intelligent contract transaction;
acquiring a trading contract and an intelligent contract method corresponding to the intelligent contract trading, and determining target field operation information of the intelligent contract trading according to the trading contract and the intelligent contract method;
generating a mutually exclusive variable behavior of the intelligent contract transaction according to the target field operation information and the transaction configuration information;
and performing dependency analysis on each intelligent contract transaction according to the mutually exclusive variable behavior of each intelligent contract transaction to obtain each parallel contract transaction in each intelligent contract transaction, and executing each parallel contract transaction in parallel.
In one possible implementation manner of the present application, the obtaining a trading contract and an intelligent contract method corresponding to the intelligent contract trade, and determining target field operation information of the intelligent contract trade according to the trading contract and the intelligent contract method includes:
acquiring contract address information associated with the intelligent contract transaction and a transaction contract corresponding to the contract address information;
inquiring the trading contract to obtain an intelligent contract method corresponding to the function identification of the intelligent contract trading;
analyzing the intelligent contract method to obtain target field operation information in the intelligent contract method, wherein the target field operation information comprises a target field and a field operation identifier.
In a possible implementation manner of the present application, the analyzing the intelligent contract method to obtain the target field operation information in the intelligent contract method includes:
performing instruction analysis on the intelligent contract method to obtain a target field, a target field operation identifier and contract calling information in the intelligent contract method;
if the target field is a set field, performing arrival fixed value analysis on the intelligent contract method to obtain a target field parameter source of the target field;
and summarizing the target field operation identification, the target field parameter source and the contract calling information to obtain the target field operation information in the intelligent contract method.
In a possible implementation manner of the present application, the generating a mutually exclusive variable behavior of the intelligent contract transaction according to the target field operation information and the transaction configuration information includes:
acquiring a contract transaction type of the intelligent contract transaction;
if the contract transaction type is a contract calling transaction type, acquiring cross-contract address information associated with the intelligent contract method and a second contract corresponding to the cross-contract address information;
acquiring cross contract field operation information associated with the intelligent contract method in the second contract, and generating a cross contract calling strategy according to the second contract and the cross contract field operation information;
and generating a mutual exclusion variable behavior of the intelligent contract transaction according to the target field operation information, the cross-contract calling strategy and the transaction configuration information.
In a possible implementation manner of the present application, the generating a mutually exclusive variable behavior of an intelligent contract transaction according to the target field operation information, the cross-contract invoking policy, and the transaction configuration information includes:
constructing a mutual exclusion variable template according to a target field in the target field operation information and contract address information of the intelligent contract transaction, and inputting the transaction configuration information into the mutual exclusion variable template to obtain a first mutual exclusion variable of the intelligent contract transaction;
generating a second mutual exclusion variable of the intelligent contract transaction according to the cross-contract address information in the cross-contract calling strategy;
and acquiring a field operation identifier in the target field operation information, and generating a mutual exclusion variable behavior of the intelligent contract transaction according to the field operation identifier, the first mutual exclusion variable and the second mutual exclusion variable.
In one possible implementation manner of the present application, generating a second mutual exclusion variable of the intelligent contract transaction according to the cross-contract address information and the transaction configuration information in the cross-contract invoking policy includes:
acquiring a cross contract interface file corresponding to the cross contract address information;
traversing the cross contract interface file according to a cross contract signature array in the cross contract calling strategy to obtain cross contract field operation information;
and generating a second mutually exclusive variable of the intelligent contract transaction based on the cross-contract field operation identification and the cross-contract field in the field operation information.
In a possible implementation manner of the present application, the generating a mutually exclusive variable behavior of the intelligent contract transaction according to the target field operation information and the transaction configuration information includes:
acquiring a contract transaction type of the intelligent contract transaction;
if the contract transaction type is a contract deployment transaction type, acquiring a contract account to be deployed according to transaction configuration information, reading a random numerical value in the target field operation information, and performing hash operation on the random numerical value to obtain a target contract address;
and generating a mutually exclusive variable behavior of the contract deployment transaction according to the contract account to be deployed, the target contract address and the field operation identifier.
In a possible implementation manner of the present application, the performing dependency analysis on each intelligent contract transaction according to the mutually exclusive variable behavior of each intelligent contract transaction to obtain each parallel contract transaction in each intelligent contract transaction, and executing each parallel contract transaction in parallel includes:
acquiring a mutual exclusion variable of a mutual exclusion variable behavior corresponding to each intelligent contract transaction;
if a target mutual exclusion variable behavior group matched with the mutual exclusion variable exists, acquiring target field operation identifiers of each target mutual exclusion variable behavior in the target mutual exclusion variable behavior group;
and performing dependency analysis on target intelligent contract transactions corresponding to the target mutual exclusion variable behaviors according to the target field operation identification to obtain parallel contract transactions in each target intelligent contract transaction, and executing each parallel contract transaction in parallel.
In one possible implementation manner of the present application, the performing dependency analysis on the intelligent contract transactions according to the target field operation identifier to obtain parallel contract transactions in each intelligent contract transaction, and executing each parallel contract transaction in parallel includes:
if the target field operation identifier of the target mutual exclusion variable behavior is a read-only operation identifier, setting the target intelligent contract transaction corresponding to the target mutual exclusion variable behavior carrying the read-write operation identifier and the write-in operation identifier as a dependent contract transaction;
if a target mutual exclusion variable behavior with a write-in operation identifier exists, determining a target intelligent contract transaction corresponding to the mutual exclusion variable behavior matched with the target mutual exclusion variable of the target mutual exclusion variable behavior as a dependent contract transaction;
and grouping the intelligent contract transactions according to the dependent contract transactions to obtain each parallel contract transaction in each intelligent contract transaction, and executing each parallel contract transaction in parallel.
In another aspect, the present application provides a blockchain parallel transaction apparatus, including:
the system comprises a transaction acquisition module, a transaction processing module and a transaction processing module, wherein the transaction acquisition module is configured to acquire each intelligent contract transaction to be processed and transaction configuration information of the intelligent contract transaction;
the contract inquiry module is configured to acquire a trading contract and an intelligent contract method corresponding to the intelligent contract trade, and determine target field operation information of the intelligent contract trade according to the trading contract and the intelligent contract method;
the behavior confirmation module is configured to generate a mutually exclusive variable behavior of the intelligent contract transaction according to the target field operation information and the transaction configuration information;
and the parallel confirmation module is configured to perform dependency analysis on each intelligent contract transaction according to the mutually exclusive variable behavior of each intelligent contract transaction, obtain each parallel contract transaction in each intelligent contract transaction, and execute each parallel contract transaction in parallel.
In another aspect, the present application further provides a blockchain parallel transaction apparatus, including:
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.
In another aspect, the present application further provides a computer-readable storage medium, on which a computer program is stored, where the computer program is loaded by a processor to execute the steps in the blockchain parallel transaction method.
In the application, each intelligent contract transaction to be processed and the transaction configuration information of each intelligent contract transaction are obtained; acquiring a trading contract and an intelligent contract method corresponding to each intelligent contract, and determining target field operation information of intelligent contract trading according to the trading contract and the intelligent contract method; after the target field operation information is acquired, mutually exclusive variable behaviors of the intelligent contract transactions are generated according to the target field operation information and the transaction configuration information, dependence analysis is performed on the intelligent contract transactions according to the mutually exclusive variable behaviors of the intelligent contract transactions, parallel execution is performed on the parallel contract transactions, the transaction behavior analysis granularity is improved, the dependence analysis accuracy is improved, and the parallelism degree and completeness of parallel processing of the contract transactions are ensured.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic view of a block chain parallel transaction method according to an embodiment of the present application;
FIG. 2 is a flowchart illustrating an embodiment of a blockchain parallel transaction method according to the present invention;
FIG. 3 is a diagram illustrating a scenario of an embodiment of a mutual exclusion variable tree according to an embodiment of the present application;
FIG. 4 is a flowchart illustrating an embodiment of a behavior of generating a mutex variable across contract address information in a blockchain parallel transaction method according to an embodiment of the present disclosure;
FIG. 5 is a schematic flow chart illustrating an embodiment of determining parallel contract transactions by performing dependency analysis on intelligent contract transactions in the blockchain parallel transaction method according to the embodiment of the present disclosure;
FIG. 6 is a schematic flow chart diagram illustrating an embodiment of parallel processing of parallel contract transactions in a blockchain parallel transaction method according to an embodiment of the present disclosure;
fig. 7 is a schematic structural diagram of an embodiment of a blockchain parallel transaction apparatus according to the present disclosure;
fig. 8 is a schematic structural diagram of an embodiment of a blockchain parallel transaction apparatus provided in an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only some embodiments of the present invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In the description of the present invention, it is to be understood that the terms "center", "longitudinal", "lateral", "length", "width", "thickness", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", etc. indicate orientations or positional relationships based on those shown in the drawings, merely for convenience of description and simplicity of description, and do not indicate or imply that the device or element referred to must have a particular orientation, be constructed and operated in a particular orientation, and thus, are not to be construed as limiting the present invention. Furthermore, the terms "first", "second" and "first" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, features defined as "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 specifically defined otherwise.
In this application, the word "exemplary" is used to mean "serving as an example, instance, or illustration. Any embodiment described herein as "exemplary" is not necessarily to be construed as preferred or advantageous over other embodiments. The following description is presented to enable any person skilled in the art to make and use the invention. In the following description, details are set forth for the purpose of explanation. It will be apparent to one of ordinary skill in the art that the present invention may be practiced without these specific details. In other instances, well-known structures and processes are not shown in detail to avoid obscuring the description of the invention with unnecessary detail. Thus, the present 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 herein.
At present, with the rapid development of the technology in the field of blockchain, more and more users uplink transaction data and perform transaction processing on the blockchain. However, the existing block chain parallel processing mode has the defects of low analysis fineness and low accuracy of analysis results when the transaction data is processed in parallel, and the scene requirement of the existing block chain transaction block chain parallel transaction is difficult to meet.
Based on the above, the present application provides a method, an apparatus, a device and a computer readable storage medium for block chain parallel transaction, so as to solve the technical problems of low analysis fineness and accuracy of block chain parallel transaction in the prior art.
The blockchain parallel transaction method is applied to a blockchain parallel transaction device, the blockchain parallel transaction device is arranged on blockchain parallel transaction equipment, one or more processors, a memory and one or more application programs are arranged in the blockchain parallel transaction equipment, and the 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; the blockchain parallel transaction device can be an intelligent terminal, such as a mobile phone, a tablet computer, an intelligent television, a network device, an intelligent computer and the like; optionally, the blockchain parallel transaction device may also be a server or a service cluster formed by multiple servers.
In the embodiment of the present application, the blockchain parallel transaction apparatus 100 is mainly used for: acquiring each intelligent contract transaction to be processed and transaction configuration information of the intelligent contract transaction;
acquiring a trading contract and an intelligent contract method corresponding to the intelligent contract trade, and determining target field operation information of the intelligent contract trade according to the trading contract and the intelligent contract method;
generating a mutually exclusive variable behavior of the intelligent contract transaction according to the target field operation information and the transaction configuration information;
and performing dependency analysis on each intelligent contract transaction according to the mutually exclusive variable behavior of each intelligent contract transaction to obtain each parallel contract transaction in each intelligent contract transaction, and executing each parallel contract transaction in parallel.
In this embodiment of the present application, the blockchain parallel transaction apparatus 100 may be an independent blockchain-based blockchain parallel transaction apparatus, or may be a blockchain-based blockchain parallel transaction apparatus network or a blockchain-based blockchain parallel transaction apparatus cluster composed of blockchain-based blockchain parallel transaction apparatuses, for example, the blockchain-based blockchain parallel transaction apparatus 100 described in this embodiment of the present application includes, but is not limited to, a computer, a network host, a single network blockchain-based blockchain parallel transaction apparatus, a plurality of network blockchain-based blockchain parallel transaction apparatus sets, or a cloud blockchain-based blockchain parallel transaction apparatus composed of a plurality of blockchain-based blockchain parallel transaction apparatuses. The Cloud blockchain-based blockchain parallel transaction device is composed of a large number of Cloud Computing (Cloud Computing) -based computers or a network blockchain-based blockchain parallel transaction device.
Those skilled in the art can understand that the application environment shown in fig. 1 is only one application scenario of the present application, and does not constitute a limitation on the application scenario of the present application, and other application environments may further include more or less blockchain-based blockchain parallel transaction apparatuses than that shown in fig. 1, or a network connection relationship of blockchain-based blockchain parallel transaction apparatuses, for example, only 1 blockchain-based blockchain parallel transaction apparatus is shown in fig. 1, and it can be understood that the scenario of blockchain-based blockchain parallel transaction may further include one or more other blockchain-based blockchain parallel transaction apparatuses, which is not limited herein; the blockchain-based blockchain parallel transaction apparatus 100 may further include a memory therein.
In addition, in the scenario of blockchain-based blockchain parallel transaction, the blockchain-based blockchain parallel transaction apparatus 100 may be provided with a display device, or the blockchain-based blockchain parallel transaction apparatus 100 is not provided with a display device in communication connection with an external display device 200, and the display device 200 is configured to output a result of execution of the blockchain-based blockchain parallel transaction method in the blockchain-based blockchain parallel transaction apparatus. The blockchain-based blockchain parallel transaction device 100 may access the background database 300 (the background database may be in a local memory of the blockchain-based blockchain parallel transaction device, and may also be set in a cloud), and information related to blockchain-based blockchain parallel transaction is stored in the background database 300.
It should be noted that the scenario diagram of blockchain-based parallel transaction shown in fig. 1 is only an example, and the scenario of blockchain-based parallel transaction described in the embodiment of the present application is for more clearly illustrating the technical solution of the embodiment of the present application, and does not constitute a limitation to the technical solution provided by the embodiment of the present application.
Based on the above scenario of blockchain-based blockchain parallel transaction, an embodiment of a blockchain-based blockchain parallel transaction method is provided.
As shown in fig. 2, fig. 2 is a schematic flowchart of an embodiment of a blockchain parallel transaction method in the embodiment of the present application, where the image processing method includes the following steps 201 — 204:
201. acquiring each intelligent contract transaction to be processed and transaction configuration information of the intelligent contract transaction;
in this embodiment, the blockchain parallel transaction method is applied to blockchain parallel transaction equipment, where the blockchain parallel transaction equipment is a node equipment in a blockchain, where the type of the blockchain parallel transaction equipment is not specifically limited, for example, the blockchain parallel transaction equipment may be an intelligent terminal or a server, and in this embodiment, the intelligent terminal is taken as an example for description.
Specifically, the blockchain parallel transaction device is configured to receive an intelligent contract transaction to be processed, determine a mutually exclusive variable behavior of the intelligent contract transaction according to transaction configuration information of the intelligent contract transaction, a transaction contract and an intelligent contract method, determine a parallel contract transaction in the intelligent contract transaction by performing dependency analysis on the mutually exclusive variable behavior, and perform parallel execution on the parallel contract transaction. Wherein the parallel contract transactions are intelligent contract transactions having no dependency relationship with other intelligent contract transactions.
Specifically, the blockchain parallel transaction device receives a transaction parallel request in the operation process, and responds to the transaction parallel request to perform transaction parallel processing on the intelligent contract transaction. The transaction parallel request may be actively triggered by a user, for example, the user actively triggers the transaction parallel request by clicking a transaction parallel button in the blockchain parallel transaction device, and optionally, the transaction parallel request may also be automatically triggered by the blockchain parallel transaction device, for example, the blockchain parallel transaction device is preset with a transaction parallel process, detects an intelligent contract transaction in the blockchain in real time, and automatically triggers the transaction parallel request after the intelligent contract transaction meets a preset parallel transaction policy.
Specifically, after receiving the parallel transaction request, the blockchain parallel transaction device acquires a block in the parallel transaction request, analyzes the intelligent contract transaction in the block, acquires each intelligent contract transaction corresponding to the parallel transaction request, and acquires transaction configuration information in each intelligent contract transaction. The transaction configuration information is a transaction parameter output by each node device for generating the intelligent contract exchange, and optionally, the transaction configuration information includes contract address information, a function identifier of an intelligent contract method, and a transaction input parameter.
202. Acquiring a trading contract and an intelligent contract method corresponding to the intelligent contract trade, and determining target field operation information of the intelligent contract trade according to the trading contract and the intelligent contract method;
after acquiring the transaction configuration information, the block chain parallel transaction equipment acquires a transaction contract and an intelligent contract method corresponding to the intelligent contract transaction through the transaction configuration information, and determines target field operation information of the intelligent contract transaction according to the transaction contract and the intelligent contract method. Wherein the trading contract is a specific intelligent contract in the block chain; the intelligent contract method is a contract method called by the current intelligent contract transaction in the characterization transaction contract; the target field operation information is the operation identification which characterizes the target field and the mutual exclusion variable which are related to the intelligent contract transaction.
Specifically, the blockchain parallel transaction device obtains the transaction type of the intelligent contract transaction in advance, and determines the transaction contract and the target field operation information of the intelligent contract transaction through the transaction type of the intelligent contract transaction and the contract address information associated with the intelligent contract transaction. Optionally, the transaction types of the intelligent contract transaction include a contract deployment transaction type, a contract lifecycle management transaction type, and a contract invocation transaction type.
Specifically, the block chain parallel transaction device obtains a contract transaction type of an intelligent contract transaction, if the contract transaction type of the intelligent contract transaction is determined to be a contract deployment transaction, determines a contract account to be deployed according to reading of transaction configuration information, reads a random numerical value in a target field of the contract account to be deployed, performs hash operation on the random numerical value to obtain an updated intelligent contract address, adds 1 to a value of the target field, and generates an exclusive variable behavior of the contract deployment transaction according to the contract account to be deployed, the target contract address and a field operation identifier. Wherein the contract account to be deployed is a from account, and the contract deployment transaction is an intelligent contract transaction for modifying a target field (nonce value) in the from account and creating ledger data of a new contract; the transaction configuration information is a contract account address to be deployed.
Specifically, the blockchain parallel transaction device obtains a transaction type of the intelligent contract, and if the contract transaction type of the intelligent contract transaction is determined to be a contract lifecycle management transaction, the contract lifecycle management contract transaction is a transaction behavior for modifying ledger data in a to account. Thus, the contract lifecycle management contract transactions may affect the account execution logic that invokes the to contract, i.e., be considered mutually exclusive with all transactions that invoke the to contract. Therefore, the blockchain parallel transaction device acquires the field operation identifier corresponding to the contract life cycle management transaction and the transaction configuration information, and generates the mutually exclusive variable behavior of the life cycle management transaction. Wherein the transaction configuration information is contract address information of the to contract.
Specifically, after determining that the transaction type of the intelligent contract transaction is a contract calling transaction type, the blockchain parallel transaction device queries the contract interface file of each intelligent contract through the contract address information of the intelligent contract transaction, so as to obtain the contract interface file matched with the contract address information, and thus obtain the transaction contract corresponding to the intelligent contract transaction.
After obtaining a trading contract corresponding to the intelligent contract trade, the block chain parallel trading device analyzes the trading contract to determine contract methods included in the trading contract, compares method identifications of the contract methods with function identifications of the intelligent contract trade, obtains a target contract method successfully compared, and determines that the target contract method is the intelligent contract method of the intelligent contract trade.
After the block chain parallel transaction equipment acquires the intelligent contract method, the instruction analysis is also carried out on the intelligent contract method, and a target field and a field operation identifier operated in the intelligent contract method are acquired, so that target field operation information in the intelligent contract method is acquired.
Optionally, the target field operation information may be obtained when the user constructs an intelligent contract transaction based on the client, or may be obtained after the intelligent contract transaction is linked up, and after the target field operation information is obtained, the target field operation information is encoded into a contract interface file of the transaction contract by the block chain parallel transaction.
203. Generating a mutually exclusive variable behavior of the intelligent contract transaction according to the target field operation information and the transaction configuration information;
after obtaining the target field operation information of the intelligent contract transaction, the blockchain parallel transaction device generates a mutual exclusion variable behavior of the intelligent contract according to the target field operation information and the transaction input parameters in the transaction configuration information, wherein the mutual exclusion variable behavior is a mutual exclusion variable representing the intelligent contract transaction and behavior information of operation aiming at the mutual exclusion variable. The mutually exclusive variable behavior comprises a mutually exclusive variable and a field operation identifier.
Specifically, the blockchain parallel transaction device constructs a mutual exclusion variable template according to the target field in the target field operation information and the contract address information, and inputs the transaction input parameters in the transaction configuration information into the mutual exclusion variable template to obtain the mutual exclusion variable of the intelligent contract transaction. The mutual exclusion variable includes any one or more of an account address and a mutual exclusion field. The account address is a mutually exclusive variable used for identifying the range of operating the account book data, namely, the transaction contract address of the intelligent contract transaction, and can be represented by a character string array, the range of operating the account book data is gradually reduced from front to back, and the smaller the range is, the higher the concurrency degree can be achieved. The mutually exclusive field is a field that defines the ledger scope of the operation as being under the transaction contract account.
Optionally, the number of elements in the mutex variable generated by the blockchain parallel transaction device may be one or more, if there is only one element in the mutex variable, that is, the mutex variable only includes an account address element, that is, the ledger modification range that identifies the mutex variable includes all data under an account specified by the ledger address; if the number of the elements in the mutex variable identifier is two, that is, the mutex variable identifier includes an account address element and a mutex field, the ledger modification range of the mutex variable is determined to be all data of the specified mutex field under the account address. And if the number of the elements in the mutual exclusion variable is more than or equal to three, namely the mutual exclusion variable also comprises an element key corresponding to the transaction input parameter, identifying the ledger modification range of the mutual exclusion variable as some data of the specified mutual exclusion field under the account address.
Specifically, after the block chain parallel transaction device generates the mutual exclusion variable, the field operation identifier corresponding to the mutual exclusion variable in the field operation information is also obtained, and the mutual exclusion variable and the field operation identifier are associated to obtain the mutual exclusion variable behavior of the intelligent contract transaction.
204. And performing dependency analysis on each intelligent contract transaction according to the mutually exclusive variable behavior of each intelligent contract transaction to obtain each parallel contract transaction in each intelligent contract transaction, and executing each parallel contract transaction in parallel.
After acquiring all the mutually exclusive variable behaviors of the intelligent contract transactions to be processed, the block chain parallel transaction equipment also performs dependence analysis on the intelligent contract transactions according to the mutually exclusive variable behaviors of the intelligent contract transactions, thereby determining whether the intelligent contract transactions can be processed in parallel, acquiring the parallel contract transactions which can be processed in parallel in the intelligent contract transactions, and executing the parallel contract transactions in parallel.
Specifically, as shown in fig. 3, fig. 3 is a scene diagram of an embodiment of a mutual exclusion variable tree in the embodiment of the present application. In the proposal, the mutually exclusive variable behavior of the intelligent contract transactions can be represented by the tree structure, and the dependency analysis is carried out on each intelligent contract transaction according to the tree structure and the mutually exclusive variable behavior to form a mutually exclusive variable tree, so that the dependency relationship in each intelligent contract transaction is determined according to the mutually exclusive variable tree.
The initialized mutex variable tree only has one root node, and the root node represents data of the whole account book. In the mutex variable tree, starting from a root node to any node, the node can be called a path, and a character string array formed by edges on the path is actually a mutex variable. The construction of the mutual exclusion variable tree is based on the mutual exclusion variable behavior, and the addition of a mutual exclusion variable behavior to the mutual exclusion variable tree can be regarded as the construction of a path in the mutual exclusion variable tree. After the block chain parallel transaction equipment constructs the mutual exclusion variable tree according to the mutual exclusion variable behaviors of the intelligent contract transactions to be processed, the dependency relationship of each intelligent contract transaction is determined through the mutual exclusion variable tree, and therefore the parallel contract transactions which do not have the dependency relationship with each intelligent contract transaction are obtained.
After acquiring parallel contract transactions in intelligent contract transactions, the block chain parallel transaction equipment inputs the parallel contract transactions into a preset transaction parallel execution model, improves the transaction parallel execution model to perform parallel processing on each parallel contract transaction, and performs serial processing on the intelligent contract transactions with dependency relationships according to a preset transaction sequence.
In the embodiment, the blockchain parallel transaction equipment acquires each intelligent contract transaction to be processed and transaction configuration information of each intelligent contract transaction; acquiring a trading contract and an intelligent contract method corresponding to each intelligent contract, and determining target field operation information of intelligent contract trading according to the trading contract and the intelligent contract method; after the target field operation information is acquired, mutually exclusive variable behaviors of the intelligent contract transactions are generated according to the target field operation information and the transaction configuration information, dependence analysis is performed on the intelligent contract transactions according to the mutually exclusive variable behaviors of the intelligent contract transactions, so that parallel contract transactions in the intelligent contract transactions are determined, the parallel contract transactions are executed in parallel, the transaction behavior analysis granularity is improved, the dependence analysis accuracy is improved, and the parallelism degree and completeness of parallel contract transaction processing are further ensured.
Fig. 4 is a flowchart illustrating an embodiment of generating a mutex variable across contract address information in a blockchain parallel transaction method according to an embodiment of the present disclosure.
In this embodiment, if it is detected that a cross-contract invoking behavior exists in an intelligent contract transaction, a mutual exclusion variable behavior analysis is performed on the cross-contract invoking behavior, specifically, the method includes steps 301-304:
301. acquiring a contract transaction type of the intelligent contract transaction;
302. if the contract transaction type is a contract calling transaction type, acquiring cross-contract address information associated with the intelligent contract method and a second contract corresponding to the cross-contract address information;
303. acquiring cross contract field operation information associated with the intelligent contract method in the second contract, and generating a cross contract calling strategy according to the second contract and the cross contract field operation information;
304. and generating a mutual exclusion variable behavior of the intelligent contract transaction according to the target field operation information, the cross-contract calling strategy and the transaction configuration information.
After acquiring contract address information associated with each intelligent contract transaction, if the contract address information is multiple, the blockchain parallel transaction device determines that the intelligent contract transaction has a cross-contract calling behavior, and determines a mutually exclusive variable behavior of the intelligent contract transaction according to the cross-contract calling behavior.
Specifically, the blockchain parallel transaction device obtains cross-contract address information associated with the intelligent contract transaction method, and obtains a second contract corresponding to the cross-contract address information and a contract interface file corresponding to the second contract according to the cross-contract address information.
And after acquiring the contract interface file, the block chain parallel transaction equipment also acquires a cross-contract calling signature array in the intelligent contract method, and acquires mutually exclusive field information in the second contract according to the cross-contract calling signature array, so as to acquire cross-contract field operation information associated with the intelligent contract method in the second contract.
Specifically, after acquiring the cross-contract calling signature array, the block chain parallel transaction device analyzes the cross-contract calling signature array to obtain each method signature in the cross-contract calling signature array, traverses the contract interface file corresponding to the second contract through the method signature, and acquires cross-contract field operation information corresponding to the method signature in the contract interface file, wherein the cross-contract field operation information includes a cross-contract field and a cross-contract operation identifier, and the block chain parallel transaction device generates a cross-contract calling policy according to the acquired second contract and the cross-contract operation field.
After acquiring a cross-contract calling strategy, the block chain parallel transaction equipment also constructs a mutual exclusion variable template according to a target field in target field operation information of intelligent contract transaction and contract address information, and inputs transaction configuration information into the mutual exclusion variable template to obtain a first mutual exclusion variable of the intelligent contract transaction; and generating a second mutual exclusion variable of the intelligent contract transaction according to the cross-contract address information in the cross-contract calling strategy.
And after the block chain parallel transaction equipment acquires the first mutual exclusion variable and the second mutual exclusion variable, generating a mutual exclusion variable behavior of the intelligent contract according to the field operation identifier, the first mutual exclusion variable and the second mutual exclusion variable.
Optionally, in a specific embodiment, the intelligent contract transaction tx1 acquired by the blockchain parallel transaction device and the contract address information of the intelligent contract transaction is determined to be addrCC, the function identifier of the intelligent contract transaction is func4, and the transaction input parameters in the transaction configuration information are [ "cc1", "cc2" ]. The block chain parallel transaction equipment acquires a transaction contract CC and an interface file ABI _ CC file corresponding to the transaction contract according to contract address information, acquires exclusive field information corresponding to the function identifier func4 in the ABI _ CC file, determines a first exclusive variable [ addrCC, fd, CC1] corresponding to the intelligent transaction method func4, namely determines that the exclusive field information represents that data in the fd [ CC1] range under the addrCC address can be operated, and also acquires a field operation identifier R corresponding to the first exclusive variable in the intelligent transaction method func4, and determines that the first exclusive variable represents that data in the fd [ CC1] range under the addrCC address can be read.
The block chain parallel transaction equipment also acquires cross contract address information addrCB in the intelligent contract method func4, acquires a second contract CB according to the cross contract address information, acquires a cross contract interface file ABI _ CB corresponding to the second contract CB, acquires a second mutually exclusive variable (addrCB, fc) in the ABI _ CB file according to a cross contract signature array [ (addrCB, [ "func3" ]) ], and determines that the second mutually exclusive variable RW variable is data representing the fc range under the addrCB address to be subjected to read-write operation.
After acquiring the first mutual exclusion variable [ addrCC, fd, cc1], the second mutual exclusion variable [ addrCB, fc ] and the corresponding field operation identifier, the block chain parallel transaction device generates a mutual exclusion variable behavior corresponding to the intelligent contract transaction. The mutual exclusion variable behavior of the intelligent contract transaction tx1 is shown in the following table:
Figure BDA0003834160520000141
Figure BDA0003834160520000151
after the block chain parallel transaction device obtains the mutual exclusion variable behaviors corresponding to the intelligent contract transactions in the above mode, the dependency analysis is performed on the intelligent contract transactions according to the mutual exclusion variable behaviors, so that the dependency relationship of the intelligent contract transactions is determined.
In this embodiment, the block chain parallel transaction device obtains the cross-contract address information associated with the intelligent contract method and the second contract corresponding to the cross-contract address information; acquiring cross contract field operation information associated with the intelligent contract method in the second contract, and generating a cross contract calling strategy according to the second contract and the cross contract field operation information; and generating a mutual exclusion variable behavior of the intelligent contract transaction according to the target field operation information, the cross-contract calling strategy and the transaction configuration information. The method and the device realize that the analysis accuracy and the analysis granularity of the mutual exclusion variable behaviors of each intelligent contract transaction are improved by analyzing the mutual exclusion variable behaviors generated by cross-contract calling, and further improve the accuracy of subsequent dependency analysis.
Fig. 5 is a schematic flow chart illustrating an embodiment of determining parallel contract transactions by performing dependency analysis on intelligent contract transactions in the blockchain parallel transaction method according to the embodiment of the present application.
Based on the above embodiment, in this proposal, after acquiring the mutual exclusion variable behavior of each intelligent contract transaction, the blockchain parallel transaction device performs dependency analysis on each intelligent contract transaction according to the mutual exclusion variable behavior, so as to determine parallel contract transactions that can be executed in parallel, specifically, including step 401 — step 403:
401. acquiring a mutual exclusion variable of a mutual exclusion variable behavior corresponding to each intelligent contract transaction;
402. if a target mutual exclusion variable behavior group with mutually exclusive variables matched exists, acquiring a target field operation identifier of each target mutual exclusion variable behavior in the target mutual exclusion variable behavior group;
403. and performing dependency analysis on target intelligent contract transactions corresponding to the target mutual exclusion variable behaviors according to the target field operation identification to obtain parallel contract transactions in each target intelligent contract transaction, and executing each parallel contract transaction in parallel.
In this embodiment, after acquiring the mutually exclusive variable behavior corresponding to each intelligent contract transaction, the blockchain parallel transaction device performs dependency analysis on each intelligent contract transaction according to the mutually exclusive variable behavior.
Specifically, the block chain parallel transaction device generates an initialized mutual exclusion variable tree, inputs each mutual exclusion variable behavior into the mutual exclusion variable tree, and analyzes the dependency relationship of each intelligent contract transaction through the mutual exclusion variable tree and the mutual exclusion variable behavior.
And the block chain parallel transaction equipment carries out dependence analysis on partial mutual exclusion variable behaviors in advance to obtain partial mutual exclusion variable behaviors without dependence, inputs the partial mutual exclusion variable behaviors into the initialized mutual exclusion variable tree, and generates initial branch nodes of the mutual exclusion variable tree.
After the block chain parallel transaction device generates the initial branch node, the dependency analysis is carried out on the residual mutex variable behaviors, the mutex variables of the residual mutex variable behaviors are obtained, and the mutex variables are compared, so that a mutex variable comparison result is obtained.
Optionally, if the mutual exclusion variable comparison result is that the mutual exclusion variable is different from other mutual exclusion variables, that is, the mutual exclusion variable is not matched with the mutual exclusion variables of other mutual exclusion variable behaviors, the blockchain parallel transaction device generates a new branch node of the mutual exclusion variable tree, and records the mutual exclusion variable behavior into the branch node.
Optionally, if the mutex variable comparison result indicates that a mutex variable identical to the mutex variable exists, that is, a mutex variable behavior matched with the mutex variable exists, the blockchain parallel transaction device sets the mutex variable behavior matched with the mutex variable as a target mutex variable behavior, stores the target mutex variable behavior in a corresponding target mutex variable behavior group in association, and generates a mutex sub-branch corresponding to the target mutex variable behavior group.
Specifically, after generating the target mutual exclusion variable behavior group, the blockchain parallel transaction device also acquires a target field operation identifier in the target mutual exclusion variable behavior group, and judges whether dependency exists in each target mutual exclusion variable behavior through the target field operation identifier, so as to obtain parallel contract transactions in target intelligent contract transactions.
Optionally, the blockchain parallel transaction device obtains each target field operation identifier 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 a target branch associated with the target mutually exclusive variable in the mutually exclusive variable tree, and if the target field operation identifier corresponding to the target branch is a read-write operation identifier or a write-in operation identifier, it is determined that the target intelligent contract transaction corresponding to the target branch and the intelligent contract transaction corresponding to the target mutually exclusive variable behavior are mutually dependent contract transactions.
Optionally, the blockchain parallel transaction device obtains each target field operation identifier in the target mutually exclusive variable behavior group, and if the target field operation identifier is a write operation identifier, the blockchain parallel transaction device obtains a target branch associated with the target mutually exclusive variable in the mutually exclusive variable tree, and determines that the target intelligent contract transactions corresponding to the target branch are mutually dependent contract transactions with the intelligent contract transactions of the target mutually exclusive variable behavior corresponding to the write operation identifier.
And the block chain parallel transaction equipment groups the intelligent contracts according to the dependency relationship of the intelligent contract transactions to obtain the parallel contract transactions in the intelligent contract transactions, and inputs the parallel contract transactions into the grouping parallel model to execute the parallel contract transactions in parallel.
Optionally, in an embodiment, the mutually exclusive variable behavior corresponding to the intelligent contract transaction acquired by the blockchain parallel transaction device is shown in the following table:
Figure BDA0003834160520000171
and after the block chain parallel transaction equipment constructs the mutual exclusion variable tree according to the mutual exclusion variable behaviors of each intelligent contract transaction, performing dependence analysis through the mutual exclusion variable behaviors and the mutual exclusion variable tree.
And traversing the mutex variable tree by the blockchain parallel transaction equipment, and determining a target mutex variable behavior group [ tx1, tx5], [ tx2], [ tx3, tx7] and [ tx4, tx6] of the same mutex variable in the mutex variable tree. And after the block chain parallel transaction equipment acquires the target mutual exclusion variable behavior group again, acquiring a target field operation identifier in the target mutual exclusion variable behavior group, and determining whether the song target mutual exclusion variable behaviors in the target mutual exclusion variable behavior group have a dependency relationship or not through the target field operation identifier.
Specifically, the blockchain parallel transaction device acquires a target field operation identifier of a target exclusive variable behavior tx5 as a read-only operation identifier, acquires a target field operation identifier of another target exclusive variable behavior tx1, and determines that the operation of tx1 is also a read-only operation, and then the blockchain parallel transaction device determines that there is no dependency relationship between the target exclusive variable behaviors tx1 and tx5, and determines that the target exclusive variable behaviors tx1 and tx5 are parallel contract transactions.
Specifically, the blockchain parallel transaction device acquires a target field operation identifier of a target exclusive variable behavior tx6 as a read-only operation identifier, acquires a target field operation identifier of another target exclusive variable behavior tx4, determines that the operation of tx4 is a write operation, that is, the target field operation identifier of tx4 is a write operation identifier, determines that a dependency relationship exists between the target exclusive variable behaviors tx4 and tx6, and sets tx4 and tx6 as the same exclusive variable branch of the exclusive variable tree.
Specifically, the blockchain parallel transaction device acquires a target field operation identifier of a target mutex variable behavior tx7 as a read-only operation identifier, acquires a target field operation identifier of another target mutex variable behavior tx3, 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, determines that a dependency relationship exists between the target mutex variable behaviors tx3 and tx7, and sets tx3 and tx7 as the same mutex variable branch of the mutex variable tree.
And the block chain parallel transaction equipment executes the intelligent contract transactions of different mutually exclusive variable branches in the mutually exclusive variable tree in parallel.
In this embodiment, the blockchain parallel transaction device acquires the mutual exclusion variable of the mutual exclusion variable behavior corresponding to each intelligent contract transaction; if a target mutual exclusion variable behavior group with mutually exclusive variables matched exists, acquiring a target field operation identifier of each target mutual exclusion variable behavior in the target mutual exclusion variable behavior group; and performing dependency analysis on target intelligent contract transactions corresponding to the target mutual exclusion variable behaviors according to the target field operation identifiers to obtain parallel contract transactions in each target intelligent contract transaction, and executing each parallel contract transaction in parallel. The dependency analysis of each intelligent contract transaction is realized through the mutual exclusion variable behavior, and the accuracy of the dependency analysis is improved.
Fig. 6 is a schematic flow chart of an embodiment of parallel processing of parallel contract transactions in the blockchain parallel transaction method provided in the embodiment of the present application, as shown in fig. 6.
Based on the foregoing embodiment, in this embodiment, the blockchain parallel transaction device performs parallel set grouping on each parallel contract transaction, and executes parallel contract transactions in parallel according to a grouping result, specifically, the method includes step 501 — step 502:
501. performing parallel set grouping on the intelligent contract transactions according to the dependency relationship identification in the intelligent contract transactions to obtain each contract transaction group and a group number, wherein the group numbers of the dependency contract transactions with the same dependency relationship identification are the same;
502. and traversing the grouping numbers of the intelligent contract transactions, setting the intelligent contract transactions with different grouping numbers as parallel contract transactions, and executing the parallel contract transactions in parallel.
In this embodiment, after the block chain parallel transaction device performs dependency analysis on each intelligent contract according to the mutually exclusive variable behavior and generates the dependency identifier of each intelligent contract, the block chain parallel transaction device performs parallel check and grouping on each intelligent contract transaction through the dependency identifier, so as to obtain each contract transaction group and a group number, where each intelligent contract transaction in the same contract transaction group has a dependency relationship, that is, the group numbers of the dependent contract transactions with the same dependency relationship identifier are the same.
After acquiring the group numbers of the intelligent contracts, the block chain parallel transaction equipment traverses the group numbers of the intelligent contract transactions, sets the intelligent contract transactions with different group numbers as parallel contract transactions, inputs the parallel contract transactions into a parallel execution model, and drives the parallel execution model to execute the parallel contract transactions in parallel.
In this embodiment, the block chain parallel transaction device performs parallel set grouping on the intelligent contract transactions according to the dependency relationship identifiers in the intelligent contract transactions to obtain each contract transaction group and a group number, wherein the group numbers of the dependency contract transactions with the same dependency relationship identifier are the same; and traversing the grouping numbers of the intelligent contract transactions, setting the intelligent contract transactions with different grouping numbers as parallel contract transactions, and executing the parallel contract transactions in parallel. And realizing parallel processing of each parallel contract transaction without dependency relationship.
In order to better implement the blockchain parallel transaction method in the embodiment of the present application, on the basis of the blockchain parallel transaction method, an embodiment of the present application further provides a blockchain parallel transaction apparatus, as shown in fig. 7, and fig. 7 is a schematic structural diagram of an embodiment of the blockchain parallel transaction apparatus provided in the embodiment of the present application. The block chain parallel transaction apparatus 600 includes:
a transaction acquisition module 601 configured to acquire each intelligent contract transaction to be processed and transaction configuration information of the intelligent contract transaction;
a contract inquiry module 602 configured to obtain a trading contract and an intelligent contract method corresponding to the intelligent contract trade, and determine target field operation information of the intelligent contract trade according to the trading contract and the intelligent contract method;
a behavior confirmation module 603 configured to generate a mutual exclusion variable behavior of the intelligent contract transaction according to the target field operation information and the transaction configuration information;
the parallel confirmation module 604 is configured to perform dependency analysis on each intelligent contract transaction according to the mutually exclusive variable behavior of each intelligent contract transaction, obtain each parallel contract transaction in each intelligent contract transaction, and execute each parallel contract transaction in parallel.
In some embodiments of the present application, the obtaining, by a blockchain parallel transaction apparatus, a transaction contract and an intelligent contract method corresponding to the intelligent contract transaction, and determining target field operation information of the intelligent contract transaction according to the transaction contract and the intelligent contract method include:
acquiring contract address information associated with the intelligent contract transaction and a transaction contract corresponding to the contract address information;
inquiring the trading contract to obtain an intelligent contract method corresponding to the function identification of the intelligent contract trading;
analyzing the intelligent contract method to obtain target field operation information in the intelligent contract method, wherein the target field operation information comprises a target field and a field operation identifier.
In some embodiments of the present application, the analyzing, by the blockchain parallel transaction device, the intelligent contract method to obtain target field operation information in the intelligent contract method includes:
performing instruction analysis on the intelligent contract method to obtain a target field, a target field operation identifier and contract calling information in the intelligent contract method;
if the target field is a set field, performing arrival fixed value analysis on the intelligent contract method to obtain a target field parameter source of the target field;
and summarizing the target field operation identification, the target field parameter source and the contract calling information to obtain the target field operation information in the intelligent contract method.
In some embodiments of the present application, the generating, by the blockchain parallel transaction apparatus, a mutually exclusive variable behavior of the intelligent contract transaction according to the target field operation information and the transaction configuration information includes:
acquiring a contract transaction type of the intelligent contract transaction;
if the contract transaction type is a contract calling transaction type, acquiring cross-contract address information associated with the intelligent contract method and a second contract corresponding to the cross-contract address information;
acquiring cross contract field operation information associated with the intelligent contract method in the second contract, and generating a cross contract calling strategy according to the second contract and the cross contract field operation information;
and generating a mutual exclusion variable behavior of the intelligent contract transaction according to the target field operation information, the cross-contract calling strategy and the transaction configuration information.
In some embodiments of the present application, the generating, by the blockchain parallel transaction apparatus, a mutually exclusive variable behavior of an intelligent contract transaction according to the target field operation information, the cross-contract invoking policy, and the transaction configuration information includes:
constructing a mutual exclusion variable template according to target fields in the target field operation information and contract address information, and inputting the transaction configuration information into the mutual exclusion variable template to obtain a first mutual exclusion variable of the intelligent contract transaction;
generating a second mutual exclusion variable of the intelligent contract transaction according to the cross-contract address information in the cross-contract calling strategy;
and acquiring a field operation identifier in the target field operation information, and generating a mutual exclusion variable behavior of the intelligent contract transaction according to the field operation identifier, the first mutual exclusion variable and the second mutual exclusion variable.
In some embodiments of the present application, the generating, by the blockchain parallel transaction device, the second mutually exclusive variable of the intelligent contract transaction according to the cross-contract address information and the transaction configuration information in the cross-contract invoking policy includes:
acquiring a cross contract interface file corresponding to the cross contract address information;
traversing the cross contract interface file according to a cross contract signature array in the cross contract calling strategy to obtain cross contract field operation information;
and generating a second mutually exclusive variable of the intelligent contract transaction based on the cross-contract field operation identification and the cross-contract field in the field operation information.
In some embodiments of the present application, the generating, by the blockchain parallel transaction apparatus, a mutually exclusive variable behavior of the intelligent contract transaction according to the target field operation information and the transaction configuration information includes:
acquiring a contract transaction type of the intelligent contract transaction;
if the contract transaction type is a contract deployment transaction type, acquiring a contract account to be deployed according to transaction configuration information, reading a random numerical value in the target field operation information, and performing hash operation on the random numerical value to obtain a target contract address;
and generating mutually exclusive variable behaviors of the contract deployment transaction according to the contract account to be deployed, the target contract address and the field operation identifier.
In some embodiments of the present application, the performing, by a blockchain parallel transaction apparatus, dependency analysis on each intelligent contract transaction according to the mutually exclusive variable behavior of each intelligent contract transaction to obtain each parallel contract transaction in each intelligent contract transaction, and executing each parallel contract transaction in parallel includes:
acquiring a mutual exclusion variable of a mutual exclusion variable behavior corresponding to each intelligent contract transaction;
if a target mutual exclusion variable behavior group with mutually exclusive variables matched exists, acquiring a target field operation identifier of each target mutual exclusion variable behavior in the target mutual exclusion variable behavior group;
and performing dependency analysis on target intelligent contract transactions corresponding to the target mutual exclusion variable behaviors according to the target field operation identification to obtain parallel contract transactions in each target intelligent contract transaction, and executing each parallel contract transaction in parallel.
In some embodiments of the present application, the performing, by the blockchain parallel transaction device, dependency analysis on the intelligent contract transactions according to the target field operation identifier to obtain parallel contract transactions in each of the intelligent contract transactions, and performing each of the parallel contract transactions in parallel includes:
if the target field operation identifier of the target mutual exclusion variable behavior is a read-only operation identifier, setting the target intelligent contract transaction corresponding to the target mutual exclusion variable behavior carrying the read-write operation identifier and the write-in operation identifier as a dependent contract transaction;
if a target mutual exclusion variable behavior with a write-in operation identifier exists, determining a target intelligent contract transaction corresponding to the mutual exclusion variable behavior matched with the target mutual exclusion variable of the target mutual exclusion variable behavior as a dependent contract transaction;
and grouping the intelligent contract transactions according to the dependency contract transactions to obtain each parallel contract transaction in each intelligent contract transaction, and executing each parallel contract transaction in parallel.
In some embodiments of the present application, the identifying the intelligent contract transactions according to the dependent contract transactions by the blockchain parallel transaction device to obtain each parallel contract transaction in each intelligent contract transaction, and executing each parallel contract transaction in parallel includes:
performing parallel set grouping on the intelligent contract transactions according to the dependency relationship identification in the intelligent contract transactions to obtain each contract transaction group and a group number, wherein the group numbers of the dependency contract transactions with the same dependency relationship identification are the same;
and traversing the grouping numbers of the intelligent contract transactions, setting the intelligent contract transactions with different grouping numbers as parallel contract transactions, and executing the parallel contract transactions in parallel.
An embodiment of the present invention further provides a blockchain parallel transaction device, as shown in fig. 8, fig. 8 is a schematic structural diagram of an embodiment of the blockchain parallel transaction device provided in the embodiment of the present application.
The blockchain parallel transaction device integrates any one of the blockchain parallel transaction apparatuses provided by the embodiments of the present invention, and 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 for performing the steps of the blockchain parallel transaction method described in any of the above embodiments of the blockchain parallel transaction method.
Specifically, the method comprises the following steps: the blockchain parallel transaction apparatus may include components such as a processor 701 of one or more processing cores, a memory 702 of one or more computer-readable storage media, a power supply 703, and an input unit 704. Those skilled in the art will appreciate that the blockchain parallel transaction device architecture shown in fig. 7 does not constitute a limitation of blockchain parallel transaction devices and may include more or fewer components than those shown, or combine certain components, or a different arrangement of components. Wherein:
the processor 701 is a control center of the blockchain parallel transaction apparatus, connects various parts of the whole blockchain parallel transaction apparatus by using various interfaces and lines, and executes various functions and processes data of the blockchain parallel transaction apparatus by running or executing software programs and/or modules stored in the memory 702 and calling data stored in the memory 702, thereby performing overall monitoring on the blockchain parallel transaction apparatus. Optionally, processor 701 may include one or more processing cores; preferably, the processor 701 may integrate an application processor, which mainly handles operating systems, user interfaces, application programs, etc., and a modem processor, which mainly handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 701.
The memory 702 may be used to store software programs and modules, and the processor 701 executes various functional applications and data processing by operating the software programs and modules stored in the memory 702. The memory 702 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data created according to use of the blockchain parallel transaction apparatus, and the like. Further, 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 device. Accordingly, the memory 702 may also include a memory controller to provide the processor 701 with access to the memory 702.
The blockchain parallel transaction device further includes a power source 703 for supplying power to each component, and preferably, the power source 703 may be logically connected to the processor 701 through a power management system, so as to implement functions of managing charging, discharging, and power consumption management through the power management system. The power supply 703 may also include any component including one or more of a dc or ac power source, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and the like.
The blockchain parallel transaction apparatus may further include an input unit 704, and the input unit 704 may be used to receive input numeric or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
Although not shown, the blockchain parallel transaction apparatus may further include a display unit and the like, which are not described in detail herein. Specifically, in this embodiment, the processor 701 in the blockchain parallel transaction apparatus loads the executable file corresponding to the process of one or more application programs into the memory 702 according to the following instructions, and the processor 701 runs the application program stored in the memory 702, so as to implement various functions, as follows:
acquiring each intelligent contract transaction to be processed and transaction configuration information of the intelligent contract transaction;
acquiring a trading contract and an intelligent contract method corresponding to the intelligent contract trade, and determining target field operation information of the intelligent contract trade according to the trading contract and the intelligent contract method;
generating a mutually exclusive variable behavior of the intelligent contract transaction according to the target field operation information and the transaction configuration information;
and performing dependency analysis on each intelligent contract transaction according to the mutually exclusive variable behavior of each intelligent contract transaction to obtain each parallel contract transaction in each intelligent contract transaction, and executing each parallel contract transaction in parallel.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and parts that are not described in detail in a certain embodiment may refer to the above detailed descriptions of other embodiments, and are not described herein again.
In a specific implementation, each unit or structure may be implemented as an independent entity, or may be combined arbitrarily to be implemented as one or several entities, and the specific implementation of each unit or structure may refer to the foregoing method embodiment, which is not described herein again.
To this end, an embodiment of the present invention provides a computer-readable storage medium, which may include: read Only Memory (ROM), random Access Memory (RAM), magnetic or optical disks, and the like. Stored thereon, is a computer program, which is loaded by a processor to execute the steps of any of the blockchain parallel transaction methods provided by the embodiments of the present invention. For example, the computer program may be loaded by a processor to perform the steps of:
acquiring each intelligent contract transaction to be processed and transaction configuration information of the intelligent contract transaction;
acquiring a trading contract and an intelligent contract method corresponding to the intelligent contract trading, and determining target field operation information of the intelligent contract trading according to the trading contract and the intelligent contract method;
generating a mutually exclusive variable behavior of the intelligent contract transaction according to the target field operation information and the transaction configuration information;
and performing dependency analysis on each intelligent contract transaction according to the mutually exclusive variable behavior of each intelligent contract transaction to obtain each parallel contract transaction in each intelligent contract transaction, and executing each parallel contract transaction in parallel.
To this end, an embodiment of the present invention provides a computer-readable storage medium, which may include: read Only Memory (ROM), random Access Memory (RAM), magnetic or optical disks, and the like. Stored thereon, is a computer program, which is loaded by a processor to execute the steps of any of the blockchain parallel transaction methods provided by the embodiments of the present invention. For example, the computer program may be loaded by a processor to perform the steps of:
acquiring each intelligent contract transaction to be processed and transaction configuration information of the intelligent contract transaction;
acquiring a trading contract and an intelligent contract method corresponding to the intelligent contract trade, and determining target field operation information of the intelligent contract trade according to the trading contract and the intelligent contract method;
generating a mutually exclusive variable behavior of the intelligent contract transaction according to the target field operation information and the transaction configuration information;
and performing dependency analysis on each intelligent contract transaction according to the mutually exclusive variable behavior of each intelligent contract transaction to obtain each parallel contract transaction in each intelligent contract transaction, and executing each parallel contract transaction in parallel.
The above operations can be implemented in the foregoing embodiments, and are not described in detail herein.
The block chain parallel transaction method provided by the embodiment of the present application is described in detail above, and the principle and the implementation of the present invention are explained in this document by applying the specific embodiment, and the description of the above embodiment is only used to help understanding the method of the present invention and the core idea thereof; meanwhile, for those skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

Claims (13)

1. A blockchain parallel transaction method is characterized by comprising the following steps:
acquiring each intelligent contract transaction to be processed and transaction configuration information of the intelligent contract transaction;
acquiring a trading contract and an intelligent contract method corresponding to the intelligent contract trade, and determining target field operation information of the intelligent contract trade according to the trading contract and the intelligent contract method;
generating a mutually exclusive variable behavior of the intelligent contract transaction according to the target field operation information and the transaction configuration information;
and performing dependency analysis on each intelligent contract transaction according to the mutually exclusive variable behavior of each intelligent contract transaction to obtain each parallel contract transaction in each intelligent contract transaction, and executing each parallel contract transaction in parallel.
2. The blockchain parallel transaction method according to claim 1, wherein the obtaining of the transaction contract and the intelligent contract method corresponding to the intelligent contract transaction, and the determining of the target field operation information of the intelligent contract transaction according to the transaction contract and the intelligent contract method, comprise:
acquiring contract address information associated with the intelligent contract transaction and a transaction contract corresponding to the contract address information;
inquiring the trading contract to obtain an intelligent contract method corresponding to the function identification of the intelligent contract trading;
analyzing the intelligent contract method to obtain target field operation information in the intelligent contract method, wherein the target field operation information comprises a target field and a field operation identifier.
3. The blockchain parallel transaction method according to claim 2, wherein the analyzing the intelligent contract method to obtain target field operation information in the intelligent contract method includes:
performing instruction analysis on the intelligent contract method to obtain a target field, a target field operation identifier and contract calling information in the intelligent contract method;
if the target field is a set field, performing arrival fixed value analysis on the intelligent contract method to obtain a target field parameter source of the target field;
and summarizing the target field operation identification, the target field parameter source and the contract calling information to obtain the target field operation information in the intelligent contract method.
4. The blockchain parallel transaction method according to claim 1, wherein the generating the mutually exclusive variable behavior of the intelligent contract transaction according to the target field operation information and the transaction configuration information includes:
acquiring a contract transaction type of the intelligent contract transaction;
if the contract transaction type is a contract calling transaction type, acquiring cross-contract address information associated with the intelligent contract method and a second contract corresponding to the cross-contract address information;
acquiring cross contract field operation information associated with the intelligent contract method in the second contract, and generating a cross contract calling strategy according to the second contract and the cross contract field operation information;
and generating a mutual exclusion variable behavior of the intelligent contract transaction according to the target field operation information, the cross-contract calling strategy and the transaction configuration information.
5. The blockchain parallel transaction method according to claim 4, wherein the generating mutually exclusive variable behaviors of intelligent contract transactions according to the target field operation information, the cross-contract invocation policy and the transaction configuration information comprises:
constructing a mutual exclusion variable template according to a target field in the target field operation information and contract address information of the intelligent contract transaction, and inputting the transaction configuration information into the mutual exclusion variable template to obtain a first mutual exclusion variable of the intelligent contract transaction;
generating a second mutual exclusion variable of the intelligent contract transaction according to the cross-contract address information in the cross-contract calling strategy;
and acquiring a field operation identifier in the target field operation information, and generating a mutual exclusion variable behavior of the intelligent contract transaction according to the field operation identifier, the first mutual exclusion variable and the second mutual exclusion variable.
6. The blockchain parallel transaction method according to claim 5, wherein the generating a second mutually exclusive variable of the intelligent contract transaction according to the cross-contract address information and the transaction configuration information in the cross-contract invocation policy comprises:
acquiring a cross contract interface file corresponding to the cross contract address information;
traversing the cross contract interface file according to a cross contract signature array in the cross contract calling strategy to obtain cross contract field operation information;
and generating a second mutually exclusive variable of the intelligent contract transaction based on the cross-contract field operation identification and the cross-contract field in the field operation information.
7. The blockchain parallel transaction method according to claim 1, wherein the generating of the mutually exclusive variable behavior of the intelligent contract transaction according to the target field operation information and the transaction configuration information includes:
acquiring a contract transaction type of the intelligent contract transaction;
if the contract transaction type is a contract deployment transaction type, acquiring a contract account to be deployed according to transaction configuration information, reading a random numerical value in the target field operation information, and performing hash operation on the random numerical value to obtain a target contract address;
and generating a mutually exclusive variable behavior of the contract deployment transaction according to the contract account to be deployed, the target contract address and the field operation identifier.
8. The blockchain parallel transaction method according to claim 1, wherein performing dependency analysis on each of the intelligent contract transactions according to the mutually exclusive variable behavior of each of the intelligent contract transactions to obtain each of the intelligent contract transactions, and performing each of the parallel contract transactions in parallel comprises:
acquiring a mutual exclusion variable of a mutual exclusion variable behavior corresponding to each intelligent contract transaction;
if a target mutual exclusion variable behavior group with mutually exclusive variables matched exists, acquiring a target field operation identifier of each target mutual exclusion variable behavior in the target mutual exclusion variable behavior group;
and performing dependency analysis on target intelligent contract transactions corresponding to the target mutual exclusion variable behaviors according to the target field operation identification to obtain parallel contract transactions in each target intelligent contract transaction, and executing each parallel contract transaction in parallel.
9. The blockchain parallel transaction method according to claim 8, wherein said performing dependency analysis on the intelligent contract transactions according to the target field operation identification to obtain parallel contract transactions in each of the intelligent contract transactions, and performing each of the parallel contract transactions in parallel, includes:
if the target field operation identifier of the target mutual exclusion variable behavior is a read-only operation identifier, setting the target intelligent contract transaction corresponding to the target mutual exclusion variable behavior carrying the read-write operation identifier and the write-in operation identifier as a dependent contract transaction;
if a target mutual exclusion variable behavior with a write-in operation identifier exists, determining a target intelligent contract transaction corresponding to the mutual exclusion variable behavior matched with the target mutual exclusion variable of the target mutual exclusion variable behavior as a dependent contract transaction;
and grouping the intelligent contract transactions according to the dependent contract transactions to obtain each parallel contract transaction in each intelligent contract transaction, and executing each parallel contract transaction in parallel.
10. The blockchain parallel transaction method of claim 9 wherein identifying the intelligent contract transactions according to the dependency contract transactions results in each of the intelligent contract transactions, and performing each of the parallel contract transactions in parallel comprises:
performing parallel set grouping on the intelligent contract transactions according to the dependency relationship identification in the intelligent contract transactions to obtain each contract transaction group and a group number, wherein the group numbers of the dependency contract transactions with the same dependency relationship identification are the same;
and traversing the grouping numbers of the intelligent contract transactions, setting the intelligent contract transactions with different grouping numbers as parallel contract transactions, and executing the parallel contract transactions in parallel.
11. A blockchain parallel transaction apparatus, the blockchain parallel transaction apparatus comprising:
the system comprises a transaction acquisition module, a transaction processing module and a transaction processing module, wherein the transaction acquisition module is configured to acquire each intelligent contract transaction to be processed and transaction configuration information of the intelligent contract transaction;
the contract inquiry module is configured to acquire a trading contract and an intelligent contract method corresponding to the intelligent contract trade, and determine target field operation information of the intelligent contract trade according to the trading contract and the intelligent contract method;
a behavior confirmation module configured to generate a mutually exclusive variable behavior of the intelligent contract transaction according to the target field operation information and the transaction configuration information;
and the parallel confirmation module is configured to perform dependency analysis on each intelligent contract transaction according to the mutually exclusive variable behavior of each intelligent contract transaction, obtain each parallel contract transaction in each intelligent contract transaction, and execute each parallel contract transaction in parallel.
12. A blockchain parallel transaction apparatus, the blockchain parallel transaction apparatus comprising:
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 of any one of claims 1 to 10.
13. A computer-readable storage medium, having stored thereon a computer program which is loaded by a processor to perform the steps of the blockchain parallel transaction method of any one of claims 1 to 10.
CN202211083577.4A 2022-09-06 2022-09-06 Block chain parallel transaction method, device, equipment and storage medium Pending CN115578096A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211083577.4A CN115578096A (en) 2022-09-06 2022-09-06 Block chain parallel transaction method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211083577.4A CN115578096A (en) 2022-09-06 2022-09-06 Block chain parallel transaction method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115578096A true CN115578096A (en) 2023-01-06

Family

ID=84581973

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211083577.4A Pending CN115578096A (en) 2022-09-06 2022-09-06 Block chain parallel transaction method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115578096A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117422468A (en) * 2023-12-18 2024-01-19 安徽中科晶格技术有限公司 Method, equipment and storage medium for parallelizing contract link contracts based on DAG model

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117422468A (en) * 2023-12-18 2024-01-19 安徽中科晶格技术有限公司 Method, equipment and storage medium for parallelizing contract link contracts based on DAG model
CN117422468B (en) * 2023-12-18 2024-03-29 安徽中科晶格技术有限公司 Method, equipment and storage medium for parallelizing contract link contracts based on DAG model

Similar Documents

Publication Publication Date Title
CN107370786B (en) General information management system based on micro-service architecture
US11055703B2 (en) Smart contract lifecycle management
KR100600671B1 (en) Method, system, and program for managing devices in a network
JP2016100005A (en) Reconcile method, processor and storage medium
CN112329184B (en) Network architecture configuration information generation method and device, storage medium and electronic equipment
CN104408118A (en) Database establishing method and device
CN110727664A (en) Method and device for executing target operation on public cloud data
US11704114B2 (en) Data structures for managing configuration versions of cloud-based applications
CN115578096A (en) Block chain parallel transaction method, device, equipment and storage medium
CN115576600A (en) Code change-based difference processing method and device, terminal and storage medium
CN115827436A (en) Data processing method, device, equipment and storage medium
US20210382711A1 (en) Data structures for managing configuration versions of cloud-based applications
CN111274004B (en) Process instance management method and device and computer storage medium
CN110532457B (en) Method and system for acquiring network segment ID
CN116974874A (en) Database testing method and device, electronic equipment and readable storage medium
US9201937B2 (en) Rapid provisioning of information for business analytics
CN112947907A (en) Method for creating code branch
CN115712571A (en) Interactive service test device, interactive service test device, computer equipment and storage medium
CN113364874B (en) Node synchronization method and device based on block chain, storage medium and server
CN113297072A (en) Container testing method and device
Liu Corpus‐Based Japanese Reading Teaching Database Cloud Service Model
CN111241042B (en) Distributed lock implementation method, system and equipment based on Etcd
JP2019144873A (en) Block diagram analyzer
CN117573730B (en) Data processing method, apparatus, device, readable storage medium, and program product
CN115242685B (en) Playback testing method, device, equipment and storage medium based on incidence matrix

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination