CN117273924A - Transaction execution method and device and electronic equipment - Google Patents

Transaction execution method and device and electronic equipment Download PDF

Info

Publication number
CN117273924A
CN117273924A CN202311097678.1A CN202311097678A CN117273924A CN 117273924 A CN117273924 A CN 117273924A CN 202311097678 A CN202311097678 A CN 202311097678A CN 117273924 A CN117273924 A CN 117273924A
Authority
CN
China
Prior art keywords
transaction
transactions
target block
execution
block
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
CN202311097678.1A
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.)
Ant Blockchain Technology Shanghai Co Ltd
Original Assignee
Ant Blockchain Technology Shanghai 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 Ant Blockchain Technology Shanghai Co Ltd filed Critical Ant Blockchain Technology Shanghai Co Ltd
Priority to CN202311097678.1A priority Critical patent/CN117273924A/en
Publication of CN117273924A publication Critical patent/CN117273924A/en
Pending legal-status Critical Current

Links

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
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor

Abstract

A transaction execution method and device and an electronic device. The method comprises the following steps: acquiring a target block to be executed from a distributed account book of a block chain; wherein the transactions contained in the target block have a grouping identification; grouping the transactions contained in the target block based on the grouping identification to obtain at least one transaction group; and executing the transactions contained in each transaction group in parallel, and executing the transactions in each transaction set in series according to the execution sequence of the transactions in each transaction group in the process of executing the transactions contained in each transaction group in parallel.

Description

Transaction execution method and device and electronic equipment
Technical Field
The embodiment of the specification belongs to the technical field of blockchains, and particularly relates to a transaction execution method and device and electronic equipment.
Background
Blockchain (Blockchain) is a new application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanisms, encryption algorithms, and the like. The blocks are combined into a chain data structure in a sequential connection mode according to the time sequence in the block chain system, and the distributed account book which is not tamperable and counterfeit and is ensured in a cryptographic mode. Because the blockchain has the characteristics of decentralization, non-tamperability of information, autonomy and the like, the blockchain is also receiving more and more attention and application.
In the related art, transactions within the same block are generally executed serially in the order in which the transactions were generated. Because the serial execution mode can only execute one transaction at a time, the execution efficiency of the intra-block transaction is low; once the transaction number of blocks is large, a problem of long execution time occurs.
Disclosure of Invention
The invention aims to provide a transaction execution scheme, which comprises the following steps:
a transaction execution method, the method comprising:
acquiring a target block to be executed from a distributed account book of a block chain; wherein the transactions contained in the target block have a grouping identification;
grouping the transactions contained in the target block based on the grouping identification to obtain at least one transaction group;
and executing the transactions contained in each transaction group in parallel, and executing the transactions in each transaction set in series according to the execution sequence of the transactions in each transaction group in the process of executing the transactions contained in each transaction group in parallel.
Optionally, the group identification is determined based on a dependency relationship between transactions contained in the target block; transactions with dependencies correspond to the same group identification.
Optionally, the grouping identifier of the transaction included in the target block is a grouping identifier allocated to the transaction based on the determined dependency relationship between the transactions included in the target block in the process of performing block verification on the target block.
Optionally, the dependency relationship includes that the transaction execution result generated by performing simulation execution on the transaction included in the target block in the process of performing block verification on the target block includes the same transaction execution object.
Optionally, the transaction execution result generated by the simulation execution includes a read-write set generated by the simulation execution.
Optionally, the same transaction execution object includes the same blockchain account and/or the same blockchain asset.
Optionally, the executing the transactions in each transaction set in serial according to the execution sequence of the transactions in each transaction group includes:
and executing the transactions in each transaction set in series according to the sequence of the transaction identifications of the transactions in each transaction group.
A block verification method, comprising:
acquiring a generated target block;
performing block verification on the target block, and determining the dependency relationship between transactions contained in the target block in the block verification process;
Grouping identifications allocated for transactions contained in the target block based on the determined dependency relationship; wherein transactions with dependencies correspond to the same group identification.
Optionally, the determining the dependency relationship between the transactions contained in the target block in the block verification process includes:
in the block verification process, a transaction execution result generated by performing simulation execution on the transaction contained in the target block is obtained;
when the same transaction execution object is contained between different transaction execution results, determining that the transaction corresponding to the different transaction execution results has a dependency relationship.
Optionally, the transaction execution result generated by the simulation execution includes a read-write set generated by the simulation execution.
Optionally, the same transaction execution object includes the same blockchain account and/or the same blockchain asset.
A transaction execution device, the device comprising:
the acquisition unit acquires a target block to be executed from a distributed account book of a blockchain; wherein the transactions contained in the target block have a grouping identification;
a grouping unit, configured to group the transactions included in the target block based on the grouping identifier, to obtain at least one transaction group;
And the execution unit is used for executing the transactions contained in each transaction group in the at least one transaction group in parallel, and executing the transactions in each transaction set in series according to the execution sequence of the transactions in each transaction group in the process of executing the transactions contained in each transaction group in parallel.
Optionally, the group identification is determined based on a dependency relationship between transactions contained in the target block; transactions with dependencies correspond to the same group identification.
Optionally, the grouping identifier of the transaction included in the target block is a grouping identifier allocated to the transaction based on the determined dependency relationship between the transactions included in the target block in the process of performing block verification on the target block.
Optionally, the dependency relationship includes that the transaction execution result generated by performing simulation execution on the transaction included in the target block in the process of performing block verification on the target block includes the same transaction execution object.
Optionally, the transaction execution result generated by the simulation execution includes a read-write set generated by the simulation execution.
Optionally, the same transaction execution object includes the same blockchain account and/or the same blockchain asset.
Optionally, the executing unit is configured to serially execute the transactions in each transaction set according to the execution sequence of the transactions in each transaction group, and further configured to serially execute the transactions in each transaction set according to the precedence order of the transaction identifiers of the transactions in each transaction group.
A block verification device, comprising:
an acquisition unit that acquires the generated target block;
the verification unit is used for carrying out block verification on the target block and determining the dependency relationship between transactions contained in the target block in the block verification process;
the distribution unit is used for distributing grouping identifiers for the transactions contained in the target block based on the determined dependence relationship; wherein transactions with dependencies correspond to the same group identification.
Optionally, the verification unit determines a dependency relationship between transactions included in the target block in the block verification process, and is further configured to obtain a transaction execution result generated by performing simulation execution on the transactions included in the target block in the block verification process; and when the same transaction execution object is contained between different transaction execution results, determining that the transaction corresponding to the different transaction execution results has a dependency relationship.
Optionally, the transaction execution result generated by the simulation execution includes a read-write set generated by the simulation execution.
Optionally, the same transaction execution object includes the same blockchain account and/or the same blockchain asset.
An electronic device, comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to perform any of the transaction execution methods described above.
In the above embodiment, by grouping the transactions in the blocks, the transactions that do not need to be ordered are split into different transaction groups, so that the execution efficiency of the transactions in a single block can be improved by parallel execution of the transaction groups. In addition, for the transactions requiring order preservation processing in the block, the transactions in the same transaction group are still executed in series according to the increasing order of the transaction serial numbers, so that the transactions requiring order preservation processing can be ensured to be executed sequentially.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings that are needed in the description of the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments described in the present disclosure, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic diagram of a blockchain-related network environment shown in the present specification;
FIG. 2 is a flow chart of a transaction execution method according to one embodiment of the present disclosure;
FIG. 3 is a flowchart of a block verification method according to an embodiment of the present disclosure;
fig. 4 is a hardware configuration diagram of a transaction execution device according to an embodiment of the present disclosure;
FIG. 5 is a block diagram of a transaction execution device according to one embodiment of the present disclosure;
fig. 6 is a block verification device module according to an embodiment of the present disclosure.
Detailed Description
In order to make the technical solutions in the present specification better understood by those skilled in the art, the technical solutions in the embodiments of the present specification will be clearly and completely described below with reference to the drawings in the embodiments of the present specification, and it is obvious that the described embodiments are only some embodiments of the present specification, not all embodiments. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are intended to be within the scope of the present disclosure.
The blockchains described in the present specification may specifically include private chains, common chains, and federated chains, and the like, and are not particularly limited in the present specification. Node devices in the blockchain can be added without limitation, and each node device can synchronize one system time so as to ensure timeliness of intelligent contract execution.
It should be noted that, a Transaction (Transaction) described in this specification refers to a piece of data that is created by a client of a blockchain and needs to be finally published to a data storage system of the blockchain.
Transactions in blockchains typically exist in a narrow sense as well as a broad sense of the transaction. A narrow transaction refers to a transfer of value issued by a user to a blockchain; for example, in a conventional blockchain network, the transaction may be a transfer initiated by the user in the blockchain. And the generalized transaction refers to a piece of service data with service intention issued by a user to a blockchain; for example, an operator may build a federation chain based on actual service requirements, rely on the federation chain to deploy some other types of online services (e.g., broadly, they may be classified as query services, call services, etc.) that are unrelated to value transfer, and in such federation chains, the transaction may be a service message or service request with a service intent issued by the user in the federation chain.
The client may include any type of upper layer application that uses the underlying service data stored in the blockchain as a data support to implement a specific service function.
Referring to fig. 1, fig. 1 is a schematic diagram illustrating a network environment related to a blockchain as described herein.
In a network environment as shown in fig. 1, a client-side computing device 101, a server-side 102, and at least one blockchain system may be included; such as blockchain system 103, blockchain system 104, and blockchain system 105.
In one implementation, the client-side computing device 101 may include a variety of different types of client-side computing devices; for example, the client side terminal device may include devices such as PC terminal devices, mobile terminal devices, internet of things devices, and other forms of smart devices with certain computing capabilities, and so forth.
In one implementation, at least some of the computing devices in the client-side terminal apparatus 101 may be coupled to the server-side 102 through various communication networks; for example, the device 3 shown in fig. 1 is coupled with the server side 102.
It should be understood that some of the client side terminal devices 101 may be directly coupled to the blockchain system through various communication networks as blockchain nodes, instead of being coupled to the server side 102; for example, the device 4 shown in FIG. 1 may be coupled to a blockchain system as a blockchain node.
Wherein the communication network may comprise a wired and/or wireless communication network; for example, a local area network (Local Area Network, LAN), wide area network (Wide Area Network, WAN), the internet, or a combination thereof, implemented based on an operator-provided wired or wireless access network, such as a mobile cellular network.
In one implementation, the client-side computing device 101 may also include one or more user-side servers; such as the device 5 shown in fig. 1. At least part of the computing devices in the client side terminal apparatus 101 may be coupled to the user side server, which may be further coupled to the server 102; for example, device 1 and device 2 shown in fig. 1 are coupled to device 5, device 5 being further coupled to server side 102.
In one embodiment, the user side server may be implemented by a service entity that builds a user account system; the service entity may include an operator entity that provides various online and/or offline services to the user;
the service carrier may include a software service carrier or a hardware service carrier.
In one embodiment, the service carrier may include various client software that provides online internet services; such as a website, web page, APP, etc.
In one embodiment, the service carrier may also include various intelligent devices deployed offline and capable of providing offline services; for example, intelligent express cabinets are deployed in residential areas, office areas, public places.
Correspondingly, the operation entity can comprise an operator corresponding to the service carrier; for example, the operating entity may include individuals, organizations, companies and enterprises, etc. that operate and manage the service carrier.
In one embodiment, server side 102 may also be coupled to one or more blockchain systems through various communication networks; for example, the server side 102 shown in FIG. 1 may be coupled to a blockchain system 103, a blockchain system 104, and a blockchain system 105, respectively, and so on.
In one embodiment, each blockchain system may maintain one or more blockchains (e.g., public blockchains, private blockchains, federated blockchains, etc.) and include a plurality of blockchain nodes for carrying the one or more blockchains; for example, blockchain node 1, blockchain node 2, blockchain node 3, blockchain node 4, blockchain node i, and the like, as shown in fig. 1, may collectively carry one or more blockchains. Inter-chain data access may also be performed between blockchains included in each blockchain system, as well as between blockchain systems.
In one embodiment, blockchain nodes may include full nodes and light nodes. The full node can download the blockchain transactions contained in each block in the blockchain in a full amount, and can perform consensus verification on the blockchain transactions contained in each blockchain according to the carried blockchain consensus algorithm.
Instead of downloading the complete blockchain, the light node may only download the blockhead data of each block in the blockchain, and use the data contained in the blockhead as a verification root for verifying the authenticity of the blockchain transaction. The light nodes may attach to the full nodes to access more functions of the blockchain.
For example, each blockchain node in the blockchain system 103 shown in fig. 1 may be a full node; while the device 4 shown in fig. 1, which is directly coupled to the blockchain system, may be attached as a light node to each full node in the blockchain system 103.
In one embodiment, the blockchain node may be a physical device or a virtual device implemented in a server or a server cluster; for example, the block link point device may be a physical host in the server cluster, or may be a virtual machine created by virtualizing a hardware resource mounted on the server or the server cluster based on a virtualization technology. Each blockchain node may be coupled together to form a network by various types of communication methods (e.g., TCP/IP) to carry one or more blockchains.
In one embodiment, the server side 102 may include a blockchain as a BaaS platform (also referred to as BaaS cloud) for providing blockchain as a service (BaaS, blockchain as a Service). The BaaS platform can provide a manner of pre-written software for activities (such as subscription and notification, user verification, database management and remote update) occurring on the blockchain, is oriented to a client side computing device coupled with the BaaS platform, provides simple and easy-to-use, one-key deployment, quick verification, flexible and customizable blockchain service, and further can accelerate blockchain application development, testing and online, and assist in the landing of blockchain business application scenes in various industries.
For example, in one example, a BaaS platform may provide software such as MQ (Message Queue) services; the client side computing device coupled with the BaaS platform can subscribe to an intelligent contract deployed on a certain blockchain in a blockchain system coupled with the BaaS platform, and a contract event generated on the blockchain after triggering execution; the BaaS platform can monitor events generated on the blockchain after triggering and executing the intelligent contract, and then adds the contract events to the message queue in the form of notification messages based on software related to the MQ service, so that the client side computing equipment subscribing to the message queue can obtain notifications related to the contract events.
In one embodiment, the BaaS platform may also provide enterprise-level platform services based on blockchain technology to help enterprise-level customers build a secure and stable blockchain environment and to easily manage the deployment, operation, maintenance, and development of blockchains.
For example, in one example, the BaaS platform may implement rich security policies and multi-tenant isolation environments based on cloud technology, provide advanced security based on chip encryption technology, provide high availability services based on highly reliable data storage that can be quickly extended without interruption end-to-end;
in another example, enhanced management functionality may also be provided to assist clients in building enterprise-level blockchain network environments; and, local support may also be provided for standard blockchain applications and data, supporting mainstream open source blockchain technologies such as Hyperledger Fabric and Enterprise Ethereum-Quorum to build an open and inclusive technology ecosystem.
Having described a network environment associated with a blockchain, further description of related embodiments will be provided with reference to a flowchart of a transaction execution method provided in connection with the present description shown in fig. 2. The transaction execution method may be applied to a transaction executing party, which may include the server side shown in fig. 1, or may also be applied to a client side computing device (such as device 4 or device 1) directly connected to the blockchain system. The transaction execution method may include the steps of:
Step 210, obtaining a target block to be executed from a distributed ledger of a blockchain; wherein the transactions contained in the target block have a group identification.
A blockchain is typically made up of blocks. The time stamps corresponding to the creation time of the block are recorded in the blocks respectively, and all the blocks form a time-ordered data chain strictly according to the time stamps recorded in the blocks.
For real data generated in the physical world, the real data can be constructed into transactions in a standard format supported by a blockchain, then the transactions are issued to the blockchain, the received transactions are packed by node equipment serving as an accounting node in the blockchain to generate target blocks, and persistent storage is performed in a distributed account book of the blockchain.
Further, the target block in the distributed ledger of the blockchain also needs to be identified by other node devices in the blockchain, that is, the other node devices in the blockchain can acquire the target block from the distributed ledger of the blockchain and perform block verification on the target block. If the other node devices are verified to determine that the target block has no problem, the accounting node can append the target block as the latest block to the end of the original blockchain, thereby completing the blockchain accounting process.
For other node devices participating in the block verification, a block identifier may be assigned to transactions within the block, as will be described in detail in the following embodiments.
Since the transaction within the target block is assigned the group identifier, the transaction performer, after obtaining the target block from the distributed ledger of the blockchain, can directly use the group identifier that the transaction contained in the target block has.
And 220, grouping the transactions contained in the target block based on the grouping identification to obtain at least one transaction group.
Transactions of the same group identification may be grouped into a transaction group based on the group identification that the transactions contained in the target block have, so the number of transaction groups depends on the number of group identifications.
In the present specification, the group identification is determined based on a dependency relationship between transactions contained in the target block; transactions with dependencies correspond to the same group identification.
The grouping identifier of the transaction included in the target block may be a grouping identifier allocated to the transaction based on the determined dependency relationship between the transactions included in the target block in the process of performing block verification on the target block.
When the method is realized, if the dependency relationship existing between at least two transactions in the target block is determined, the same grouping identification can be allocated for the transactions with the dependency relationship; otherwise, if there is no dependency between transactions, different group identifications may be assigned.
In the present specification, the above block verification may include verification of validity and verification of analog execution. Where verification of legitimacy is typically used to verify whether the transaction in the block is legitimate, e.g., to verify whether the initiator of the transaction is correct; the verification of the simulation execution is used for verifying whether the transaction execution result of the transaction in the block meets the expectations.
It should be noted that, the transaction execution result of performing simulation execution production on the transaction in the block verification process is not recorded in the block chain; the transaction execution result of the simulated execution production is only used for verifying whether the transaction accords with the expectations, namely the transaction execution result of the same transaction in the simulated execution production is consistent with the transaction execution result recorded in the block, and the transaction accords with the expectations; conversely, if the execution result of the transaction for simulating the execution of the production is inconsistent with the execution result of the transaction recorded in the block, the transaction is not expected. Once a transaction that does not meet expectations occurs, the consensus of the block results in a failure of the consensus.
Further, the dependency relationship includes that the transaction execution result generated by performing simulation execution on the transaction included in the target block in the process of performing block verification on the target block includes the same transaction execution object.
In the present specification, as to whether there is a dependency relationship between transactions contained in a target block, a transaction execution result generated by performing simulation execution by comparing transactions may be compared; if the transaction execution results of the simulated execution of at least two transactions contain the same transaction execution object, then the at least two transactions are interpreted as having a dependency relationship.
In this specification, the transaction execution result generated by the simulation execution includes a read-write set generated by the simulation execution. The read-write set consists of a read set and a write set. Wherein, the read set is all data related to the transaction before the simulation execution, and the write set is all data related to the transaction after the simulation execution.
For example, a transaction indicates that blockchain account A transfers blockchain asset C to blockchain account B; the read-write set of transactions includes a read set comprising at least an account balance of the blockchain account a prior to transfer and an account balance of the blockchain account B prior to transfer; accordingly, the write set includes at least the account balance of the post transfer blockchain account a and the account balance of the post transfer blockchain account B.
In this specification, the same transaction execution object includes the same blockchain account and/or the same blockchain asset. For the following example, assume that transaction 1 represents a transfer of blockchain asset C from blockchain account A to blockchain account B, and transaction 2 represents a transfer of blockchain asset D from blockchain account B to blockchain account C. Then, since transaction 1 and transaction 2 have the same blockchain account, blockchain account B, transaction 1 and transaction 2 may be considered as having a dependency relationship.
Further, if there is also a transaction 3, the transaction 3 indicates that the blockchain account D is conducting blockchain asset C to blockchain account E. Then, since transaction 3 has the same blockchain asset, blockchain asset C, as transaction 1, transaction 3 and transaction 1 can also be considered as having a dependency relationship.
Based on the determined dependencies, transaction 1, transaction 2, and transaction 3 may be assigned the same group identification.
In the present specification, when a transaction executing party executes a transaction in a block, it is necessary to ensure a transaction execution order for the transaction having a dependency relationship, and the correct transaction execution result can be obtained by executing the transaction while ensuring that the transaction execution order is correct. This manner of ensuring that the transaction execution order is correct may be referred to as order preserving processing.
In the specification, the transactions with the dependency relationship are subjected to order keeping processing, and on one hand, the transactions with the dependency relationship are allocated with the same grouping identification, so that the transactions can be divided into the same transaction group. On the other hand, the transactions within the same transaction group may be ordered in increasing order of transaction sequence numbers; this ensures the correct order of execution of the transactions.
In an exemplary embodiment, before the step 220, the method may further include:
determining whether the number of the acquired transactions recorded in the target block is greater than a threshold;
accordingly, grouping the transactions included in the target block based on the grouping identifier may include:
and in response to the acquired number of transactions recorded in the target block being greater than a threshold, grouping transactions contained in the target block based on the grouping identification.
In practical applications, a block with a number of transactions within the block greater than a threshold may be referred to as a large block; since there are many transactions in a large block, it is necessary to improve the execution efficiency of transactions. Wherein the threshold may be an empirically defined value.
Step 230: and executing the transactions contained in each transaction group in parallel, and executing the transactions in each transaction set in series according to the execution sequence of the transactions in each transaction group in the process of executing the transactions contained in each transaction group in parallel.
The present description may employ multi-threading techniques to execute transactions contained within each transaction group in parallel. Further, transactions within the same transaction group may be executed serially in the order in which the transactions were executed. For the following
Specifically, in the process of executing the transactions included in each transaction group in parallel, the transactions in each transaction set may be executed in series according to the sequence of the transaction identifications of the transactions in each transaction group.
In general, transactions within a block may have a transaction identification that may be used to indicate the order in which the transactions were executed. The transaction identification may be determined based on the transaction uplink time stamp, or the transaction uplink time stamp may be directly used as the transaction identification.
In the above embodiment, on the one hand, by grouping the transactions in the blocks, the transactions without order preservation are split into different transaction groups, so that the execution efficiency of the transactions in a single block can be improved by parallel execution of the transaction groups; on the other hand, for the transactions requiring order preservation processing in the block, the transactions in the same transaction group are still executed in series according to the increasing order of the transaction serial numbers, so that the transactions requiring order preservation processing can be ensured to be executed sequentially.
Related embodiments of a block verification method corresponding to the transaction execution embodiment of fig. 2 described above are further described below, and may be applied to node devices in a blockchain. The block verification method may include the following steps as shown in fig. 3:
in step 310, the generated target block is obtained.
Step 320, performing block verification on the target block, and determining a dependency relationship between transactions included in the target block in the block verification process.
Step 330, assigning a grouping identifier to the transaction contained in the target block based on the determined dependency relationship; wherein transactions with dependencies correspond to the same group identification.
A node device in the blockchain that acts as an accounting node may receive transactions posted to the blockchain and package transactions received over a period of time (which may be referred to as an accounting period) into a target block.
Further, the target block in the distributed ledger of the blockchain also needs to be identified by other node devices in the blockchain, that is, the other node devices in the blockchain can acquire the target block from the distributed ledger of the blockchain and perform block verification on the target block. If the other node devices are verified to determine that the target block has no problem, the accounting node can append the target block as the latest block to the end of the original blockchain, thereby completing the blockchain accounting process.
After the target block is acquired, the other node devices participating in the block verification can perform block verification on the target block, and determine the dependency relationship between transactions contained in the target block in the process of block verification.
In the present specification, the above block verification may include verification of validity and verification of analog execution. Where verification of legitimacy is typically used to verify whether the transaction in the block is legitimate, e.g., to verify whether the initiator of the transaction is correct; the verification of the simulation execution is used for verifying whether the transaction execution result of the transaction in the block meets the expectations.
It should be noted that, the transaction execution result of performing simulation execution production on the transaction in the block verification process is not recorded in the block chain; the transaction execution result of the simulated execution production is only used for verifying whether the transaction accords with the expectations, namely the transaction execution result of the same transaction in the simulated execution production is consistent with the transaction execution result recorded in the block, and the transaction accords with the expectations; conversely, if the execution result of the transaction for simulating the execution of the production is inconsistent with the execution result of the transaction recorded in the block, the transaction is not expected. Once a transaction that does not meet expectations occurs, the consensus of the block results in a failure of the consensus.
In an exemplary embodiment, the determining, in the block verification process, the dependency relationship between the transactions included in the target block in step 320 may include:
in the block verification process, a transaction execution result generated by performing simulation execution on the transaction contained in the target block is obtained;
when the same transaction execution object is contained between different transaction execution results, determining that the transaction corresponding to the different transaction execution results has a dependency relationship.
In the present specification, as to whether there is a dependency relationship between transactions contained in a target block, a transaction execution result generated by performing simulation execution by comparing transactions may be compared; if the transaction execution results of the simulated execution of at least two transactions contain the same transaction execution object, then the at least two transactions are interpreted as having a dependency relationship.
In this specification, the transaction execution result generated by the simulation execution includes a read-write set generated by the simulation execution. The read-write set consists of a read set and a write set. Wherein, the read set is all data related to the transaction before the simulation execution, and the write set is all data related to the transaction after the simulation execution.
For example, a transaction indicates that blockchain account A transfers blockchain asset C to blockchain account B; the read-write set of transactions includes a read set comprising at least an account balance of the blockchain account a prior to transfer and an account balance of the blockchain account B prior to transfer; accordingly, the write set includes at least the account balance of the post transfer blockchain account a and the account balance of the post transfer blockchain account B.
In this specification, the same transaction execution object includes the same blockchain account and/or the same blockchain asset. For the following example, assume that transaction 1 represents a transfer of blockchain asset C from blockchain account A to blockchain account B, and transaction 2 represents a transfer of blockchain asset D from blockchain account B to blockchain account C. Then, since transaction 1 and transaction 2 have the same blockchain account, blockchain account B, transaction 1 and transaction 2 may be considered as having a dependency relationship.
Further, if there is also a transaction 3, the transaction 3 indicates that the blockchain account D is conducting blockchain asset C to blockchain account E. Then, since transaction 3 has the same blockchain asset, blockchain asset C, as transaction 1, transaction 3 and transaction 1 can also be considered as having a dependency relationship.
Based on the determined dependencies, transaction 1, transaction 2, and transaction 3 may be assigned the same group identification.
In the present specification, when a transaction executing party executes a transaction in a block, it is necessary to ensure a transaction execution order for the transaction having a dependency relationship, and the correct transaction execution result can be obtained by executing the transaction while ensuring that the transaction execution order is correct. This manner of ensuring that the transaction execution order is correct may be referred to as order preserving processing.
In the specification, the transactions with the dependency relationship are subjected to order keeping processing, and on one hand, the transactions with the dependency relationship are allocated with the same grouping identification, so that the transactions can be divided into the same transaction group. On the other hand, the transactions within the same transaction group may be ordered in increasing order of transaction sequence numbers; this ensures the correct order of execution of the transactions.
By the block verification method provided by the embodiment, grouping identifiers can be allocated for the transactions contained in the target block, so that a transaction executive party can conveniently group the transactions contained in the target block based on the grouping identifiers when executing the transactions; and finally, the execution efficiency of transactions in a single block is improved by executing the transaction groups in parallel.
Corresponding to the foregoing embodiments of the transaction execution and block execution methods, embodiments of the transaction execution device and the block execution device are also provided. The embodiment of the device can be implemented by software, or can be implemented by hardware or a combination of hardware and software. Taking a software implementation as an example, the device in a logic sense is formed by reading a corresponding computer program in a nonvolatile memory into a memory by a processor of a device where the device is located. In terms of hardware, as shown in fig. 4, a hardware structure diagram of a device where the transaction execution device in this specification is located is shown in fig. 4, and in addition to the processor, the network interface, the memory and the nonvolatile memory shown in fig. 4, the device where the device in this embodiment is located may further include other hardware according to actual functions of transaction execution and block verification, which will not be described herein again.
Referring to fig. 5, a block diagram of a transaction execution device according to an embodiment of the present disclosure, where the device corresponds to the embodiment shown in fig. 2, and the device includes:
an acquiring unit 510 that acquires a target block to be executed from a distributed ledger of a blockchain; wherein the transactions contained in the target block have a grouping identification;
A grouping unit 520, configured to group the transactions included in the target block based on the grouping identifier, so as to obtain at least one transaction group;
the execution unit 530 executes the transactions included in each of the at least one transaction group in parallel, and serially executes the transactions in each transaction set according to the execution order of the transactions in each transaction group in the process of executing the transactions included in each transaction group in parallel.
Optionally, the group identification is determined based on a dependency relationship between transactions contained in the target block; transactions with dependencies correspond to the same group identification.
Optionally, the grouping identifier of the transaction included in the target block is a grouping identifier allocated to the transaction based on the determined dependency relationship between the transactions included in the target block in the process of performing block verification on the target block.
Optionally, the dependency relationship includes that the transaction execution result generated by performing simulation execution on the transaction included in the target block in the process of performing block verification on the target block includes the same transaction execution object.
Optionally, the transaction execution result generated by the simulation execution includes a read-write set generated by the simulation execution.
Optionally, the same transaction execution object includes the same blockchain account and/or the same blockchain asset.
Optionally, the executing unit 530 is configured to serially execute the transactions in the respective transaction sets according to the execution order of the transactions in the respective transaction groups, and is further configured to serially execute the transactions in the respective transaction sets according to the precedence order of the transaction identifiers of the transactions in the respective transaction groups.
Referring further to fig. 6, a block diagram of a block verification device according to an embodiment of the present disclosure, where the device corresponds to the embodiment shown in fig. 3, includes:
an acquisition unit 610 that acquires the generated target block;
a verification unit 620, configured to perform block verification on the target block, and determine a dependency relationship between transactions included in the target block in the block verification process;
an allocation unit 630, configured to allocate a group identifier for the transaction included in the target block based on the determined dependency relationship; wherein transactions with dependencies correspond to the same group identification.
Optionally, the verification unit 620 determines a dependency relationship between transactions included in the target block during the block verification, and is further configured to obtain a transaction execution result generated by performing simulation on the transactions included in the target block during the block verification; and when the same transaction execution object is contained between different transaction execution results, determining that the transaction corresponding to the different transaction execution results has a dependency relationship.
Optionally, the transaction execution result generated by the simulation execution includes a read-write set generated by the simulation execution.
Optionally, the same transaction execution object includes the same blockchain account and/or the same blockchain asset.
The system, apparatus, module or unit set forth in the above embodiments may be implemented in particular by a computer chip or entity, or by a product having a certain function. A typical implementation device is a computer, which may be in the form of a personal computer, laptop computer, cellular telephone, camera phone, smart phone, personal digital assistant, media player, navigation device, email device, game console, tablet computer, wearable device, or a combination of any of these devices.
The implementation process of the functions and roles of each unit in the above device is specifically shown in the implementation process of the corresponding steps in the above method, and will not be described herein again.
For the device embodiments, reference is made to the description of the method embodiments for the relevant points, since they essentially correspond to the method embodiments. The apparatus embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purposes of the present description. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
Fig. 5 above describes the internal functional modules and structural schematic of the transaction execution device, and the execution subject may be an electronic device, which includes:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to perform an embodiment of any of the transaction execution methods described above.
Similarly, fig. 6 above describes an internal functional module and a schematic of a block verification apparatus, and the substantial execution subject thereof may be an electronic device, including:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to perform embodiments of the block verification method described above.
In the above embodiment of the electronic device, it should be understood that the processor may be a CPU, but may also be other general purpose processors, digital signal processors (english: digital Signal Processor, abbreviated as DSP), application specific integrated circuits (english: application Specific Integrated Circuit, abbreviated as ASIC), and the like. A general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc., and the aforementioned memory may be a read-only memory (ROM), a random access memory (random access memory, RAM), a flash memory, a hard disk, or a solid state disk. The steps of a method disclosed in connection with the embodiments of the present specification may be embodied directly in a hardware processor, or in a combination of hardware and software modules in a processor.
In the 90 s of the 20 th century, improvements to one technology could clearly be distinguished as improvements in hardware (e.g., improvements to circuit structures such as diodes, transistors, switches, etc.) or software (improvements to the process flow). However, with the development of technology, many improvements of the current method flows can be regarded as direct improvements of hardware circuit structures. Designers almost always obtain corresponding hardware circuit structures by programming improved method flows into hardware circuits. Therefore, an improvement of a method flow cannot be said to be realized by a hardware entity module. For example, a programmable logic device (Programmable Logic Device, PLD) (e.g., field programmable gate array (Field Programmable Gate Array, FPGA)) is an integrated circuit whose logic function is determined by the programming of the device by a user. A designer programs to "integrate" a digital system onto a PLD without requiring the chip manufacturer to design and fabricate application-specific integrated circuit chips. Moreover, nowadays, instead of manually manufacturing integrated circuit chips, such programming is mostly implemented by using "logic compiler" software, which is similar to the software compiler used in program development and writing, and the original code before the compiling is also written in a specific programming language, which is called hardware description language (Hardware Description Language, HDL), but not just one of the hdds, but a plurality of kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), lava, lola, myHDL, PALASM, RHDL (Ruby Hardware Description Language), etc., VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog are currently most commonly used. It will also be apparent to those skilled in the art that a hardware circuit implementing the logic method flow can be readily obtained by merely slightly programming the method flow into an integrated circuit using several of the hardware description languages described above.
The controller may be implemented in any suitable manner, for example, the controller may take the form of, for example, a microprocessor or processor and a computer readable medium storing computer readable program code (e.g., software or firmware) executable by the (micro) processor, logic gates, switches, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), programmable logic controllers, and embedded microcontrollers, examples of which include, but are not limited to, the following microcontrollers: ARC 625D, atmel AT91SAM, microchip PIC18F26K20, and Silicone Labs C8051F320, the memory controller may also be implemented as part of the control logic of the memory. Those skilled in the art will also appreciate that, in addition to implementing the controller in a pure computer readable program code, it is well possible to implement the same functionality by logically programming the method steps such that the controller is in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers, etc. Such a controller may thus be regarded as a kind of hardware component, and means for performing various functions included therein may also be regarded as structures within the hardware component. Or even means for achieving the various functions may be regarded as either software modules implementing the methods or structures within hardware components.
The system, apparatus, module or unit set forth in the above embodiments may be implemented in particular by a computer chip or entity, or by a product having a certain function. One typical implementation device is a server system. Of course, this specification does not exclude that as future computer technology advances, the computer implementing the functions of the above-described embodiments may be, for example, a personal computer, a laptop computer, a car-mounted human-computer interaction device, a cellular telephone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
Although one or more embodiments of the present description provide method operational steps as described in the embodiments or flowcharts, more or fewer operational steps may be included based on conventional or non-inventive means. The order of steps recited in the embodiments is merely one way of performing the order of steps and does not represent a unique order of execution. When implemented in an actual device or end product, the instructions may be executed sequentially or in parallel (e.g., in a parallel processor or multi-threaded processing environment, or even in a distributed data processing environment) as illustrated by the embodiments or by the figures. The terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, it is not excluded that additional identical or equivalent elements may be present in a process, method, article, or apparatus that comprises a described element. For example, if first, second, etc. words are used to indicate a name, but not any particular order.
For convenience of description, the above devices are described as being functionally divided into various modules, respectively. Of course, when one or more of the present description is implemented, the functions of each module may be implemented in the same piece or pieces of software and/or hardware, or a module that implements the same function may be implemented by a plurality of sub-modules or a combination of sub-units, or the like. The above-described apparatus embodiments are merely illustrative, for example, the division of the units is merely a logical function division, and there may be additional divisions when actually implemented, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the specification. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In one typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include volatile memory in a computer-readable medium, random Access Memory (RAM) and/or nonvolatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of computer-readable media.
Computer readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, read only compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage, graphene storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. Computer-readable media, as defined herein, does not include transitory computer-readable media (transmission media), such as modulated data signals and carrier waves.
One skilled in the relevant art will recognize that one or more embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, one or more embodiments of the present description may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Moreover, one or more embodiments of the present description can take the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
One or more embodiments of the present specification may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. One or more embodiments of the present specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
In this specification, each embodiment is described in a progressive manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for system embodiments, since they are substantially similar to method embodiments, the description is relatively simple, as relevant to see a section of the description of method embodiments. In the description of the present specification, a description referring to terms "one embodiment," "some embodiments," "examples," "specific examples," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the present specification. In this specification, schematic representations of the above terms are not necessarily directed to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, the different embodiments or examples described in this specification and the features of the different embodiments or examples may be combined and combined by those skilled in the art without contradiction.
The foregoing is merely an example of one or more embodiments of the present specification and is not intended to limit the one or more embodiments of the present specification. Various modifications and alterations to one or more embodiments of this description will be apparent to those skilled in the art. Any modification, equivalent replacement, improvement, or the like, which is within the spirit and principles of the present specification, should be included in the scope of the claims.

Claims (14)

1. A transaction execution method, the method comprising:
acquiring a target block to be executed from a distributed account book of a block chain; wherein the transactions contained in the target block have a grouping identification;
grouping the transactions contained in the target block based on the grouping identification to obtain at least one transaction group;
and executing the transactions contained in each transaction group in parallel, and executing the transactions in each transaction set in series according to the execution sequence of the transactions in each transaction group in the process of executing the transactions contained in each transaction group in parallel.
2. The method of claim 1, the group identification being determined based on dependencies between transactions contained in the target block; transactions with dependencies correspond to the same group identification.
3. The method of claim 2, wherein the group identifier of the transaction included in the target block is a group identifier allocated to the transaction based on the determined dependency relationship between the transactions included in the target block in the process of block verification for the target block.
4. The method of claim 3, the dependency relationship comprising including the same transaction execution object in a transaction execution result generated by simulated execution of a transaction included in the target block in a block verification process for the target block.
5. The method of claim 4, wherein the transaction execution results from the simulation execution comprise a read-write set generated by the simulation execution.
6. The method of claim 4, the same transaction execution object comprising the same blockchain account and/or the same blockchain asset.
7. The method of claim 1, the serially executing transactions within each transaction set in an order of execution of transactions within each transaction group, comprising:
and executing the transactions in each transaction set in series according to the sequence of the transaction identifications of the transactions in each transaction group.
8. A block verification method, comprising:
acquiring a generated target block;
performing block verification on the target block, and determining the dependency relationship between transactions contained in the target block in the block verification process;
grouping identifications allocated for transactions contained in the target block based on the determined dependency relationship; wherein transactions with dependencies correspond to the same group identification.
9. The method of claim 8, the determining a dependency relationship between transactions included in the target block in the process of block verification comprising:
in the block verification process, a transaction execution result generated by performing simulation execution on the transaction contained in the target block is obtained;
when the same transaction execution object is contained between different transaction execution results, determining that the transaction corresponding to the different transaction execution results has a dependency relationship.
10. The method of claim 9, wherein the transaction execution results from the simulation execution comprise a read-write set from the simulation execution.
11. The method of claim 9, the same transaction execution object comprising the same blockchain account and/or the same blockchain asset.
12. A transaction execution device, the device comprising:
the acquisition unit acquires a target block to be executed from a distributed account book of a blockchain; wherein the transactions contained in the target block have a grouping identification;
a grouping unit, configured to group the transactions included in the target block based on the grouping identifier, to obtain at least one transaction group;
and the execution unit is used for executing the transactions contained in each transaction group in the at least one transaction group in parallel, and executing the transactions in each transaction set in series according to the execution sequence of the transactions in each transaction group in the process of executing the transactions contained in each transaction group in parallel.
13. A block verification device, comprising:
an acquisition unit that acquires the generated target block;
the verification unit is used for carrying out block verification on the target block and determining the dependency relationship between transactions contained in the target block in the block verification process;
the distribution unit is used for distributing grouping identifiers for the transactions contained in the target block based on the determined dependence relationship; wherein transactions with dependencies correspond to the same group identification.
14. An electronic device, comprising:
A processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to perform the method of any of the preceding claims 1-7 or 8-11.
CN202311097678.1A 2023-08-28 2023-08-28 Transaction execution method and device and electronic equipment Pending CN117273924A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311097678.1A CN117273924A (en) 2023-08-28 2023-08-28 Transaction execution method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311097678.1A CN117273924A (en) 2023-08-28 2023-08-28 Transaction execution method and device and electronic equipment

Publications (1)

Publication Number Publication Date
CN117273924A true CN117273924A (en) 2023-12-22

Family

ID=89220486

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311097678.1A Pending CN117273924A (en) 2023-08-28 2023-08-28 Transaction execution method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN117273924A (en)

Similar Documents

Publication Publication Date Title
US9734159B2 (en) File path modification based management
US20190266128A1 (en) Method and system for verification of deleted data for blockchains
US10601680B2 (en) Application resiliency using APIs
CN114662159A (en) Data processing method, device and equipment
CN111767143A (en) Transaction data processing method, device, equipment and system
US10649978B2 (en) Preview processing and automatic correction of bulk data for software as a service applications
US11308223B2 (en) Blockchain-based file handling
US9473304B1 (en) Generation and distribution of named, definable, serialized tokens
CN109032803B (en) Data processing method and device and client
CN111355816B (en) Server selection method, device, equipment and distributed service system
US10678626B2 (en) Distributed product deployment validation
US10182104B1 (en) Automatic propagation of resource attributes in a provider network according to propagation criteria
CN111767144A (en) Transaction routing determination method, device, equipment and system for transaction data
US11409724B2 (en) Hashed balanced tree data structure
US10530842B2 (en) Domain-specific pattern design
CN116305298B (en) Method and device for managing computing power resources, storage medium and electronic equipment
US10176059B2 (en) Managing server processes with proxy files
CN115658357A (en) Method and apparatus for replaying blockchain transactions
CN117273924A (en) Transaction execution method and device and electronic equipment
US10242111B2 (en) Node controllers for hierarchical data structures
CN115485677A (en) Secure data replication in a distributed data storage environment
CN113726638A (en) Method, device and equipment for managing multi-cloud multi-core container and storage medium
CN109151016B (en) Flow forwarding method and device, service system, computing device and storage medium
US10554498B2 (en) Shadow agent projection in multiple places to reduce agent movement over nodes in distributed agent-based simulation
CN111488322A (en) File system service method and device and server equipment

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