Transaction execution method, device and electronic equipment
By actively consensus verification and storage of abnormal transactions that are not referenced by subsequent transactions in the DAG blockchain, the problems of low transaction processing efficiency and double spending are solved, and the effectiveness of efficient parallel transaction execution and result storage is achieved.
Patent Information
- Application Number
- CN202210449876.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-26
- Publication Date
- 2025-08-12
- Estimated Expiration
- 2042-04-26
AI Technical Summary
Due to the use of a chain structure, traditional blockchain systems have low transaction processing efficiency and cannot execute transaction requests in parallel. There is a double spending problem with the blockchain system based on DAG.
In a DAG-based blockchain, an abnormal transaction that is not referenced by subsequent transactions is actively consensus verification, and it is packaged into a transaction set and verified to ensure that the transaction execution results are stored in the distributed ledger after verification is passed.
Improve transaction processing efficiency, avoid double spending problems caused by abnormal transactions, and ensure the validity and consistency of transaction results.
Smart Images

Figure CN114756561B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of this specification belong to the field of blockchain technology, and in particular to transaction execution methods and devices and electronic devices. Background Art
[0002] Since the data storage structure of the distributed ledger of the traditional blockchain is a chain structure, under the chain structure, the traditional blockchain system can only execute transaction requests serially but not in parallel; this results in low transaction processing efficiency of the traditional blockchain system, making it difficult to cope with a sudden large number of transaction requests.
[0003] In this regard, blockchain technology based on DAG (Directed Acyclic Graph) has been proposed. A DAG-based blockchain uses a DAG-based data storage structure, rather than traditional blocks, to store distributed accounts. This allows for parallel execution of transaction requests, significantly improving transaction processing efficiency. Summary of the Invention
[0004] The purpose of this invention is to provide a transaction execution solution for solving the fast consensus and double-spending problems in DAG-based blockchain scenario applications.
[0005] A transaction execution method, applied to a node device in a DAG-based blockchain, comprising:
[0006] In response to the received blockchain transaction, verify at least one historical transaction referenced by the blockchain transaction, and execute the blockchain transaction after the verification is successful;
[0007] Packing the received blockchain transactions that are not referenced by subsequent blockchain transactions into a transaction set, and initiating consensus verification for the transactions in the transaction set;
[0008] In response to consensus verification of the transactions in the transaction set passing, execution results corresponding to the transactions in the transaction set are stored in the distributed ledger of the blockchain.
[0009] Optionally, packaging the received blockchain transactions that are not referenced by subsequently received blockchain transactions into a transaction set includes:
[0010] Based on the preset time interval, the blockchain transactions that are not referenced by the subsequent blockchain transactions received are periodically packaged into a transaction set.
[0011] Optionally, the method further includes:
[0012] After the blockchain transaction is executed, cache the execution result of the blockchain transaction;
[0013] The storing the execution results corresponding to the transactions in the transaction set in the distributed ledger of the blockchain includes:
[0014] The execution results corresponding to the transactions in the cached transaction set are stored in the distributed ledger of the blockchain.
[0015] Optionally, after executing the blockchain transaction after verification is passed, the method further includes:
[0016] The execution results of the historical transactions are stored in the distributed ledger of the blockchain.
[0017] Optionally, storing the execution results of the historical transactions in the distributed ledger of the blockchain includes:
[0018] After the blockchain transaction is executed, the cached execution results corresponding to the historical transactions referenced by the blockchain transaction are stored in the distributed ledger of the blockchain.
[0019] Optionally, executing the blockchain transaction includes:
[0020] If the received blockchain transaction is multiple blockchain transactions, the multiple blockchain transactions are executed in parallel.
[0021] Optionally, executing the blockchain transaction includes:
[0022] The blockchain transaction is distributed to each node device in the blockchain, and the blockchain transaction is executed in a distributed manner by each node device.
[0023] A transaction execution device, applied to a node device in a DAG-based blockchain, comprising:
[0024] an execution unit, in response to a received blockchain transaction, verifying at least one historical transaction referenced by the blockchain transaction, and executing the blockchain transaction after the verification is successful;
[0025] The consensus unit packages received blockchain transactions that are not referenced by subsequently received blockchain transactions into a transaction set, and initiates consensus verification for the transactions in the transaction set;
[0026] The storage unit stores, in response to consensus verification of the transactions in the transaction set passing, the execution results corresponding to the transactions in the transaction set in the distributed ledger of the blockchain.
[0027] Optionally, the consensus unit is further configured to periodically package the received blockchain transactions that are not referenced by subsequently received blockchain transactions into a transaction set based on a preset time interval.
[0028] Optionally, the device further includes:
[0029] a cache unit, configured to cache the execution result of the blockchain transaction after the blockchain transaction is executed;
[0030] The storage unit is further configured to store execution results corresponding to transactions in the cached transaction set in the distributed ledger of the blockchain.
[0031] Optionally, after the execution unit, the device further includes:
[0032] The storage subunit, after executing the blockchain transaction after verification, stores the execution result of the historical transaction in the distributed ledger of the blockchain.
[0033] Optionally, after the blockchain transaction is executed, the storage subunit stores the cached execution results corresponding to the historical transactions referenced by the blockchain transaction in the distributed ledger of the blockchain.
[0034] Optionally, in the execution unit, executing the blockchain transaction includes:
[0035] If the received blockchain transaction is multiple blockchain transactions, the multiple blockchain transactions are executed in parallel.
[0036] Optionally, in the execution unit, executing the blockchain transaction includes:
[0037] The blockchain transaction is distributed to each node device in the blockchain, and the blockchain transaction is executed in a distributed manner by each node device.
[0038] An electronic device, comprising:
[0039] processor;
[0040] a memory for storing processor-executable instructions;
[0041] Wherein, the processor is configured to perform any of the above transaction execution methods.
[0042] A computer-readable storage medium comprising:
[0043] When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute any one of the above-mentioned transaction execution methods.
[0044] In the above embodiment, for blockchain transactions that are not referenced by subsequent blockchain transactions, consensus verification is proactively performed on these blockchain transactions to verify their validity. After consensus verification, the execution results corresponding to these blockchain transactions are stored in the blockchain's distributed ledger. This allows blockchain transactions to be processed promptly even if they are not referenced by subsequent transactions, thus avoiding the double-spending problem caused by these blockchain transactions not being referenced for a long time. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the technical solutions of the embodiments of this specification, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments recorded in this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0046] Figure 1a This is a schematic diagram of the data storage structure of a traditional blockchain provided by an exemplary embodiment;
[0047] Figure 1b is a schematic diagram of transaction information in a block provided by an exemplary embodiment;
[0048] Figure 2a This is a schematic diagram of a data storage structure of a DAG-based blockchain provided by an exemplary embodiment;
[0049] Figure 2b is a schematic diagram of transaction information in a directed acyclic graph provided by an exemplary embodiment;
[0050] Figure 3 is a schematic diagram of an improved DAG-based blockchain provided by an exemplary embodiment;
[0051] Figure 4 is a flow chart of a transaction execution method provided by an exemplary embodiment;
[0052] Figure 5 is a schematic structural diagram of an electronic device provided by an exemplary embodiment;
[0053] Figure 6 It is a block diagram of a transaction execution device provided by an exemplary embodiment. DETAILED DESCRIPTION
[0054] To help those skilled in the art better understand the technical solutions in this specification, the following will provide a clear and complete description of the technical solutions in the embodiments of this specification, in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of this specification, not all of them. All other embodiments derived by those skilled in the art based on the embodiments in this specification without creative effort shall fall within the scope of protection of this specification.
[0055] Please refer to Figure 1a The schematic diagram of the storage structure of the traditional blockchain is shown in Figure 1. Figure 1a As shown, the data storage structure of the distributed ledger of the traditional blockchain is a chain structure; that is, the distributed ledger is composed of blocks connected one by one. Figure 1b The schematic diagram of the block shown in the figure shows that the transaction information stored in each block is executed serially according to the time sequence of the transaction. Figure 1b In the example, from transaction a to transaction g, according to the time sequence of transactions, transaction a is executed first, followed by transaction b, followed by transaction c, followed by transaction d, followed by transaction f, and finally followed by transaction g.
[0056] Since transactions under a chain structure need to be executed sequentially in chronological order, traditional blockchain systems can only execute transaction requests serially but not in parallel. This results in low transaction processing efficiency in traditional blockchain systems, making it difficult to cope with sudden large numbers of transaction requests.
[0057] In order to solve the problem of low transaction processing efficiency of traditional blockchain systems, a blockchain based on DAG (directed acyclic graph) has been proposed in related technologies.
[0058] A DAG-based blockchain refers to a blockchain in which the data storage structure of the distributed accounts of the blockchain no longer uses traditional blocks, but instead uses the data storage structure of a DAG directed acyclic graph.
[0059] Please refer to Figure 2a The schematic diagram of the data storage structure of the DAG-based blockchain is shown in Figure 1. Figure 2a As shown in Figure 1, the data storage structure of a distributed ledger in a DAG-based blockchain is a directed acyclic graph. Unlike a chain-like structure, which can only execute transaction requests serially, a directed acyclic graph can execute multiple transaction requests concurrently. Furthermore, unlike traditional blockchains, DAG-based blockchains lack the concept of blocks; that is, the blockchain does not need to periodically package received transaction requests into blocks. Therefore, each node in the blockchain can asynchronously process its own received transaction requests without waiting for transaction requests from other nodes, eliminating the time wasted waiting.
[0060] In the distributed ledger of a DAG-based blockchain, transactions are no longer stored in the form of blocks; and different transactions do not need to be executed in chronological order. Multiple node devices can concurrently execute multiple transaction requests at the same time. It should be noted that in the distributed ledger of a DAG-based blockchain, the transaction executed later needs to reference at least one previous historical transaction, thus forming a Figure 2b The directed acyclic graph shown. Figure 1b Different, in Figure 2b In the example, transactions a through g are not executed serially but can be executed in parallel. For example, transactions a, d, and b can be executed in parallel. Furthermore, a later transaction must reference at least one previous historical transaction. For example, transaction f references both transactions a and b.
[0061] Since the DAG-based blockchain can execute multiple transaction requests in parallel, it has a lot of improvements in transaction processing efficiency compared to the traditional chain-structured blockchain.
[0062] However, since the blockchain that is eager to use DAG cancels blocks, transaction execution is no longer strictly carried out in the order of transaction time, so it will face the "double spending problem" in blockchain technology.
[0063] The double-spending problem occurs when a transaction is repeatedly initiated (called a fake transaction) by a malicious user between its initiation and its execution (called a true transaction). Because fake and true transactions are essentially the same, a transaction is executed twice. This is prohibited in certain sensitive business scenarios. For example, in businesses involving funds, if a transfer transaction is executed twice, the user's account will be deducted twice for the same amount, which is absolutely not allowed.
[0064] In order to solve the double-spending problem of the existing DAG-based blockchain, this manual improves the existing DAG-based blockchain. Figure 3 , Figure 3 This is a schematic diagram of the improved DAG-based blockchain shown in this specification.
[0065] exist Figure 3 In the distributed ledger data structure of the DAG-based blockchain is still a directed acyclic graph. Compared with the existing DAG blockchain, the differences are:
[0066] In a directed acyclic graph, blockchain transactions that are not referenced by subsequent blockchain transactions (referred to as abnormal transactions) can be packaged into a transaction set, and consensus verification can be initiated for the transactions in the transaction set. In other words, through proactive consensus verification, abnormal transactions are promptly processed, thus avoiding the double-spending problem caused by these abnormal transactions not being referenced for a long time.
[0067] The following combination Figure 4 This specification introduces an embodiment of a transaction execution method provided in this specification. This embodiment can be applied to node devices in a DAG-based blockchain. The method includes:
[0068] Step 210: In response to the received blockchain transaction, verify at least one historical transaction referenced by the blockchain transaction, and execute the blockchain transaction after the verification is successful;
[0069] As mentioned above, in a distributed ledger based on a DAG blockchain, a transaction executed later needs to reference at least one previous historical transaction and verify the validity of the referenced historical transaction. Only after the validity of the referenced historical transaction has been verified can the current transaction be executed.
[0070] Therefore, after receiving a blockchain transaction, the node device also needs to reference at least one previous historical transaction, verify the at least one historical transaction referenced by the blockchain transaction, and execute the blockchain transaction after the verification is passed.
[0071] In an exemplary embodiment, after the blockchain transaction is executed after verification, the execution result of the historical transaction can also be stored in the distributed ledger of the blockchain.
[0072] Since previous historical transactions have been verified to be valid, the execution results of the historical transactions previously executed need to be stored in the distributed ledger, which is the so-called "transaction placement".
[0073] This means that for any blockchain transaction, even if it has been executed by a node device, its execution result is not immediately stored in the distributed ledger. Instead, it has to wait until the blockchain transaction is proven to be valid before the execution result can be actually stored in the distributed ledger.
[0074] In an exemplary embodiment, for a node device, after the blockchain transaction is executed, the execution result of the blockchain transaction can be temporarily cached.
[0075] Accordingly, the aforementioned storing of the execution results of the historical transactions in the distributed ledger of the blockchain may include:
[0076] After the blockchain transaction is executed, the cached execution results corresponding to the historical transactions referenced by the blockchain transaction are stored in the distributed ledger of the blockchain.
[0077] In this example, the transaction is executed first, and the execution result is cached. After the transaction is subsequently verified to be valid, the execution result is written to the disk, thus truly completing the transaction execution.
[0078] In an exemplary embodiment, executing the blockchain transaction may include:
[0079] If the received blockchain transaction is multiple blockchain transactions, the multiple blockchain transactions are executed in parallel.
[0080] The concurrent execution may specifically refer to distributing the blockchain transaction to each node device in the blockchain, and having each node device execute the blockchain transaction in a distributed manner.
[0081] As mentioned above, in a DAG-based blockchain, multiple blockchain transactions can be executed concurrently, thereby improving the transaction processing efficiency of the blockchain.
[0082] Step 220: Pack the received blockchain transactions that are not referenced by subsequently received blockchain transactions into a transaction set, and initiate consensus verification for the transactions in the transaction set.
[0083] In this specification, node devices can collect blockchain transactions that are not referenced by subsequent blockchain transactions (referred to as abnormal transactions), package these abnormal transactions into a transaction set, and perform consensus verification on each transaction in the transaction set to verify the validity of these abnormal transactions. The consensus verification can include a consensus algorithm used in traditional blockchains, such as the PoW algorithm.
[0084] In an exemplary embodiment, packaging the received blockchain transactions that are not referenced by subsequently received blockchain transactions into a transaction set may include:
[0085] Based on the preset time interval, the blockchain transactions that are not referenced by the subsequent blockchain transactions received are periodically packaged into a transaction set.
[0086] By applying this example, we can proactively verify the validity of abnormal transactions to avoid double spending caused by these abnormal transactions not being referenced for a long time.
[0087] Furthermore, the preset time interval can be set as short as possible, which can further reduce the suspension time of abnormal transactions, which is equivalent to raising the time threshold for double spending, and can effectively solve the double spending problem of most abnormal transactions.
[0088] Step 230: In response to consensus verification of the transactions in the transaction set being passed, the execution results corresponding to the transactions in the transaction set are stored in the distributed ledger of the blockchain.
[0089] After the consensus verification of the transactions in the transaction set is passed, it indicates that the transactions are valid, and the execution results of the transactions in the aforementioned step 210 can be stored in the distributed ledger in the blockchain.
[0090] As mentioned above, if the node device caches the execution results, then correspondingly, storing the execution results corresponding to the transactions in the transaction set in the distributed ledger of the blockchain may include:
[0091] The execution results corresponding to the transactions in the cached transaction set are stored in the distributed ledger of the blockchain.
[0092] In summary, through the embodiments of this specification, for blockchain transactions that are not referenced by subsequent blockchain transactions, consensus verification is proactively performed on these blockchain transactions to verify the validity of the blockchain transactions. After consensus verification, the execution results corresponding to these blockchain transactions are stored in the blockchain's distributed ledger. This allows blockchain transactions to be processed promptly even if they are not referenced by subsequent transactions, thus avoiding the double-spending problem caused by these blockchain transactions not being referenced for a long time.
[0093] Corresponding to the aforementioned transaction execution method embodiment, this specification also provides an embodiment of a transaction execution device. The device embodiment can be implemented by software, or by hardware or a combination of software and hardware. Taking software implementation as an example, as a device in a logical sense, it is formed by the processor of the device where it is located reading the corresponding computer business program instructions in the non-volatile memory into the memory for execution. From the hardware level, such as Figure 5 The following is a hardware structure diagram of the device where the transaction execution device of this manual is located, except Figure 5 In addition to the processor, network interface, memory, and non-volatile memory shown, the device in which the apparatus in the embodiment is located generally performs actual functions according to transactions and may also include other hardware, which will not be described in detail.
[0094] See Figure 6 , is a module diagram of a transaction execution device provided in an embodiment of this specification, the device corresponds to Figure 4The embodiment shown is applied to a node device in a DAG-based blockchain, and the device includes:
[0095] The execution unit 310 verifies at least one historical transaction referenced by the blockchain transaction in response to the received blockchain transaction, and executes the blockchain transaction after the verification is successful;
[0096] The consensus unit 320 packages the received blockchain transactions that are not referenced by subsequently received blockchain transactions into a transaction set, and initiates consensus verification for the transactions in the transaction set;
[0097] The storage unit 330 stores the execution results corresponding to the transactions in the transaction set in the distributed ledger of the blockchain in response to the consensus verification of the transactions in the transaction set passing.
[0098] Optionally, the consensus unit 320 is further configured to periodically package the received blockchain transactions that are not referenced by subsequently received blockchain transactions into a transaction set based on a preset time interval.
[0099] Optionally, the device further includes:
[0100] a cache unit, configured to cache the execution result of the blockchain transaction after the blockchain transaction is executed;
[0101] The storage unit 330 is further configured to store the execution results corresponding to the transactions in the cached transaction set in the distributed ledger of the blockchain.
[0102] Optionally, after the execution unit 310, the apparatus further includes:
[0103] The storage subunit, after executing the blockchain transaction after verification, stores the execution result of the historical transaction in the distributed ledger of the blockchain.
[0104] Optionally, after the blockchain transaction is executed, the storage subunit stores the cached execution results corresponding to the historical transactions referenced by the blockchain transaction in the distributed ledger of the blockchain.
[0105] Optionally, in the execution unit 310, executing the blockchain transaction includes:
[0106] If the received blockchain transaction is multiple blockchain transactions, the multiple blockchain transactions are executed in parallel.
[0107] Optionally, in the execution unit 310, executing the blockchain transaction includes:
[0108] The blockchain transaction is distributed to each node device in the blockchain, and the blockchain transaction is executed in a distributed manner by each node device.
[0109] In the 1990s, technological improvements could be clearly distinguished as either hardware improvements (for example, improvements to circuit structures like diodes, transistors, and switches) or software improvements (improvements to process flows). However, with the advancement of technology, many process flow improvements today can now be considered direct improvements to hardware circuit structures. Designers almost always create the corresponding hardware circuit structure by programming the improved process flow into the hardware circuit. Therefore, it cannot be said that a process flow improvement cannot be implemented using hardware modules. For example, a programmable logic device (PLD), such as a field programmable gate array (FPGA), is an integrated circuit whose logical function is determined by user programming. Designers can "integrate" a digital system on a PLD through their own programming, without having to hire a chip manufacturer to design and manufacture a dedicated integrated circuit chip. Moreover, nowadays, instead of manually fabricating integrated circuit chips, this programming is mostly done using "logic compiler" software. This is similar to the software compiler used when developing programs. Before compilation, the original code must also be written in a specific programming language, called a hardware description language (HDL). There is not just one HDL, but many, 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. The most commonly used ones are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art will also understand that by simply programming the method flow in one of these hardware description languages and then programming it into an integrated circuit, a hardware circuit that implements the logic method flow can be easily obtained.
[0110] The controller can be implemented in any suitable manner. For example, the controller can take the form of 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 (ASICs), programmable logic controllers, and embedded microcontrollers. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art will also know that in addition to implementing the controller in a purely computer-readable program code format, the controller can be implemented in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers by logically programming the method steps. Therefore, such a controller can be considered a hardware component, and the devices included therein for implementing various functions can also be considered as structures within the hardware component. Or even, the devices for implementing various functions can be considered as both software modules that implement the method and structures within the hardware component.
[0111] The systems, devices, modules, or units described in the above embodiments may be implemented by computer chips or entities, or by products having certain functions. A typical implementation device is a server system. Of course, the present invention does not exclude that with the future development of computer technology, the computer that implements the functions of the above embodiments may be, for example, a personal computer, a laptop computer, an in-vehicle human-computer interaction device, a cellular phone, 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.
[0112] Although one or more embodiments of this specification provide method operation steps as described in the embodiments or flow charts, more or fewer operation steps may be included based on conventional or non-creative means. The order of steps listed in the embodiments is only one way of executing the order of many steps and does not represent the only execution order. When the device or terminal product in practice is executed, it can be executed in sequence or in parallel according to the method shown in the embodiments or the drawings (for example, a parallel processor or a multi-threaded processing environment, or even a distributed data processing environment). The term "comprise", "include" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, product or equipment including a series of elements includes not only those elements, but also includes other elements that are not clearly listed, or also includes elements inherent to such process, method, product or equipment. In the absence of more restrictions, it is not excluded that there are other identical or equivalent elements in the process, method, product or equipment including the elements. For example, if the words first, second, etc. are used to represent the name, they do not represent any particular order.
[0113] For the convenience of description, the above devices are described in terms of functions divided into various modules. Of course, when implementing one or more of the present specifications, the functions of each module can be implemented in the same or multiple software and / or hardware, or the module that implements the same function can be implemented by a combination of multiple sub-modules or sub-units, etc. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0114] The present invention is described with reference to the flowcharts and / or block diagrams of the methods, apparatus (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce a device for implementing the functions specified in one or more processes in the flowchart and / or one or more blocks in the block diagram.
[0115] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a product including an instruction device that implements the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0116] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0117] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0118] Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
[0119] Computer-readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media 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, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage, graphene storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory media such as modulated data signals and carrier waves.
[0120] Those skilled in the art will appreciate that one or more embodiments of this specification may be provided as a method, system, or computer program product. Thus, one or more embodiments of this specification may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, one or more embodiments of this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0121] One or more embodiments of this specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, and the like that perform specific tasks or implement specific abstract data types. One or more embodiments of this specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communications network. In distributed computing environments, program modules may be located in local and remote computer storage media, including storage devices.
[0122] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between the various embodiments can be referenced across them. Each embodiment focuses on the differences from the other embodiments. In particular, since the system embodiments are generally similar to the method embodiments, their description is relatively simple. For relevant parts, reference can be made to the description of the method embodiments. Throughout this specification, reference to the terms "one embodiment," "some embodiments," "examples," "specific examples," or "some examples" means that the specific features, structures, materials, or characteristics described in conjunction with that embodiment or example are included in at least one embodiment or example of this specification. In this specification, the schematic representations of these terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, those skilled in the art may combine and integrate the different embodiments or examples, and features of different embodiments or examples, described in this specification, without conflict.
[0123] The foregoing is merely an example of one or more embodiments of this specification and is not intended to limit the one or more embodiments of this specification. It will be apparent to those skilled in the art that various modifications and variations may be made to one or more embodiments of this specification. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of this specification shall be included within the scope of the claims.
Claims
1. A transaction execution method, applied to a node device in a DAG-based blockchain, comprising: In response to the received blockchain transaction, verify at least one historical transaction referenced by the blockchain transaction, and execute the blockchain transaction after the verification is successful; Packing the received blockchain transactions that are not referenced by subsequent blockchain transactions into a transaction set, and initiating consensus verification for the transactions in the transaction set; In response to consensus verification of the transactions in the transaction set passing, execution results corresponding to the transactions in the transaction set are stored in the distributed ledger of the blockchain.
2. The method according to claim 1, wherein the step of packaging the received blockchain transactions that are not referenced by subsequently received blockchain transactions into a transaction set comprises: Based on the preset time interval, the blockchain transactions that are not referenced by the subsequent blockchain transactions received are periodically packaged into a transaction set.
3. The method according to claim 2, further comprising: After the blockchain transaction is executed, cache the execution result of the blockchain transaction; The storing the execution results corresponding to the transactions in the transaction set in the distributed ledger of the blockchain includes: The execution results corresponding to the transactions in the cached transaction set are stored in the distributed ledger of the blockchain.
4. The method according to claim 1, after executing the blockchain transaction after verification, the method further comprises: The execution results of the historical transactions are stored in the distributed ledger of the blockchain.
5. The method according to claim 4, wherein storing the execution results of the historical transactions in the distributed ledger of the blockchain comprises: After the blockchain transaction is executed, the cached execution results corresponding to the historical transactions referenced by the blockchain transaction are stored in the distributed ledger of the blockchain.
6. The method according to claim 1, wherein executing the blockchain transaction comprises: If the received blockchain transaction is multiple blockchain transactions, the multiple blockchain transactions are executed in parallel.
7. The method according to claim 1, wherein executing the blockchain transaction comprises: The blockchain transaction is distributed to each node device in the blockchain, and the blockchain transaction is executed in a distributed manner by each node device.
8. A transaction execution device, applied to a node device in a DAG-based blockchain, comprising: an execution unit, in response to a received blockchain transaction, verifying at least one historical transaction referenced by the blockchain transaction, and executing the blockchain transaction after the verification is successful; The consensus unit packages received blockchain transactions that are not referenced by subsequently received blockchain transactions into a transaction set, and initiates consensus verification for the transactions in the transaction set; The storage unit stores, in response to consensus verification of the transactions in the transaction set passing, the execution results corresponding to the transactions in the transaction set in the distributed ledger of the blockchain.
9. An electronic device comprising: processor; a memory for storing processor-executable instructions; The processor is configured to execute the method according to any one of claims 1 to 7.
10. A computer-readable storage medium comprising: When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
DAG-based block chain transaction processing method and device
CN109544344A