Block chain user operation packaging method and device

By simulating the execution of user operations to obtain read and write sets, generating directed acyclic graphs and dividing user operations sets, solving the problem that user operations cannot be executed in parallel in the prior art, improving execution efficiency and reducing transaction fees.

CN120047142APending Publication Date: 2025-05-27ANT BLOCKCHAIN TECHNOLOGY (SHANGHAI) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510125375.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-26
Publication Date
2025-05-27

AI Technical Summary

Technical Problem

In existing blockchain transactions, user operations cannot be executed in parallel after being packaged, resulting in low execution efficiency.

Method used

By performing user operations through simulation, obtaining the read and write sets it accesses, and saving them in the user operations memory pool. Then, the target operations and their read and write sets arranged in order are extracted, and directed acyclic graphs are generated, and the user operations collection is divided according to the topological structure of the graph, and packaged them into blockchain transactions.

Benefits of technology

This increases the probability that user operations are packaged into blockchain transactions and is executed in parallel, thereby improving the execution efficiency of user operations and reducing the execution costs of blockchain transactions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120047142A_ABST
    Figure CN120047142A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a block chain user operation packaging method and equipment, and the method comprises the steps: obtaining a read-write set corresponding to the access of each user operation in response to the obtaining of each user operation sent by a block chain user, and enabling the read-write set to indicate a set of block chain state data accessed by the user operation; storing each user operation and the read-write set corresponding to each user operation in a preset user operation memory pool; extracting N target operations arranged in sequence and read-write sets corresponding to the N target operations from the user operations stored in the user operation memory pool; according to the read-write set of the N target operations, dividing the N target operations to obtain a plurality of user operation sets arranged in sequence; and packaging each user operation set into a block chain transaction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of this specification belong to the technical field of blockchain, and particularly relate to a method and device for packaging blockchain user operations. Background Art

[0002] UserOperation is a special operation representing user intentions in the blockchain. Traditional blockchain transactions are usually directly initiated by users, including fields such as clear senders, receivers, transfer amounts, Gas, etc., and are authorized to operate through private key signatures. UserOperation is a special operation based on Account Abstraction and can be executed through contract accounts, thereby enabling the invocation of functions in smart contracts to execute more complex logical functions relative to traditional transactions, such as cryptocurrency transfer, data storage, conditional judgment, etc. This way of execution through contracts greatly enhances the functionality of UserOperation compared to the simple currency transfer of traditional transactions. UserOperation itself can also be packaged into the form of a blockchain transaction. After the UserOperation is packaged into a blockchain transaction, each UserOperation will be recorded in the blockchain ledger, forming an immutable record chain in chronological order, enabling any UserOperation to be accurately traced and ensuring the transparency and credibility of UserOperation. Summary of the Invention

[0003] The purpose of the present invention is to provide a method and device for packaging blockchain user operations, which can increase the probability of parallel execution after the user operations are packaged into blockchain transactions, thereby improving the execution efficiency of user operations.

[0004] To achieve the above objective, the first aspect of this specification provides a method for packaging blockchain user operations, including: in response to obtaining each user operation sent by a blockchain user, obtaining the read-write sets corresponding to each user operation, where the read-write set indicates a set of blockchain state data accessed by the user operation; saving each user operation and the read-write set corresponding to each user operation in a preset user operation memory pool; extracting N target operations arranged in order and their corresponding read-write sets from the user operations saved in the user operation memory pool; dividing the N target operations according to the read-write sets of the N target operations to obtain multiple user operation sets arranged in order; and packaging each user operation set into a blockchain transaction.

[0005] The second aspect of this specification provides a computing device, including: a processor; and a memory in which a program is stored. When the processor executes the program, the following operations are performed: in response to obtaining each user operation sent by a blockchain user, obtain the read-write sets corresponding to the access of each user operation, where the read-write sets indicate the set of blockchain state data accessed by the user operation; save each user operation and the read-write set corresponding to each user operation in a preset user operation memory pool; extract N target operations arranged in order and their corresponding read-write sets from the user operations saved in the user operation memory pool; divide the N target operations according to the read-write sets of the N target operations to obtain multiple sets of user operations arranged in order; and package each set of user operations into a blockchain transaction.

[0006] In the packaging scheme for blockchain user operations provided in the embodiments of this specification, it is possible to, in response to obtaining each user operation sent by a blockchain user, simulate the execution of each user operation to obtain the read-write sets corresponding to the access of each user operation, where the read-write sets indicate the blockchain state data accessed by the user operation; save each user operation and its corresponding read-write set in a preset user operation memory pool. Furthermore, it is possible to extract N target operations arranged in order from the user operation memory pool, and generate a directed acyclic graph based on the order of the N target operations and their respective corresponding read-write sets. The nodes in the directed acyclic graph correspond to the target operations, and the edges between the nodes represent the dependency relationships between the target operations determined according to the read-write sets of the target operations; determine multiple sets of user operations arranged in order according to the directed acyclic graph, where each set of user operations includes at least one user operation, and package the multiple sets of user operations into the corresponding multiple transactions arranged in order. Through this method, the probability that user operations can be executed in parallel after being packaged into blockchain transactions can be increased, thereby improving the execution efficiency of user operations. BRIEF DESCRIPTION OF THE DRAWINGS

[0007] To more clearly illustrate the technical solutions in the embodiments of this specification, the following will briefly introduce the accompanying drawings required for the description of the embodiments. Obviously, the accompanying drawings in the following description are only some embodiments recorded in this specification. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.

[0008] Figure 1 is a schematic diagram of a packaging scheme for blockchain user operations;

[0009] Figure 2 is a schematic diagram of a method for packaging blockchain user operations in an embodiment of this specification;

[0010] Figure 3 is a flowchart of a method for packaging blockchain user operations in an embodiment of this specification;

[0011] Figure 4 It is a schematic diagram of generating a directed acyclic graph in an embodiment of this specification;

[0012] Figure 5 It is a schematic diagram of packing transactions according to a directed acyclic graph in an embodiment of this specification;

[0013] Figure 6 It is an architecture diagram of a packing device for blockchain user operations in an embodiment of this specification. Detailed implementation manners

[0014] In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings in the embodiments of this specification. Obviously, the described embodiments are only a part of the embodiments of this specification, rather than all the embodiments. Based on the embodiments in this specification, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of this specification.

[0015] As mentioned above, UserOperation is a special operation in the blockchain that represents the user's intention. Traditional blockchain transactions are usually directly initiated by users and include fields such as clear sender, receiver, transfer amount, Gas, etc., and are authorized to operate through private key signatures. However, UserOperation is a special operation based on Account Abstraction and can be executed through a contract account, so that functions in smart contracts can be called to execute more complex logical functions compared to traditional transactions, such as cryptocurrency transfer, data storage, conditional judgment, etc. Specifically, in an example of a payment scenario, a user can execute a logical function of making a payment only when specific conditions are met through UserOperation.

[0016] This way of execution through a contract greatly enhances the functionality of UserOperation compared to traditional transactions that are usually only used for currency transfer. And UserOperation itself can also be packed into the form of a blockchain transaction. After UserOperation is packed into a blockchain transaction, each UserOperation will be recorded in the blockchain ledger and form an immutable record chain in chronological order, enabling any UserOperation to be accurately traced and ensuring the transparency and credibility of UserOperation.

[0017] Figure 1 It is a schematic diagram of a packing scheme for blockchain user operations. As Figure 1As shown, in the existing solution for packing user operations, usually all user operations sent by the user are placed in a preset memory pool (UserOperation Mempool, also known as the user operation memory pool), and then the bundler role extracts multiple user operations from the user operation memory pool, packs them into one or more blockchain transactions (for convenience of description, also called bundler transactions), and saves the packed blockchain transactions into blocks for subsequent execution. The problem with this solution is that since the transactions packed by the bundler include a group of user operations, multiple user operations with the potential for parallel execution cannot be executed in parallel during subsequent execution after being packed into the user operations after packing by the user, resulting in a low execution efficiency of user operations. For example, the bundler packs three user operations, UserOperationA, UserOperationB, and UserOperationC, into one blockchain transaction. The data sets accessed by these three user operations are: UserOperationA: <k1, write>, UserOperationB: <k2, read>, UserOperationC: <k3, readwrite>. Among them, k1, k2, and k3 respectively represent the keys (Key) of the blockchain state data, and read (read), write (write), and readwrite (read and write) represent the access types to the data. Since the data accessed by UserOperationA, UserOperationB, and UserOperationC is different, UserOperationA, UserOperationB, and UserOperationC themselves can be executed in parallel, or rather they have the potential for parallel execution. However, since they are packed into one blockchain transaction, and the multiple user operations within the blockchain transaction are executed serially, UserOperationA, UserOperationB, and UserOperationC, which originally have the potential for parallel execution, cannot be actually executed in parallel after packing. And the execution efficiency of parallel execution of user operations is usually higher than that of serial execution. Therefore, this solution reduces the execution efficiency of user operations.

[0018] Another packing solution is to pack each user operation into a corresponding blockchain transaction, so that subsequent parallel execution of blockchain transactions can actually execute user operations in parallel. However, since usually each blockchain transaction has a basic execution cost, packing each user operation into a blockchain transaction will result in a substantial increase in the number of executed transactions and generate a large amount of additional transaction fees.

[0019] To solve the above technical problems, an embodiment of this specification proposes a method for packaging blockchain user operations. Figure 2 It is a schematic diagram of a method for packaging blockchain user operations in an embodiment of this specification. As Figure 3 shown, after obtaining each user operation sent by the user, each user operation can be simulated and executed to determine the set of data accessed by each user operation (also referred to as the read-write set). After determining the read set, the user operation and its read-write set are saved in the user operation memory pool. Before packaging a transaction, the packager extracts multiple user operations and their read-write sets from the user operation memory pool, and generates a directed acyclic graph (DAG, Directed Acyclic Graph) based on the user operation and its read-write set. The nodes included in the directed acyclic graph represent user operations, and the edges between the nodes represent the dependency relationships between user operations determined according to the read-write sets of the user operations. Furthermore, the packager can divide the user operations corresponding to all the nodes in the graph into multiple user operation groups (sets) according to the topological structure of the directed acyclic graph, and package the corresponding blockchain transactions according to each user operation group.

[0020] The advantages of this method are as follows: First, compared with the existing scheme of packaging multiple user operations in a blockchain transaction, it is possible to group user operations conveniently according to the topological structure of the directed acyclic graph representing user operations and their dependency relationships, reduce the probability that the user operations that can be executed in parallel are included within the group, and make the blockchain transactions packaged according to the group have a greater probability of being executed in parallel. Furthermore, the overall execution efficiency of multiple user operations is improved. Second, compared with the scheme of packaging each transaction as a blockchain transaction, it is possible to reduce the execution cost of blockchain transactions on the basis of facilitating the substantial parallel execution of user operations with the potential for parallel execution.

[0021] Next, a method for packaging blockchain user operations provided by an embodiment of this specification will be further described. Figure 3 It is a flowchart of a method for packaging blockchain user operations in an embodiment of this specification. As Figure 3 shown, the method at least includes the following steps:

[0022] Step S301: In response to obtaining each user operation sent by a blockchain user, obtain the read-write set corresponding to each user operation, where the read-write set indicates the set of blockchain state data accessed by the user operation; save each user operation and the read-write set corresponding to each user operation in a preset user operation memory pool;

[0023] Step S303: Extract N target operations arranged in order and their corresponding read-write sets from the user operations saved in the user operation memory pool; divide the N target operations according to the read-write sets of the N target operations to obtain multiple user operation sets arranged in order; and package each user operation set into a blockchain transaction.

[0024] First, in step S301, in response to obtaining each user operation sent by a blockchain user, each user operation can access its corresponding read-write set. The read-write set can indicate a set of blockchain state data accessed by the user operation. In different embodiments, the blockchain user can be a user of different specific blockchains that can execute transactions in parallel, and this specification does not limit this. In different embodiments, the process of each user operation accessing its corresponding read-write set can be different. In one embodiment, for example, by calling a specific function preset in the blockchain, the user operation can be simulated to execute, so as to obtain the read-write set of the user operation. In different embodiments, the types of blockchain state data accessed by the user operation can be different. In one example, the access types of the user operation can include reading, writing, and reading and writing.

[0025] By simulating the execution of the user operation, the blockchain state data accessed by the user operation can be determined. In different embodiments, the set of blockchain state data accessed by the user operation can be different. In one embodiment, the access type of the user operation can include one or more of reading, writing, and reading and writing. According to this embodiment, the read-write set can include the identifiers of the blockchain state data read by the user operation, the identifiers of the blockchain state data written by the user operation, and the set of identifiers of the blockchain state data read and written by the user operation.

[0026] After determining the read-write set corresponding to each user operation, each user operation and the read-write set corresponding to each user operation can be saved in a preset user operation memory pool. In different specific embodiments, the data format of saving each user operation and the read-write set corresponding to the user operation in the preset user operation memory pool can be different. In one embodiment, for example, the data format can be: UserOperation0:<k1,write><k2,read>. Where UserOperation0 is the identifier of the user operation, k1 and k2 are the identifiers of the blockchain state data accessed by UserOperation0, and read (reading), write (writing) are the access types for the blockchain state data. In different examples, the identifiers corresponding to the blockchain state data can be different. In one example, for example, it can be specifically the key of the blockchain state data.

[0027] Then, in step S303, extract N target operations arranged in order and their corresponding read-write sets from the user operations saved in the user operation memory pool. According to the read-write sets of the N target operations, the N target operations can be divided to obtain multiple user operation sets arranged in order. Furthermore, each user operation set can be packaged into a blockchain transaction.

[0028] According to different embodiments, the process of obtaining multiple user operation sets according to the read-write sets of the N target operations can be different. In one embodiment, a directed acyclic graph can be generated from the order of the N target operations and the read-write sets corresponding to the N target operations respectively. The nodes in the directed acyclic graph correspond to the target operations, and the edges between the nodes represent the dependency relationships between the target operations determined according to the read-write sets of the target operations; according to the directed acyclic graph, multiple user operation sets arranged in order are determined, and each user operation set includes at least one user operation.

[0029] According to different specific embodiments, the specific process of generating the directed acyclic graph can also be different. For example, a directed acyclic graph can be constructed based on a preset union-find algorithm. In one embodiment, N tree diagrams can be generated according to the N target operations, with the nodes corresponding to the N target operations as the root nodes respectively. The N tree diagrams include the first tree diagram corresponding to the target operation ranked first and N - 1 second tree diagrams corresponding to the N - 1 target operations other than the one ranked first; the N - 1 second tree diagrams are sequentially merged into the first tree diagram to obtain the directed acyclic graph. The merging includes: determining the target dependency relationship between the target operation corresponding to a node in the first tree diagram and the target operation corresponding to the root node of the second tree diagram according to the read-write sets of the target operations corresponding to the nodes in the first tree diagram and the read-write set of the target operation corresponding to the root node of the second tree diagram, and adding a directed edge between a node in the first tree diagram and the root node of the second tree diagram according to the target dependency relationship. In a specific embodiment, the target dependency relationship between the target operation corresponding to the target node in the first tree diagram and the target operation corresponding to the root node of the second tree diagram can be determined according to the read-write sets of the target operations corresponding to the nodes in the first tree diagram and the read-write set of the target operation corresponding to the root node of the second tree diagram, and the read-write sets of the target operation corresponding to the target node and the read-write set of the target operation corresponding to the root node of the second tree diagram indicate the same blockchain state data.

[0030] Figure 4 is a schematic diagram of generating a directed acyclic graph in an embodiment of this specification. As Figure 4As shown, for example, seven sequentially sorted user operations are extracted from the memory pool: UserOperation0 to UserOperation6 (user operation 0 to user operation 6). The order of each user operation can be determined when each operation is saved to the memory pool. Their read-write sets are respectively UserOperation0: <k1,write><k2,read>, UserOperation1: <k1,read><k3,write><k4,read>, UserOperation2: <k3,read>, UserOperation3: <k1,read><k4,read>, UserOperation4: <k3,readwrite>, UserOperation5: <k1,read>, UserOperation6: <k4,read>. Seven single-node tree diagrams can be generated based on UserOperation0 to UserOperation6 (i.e., tree diagrams with the nodes corresponding to UserOperation0 to UserOperation6 as the root nodes respectively. For the convenience of description, the tree diagrams corresponding to UserOperation0 to UserOperation6 are also referred to). Then, the tree diagrams corresponding to UserOperation1 to UserOperation6 can be sequentially merged into the tree diagram corresponding to UserOperation1. Specifically, for example, the process of merging the tree diagram corresponding to UserOperation1 into the tree diagram corresponding to UserOperation0 can be as follows: Since the tree diagram corresponding to UserOperation1 has only one root node, that is, the node corresponding to UserOperation1. And at this time, the tree diagram corresponding to UserOperation0 also has only one root node, that is, the node corresponding to UserOperation0. Therefore, the dependency relationship between the two can be determined according to the read-write set of UserOperation1 and the read-write set of UserOperation0. For example, it can be determined that they access the same blockchain data, that is, the status data identified by k1, based on the fact that UserOperation0 writes the status data identified by k1 and UserOperation1 reads the status data identified by k1.Therefore, a directed edge pointing to the UserOperation1 node can be established between the UserOperation0 node and the UserOperation1 node, indicating that there is a dependency relationship between UserOperation0 and UserOperation1, and UserOperation0 is executed before UserOperation1, so as to merge the tree diagram corresponding to UserOperation1 into the tree diagram corresponding to UserOperation0. At this time, the tree diagram corresponding to UserOperation0 includes two nodes, UserOperation0 and UserOperation1, where UserOperation0 is the root node.

[0031] Next, the tree diagrams corresponding to UserOperation2 and UserOperation3 can be successively merged into the tree diagram corresponding to UserOperation0. The specific process is similar to the process of merging the tree diagram corresponding to UserOperation1 into the tree diagram corresponding to UserOperation0. For example, based on the fact that UserOperation2 and UserOperation1 both access the status data represented by k3 (for convenience of description, it can also be simply referred to as accessing k3 later), and UserOperation3 and UserOperation1 both access k1, directed edges can be established between the UserOperation1 node and the UserOperation2 node, and between the UserOperation1 node and the UserOperation3 node respectively, so as to successively merge the tree diagrams corresponding to UserOperation2 and UserOperation3 into the tree diagram corresponding to UserOperation0. In a specific implementation manner, when the root node of the tree diagram to be merged (such as the UserOperation3 node in the tree diagram corresponding to UserOperation3) has the same access data as the user operations corresponding to multiple nodes in the tree diagram to be incorporated (such as the tree diagram corresponding to UserOperation0, such as UserOperation0 and UserOperation1), a user operation can be determined according to the outermost node among the user nodes corresponding to these user operations, and a directed edge is established between the node corresponding to this user operation and the UserOperation3 node. In an example, for instance, UserOperation2 has the same access data as both UserOperation0 and UserOperation1, and in the tree diagram corresponding to UserOperation0, the UserOperation1 node is the outermost node relative to the UserOperation0 node. Therefore, by establishing a directed edge between the UserOperation1 node and the UserOperation3 node, the tree diagram corresponding to UserOperation3 can be merged into the tree diagram corresponding to UserOperation0. After that, the tree diagrams corresponding to UserOperation4 to UserOperation6 can also be merged into the tree diagram corresponding to UserOperation0 to obtain a complete directed acyclic graph. The specific process of the merger is similar to the process of merging the tree diagrams corresponding to UserOperation1 to UserOperation3, which will not be elaborated here.

[0032] After generating a directed acyclic graph, multiple ordered sets of user operations can be determined according to the directed acyclic graph. Each set of user operations includes at least one user operation, and the multiple sets of user operations are packaged into corresponding multiple transactions arranged in order. In different embodiments, the specific processes of the multiple sets of user operations may be different. In one embodiment, the directed acyclic graph can be divided into multiple subgraphs. Each subgraph includes at least one node. The at least one node is connected in series by directed edges to form a linear node chain. And for any node in the at least one node, if there are approximately two or more child nodes, the child nodes of the any node are not included in the linear node chain. According to the corresponding operations of the nodes included in each of the multiple subgraphs and the order of the corresponding operations, multiple ordered sets of user operations are determined.

[0033] Figure 5 This is a schematic diagram of packaging transactions according to a directed acyclic graph in an embodiment of this specification. As Figure 5 shown, for example, according to Figure 4 the determined DAG, the set of user operations 0 (composed of the user operation 0 node and the user operation 1 node), the set of user operations 1 (composed of the user operation 2 node and the user operation 4 node), the set of user operations 2 (composed of the user operation 3 node), the set of user operations 3 (composed of the user operation 5 node), and the set of user operations 4 (composed of the user operation 6 node) can be determined in sequence. Among them, for example, the process of determining the set of user operations 0 can be as follows: Since the user operation 0 node and the child node of the user operation 0 node, the user operation 1 node, can be connected in series by a directed edge to form a node chain, it can be determined that at least the user operation 0 node and the user operation 1 node can form a node set. And since the user operation 1 node has approximately two or more child nodes (the user operation 2 node and the user operation 3 node), the user operation 2 node and the user operation 3 node cannot be added to this node set. Therefore, it can be determined that the set of user operations 0 is composed of the user operation 0 node and the user operation 1 node. Subsequently, the sets of user operations 1 to 4 can be determined in sequence. The process of determining these user sets is similar to the process of determining the set of user operations 0 and will not be elaborated here.

[0034] After determining the sets of user operations 0 to 4, the sets of user operations 0 to 4 can be packaged into sequential blockchain transactions, such as Tx0 to Tx4. Each blockchain transaction can include the user operations in the corresponding set of user operations.

[0035] After that, multiple packaged blockchain transactions can be saved into the blocks of the blockchain for subsequent execution. In one implementation, the multiple transactions can be sequentially saved into the target block according to the sorting of the multiple transactions. In another implementation, the multiple transactions can also be saved into the target block in batches. In this way, the probability that user operations with dependencies are packaged into different transactions, resulting in difficulty in parallel execution of different transactions, can be greatly reduced. For example, Tx1 (including user operation 2 and user operation 4) and Tx2 (including user operation 3) packaged in this way can be executed in parallel. Tx3 (including user operation 5) and Tx4 (including user operation 6) can also be executed in parallel. It should be noted that in different implementations, the packaged transactions can be executed based on different specific transaction scheduling processes. And by packaging transactions in this way, the probability of transaction parallelism can be increased, and it is not limited that all transactions packaged in this way are executed in parallel. For example, Tx0 (including user operation 0 and user operation 1) can be executed before Tx1 and Tx2, Tx1 and Tx2 can be parallel, and after Tx2 is executed, Tx3 and Tx4 can be executed in parallel.

[0036] According to an embodiment of another aspect, there is also provided a packaging device for blockchain user operations. Figure 6 is an architecture diagram of a packaging device for blockchain user operations in an embodiment of this specification, as Figure 6 shown, the device 600 includes:

[0037] A response unit 61, configured to, in response to obtaining each user operation sent by a blockchain user, simulate the execution of each user operation to obtain the read-write sets accessed by each user operation, where the read-write sets indicate the set of blockchain state data accessed by the user operation; save each user operation and the corresponding read-write set of each user operation in a preset user operation memory pool;

[0038] A packaging unit 62, configured to extract N target operations arranged in order from the user operations saved in the user operation memory pool, generate a directed acyclic graph according to the order of the N target operations and the read-write sets corresponding to the N target operations respectively, where the nodes in the directed acyclic graph correspond to the target operations, and the edges between the nodes represent the dependency relationships between the target operations determined according to the read-write sets of the target operations; determine multiple sets of user operations arranged in order according to the directed acyclic graph, where each set of user operations includes at least one user operation, and package the multiple sets of user operations into corresponding multiple transactions arranged in order.

[0039] Another aspect of this specification provides a computing device, including: a processor; and a memory, where a program is stored, and when the processor executes the program, the following operations are performed: in response to obtaining each user operation sent by a blockchain user, obtaining the read-write sets corresponding to the access of each user operation, where the read-write sets indicate a set of blockchain state data accessed by the user operation; saving each user operation and the read-write sets corresponding to each user operation in a preset user operation memory pool; extracting N target operations arranged in order and their corresponding read-write sets from the user operations saved in the user operation memory pool; dividing the N target operations according to the read-write sets of the N target operations to obtain multiple user operation sets arranged in order; and packaging each user operation set into a blockchain transaction.

[0040] Another aspect of this specification provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed in a computer, the computer is made to execute any one of the above methods.

[0041] Another aspect of this specification provides a computer program product, including a computer program / instructions, which when executed by a processor implement any one of the above methods.

[0042] In the 1990s, improvements to a technology could be clearly distinguished as either hardware improvements (e.g., improvements to circuit structures such as diodes, transistors, switches, etc.) or software improvements (improvements to method flows). However, with the development of technology, many method flow improvements today can be regarded as direct improvements to hardware circuit structures. Almost all designers obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that an improvement to a method flow cannot be implemented using a hardware entity module. For example, a Programmable Logic Device (PLD) (such as a Field Programmable Gate Array (FPGA)) is such an integrated circuit whose logical function is determined by the user programming the device. Designers can program themselves to "integrate" a digital system onto a single PLD, without having to ask a chip manufacturer to design and fabricate a dedicated integrated circuit chip. Moreover, nowadays, instead of manually fabricating integrated circuit chips, this programming is mostly implemented using "logic compiler" software, which is similar to the software compiler used in program development and writing. The original code before compilation also has to be written in a specific programming language, which is called a Hardware Description Language (HDL), and there is not just one type of 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. Currently, the most commonly used are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also be aware that by simply performing a little logical programming on the method flow using the above-mentioned several hardware description languages and programming it into an integrated circuit, it is easy to obtain the hardware circuit that implements the logical method flow.

[0043] The controller can be implemented in any suitable manner. For example, the controller can take the form of, for example, a microprocessor or a processor and a computer-readable medium storing computer-readable program code (such as software or firmware) executable by the (micro)processor, logic gates, switches, an application specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of the controller 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 also know that in addition to implementing the controller in the form of pure computer-readable program code, it is entirely possible to logically program the method steps to enable the controller to be implemented in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers, etc. to achieve the same function. Therefore, such a controller can be considered a hardware component, and the devices included therein for implementing various functions can also be regarded as the structures within the hardware component. Or even, the devices for implementing various functions can be regarded as either software modules for implementing the method or the structures within the hardware component.

[0044] The systems, devices, modules, or units illustrated in the above embodiments can be specifically implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a server system. Of course, this application does not exclude that with the development of future computer technologies, the computers for implementing the functions of the above embodiments can be, for example, personal computers, laptop computers, in-vehicle human-machine interaction devices, cellular phones, camera phones, smart phones, personal digital assistants, media players, navigation devices, email devices, game consoles, tablet computers, wearable devices, or any combination of these devices.

[0045] Although one or more embodiments of this specification provide method operation steps as described in the embodiments or flowcharts, 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 among many execution orders of steps and does not represent the only execution order. When the actual device or terminal product is executed, it may be executed in the order of the method shown in the embodiments or the drawings or executed in parallel (for example, in a parallel processor or multi-threaded processing environment, or even in a distributed data processing environment). The term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, product or device comprising a series of elements not only includes those elements, but also includes other elements not expressly listed, or also includes elements inherent to such process, method, product or device. Without further limitation, it does not exclude the existence of additional identical or equivalent elements in the process, method, product or device comprising the said elements. For example, if terms such as first and second are used to denote names, they do not denote any particular order.

[0046] For the convenience of description, the above device is described by dividing it into various modules according to functions. Of course, when implementing one or more of this specification, the functions of each module can be implemented in the same or multiple software and / or hardware, or the modules implementing the same function can be realized by a combination of multiple sub-modules or sub-units, etc. The device embodiments described above are only illustrative. For example, the division of the units is only a logical function division, and there may be other division methods in actual implementation. For example, 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 displayed or discussed coupling or direct coupling or communication connection to each other can be through some interfaces, and the indirect coupling or communication connection of the device or unit can be in electrical, mechanical or other forms.

[0047] The present invention is described with reference to the flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each flow and / or block in the flowchart and / or block diagram, and the combination of flows 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 the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing devices generate a device for implementing the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.

[0048] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, such that the instructions stored in the computer-readable memory produce a manufacture including an instruction device that implements the functions specified in one or more processes and / or blocks Figure 1 in one or more processes and / or blocks Figure 1 specified in the block or blocks.

[0049] These computer program instructions can also be loaded onto a computer or other programmable data processing device, such that a series of operational steps are performed on the computer or other programmable device to generate a computer-implemented process, and thus the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes and / or blocks Figure 1 in one or more processes and / or blocks Figure 1 specified in the block or blocks.

[0050] In a typical configuration, a computing device includes one or more processors (CPUs), an input / output interface, a network interface, and memory.

[0051] The memory may include non-permanent memory in the form of computer-readable media, random access memory (RAM), and / or non-volatile memory such as read-only memory (ROM) or flash memory (flash RAM). Memory is an example of computer-readable media.

[0052] Computer-readable media includes permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology for information storage. The 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 technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette tapes, 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 computer-readable media such as modulated data signals and carrier waves.

[0053] Those skilled in the art should understand that one or more embodiments of this specification can be provided as a method, a system, or a computer program product. Therefore, one or more embodiments of this specification can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, one or more embodiments of this specification can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

[0054] One or more embodiments of this specification can 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, etc. that perform specific tasks or implement specific abstract data types. One or more embodiments of this specification can also be practiced in a distributed computing environment where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.

[0055] Each embodiment in this specification is described in a progressive manner. For the same or similar parts among the embodiments, reference can be made to each other. Each embodiment focuses on the differences from other embodiments. In particular, for system embodiments, since they are basically similar to method embodiments, the description is relatively simple, and reference can be made to the relevant parts of the method embodiments for the related content. In the description of this specification, the description of reference terms such as "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials, or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of this specification. In this specification, the schematic expressions of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described can be combined in a suitable manner in any one or more embodiments or examples. In addition, without contradiction, those skilled in the art can combine and combine the different embodiments or examples described in this specification and the features of different embodiments or examples.

[0056] The above description is only for the embodiments of one or more embodiments of this specification and is not used to limit one or more embodiments of this specification. For those skilled in the art, one or more embodiments of this specification can have various changes and modifications. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this specification shall be included within the scope of the claims.

Claims

1. A method for packaging blockchain user operations, comprising: In response to obtaining each user operation sent by a blockchain user, a read-write set corresponding to each user operation access is obtained, wherein the read-write set indicates a set of blockchain state data accessed by the user operation; each user operation and the read-write set corresponding to each user operation are saved in a preset user operation memory pool; Extracting N target operations and their corresponding read-write sets arranged in order from the user operations stored in the user operation memory pool; dividing the N target operations according to the read-write sets of the N target operations to obtain a plurality of user operation sets arranged in order; and packaging each user operation set into a blockchain transaction.

2. The method according to claim 1, wherein: According to the read-write sets of the N target operations, the N target operations are divided to obtain multiple user operation sets, including: according to the order of the N target operations and the read-write sets corresponding to the N target operations, a directed acyclic graph is generated, the nodes in the directed acyclic graph correspond to the target operations, and the edges between the nodes represent the dependency relationship between the target operations determined according to the read-write sets of the target operations; according to the directed acyclic graph, multiple user operation sets arranged in order are determined, and the user operation sets include at least one user operation.

3. The method according to claim 2, wherein: According to the order of the N target operations and the read-write sets corresponding to the N target operations, a directed acyclic graph is generated, including: According to N target operations, N tree diagrams are generated with nodes corresponding to the N target operations as root nodes, the N tree diagrams including a first tree diagram corresponding to the target operation ranked first and N-1 second tree diagrams corresponding to N-1 target operations other than the first one; the N-1 second tree diagrams are merged into the first tree diagram in sequence to obtain the directed acyclic graph, the merging comprising: determining a target dependency relationship between a target operation corresponding to a node in the first tree diagram and a target operation corresponding to the root node of the second tree diagram according to a read-write set of the target operation corresponding to the node in the first tree diagram and a read-write set of the target operation corresponding to the root node of the second tree diagram, and adding a directed edge between a node in the first tree diagram and the root node of the second tree diagram according to the target dependency relationship.

4. The method according to claim 3, wherein: According to the directed acyclic graph, a plurality of user operation sets arranged in order are determined, including: dividing the directed acyclic graph into a plurality of subgraphs, wherein the subgraphs include at least one node, the at least one node is connected in series into a linear node chain through directed edges, and if any node in the at least one node has approximately two child nodes, the child nodes of the arbitrary node are not included in the linear node chain; and according to corresponding operations of the nodes included in each of the plurality of subgraphs, and the order of the corresponding operations, a plurality of user operation sets arranged in order are determined.

5. The method according to claim 3, wherein: Determining a target dependency relationship between a target operation corresponding to a node in the first dendrogram and a target operation corresponding to the root node of the second dendrogram according to a read-write set of a target operation corresponding to a node in the first dendrogram and a target operation corresponding to the root node of the second dendrogram, including: determining a target dependency relationship between a target operation corresponding to a target node in the first dendrogram and a target operation corresponding to the root node of the second dendrogram according to a read-write set of a target operation corresponding to a node in the first dendrogram and a read-write set of a target operation corresponding to the root node of the second dendrogram, wherein the read-write set of the target operation corresponding to the target node and the read-write set of the target operation corresponding to the root node of the second dendrogram indicate the same blockchain state data.

6. According to the method of claim 1, the type of access includes one or more of read, write, and read and write; the read-write set includes an identifier of the blockchain state data read by the user operation, an identifier of the blockchain state data written by the user operation, and a set of identifiers of the blockchain state data read and written by the user operation.

7. The method according to claim 1, wherein: The read-write set corresponding to each user operation access is obtained by simulating the execution of each user operation access.

8. The method according to claim 1, further comprising: According to the order of the multiple transactions, the multiple transactions are saved in the target block in sequence.

9. The method according to claim 1, further comprising: The multiple transactions are saved in batches into a target block.

10. A computer device comprising: processor; and a memory, wherein a program is stored, wherein when the processor executes the program, the following operations are performed: In response to obtaining each user operation sent by a blockchain user, a read-write set corresponding to each user operation access is obtained, wherein the read-write set indicates a set of blockchain state data accessed by the user operation; each user operation and the read-write set corresponding to each user operation are saved in a preset user operation memory pool; Extracting N target operations and their corresponding read-write sets arranged in order from the user operations stored in the user operation memory pool; dividing the N target operations according to the read-write sets of the N target operations to obtain a plurality of user operation sets arranged in order; and packaging each user operation set into a blockchain transaction.