Data processing method and device based on block chain, equipment and readable medium
By constructing a read set dictionary, a write set dictionary, a read set sequence diagram and a write set sequence diagram, and a transaction conflict bitmap are constructed in parallel, the problem of slow construction of directed acyclic graphs in the existing technology is solved, and the rapid construction of directed acyclic graphs is achieved, and the performance of the blockchain system is improved.
Patent Information
- Application Number
- CN202311777113.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-21
- Publication Date
- 2025-06-24
AI Technical Summary
In the prior art, the construction of directed acyclic graphs is slower and cannot adapt to massive data scenarios.
By building the block's read set dictionary, write set dictionary, read set order chart and write set order chart, the conflict bitmap of each transaction is constructed in parallel, and finally the directed acyclic graph of the block is constructed.
It realizes the rapid construction of directed acyclic graphs, shortens the time to judge execution conflicts, and improves the performance of the blockchain system and adaptability to massive data scenarios.
Smart Images

Figure CN120196788A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer and communication technologies. Specifically, it relates to a data processing method, apparatus, device, and readable medium based on a blockchain. Background Art
[0002] A blockchain is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. Only after the data blocks generated by consensus nodes in the blockchain pass verification can they be added to the blockchain. To improve the verification speed of data blocks, transactions included in the data blocks can be executed in parallel. Before executing transactions in parallel, it is necessary to clarify which transactions in the block have dependencies and need to be executed sequentially; and which transactions can be executed in parallel, so as to obtain a reasonable transaction execution order.
[0003] In related technologies, a directed acyclic graph (DAG) is constructed to determine the execution order of transactions in a block. However, the current speed of constructing a DAG is slow and cannot adapt to scenarios of massive data. Therefore, how to improve the construction speed of a directed acyclic graph is an urgent problem to be solved currently. Summary of the Invention
[0004] Embodiments of this application provide a data processing method, apparatus, electronic device, computer-readable medium, and computer program product based on a blockchain, which can improve the construction speed of a directed acyclic graph.
[0005] Other features and advantages of this application will become apparent through the following detailed description, or be learned in part through the practice of this application.
[0006] In a first aspect, embodiments of this application provide a data processing method based on a blockchain, and the method includes:
[0007] Construct a read set dictionary of the block based on read set transaction parameters required for each transaction execution in the block, and construct a write set dictionary of the block based on write set transaction parameters required for each transaction execution;
[0008] Construct a read set sequence graph and a write set sequence graph of the block based on the arrangement order of each transaction in the block, the read set transaction parameters, and the write set transaction parameters corresponding to each transaction; wherein, the read set sequence graph is used to represent the number of prior transactions that need to read each transaction parameter corresponding to each transaction, and the write set sequence graph is used to represent the number of prior transactions that need to update each transaction parameter corresponding to each transaction;
[0009] Based on the read set dictionary, the write set dictionary, the read set sequence diagram, and the write set sequence diagram, construct the conflict bitmap of each transaction in parallel; wherein, the conflict bitmap of any transaction includes the transactions that have execution conflicts with the any transaction.
[0010] Construct the directed acyclic graph of the block based on the conflict bitmap of each transaction.
[0011] In a second aspect, an embodiment of the present application provides a blockchain-based data processing device, the device includes an initial construction unit, a parallel construction unit, and a processing unit, wherein:
[0012] The initial construction unit is configured to construct the read set dictionary of the block based on the read set transaction parameters required for each transaction execution in the block, and construct the write set dictionary of the block based on the write set transaction parameters required for each transaction update.
[0013] The initial construction unit is configured to construct the read set sequence diagram and the write set sequence diagram of the block based on the arrangement order of each transaction in the block, the read set transaction parameters and the write set transaction parameters corresponding to each transaction; wherein, the read set sequence diagram is used to represent the number of prior transactions that need to read each transaction parameter corresponding to each transaction, and the write set sequence diagram is used to represent the number of prior transactions that need to update each transaction parameter corresponding to each transaction.
[0014] The parallel construction unit is configured to construct the conflict bitmap of each transaction in parallel based on the read set dictionary, the write set dictionary, the read set sequence diagram, and the write set sequence diagram; wherein, the conflict bitmap of any transaction includes the transactions that have execution conflicts with the any transaction.
[0015] The processing unit is configured to construct the directed acyclic graph of the block based on the conflict bitmap of each transaction.
[0016] In a third aspect, an embodiment of the present application provides an electronic device, including one or more processors; a storage device for storing one or more computer programs, when the one or more computer programs are executed by the one or more processors, enabling the electronic device to implement the blockchain-based data processing method as described above.
[0017] In a fourth aspect, an embodiment of the present application provides a computer-readable medium, on which a computer program is stored, when the computer program is executed by a processor of an electronic device, enabling the electronic device to execute the blockchain-based data processing method as described above.
[0018] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program stored in a computer-readable medium. A processor of an electronic device reads and executes the computer program from the computer-readable medium, so that the electronic device executes the data processing method based on a blockchain as described above.
[0019] In the technical solution provided by the embodiment of the present application, when constructing the conflict bitmap of each transaction, by means of the pre-constructed read set dictionary, write set dictionary, read set order graph, and write set order graph, it is not necessary to rely on the execution conflict situation of the transactions arranged before each transaction when constructing the conflict bitmap of each transaction. Thus, parallel construction of the conflict bitmap of each transaction can be achieved. It can be seen that, compared with the existing solution that needs to serially judge the execution conflict situation of transactions, the embodiment of the present application can greatly shorten the time required to judge the execution conflict situation by parallelly constructing the conflict bitmap, thereby achieving the purpose of improving the construction speed of the directed acyclic graph.
[0020] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present application, and are used together with the specification to explain the principles of the present application. Obviously, the accompanying drawings in the following description are only some embodiments of the present application, and those of ordinary skill in the art can obtain other drawings according to these drawings without creative efforts. In the drawings:
[0022] Figure 1 is a schematic structural diagram of a blockchain system provided by an embodiment of the present application;
[0023] Figure 2 is a schematic diagram of a blockchain provided by an embodiment of the present application;
[0024] Figure 3 is a schematic flowchart of a data processing method based on a blockchain provided by an embodiment of the present application;
[0025] Figure 4 is a schematic diagram of the update of a world state provided by an embodiment of the present application;
[0026] Figure 5 is a schematic diagram of the read / write sets of a transaction provided by an embodiment of the present application;
[0027] Figure 6 is a schematic diagram of a read set dictionary provided by an embodiment of the present application;
[0028] Figure 7 It is a schematic diagram of a write set dictionary provided by an embodiment of the present application;
[0029] Figure 8 It is a schematic diagram of an execution conflict provided by an embodiment of the present application;
[0030] Figure 9 It is a schematic flowchart of another data processing method based on blockchain provided by an embodiment of the present application;
[0031] Figure 10 It is a schematic diagram of the construction process of a read set sequence diagram provided by an embodiment of the present application;
[0032] Figure 11 It is a schematic diagram of the construction process of a write set sequence diagram provided by an embodiment of the present application;
[0033] Figure 12 It is a schematic diagram of the construction process of a conflict bitmap provided by an embodiment of the present application;
[0034] Figure 13 It is a schematic diagram of the construction process of another conflict bitmap provided by an embodiment of the present application;
[0035] Figure 14 It is a schematic diagram of the construction process of a directed acyclic graph provided by an embodiment of the present application;
[0036] Figure 15 It is a structural block diagram of a data processing device based on blockchain provided by an embodiment of the present application;
[0037] Figure 16 It shows a schematic diagram of the structure of a computer system of an electronic device suitable for implementing the embodiments of the present application. Detailed implementation manners
[0038] Here, the exemplary embodiments will be described in detail, and the examples are shown in the drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementation manners described in the following exemplary embodiments do not represent all implementation manners consistent with the present application. On the contrary, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0039] The block diagrams shown in the drawings are only functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.
[0040] In the embodiments of the present application, the term "module" or "unit" refers to a computer program with a predetermined function or a part of a computer program, which works together with other related parts to achieve a predetermined goal, and can be fully or partially implemented by using software, hardware (such as a processing circuit or a memory), or a combination thereof. Similarly, one processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be a part of the overall module or unit that includes the function of the module or unit.
[0041] The flowcharts shown in the accompanying drawings are only exemplary illustrations, and do not necessarily include all the contents and operations, nor do they necessarily need to be executed in the described order. For example, some operations can be decomposed, while some operations can be combined or partially combined. Therefore, the actual execution order may change according to the actual situation.
[0042] It should also be noted that: "a plurality of" mentioned in the present application refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships can exist. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone. The character " / " generally represents an "or" relationship between the associated objects before and after.
[0043] Blockchain is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, and encryption algorithms. Essentially, blockchain is a decentralized database, a series of data blocks generated by using cryptographic methods. Each data block contains information about a batch of network transactions, which is used to verify the validity of the information (anti-counterfeiting) and generate the next block. Blockchain can include the blockchain underlying platform, the platform product service layer, and the application service layer.
[0044] Among them, the consensus mechanism of blockchain refers to the mechanism by which blockchain nodes reach a consensus on a block (also known as block information or block data), which can ensure that the latest block is accurately added to the blockchain. The current mainstream consensus algorithms include: Proof of Work (POW), Proof of Stake (POS), Delegated Proof of Stake (DPOS), Practical Byzantine Fault Tolerance (PBFT) algorithm, etc. Among them, in various consensus algorithms, usually after a preset number of consensus nodes reach an agreement on the data to be consensus (i.e., the consensus proposal), the consensus on the consensus proposal is determined to be successful.
[0045] For example, in the PBFT algorithm, for N ≥ 3f + 1 consensus nodes, f malicious nodes can be tolerated, where N and f are positive integers. That is to say, when 2f + 1 nodes among the N consensus nodes reach an agreement, it can be determined that the consensus is successful.
[0046] The blocks with successful consensus will be added to the blockchain, thereby updating the world state of the blockchain. Among them, after all the transactions included in the block in the blockchain are executed, the latest data state in the blockchain is called the "world state". The essence of the blockchain is to enter the next world state from one world state through the transactions in the block. Therefore, the consensus nodes are the key to maintaining data consistency in the blockchain.
[0047] In specific implementation, the consensus nodes can include a consensus engine and a scheduling execution module. Among them, the consensus engine mainly includes a consensus algorithm module and a peer-to-peer network communication module. The consensus algorithm module can include various specific consensus algorithms, and different consensus algorithms have different applicable scenarios.
[0048] Peer-to-peer network communication refers to a communication technology that does not rely on a centralized server but relies on a group of peers (peers) to exchange information. The peer-to-peer network communication module is responsible for the broadcast and reception of messages. The messages can specifically be blocks and voting information (i.e., the voting results of the nodes), etc.
[0049] In addition, the consensus nodes can be mainly divided into two roles: the primary node and the secondary node. The primary node refers to the consensus node that initiates a consensus proposal in the blockchain. The main responsibility of the primary node is to package transactions to construct a block in a round of consensus and broadcast the block to other secondary nodes. Therefore, the primary node plays a key role in a round of consensus. If the primary node behaves maliciously, packages invalid transactions or has an incorrect block structure, no consensus on the block will be reached in this round of consensus.
[0050] The secondary node refers to the node that verifies the block in the blockchain. The main role of the secondary node is to execute the transactions in the block and verify the validity of the block after receiving the block broadcast by the primary node. When the verified block is invalid or the execution results are inconsistent, the secondary node will not vote for or vote against the block to indicate that the secondary node has not reached a consensus with the primary node on the block; when the block is verified to be valid and the execution results are consistent, the secondary node will vote for the block to indicate that the secondary node has reached a consensus with the primary node on the block.
[0051] The verification process of the slave node can specifically include: the slave node executes the transactions included in the block to obtain the execution result of the slave node; for the transactions included in the block, if the execution result of the slave node is the same as that of the master node, it can be determined that the corresponding block has passed the verification of the slave node, that is, the slave node and the master node reach a consensus on the block; if the execution result of the slave node is different from that of the master node, it can be determined that the corresponding block has not passed the verification of the slave node, that is, the slave node and the master node do not reach a consensus on the block.
[0052] Among them, the execution result of any node can include the read-write set corresponding to the transaction executed by the any node. Therefore, whether the execution results of two nodes are the same actually means whether the read-write sets corresponding to the transactions executed by the two nodes are the same.
[0053] Specifically, the read-write set includes a read set and a write set. The read set includes the transaction parameters that need to be read when executing a transaction. The write set includes the transaction parameters updated during the execution of the transaction. Among them, the transaction parameter is a variable, and the value of the transaction parameter will not change under the same world state, but the value of the same transaction parameter will change under different world states.
[0054] It should be noted that the transaction parameters can include one or more parameters related to the blockchain ledger transaction such as account balance, asset ownership, and incoming amount. If the state values corresponding to the same transaction parameter included in the two read sets are different, it can be explained that the world states or version information of the two read sets are different.
[0055] In addition, the update can include one or more operations such as addition, modification, and deletion. After the block reaches a consensus, the world state of all consensus nodes in the blockchain can be updated by executing the transactions in the block, so that the world states of all consensus nodes are kept consistent.
[0056] Currently, in order to improve the execution speed of the transactions in the block, and thus improve the verification speed of the block. The blockchain can execute some or all of the transactions in the block in parallel. Since there may be execution dependencies among some transactions in the block, resulting in execution conflicts; therefore, before executing the transactions in parallel, it is necessary to clarify which transactions in the block have dependencies and the execution order; and which transactions can be executed in parallel, so as to obtain a reasonable transaction execution order.
[0057] In the related art, the execution order of transactions in a block is determined by constructing a Directed Acyclic Graph (DAG). The specific process of constructing the current directed acyclic graph includes: 1) Using the number of transactions as the maximum number of vertices to obtain an initial directed acyclic graph; 2) Reading out transactions in sequence according to the arrangement order of transactions in the block. 3) If the currently read transaction is a transaction that can be executed in parallel, then parse the conflict domain of the transaction; and check whether there is a transaction in the previous transactions that conflicts with this transaction. If so, construct a dependency edge between the currently read transaction and the detected transaction. 4) If the currently read transaction is not a transaction that can be executed in parallel, it is considered that the transaction must be executed after all the transactions arranged before this transaction are executed. Therefore, a dependency edge is established between this transaction and its previous transactions. Thus, the directed acyclic graph of the block is obtained.
[0058] It can be seen that the existing solution needs to read out transactions in sequence according to the arrangement order of transactions in the block and determine whether there is a transaction in other transactions that conflicts with the currently read transaction.
[0059] Based on this, the embodiment of the present application provides a data processing solution based on a blockchain. Before constructing the directed acyclic graph of the block, a read set dictionary, a write set dictionary, a read set order graph, and a write set order graph of the block are pre-constructed. Then, based on the read set dictionary, the write set dictionary, the read set order graph, and the write set order graph, the conflict bitmap of each transaction is constructed in parallel. Finally, the directed acyclic graph of the block can be constructed according to the conflict bitmap of each transaction.
[0060] Among them, a block refers to a block that has not yet reached consensus. The block needs to be added to the blockchain after consensus is successful. The read set dictionary can be constructed based on the read set transaction parameters required for each transaction execution in the block. Correspondingly, the write set dictionary can be constructed based on the write set transaction parameters required for each transaction execution.
[0061] In addition, the read set order graph and the write set order graph of the block can be constructed based on the arrangement order of each transaction in the block, the read set transaction parameters, and the write set transaction parameters corresponding to each transaction. The read set order graph or the write set order graph is used to represent: the number of previous transactions that need to read or update each transaction parameter corresponding to each transaction. In addition, the conflict bitmap of any transaction includes transactions that have an execution conflict with any transaction.
[0062] It is not difficult to see that based on the constructed read set dictionary, write set dictionary, read set sequence diagram, and write set sequence diagram, this solution can construct the conflict bitmap of each transaction in parallel, thereby quickly constructing the directed acyclic graph of the block. Compared with the existing solution that needs to sequentially judge the execution conflicts of transactions; this solution can judge the execution conflicts of each transaction in parallel, thereby greatly reducing the judgment time of execution conflicts, and further achieving the purpose of improving the construction speed of the directed acyclic graph.
[0063] Based on the above blockchain-based data processing solution, an embodiment of this application provides a blockchain system, as shown in Figure 1 , Figure 1 shows a schematic structural diagram of a blockchain system. Figure 1 The blockchain system 100 shown can specifically be a system for data sharing between nodes. The blockchain system 100 may include multiple blockchain nodes (also referred to as consensus nodes), such as Figure 1 the blockchain nodes 101 to 104 shown; among them, Figure 1 the ellipsis in indicates that the blockchain system 100 also includes other blockchain nodes. Blockchain nodes are the basic components of the entire blockchain system and are responsible for functions such as processing transactions, storing blockchain data, and participating in consensus.
[0064] Each blockchain node in the blockchain system 100 stores an identical blockchain (also referred to as a block ledger). The block ledger is the core data structure in the blockchain system and is used to store and manage all confirmed blocks. The block ledger is organized in a chain structure, and each block contains a set of transactions, a block header (including metadata such as the hash value of the previous block, timestamp, etc.), and other information. The block ledger provides a public and immutable transaction history for the blockchain system, ensuring the transparency and consistency of the system.
[0065] In addition, each blockchain node can receive input information during normal operation and maintain the shared data within the blockchain system 100 based on the received input information. To ensure information interconnection within the blockchain system 100, as Figure 1 shown, there can be a wired or wireless communication connection between each blockchain node in the blockchain system 100, and the blockchain nodes can transmit information through the above communication connection.
[0066] For example, when any blockchain node in the blockchain system 100 responds to a transaction request of an object and executes multiple transactions of the request, the multiple executed transactions can be packed into a block as input information. After other blockchain nodes in the blockchain system 100 receive the block, they process the block according to the consensus algorithm. After the block obtains consensus, the block is stored as data in the shared data, so that the data stored on all blockchain nodes in the blockchain system 100 is consistent.
[0067] For each blockchain node in the blockchain system 100, there is a corresponding node identifier, and each blockchain node in the blockchain system 100 can store the node identifiers of other blockchain nodes in the blockchain system 100, so as to broadcast the generated block to other blockchain nodes in the blockchain system 100 according to the node identifiers of other blockchain nodes in the future. A node identifier list as shown in the following table can be maintained in each blockchain node, and the node name and the node identifier are stored in the node identifier list correspondingly. Among them, the node identifier can be an IP (Internet Protocol) address and any other information that can be used to identify the node. Only the IP address is taken as an example in Table 1 for illustration.
[0068] Table 1
[0069]
[0070]
[0071] Each node in the blockchain system 100 stores an identical blockchain. The blockchain consists of multiple blocks. Refer to Figure 2 , the blockchain consists of multiple blocks. The genesis block includes a block header and a block body. The block header stores the input information feature value, version number, timestamp, and difficulty value. The block body stores the input information; the next block of the genesis block takes the genesis block as the parent block. The next block also includes a block header and a block body. The block header stores the input information feature value of the current block, the block header feature value of the parent block, version number, timestamp, and difficulty value, and so on. In this way, the block data stored in each block in the blockchain is associated with the block data stored in the parent block, ensuring the security of the input information in the block.
[0072] In one embodiment, the blockchain node 101 may package multiple transactions to form a block to be consensus. Then, the blockchain node 101 may first construct a read set dictionary, a write set dictionary, a read set order graph, and a write set order graph for the block. After that, the blockchain node 101 may parallelly construct a conflict bitmap for each transaction based on the read set dictionary, the write set dictionary, the read set order graph, and the write set order graph. Finally, the blockchain node 101 may construct a directed acyclic graph of the block according to the conflict bitmap of each transaction.
[0073] Optionally, the blockchain node 101 (at this time, the blockchain node 101 is the master node) may also determine the execution order of each transaction in the block based on the constructed directed acyclic graph; and send the block and the execution order of each transaction to other blockchain nodes (i.e., slave nodes) in the blockchain, so that other blockchain nodes can verify the block based on the execution order of each transaction to obtain the verification result of the block. Further, the blockchain node 101 may also receive the verification result sent by the consensus node to perform consensus on the block according to the received verification result.
[0074] It should be noted that the embodiments of the present application can be applied to various scenarios, including but not limited to various scenarios such as smart finance, cloud technology, AI (Artificial Intelligence), intelligent transportation, and intelligent healthcare, and no limitation is made thereto.
[0075] At the same time, in the specific implementation manner of the present application, if data or information such as blocks and transactions involves objects, when the embodiments of the present application are applied to specific products or technologies, object permission or consent needs to be obtained, and the collection, use, and processing of relevant data or information need to comply with relevant laws, regulations, and standards of relevant countries and regions.
[0076] The following elaborates in detail on various implementation details of the technical solutions of the embodiments of the present application:
[0077] As Figure 3 shown, Figure 3 is a flowchart of a data processing method based on a blockchain shown in an embodiment of the present application. This method can be applied to Figure 1 the blockchain system shown. This method can be executed by each blockchain node in the blockchain system. In the embodiments of the present application, taking the example that this method is executed by the master node, the data processing method based on the blockchain may include S301 to S304, which are introduced in detail as follows:
[0078] S301. Construct a read set dictionary of the block based on the read set transaction parameters required for the execution of each transaction in the block, and construct a write set dictionary of the block based on the write set transaction parameters required for the update of each transaction.
[0079] In the embodiments of the present application, a block specifically refers to a block that has not yet reached consensus. The block needs to be added to the blockchain after consensus is successfully reached. A block contains multiple transactions, and the multiple transactions in the block are arranged in a certain order.
[0080] Among them, the arrangement order of each transaction in the block can be the order in which each transaction is written into the block, or the arrangement order obtained based on the importance of each transaction, which is not limited herein. The importance of a transaction can be determined according to information such as the amount of resources consumed by the transaction execution and whether the transaction is a cross-chain transaction, which will not be elaborated herein.
[0081] In addition, the read set dictionary of the block is used to represent the correspondence between each transaction parameter and the transaction that reads each transaction parameter; and the write set dictionary is used to represent the correspondence between each transaction parameter and the transaction that updates each transaction parameter.
[0082] In addition, since the aforementioned transaction parameter is a variable; therefore, the read set transaction parameter corresponding to each transaction in the embodiments of the present application specifically refers to the value of the transaction parameter required to be read during the execution of each transaction in the current world state. Similarly, the write set transaction parameter corresponding to each transaction in the embodiments of the present application specifically refers to the value of the transaction parameter required to be updated during the execution of each transaction in the current world state.
[0083] For example, in a financial scenario, the transaction parameters may include the total resources of the first company, the total resources of the second company, and the total resources of the third company. Among them, the first company is the parent company of the second company and the third company, the second company is a first-level subsidiary of the first company, and the third company is a second-level subsidiary of the first company.
[0084] At the same time, the block generated by the primary node may contain 4 transactions. Among them, the first transaction in the block (referred to as transaction 1 for short) represents that the second company applies to the resource storage institution for new resources to be added to the total resources of the second company based on the total resources of the first company; the second transaction in the block (referred to as transaction 2 for short) represents that the third company applies to the resource storage institution for new resources to be added to the total resources of the third company based on the total resources of the second company; the third transaction in the block (referred to as transaction 3 for short) represents that the third company applies to the resource storage institution for new resources to be added to the total resources of the third company based on the total resources of the first company; the fourth transaction in the block (referred to as transaction 4 for short) represents that the second company applies to the resource storage institution for new resources to be added to the total resources of the second company based on the total resources of the first company.
[0085] Please refer to the appendix Figure 4 which shows a schematic diagram of the update of a world state. As Figure 4As shown, in the current world state, the total resources of the first company are k1, the total resources of the second company are k2, and the total resources of the third company are k3. In the next world state, the total resources of the first company will be updated to v1, the total resources of the second company will be updated to v2, and the total resources of the third company will be updated to v3.
[0086] Therefore, please refer to the appendix Figure 5 , which shows a schematic diagram of the read and write sets of a transaction. Since in Transaction 1, new resources need to be applied to the resource storage institution based on the total resources of the first company. Therefore, executing Transaction 1 requires reading the total resources k1 of the first company. As Figure 5 shown, the read set transaction parameter corresponding to Transaction 1 is k1. Among them, "k1→v1" means that the read operation in Transaction 1 will affect the value v1 of the total resources of the first company in the next world state.
[0087] At the same time, since the new resources applied in Transaction 1 will be added to the total resources of the second company; therefore, Transaction 1 will update the total resources k2 of the second company during execution. As Figure 5 shown, the write set transaction parameter corresponding to Transaction 1 is k2. Among them, "k2→v2" means that the update operation in Transaction 2 will affect the value v2 of the total resources of the second company in the next world state.
[0088] The read set transaction parameters and write set transaction parameters corresponding to Transactions 2 to 4 are the same in principle, so they will not be elaborated here.
[0089] Based on the above Figures 4 to 5 example, please refer to the appendix Figure 6 , which shows a schematic diagram of a read set dictionary. Among them, Transactions 1 to 4 are respectively referred to by the numbers 1 to 4. From Figure 5 it can be seen that the transactions that need to read the transaction parameter k1 are Transaction 1, Transaction 3, and Transaction 4, the transaction that needs to read the transaction parameter k2 is Transaction 2, and there is no transaction that needs to read the transaction parameter k3.
[0090] Therefore, as Figure 6 shown in the read set dictionary 601 in , the transactions corresponding to the transaction parameter k1 are Transaction 1, Transaction 3, and Transaction 4; the transaction corresponding to the transaction parameter k2 is Transaction 2; there is no transaction corresponding to the transaction parameter k3.
[0091] Similarly, from Figure 5 it can be seen that there is no transaction that needs to update the transaction parameter k1, the transactions that need to update the transaction parameter k2 are Transaction 1 and Transaction 4, and the transactions that need to update the transaction parameter k3 are Transaction 2 and Transaction 3. Therefore, please refer to the appendix Figure 7 , which shows a schematic diagram of a write set dictionary. As Figure 7As shown in the write set dictionary 701, there is no corresponding transaction for the transaction parameter k1; the transactions corresponding to the transaction parameter k2 are transaction 1 and transaction 4; the transactions corresponding to the transaction parameter k3 are transaction 2 and transaction 3.
[0092] It should be noted that Figure 6 and Figure 7 are just one data structure form of the read set dictionary and the write set dictionary. The data structure forms of the read set dictionary and the write set dictionary can specifically also be tables, line charts, etc. The data structure forms of the read set dictionary and the write set dictionary are not limited herein.
[0093] S302. Based on the arrangement order of each transaction in the block, the read set transaction parameters and the write set transaction parameters corresponding to each transaction, construct the read set order diagram and the write set order diagram of the block.
[0094] In the embodiments of the present application, the read set order diagram is used to represent the number of prior transactions that need to read each transaction parameter corresponding to each transaction; and the write set order diagram is used to represent the number of prior transactions that need to update each transaction parameter corresponding to each transaction.
[0095] Specifically, each transaction parameter corresponding to each transaction can be the read set transaction parameter corresponding to each transaction or the write set transaction parameter corresponding to each transaction; the prior transaction refers to the transaction arranged before each transaction. Then, the read set order diagram can specifically be used to represent: the number of transactions arranged before each transaction and that need to read the read set transaction parameter corresponding to each transaction, and the number of transactions arranged before each transaction and that need to read the write set transaction parameter corresponding to each transaction.
[0096] At the same time, the write set order diagram can specifically be used to represent: the number of transactions arranged before each transaction and that need to update the read set transaction parameter corresponding to each transaction, and the number of transactions arranged before each transaction and that need to update the write set transaction parameter corresponding to each transaction.
[0097] In one embodiment, the construction process of the read set order diagram may include: for any transaction (specifically, each transaction in the block), obtain the transactions whose corresponding read set transaction parameters are the same as those of the any transaction; determine the number of transactions arranged before the any transaction among the obtained transactions; and select the transactions whose corresponding read set transaction parameters are the same as the write set transaction parameters of the any transaction; determine the number of transactions arranged before the any transaction among the selected transactions; finally, the read set order diagram can be generated based on the two obtained numbers.
[0098] In one embodiment, the construction process of the write set sequence diagram may include: for any transaction (specifically, each transaction in the block), obtaining the transaction whose corresponding write set transaction parameters are the same as the read set transaction parameters of any transaction; determining the number of transactions arranged before any transaction among the obtained transactions; and selecting the transaction whose corresponding write set transaction parameters are the same as the write set transaction parameters of any transaction; determining the number of transactions arranged before any transaction among the selected transactions; finally, a write set sequence diagram may be generated based on the two obtained quantities.
[0099] S303. Based on the read set dictionary, the write set dictionary, the read set sequence diagram, and the write set sequence diagram, construct the conflict bitmap of each transaction in parallel.
[0100] In the embodiments of the present application, the conflict bitmap of any transaction includes the transactions that have execution conflicts with the any transaction. The conflict bitmap of any transaction may include multiple cells, and each cell corresponds to each transaction in the block one by one. The value contained in each cell is used to represent whether the transaction corresponding to each cell has an execution conflict with the any transaction.
[0101] Among them, the execution conflict may include read-write conflict, write-write conflict, and write-read conflict. Specifically, if the transaction parameters required to be read when a transaction is executed are the transaction parameters required to be updated when another transaction is executed, it can be considered that there is a read-write conflict between these two transactions. If the transaction parameters required to be updated when a transaction is executed are the transaction parameters required to be updated when another transaction is executed, it can be considered that there is a write-write conflict between these two transactions. If the transaction parameters required to be updated when a transaction is executed are the transaction parameters required to be read when another transaction is executed, it can be considered that there is a write-read conflict between these two transactions.
[0102] It should be noted that if the transaction parameters required to be read when a transaction is executed are the transaction parameters required to be read when another transaction is executed, it can also be stated that there is a read-read conflict between these two transactions. However, since the read-read conflict does not affect the execution order of the two transactions, it is not included in the execution conflict.
[0103] For example, please refer to the appendix Figure 8 , which shows a schematic diagram of an execution conflict. As Figure 8 shown, the read set transaction parameters corresponding to transaction 1 and the read set transaction parameters corresponding to transaction 3 are both k1, then there is a read-read conflict between transaction 1 and transaction 3; however, since the read-read conflict does not affect the execution order, it is not included in the execution conflict. The write set transaction parameters corresponding to transaction 1 and the read set transaction parameters corresponding to transaction 2 are both k2, then there is a read-write conflict between transaction 1 and transaction 2.
[0104] Meanwhile, the write set transaction parameters corresponding to Transaction 2 and the write set transaction parameters corresponding to Transaction 3 are both k3, so there is a write-write conflict between Transaction 2 and Transaction 3. The read set transaction parameters corresponding to Transaction 2 and the write set transaction parameters corresponding to Transaction 4 are both k2, so there is a write-read conflict between Transaction 2 and Transaction 3. The write set transaction parameters corresponding to Transaction 1 and the write set transaction parameters corresponding to Transaction 4 are both k2, so there is a write-write conflict between Transaction 1 and Transaction 4.
[0105] S304. Construct a directed acyclic graph of the block based on the conflict bitmap of each transaction.
[0106] In the embodiment of the present application, the directed acyclic graph of the block is used to represent the corresponding relationship between any transaction in the block and the transactions that have execution conflicts with any transaction. Since the conflict bitmap of a transaction can clearly represent which transactions have execution conflicts with this transaction. Therefore, based on the conflict bitmaps of all transactions included in the comprehensive block, the directed acyclic graph of the block can be directly constructed.
[0107] Optionally, after obtaining the directed acyclic graph of the block, the master node can also determine the execution order of each transaction in the block based on the obtained directed acyclic graph; then, send the block and the execution order of each transaction to the slave nodes in the blockchain, so that the slave nodes verify the block based on the execution order of each transaction to obtain the verification result of the block; finally, the master node can receive the verification result sent by the slave node and perform consensus on the block according to the received verification result.
[0108] Further, the specific process of the master node sending the block and the execution order of each transaction to the slave nodes in the blockchain may include: the master node adds the execution order of each transaction to the block to obtain an updated block; then, the master node sends the updated block to the slave nodes.
[0109] Further, if the number of verification results indicating successful transaction verification in the verification results received by the master node is greater than or equal to the specified number threshold, it can be determined that the block consensus is successful; then, the master node can perform on-chain processing on this block. If the number of verification results indicating successful transaction verification in the verification results received by the master node is less than the specified number threshold, it can be determined that the block consensus fails; then, the master node can perform clearing processing on this block. Among them, the specified number threshold can be set manually or set by any blockchain node in the above blockchain system, which is not limited here.
[0110] In a possible implementation, steps S301 to 304 can also be applied to slave nodes in a blockchain system. Specifically, after receiving a block, a slave node can execute steps S301 to 304 to obtain a directed acyclic graph of the block; then, based on the obtained directed acyclic graph, the slave node determines the execution order of each transaction in the block; finally, the slave node executes the transactions in the block based on the execution order of each transaction to verify the block and obtain a verification result of the block.
[0111] Optionally, the slave node can also send the verification result of the block to the master node so that the master node can perform consensus on the block according to the received verification result.
[0112] In the embodiments of the present application, when constructing the conflict bitmap of each transaction, by using the previously constructed read set dictionary, write set dictionary, read set order graph, and write set order graph, it is not necessary to rely on the execution conflict situation of the transactions arranged before each transaction when constructing the conflict bitmap of each transaction. Thus, it is possible to construct the conflict bitmap of each transaction in parallel. It can be seen that compared with the existing solutions that need to serially judge the execution conflict situation of transactions, the embodiments of the present application can greatly shorten the time required to judge the execution conflict situation by constructing the conflict bitmap of each transaction in parallel, thereby achieving the purpose of improving the construction speed of the directed acyclic graph.
[0113] Furthermore, the faster the construction speed of the directed acyclic graph, the faster the subsequent slave nodes can receive the blocks to be consensus and verify the blocks. Therefore, by improving the construction speed of the directed acyclic graph, the embodiments of the present application are beneficial to shortening the overall time required for block consensus, thereby improving the overall performance of the blockchain system, and further beneficial to improving the ability of the blockchain to handle massive data scenarios.
[0114] In addition, when constructing the conflict bitmap of each transaction in the embodiments of the present application, it is not necessary to rely on the execution conflict situation of the transactions arranged before each transaction; then, even if there is an error in the conflict bitmap of the previous transaction, it will not affect the accuracy of the conflict bitmap of the subsequent transaction. Therefore, the solution of constructing the conflict bitmap of each transaction in parallel in the embodiments of the present application has robustness and stability.
[0115] In addition, although the construction of the read set dictionary, write set dictionary, read set order graph, and write set order graph also takes some time; they can also be constructed in parallel, that is, the write set dictionary, read set order graph, and write set order graph are constructed simultaneously, so the actual construction time required in the embodiments of the present application is also much less than that of the existing solutions.
[0116] In an embodiment of the present application, as Figure 9 shown, there is provided another flow schematic diagram of a data processing method based on a blockchain, and this method can be applied to Figure 1The blockchain system shown, this method can be executed by each blockchain node in the blockchain system. In the embodiments of this application, taking the execution of this method by the master node as an example for illustration, this data processing method based on blockchain is Figure 3 an extension based on the method shown.
[0117] Among them, S901 to S907 are introduced in detail as follows:
[0118] S901. Construct a read set dictionary of the block based on the read set transaction parameters required for each transaction execution in the block, and construct a write set dictionary of the block based on the write set transaction parameters required for each transaction execution.
[0119] In the embodiments of this application, the specific implementation manner of step S901 can refer to the specific implementation manner of step S301 in the above embodiments, which will not be elaborated here.
[0120] S902. Construct a read set order graph and a write set order graph of the block based on the arrangement order of each transaction in the block, the read set transaction parameters and the write set transaction parameters corresponding to each transaction.
[0121] In the embodiments of this application, the specific construction process of the read set order graph and the write set order graph may include: 1) Construct a read set dictionary based on the read set transaction parameters corresponding to each transaction, and construct a write set dictionary based on the write set transaction parameters corresponding to each transaction; 2) Construct a read set order graph of the block according to the read set dictionary and the transactions arranged before each transaction; 3) Construct a write set order graph of the block according to the write set dictionary and the transactions arranged before each transaction.
[0122] Among them, the construction methods of the read set dictionary and the write set dictionary can specifically refer to the specific implementation manner of step S301 in the above embodiments, which will not be elaborated here.
[0123] In one embodiment, the specific process of constructing a read set order graph of the block according to the read set dictionary and the transactions arranged before each transaction may include: First, construct a read set initial graph according to the number of transactions in the read set dictionary whose corresponding transaction parameters are the same as the read set transaction parameters of each transaction and are arranged before each transaction; Second, update the read set initial graph according to the number of transactions in the read set dictionary whose corresponding transaction parameters are the same as the write set transaction parameters of each transaction and are arranged before each transaction, to obtain the read set order graph of the block.
[0124] In specific implementation, based on Figures 6 to 7 the read set dictionary and the write set dictionary shown in Figure 10 , please refer to the appendix Figure 10As shown, the row headers in the initial read set diagram 1001 are transactions, and each row represents transactions 1 to 4 respectively; the column headers are transaction parameters, and each row represents k1, k2, and k3 respectively.
[0125] As Figure 6 shown, the read set transaction parameter of transaction 1 is k1, and the transaction parameters corresponding to transactions 3 and 4 in the read set dictionary 601 are also k1; then, among the transactions with the same transaction parameter as the read set transaction parameter of transaction 1, there is no transaction arranged before transaction 1. Therefore, as shown in the initial read set diagram 1001, the position corresponding to transaction parameter k1 of transaction 1 can be updated to 0, which means the number of prior transactions that need to read the read set transaction parameter corresponding to transaction 1 is 0. Similarly, the position corresponding to transaction parameter k2 of transaction 2 in the initial read set diagram 1001 is 0.
[0126] Then, as Figure 6 shown, the read set transaction parameter of transaction 3 is k1, and the transaction parameters corresponding to transactions 1 and 4 in the read set dictionary 601 are also k1; and among these transactions, only transaction 1 is arranged before transaction 3. Therefore, as shown in the initial read set diagram 1001, the position corresponding to transaction parameter k1 of transaction 3 can be updated to 1, which means the number of prior transactions that need to read the read set transaction parameter corresponding to transaction 3 is 1. Similarly, the position corresponding to transaction parameter k1 of transaction 4 in the initial read set diagram 1001 is 2.
[0127] After that, as Figure 7 shown, the transaction parameter corresponding to transaction 1 in the write set dictionary (i.e., the write set transaction parameter) is k2; and in the read set dictionary 601 as Figure 6 shown, the transaction parameter corresponding to transaction 2 is also k2; since transaction 2 is arranged after transaction 1, there is no transaction arranged before transaction 1 among the transactions with the same transaction parameter as the write set transaction parameter of transaction 1. Therefore, as shown in the read set sequence diagram 1002, the position corresponding to transaction parameter k2 of transaction 1 can be updated to 0, which means the number of prior transactions that need to read the write set transaction parameter corresponding to transaction 1 is 0. Similarly, the position corresponding to transaction parameter k3 of transaction 2 in the initial read set diagram 1001 can be 0, and the position corresponding to transaction parameter k3 of transaction 3 can be 0.
[0128] Finally, as Figure 7 shown, the transaction parameter corresponding to transaction 4 in the write set dictionary 701 is k2; and in the read set dictionary 601 as Figure 6 shown, the transaction parameter corresponding to transaction 2 is also k2; since transaction 2 is arranged before transaction 4. Therefore, as shown in the read set sequence diagram 1002, the position corresponding to transaction parameter k2 of transaction 4 can be updated to 1, which means the number of prior transactions that need to read the write set transaction parameter corresponding to transaction 4 is 1.
[0129] In one embodiment, the specific process of constructing the write set order graph of a block according to the write set dictionary and the transactions arranged before each transaction may include: First, construct an initial write set graph according to the transaction parameters corresponding in the write set dictionary being the same as the write set transaction parameters of each transaction and the number of transactions arranged before each transaction; Second, update the initial write set graph according to the transaction parameters corresponding in the write set dictionary being the same as the read set transaction parameters of each transaction and the number of transactions arranged before each transaction, to obtain the read set order graph of the block.
[0130] In a specific implementation, based on Figures 6 to 7 the read set dictionary and write set dictionary shown in Figure 11 , please refer to the appendix Figure 11 , which shows a schematic diagram of the construction process of a write set order graph. As
[0131] shown, the row headers in the initial write set graph 1101 are transactions, and each row is transaction 1 to 4 respectively; the column headers are transaction parameters, and each row is k1, k2, and k3 respectively.
[0131] As Figure 7 shown, the write set transaction parameter of transaction 1 is k2, and the transaction parameter corresponding to transaction 4 in the write set dictionary 701 is also k2; and transaction 4 is arranged after transaction 1. Therefore, as shown in the initial write set graph 1101, the position corresponding to transaction parameter k2 of transaction 1 can be updated to 0, which means that the number of prior transactions that need to update the write set transaction parameter corresponding to transaction 1 is 0. Similarly, the position corresponding to transaction parameter k3 of transaction 2 in the initial write set graph 1101 is 0, the position corresponding to transaction parameter k3 of transaction 3 is 1, and the position corresponding to transaction parameter k2 of transaction 4 is 1.
[0132] After that, as Figure 6 shown, the transaction parameter (i.e., the write set transaction parameter) corresponding to transaction 1 in the read set dictionary 601 is k1; and Figure 7 in the write set dictionary 701 shown, there is no transaction corresponding to the transaction parameter k1. Therefore, as shown in the write set order graph 1102, the position corresponding to transaction parameter k1 of transaction 1 can be updated to 0, which means that the number of prior transactions that need to update the write set transaction parameter corresponding to transaction 1 is 0. Similarly, the position corresponding to transaction parameter k2 of transaction 2 in the write set order graph 1102 is 1, the position corresponding to transaction parameter k1 of transaction 3 is 0, and the position corresponding to transaction parameter k1 of transaction 4 is 0.
[0133] S903. Generate the read-write conflict results of each transaction in parallel based on the read set transaction parameters, write set dictionary, and write set order graph of each transaction.
[0134] In the embodiments of the present application, the read-write conflict result of each transaction is used to represent whether there is a read-write conflict in each transaction. Optionally, when the read-write conflict result of any transaction is used to represent that there is a read-write conflict, the read-write conflict result of any transaction may specifically include the identification information of the transaction that has a read-write conflict with any transaction. Among them, the transaction identification information is used to uniquely identify a transaction. The transaction identification information may be a number, a character, a field, which is not limited herein. For example, referring to Figure 6 In the example, the transaction identification of the first transaction in the block may be "1".
[0135] In one embodiment, the generation process of the read-write conflict result of each transaction may specifically include: obtaining the transaction corresponding to the read set transaction parameter of each transaction in the write set dictionary; if the obtained transaction includes a transaction other than each transaction, obtaining the first quantity corresponding to each transaction in the write set sequence diagram; generating the read-write conflict result of each transaction based on the relationship between the first quantity and the first preset threshold.
[0136] Among them, the first quantity is used to represent the number of prior transactions that need to update the read set transaction parameter of each transaction; the first preset threshold may be set manually or set by any blockchain node in the above blockchain system, which is not limited herein.
[0137] Optionally, the specific process of generating the read-write conflict result of each transaction based on the relationship between the first quantity and the first preset threshold may include: if the first quantity is greater than the first preset threshold, selecting the transaction arranged before each transaction from the obtained transactions, and generating a read-write conflict result for representing that there is a read-write conflict based on the arrangement order of each transaction in the block and the selected transactions; if the first quantity is less than or equal to the first preset threshold, generating a read-write conflict result for representing that there is no read-write conflict.
[0138] Optionally, since it is mentioned above that the read-write conflict result of any transaction may specifically include the identification information of the transaction that has a read-write conflict with any transaction. Then, for any transaction, the specific process of generating a read-write conflict result based on the arrangement order of any transaction in the block and the corresponding selected transactions may include: obtaining a target transaction from the selected transactions based on the arrangement order of any transaction in the block; generating a read-write conflict result for representing that there is a read-write conflict according to the identification information of the target transaction.
[0139] Among them, the number of target transactions is the same as the first quantity, and the difference in the arrangement serial number between the target transaction and any transaction is less than the difference in the arrangement serial number between other transactions and any transaction among the selected transactions.
[0140] S904. Based on the write set transaction parameter, the write set dictionary, and the write set sequence diagram of each transaction, generate the write-write conflict result of each transaction in parallel.
[0141] In an embodiment of the present application, the write-write conflict result of each transaction is used to characterize whether there is a write-write conflict in each transaction. Optionally, when the write-write conflict result of any transaction is used to characterize the existence of a write-write conflict, the write-write conflict result of any transaction may specifically include the identification information of the transaction that has a write-write conflict with any transaction.
[0142] In one embodiment, the generation process of the write-write conflict result of each transaction may specifically include: obtaining the transaction corresponding to the write set transaction parameter of each transaction in the write set dictionary; if the obtained transaction includes a transaction other than each transaction, obtaining the second quantity corresponding to each transaction in the write set order diagram; and generating the write-write conflict result of each transaction based on the relationship between the second quantity and the second preset threshold.
[0143] Wherein, the second quantity is used to characterize the number of prior transactions that need to update the write set transaction parameter of each transaction; the second preset threshold may be set manually or by any blockchain node in the above blockchain system, and is not limited herein.
[0144] Optionally, the specific process of generating the write-write conflict result of each transaction based on the relationship between the second quantity and the second preset threshold may include: if the second quantity is greater than the second preset threshold, selecting the transactions arranged before each transaction from the obtained transactions, and generating a write-write conflict result for characterizing the existence of a write-write conflict based on the arrangement order of each transaction in the block and the selected transactions; if the second quantity is less than or equal to the second preset threshold, generating a write-write conflict result for characterizing the non-existence of a write-write conflict.
[0145] Optionally, since the write-write conflict result of any transaction may specifically include the identification information of the transaction that has a write-write conflict with any transaction as mentioned above. Then, for any transaction, the specific process of generating a write-write conflict result based on the arrangement order of any transaction in the block and the corresponding selected transactions may include: obtaining a specified transaction from the selected transactions based on the arrangement order of any transaction in the block; and generating a write-write conflict result for characterizing the existence of a write-write conflict according to the transaction identification information of the specified transaction.
[0146] Wherein, the number of specified transactions is the same as the second quantity, and the difference in the arrangement serial number between the specified transaction and any transaction is less than the difference in the arrangement serial number between other transactions in the selected transactions and any transaction.
[0147] S905. Based on the write set transaction parameter, read set dictionary, and read set order diagram of each transaction, generate the write-read conflict result of each transaction in parallel.
[0148] In the embodiments of the present application, the write-read conflict result of each transaction is used to characterize whether there is a write-read conflict in each transaction. Optionally, when the write-read conflict result of any transaction is used to characterize the existence of a write-read conflict, the write-read conflict result of any transaction may specifically include the identification information of the transaction that has a write-read conflict with any transaction.
[0149] In one embodiment, the generation process of the write-read conflict result of each transaction may specifically include: obtaining the transaction corresponding to the write set transaction parameter of each transaction in the read set dictionary; if the obtained transaction includes a transaction other than each transaction, obtaining the third quantity corresponding to each transaction in the read set order diagram; and generating the write-read conflict result of each transaction based on the relationship between the third quantity and the third preset threshold.
[0150] Wherein, the third quantity is used to characterize the number of prior transactions that need to read the write set transaction parameter of each transaction; the third preset threshold may be set manually or set by any blockchain node in the above blockchain system, and is not limited herein.
[0151] Optionally, the specific process of generating the write-read conflict result of each transaction based on the relationship between the third quantity and the third preset threshold may include: if the third quantity is greater than the third preset threshold, selecting the transactions arranged before each transaction from the obtained transactions, and generating a write-read conflict result for characterizing the existence of a write-read conflict based on the arrangement order of each transaction in the block and the selected transactions; if the third quantity is less than or equal to the third preset threshold, generating a write-read conflict result for characterizing the non-existence of a write-read conflict.
[0152] Optionally, since the write-read conflict result of any transaction mentioned above may specifically include the identification information of the transaction that has a write-read conflict with any transaction. Then, for any transaction, the specific process of generating the write-read conflict result based on the arrangement order of any transaction in the block and the corresponding selected transactions may include: obtaining a reference transaction from the selected transactions based on the arrangement order of any transaction in the block; and generating a write-read conflict result for characterizing the existence of a write-read conflict according to the transaction identification information of the reference transaction.
[0153] Wherein, the number of reference transactions is the same as the third quantity, and the difference in the arrangement serial number between the write-read transaction and any transaction is less than the difference in the arrangement serial number between other transactions in the selected transactions and any transaction.
[0154] S906. Parallelly construct the conflict bitmap of each transaction according to the write-read conflict result, write-write conflict result, and write-read conflict result of each transaction.
[0155] In the embodiments of the present application, the construction process of the conflict bitmap for each transaction may include: First, for each transaction, construct the initial bitmap of the transaction; wherein, the initial bitmap of the transaction includes a plurality of cells to be assigned values, and each cell corresponds to each transaction in the block one by one. Then, based on the read-write conflict result, write-write conflict result, and write-read conflict result of the transaction, assign values to the cells in the initial bitmap for the transaction to obtain the conflict bitmap of the transaction.
[0156] Optionally, since the identification information of the transaction that generates the corresponding conflict with any transaction may also be included in each conflict result of any transaction mentioned in steps S903 to S905. Therefore, the assignment process may specifically include: If it is detected that the read-write conflict result, write-write conflict result, or write-read conflict result of each transaction contains identification information, then update the target cell in the initial bitmap to the conflict parameter to obtain the conflict bitmap of each transaction.
[0157] Wherein, the transaction corresponding to the target cell matches the transaction indicated by the detected identification information, and the conflict parameter is used to characterize that there is an execution conflict between each transaction and the transaction corresponding to the target cell.
[0158] Optionally, in order to further shorten the time required to construct the conflict bitmap for each transaction, steps S904 to S905 may be executed in parallel. Further, steps S904 to S906 may also be executed in parallel, which is not limited herein.
[0159] In specific implementation, based on the read set dictionary 601, write set dictionary 701, read set sequence diagram 1002, and write set sequence diagram 1102 respectively shown in the above Figure 6 、 Figure 7 、 Figure 10 and Figure 11 , please refer to Appendix Figure 12 , which shows a schematic diagram of the construction process of a conflict bitmap. The first preset threshold, the second preset threshold, and the third preset threshold can be preset to be all 0. As Figure 12 shows, an initial bitmap 1201 can be constructed for transaction 1. Among them, the four cells from right to left in the initial bitmap 1201 correspond to transaction 1, transaction 2, transaction 3, and transaction 4 respectively.
[0160] As Figure 12 in case (a) shows, the read set transaction parameter k1 of transaction 1 does not have a corresponding transaction in the write set dictionary 701; therefore, the read-write conflict result of transaction 1 is used to characterize that there is no read-write conflict.
[0161] As Figure 12As shown in case (b) in, the write set transaction parameter k2 of transaction 1 corresponds to transaction 4 in addition to transaction 1 in the write set dictionary 701. Then, subsequently, according to the write set sequence diagram 1102, it can be determined that the number of prior transactions that need to update the write set transaction parameter k2 of transaction 1 is 0, which is equal to the second preset threshold. Therefore, the write-write conflict result of transaction 1 is used to indicate that there is no write-write conflict.
[0162] As Figure 12 shown in case (c) in, the write set transaction parameter k2 of transaction 1 corresponds to transaction 2 in the read set dictionary 601. Then, subsequently, according to the read set sequence diagram 1002, it can be determined that the number of prior transactions that need to read the write set transaction parameter k2 of transaction 1 is 0, which is equal to the third preset threshold. Therefore, the write-read conflict result of transaction 1 is used to indicate that there is no write-read conflict.
[0163] Finally, since the read-write conflict result, write-write conflict result, and write-read conflict result of transaction 1 do not contain any identification information. Therefore, there are no cells in the conflict bitmap 1202 of transaction 1 obtained after updating the initial bitmap 1201 that are assigned conflict parameters.
[0164] Based on Figure 12 the example in, please refer to the appendix Figure 13 , which shows a schematic diagram of another construction process of the conflict bitmap. The conflict parameter can be preset to "1".
[0165] As Figure 13 shown in case (a) in, the read set transaction parameter k2 of transaction 2 corresponds to transaction 1 and transaction 4 in the write set dictionary 701; then, subsequently, according to the write set sequence diagram 1102, it can be determined that the number of prior transactions that need to update the read set transaction parameter k2 of transaction 2 is 1, which is greater than the first preset threshold. Among them, transaction 1 is arranged before transaction 2. Therefore, the read-write conflict result of transaction 2 contains the identification information of transaction 1 that has a read-write conflict with transaction 2.
[0166] As Figure 13 shown in case (b) in, the write set transaction parameter k3 of transaction 2 corresponds to transaction 3 in addition to transaction 2 in the write set dictionary 701. Then, subsequently, according to the write set sequence diagram 1102, it can be determined that the number of prior transactions that need to update the write set transaction parameter k3 of transaction 2 is 0, which is equal to the second preset threshold. Therefore, the write-write conflict result of transaction 2 is used to indicate that there is no write-write conflict.
[0167] As Figure 13 shown in case (c) in, the write set transaction parameter k3 of transaction 2 does not correspond to any transaction in the read set dictionary 601. Therefore, the write-read conflict result of transaction 2 is used to indicate that there is no write-read conflict
[0168] Finally, the identification information of Transaction 1 can be detected in the read-write conflict result, write-write conflict result, and write-read conflict result of Transaction 2. Therefore, in the conflict bitmap 1302 of Transaction 2 obtained after updating the initial bitmap 1301, only the cell corresponding to Transaction 1 is assigned the conflict parameter "1".
[0169] The construction process of the conflict bitmaps of other transactions can refer to the construction processes of the conflict bitmaps of Transaction 1 and Transaction 2 above, which will not be elaborated here.
[0170] S907. Construct a directed acyclic graph of the block based on the conflict bitmap of each transaction.
[0171] In addition, for the specific implementation manner of step S907, reference can be made to the specific implementation manner of step S304 in the above embodiments, which will not be elaborated here.
[0172] In specific implementation, based on Figure 12 and Figure 13 in the example, please refer to the appendix Figure 14 , which shows a schematic diagram of the construction process of a directed acyclic graph. As Figure 14 shown, the above example can obtain four conflict bitmaps corresponding to Transaction 1 to Transaction 4 respectively. Among them, since the conflict bitmap 1402 of Transaction 1 indicates that there is no transaction in conflict with Transaction 1 during execution. Therefore, there is no other transaction corresponding to Transaction 1 in the directed acyclic graph 1401 of the block.
[0173] Since the conflict bitmap 1403 of Transaction 1 indicates that Transaction 2 is in conflict with Transaction 1 during execution. Therefore, the transaction corresponding to Transaction 2 in the directed acyclic graph 1401 of the block is Transaction 1. Since the conflict bitmap 1404 of Transaction 3 indicates that Transaction 2 is in conflict with Transaction 3 during execution. Therefore, the transaction corresponding to Transaction 3 in the directed acyclic graph 1401 of the block is Transaction 2. Since the conflict bitmap 1405 of Transaction 4 indicates that both Transaction 1 and Transaction 2 are in conflict with Transaction 3 during execution. Therefore, the transactions corresponding to Transaction 4 in the directed acyclic graph 1401 of the block are Transaction 1 and Transaction 2.
[0174] In the embodiments of the present application, by generating the read-write conflict results, write-write conflict results, and write-read conflict results of each transaction in parallel, compared with the need to sequentially generate all the conflict results of each transaction, the time required to determine all the conflict results of all transactions can be effectively shortened. It is beneficial to construct the conflict bitmap of each transaction earlier subsequently. At the same time, in the embodiments of the present application, by constructing the conflict bitmap of each transaction in parallel, compared with the solution of sequentially determining the conflict bitmap of each transaction, the time required to determine and construct the conflict bitmaps of all transactions can also be effectively shortened. It is beneficial to construct the directed acyclic graph of the block earlier subsequently, thereby being beneficial to further improving the construction speed of the directed acyclic graph.
[0175] An apparatus embodiment of the present application is introduced herein, which can be used to execute the method of the blockchain-based data processing system in the above embodiments of the present application. For details not disclosed in the apparatus embodiment of the present application, please refer to the embodiments of the above-mentioned blockchain-based data processing system method of the present application.
[0176] An embodiment of the present application provides a blockchain-based data processing apparatus. As Figure 15 shown, the apparatus includes an initial construction unit 1501, a parallel construction unit 1502, and a processing unit 1503, where:
[0177] The initial construction unit 1501 is configured to construct a read set dictionary of a block based on read set transaction parameters required for each transaction execution in the block, and construct a write set dictionary of the block based on write set transaction parameters required for each transaction execution.
[0178] The initial construction unit 1501 is configured to construct a read set order graph and a write set order graph of the block based on the arrangement order of each transaction in the block, the read set transaction parameters, and the write set transaction parameters corresponding to each transaction; wherein, the read set order graph is used to represent the number of prior transactions that need to read each transaction parameter corresponding to each transaction, and the write set order graph is used to represent the number of prior transactions that need to update each transaction parameter corresponding to each transaction.
[0179] The parallel construction unit 1502 is configured to construct a conflict bitmap for each transaction in parallel based on the read set dictionary, the write set dictionary, the read set order graph, and the write set order graph; wherein, the conflict bitmap of any one transaction includes transactions that have execution conflicts with any one transaction.
[0180] The processing unit 1503 is configured to construct a directed acyclic graph of the block based on the conflict bitmap of each transaction.
[0181] In an embodiment of the present application, based on the foregoing solution, when the parallel construction unit 1502 constructs a conflict bitmap for each transaction in parallel based on the read set dictionary, the write set dictionary, the read set order graph, and the write set order graph, it can be specifically configured to: generate read-write conflict results for each transaction in parallel based on the read set transaction parameters, the write set dictionary, and the write set order graph of each transaction; generate write-write conflict results for each transaction in parallel based on the write set transaction parameters, the write set dictionary, and the write set order graph of each transaction; generate write-read conflict results for each transaction in parallel based on the write set transaction parameters, the read set dictionary, and the read set order graph of each transaction; and construct a conflict bitmap for each transaction in parallel according to the read-write conflict results, the write-write conflict results, and the write-read conflict results of each transaction.
[0182] In an embodiment of the present application, based on the foregoing solution, in the process of generating the first conflict result of each transaction, the parallel construction unit 1502 may specifically be configured to: obtain the transaction corresponding to the read set transaction parameter of each transaction in the write set dictionary; if the obtained transaction includes a transaction other than each transaction, obtain the first quantity corresponding to each transaction in the write set order diagram; wherein the first quantity is used to represent the number of prior transactions that need to update the read set transaction parameter of each transaction; based on the relationship between the first quantity and the first preset threshold, generate the read-write conflict result of each transaction.
[0183] In an embodiment of the present application, based on the foregoing solution, when the parallel construction unit 1502 generates the read-write conflict result of each transaction based on the relationship between the first quantity and the first preset threshold, it may specifically be configured to: if the first quantity is greater than the first preset threshold, select the transactions arranged before each transaction from the obtained transactions, and generate a read-write conflict result used to represent the existence of a read-write conflict based on the arrangement order of each transaction in the block and the selected transactions; if the first quantity is less than or equal to the first preset threshold, generate a read-write conflict result used to represent the non-existence of a read-write conflict.
[0184] In an embodiment of the present application, based on the foregoing solution, in the process of generating the write-write conflict result of each transaction, the parallel construction unit 1502 may specifically be configured to: obtain the transaction corresponding to the write set transaction parameter of each transaction in the write set dictionary; if the obtained transaction includes a transaction other than each transaction, obtain the second quantity corresponding to each transaction in the write set order diagram; wherein the second quantity is used to represent the number of prior transactions that need to update the write set transaction parameter of each transaction; based on the relationship between the second quantity and the second preset threshold, generate the write-write conflict result of each transaction.
[0185] In an embodiment of the present application, based on the foregoing solution, in the process of generating the write-read conflict result of each transaction, the parallel construction unit 1502 may specifically be configured to: obtain the transaction corresponding to the write set transaction parameter of each transaction in the read set dictionary; if the obtained transaction includes a transaction other than each transaction, obtain the third quantity corresponding to each transaction in the read set order diagram; wherein the third quantity is used to represent the number of prior transactions that need to read the write set transaction parameter of each transaction; based on the relationship between the third quantity and the third preset threshold, generate the write-read conflict result of each transaction.
[0186] In one embodiment of the present application, based on the foregoing solution, when the parallel construction unit 1502 constructs the conflict bitmap of each transaction in parallel according to the read-write conflict result, write-write conflict result, and write-read conflict result of each transaction, it can be specifically configured as follows: for each transaction, construct an initial bitmap of the transaction; wherein, the initial bitmap of the transaction includes a plurality of cells to be assigned, and each cell corresponds to each transaction in the block; based on the read-write conflict result, write-write conflict result, and write-read conflict result of the transaction, assign values to the cells in the initial bitmap for the transaction to obtain the conflict bitmap of the transaction.
[0187] In one embodiment of the present application, based on the foregoing solution, when the initial construction unit 1501 constructs the read set order diagram and write set order diagram of the block based on the arrangement order of each transaction in the block, the read set transaction parameters, and the write set transaction parameters corresponding to each transaction, it can be specifically configured as follows: construct a read set dictionary based on the read set transaction parameters corresponding to each transaction, and construct a write set dictionary based on the write set transaction parameters corresponding to each transaction; construct the read set order diagram of the block according to the read set dictionary and the transactions arranged before each transaction; construct the write set order diagram of the block according to the write set dictionary and the transactions arranged before each transaction.
[0188] In one embodiment of the present application, based on the foregoing solution, when the initial construction unit 1501 constructs the read set order diagram of the block according to the read set dictionary and the transactions arranged before each transaction, it can be specifically configured as follows: construct a read set initial diagram according to the number of transactions in the read set dictionary whose corresponding transaction parameters are the same as the read set transaction parameters of each transaction and are arranged before each transaction; update the read set initial diagram according to the number of transactions in the read set dictionary whose corresponding transaction parameters are the same as the write set transaction parameters of each transaction and are arranged before each transaction to obtain the read set order diagram of the block.
[0189] According to one embodiment of the present application, Figure 3 and Figure 9 each step involved in the method shown Figure 15 can be executed by each unit in the blockchain-based data processing device shown.
[0190] According to another embodiment of the present application, Figure 15Each unit in the blockchain-based data processing device shown is divided based on logical functions. The above-mentioned units can be separately or entirely combined into one or several other units to form, or a certain one (or some) of the units can be further split into multiple smaller units in terms of function to form, which can achieve the same operations without affecting the realization of the technical effects of the embodiments of this application. In other embodiments of this application, the above-mentioned blockchain-based data processing device may also include other units. In practical applications, these functions can also be assisted by other units and can be achieved through the cooperation of multiple units.
[0191] According to another embodiment of this application, it can be achieved by running a computer program (including program code) capable of executing each step involved in the method shown on a general computing device such as a computer device including processing elements and storage elements such as a central processing unit (CPU), a random access storage medium (RAM), and a read-only storage medium (ROM). Figure 3 or Figure 9 shown to construct the blockchain-based data processing device shown as Figure 15 shown, and to implement the blockchain-based data processing method of the embodiments of this application. The computer program can be recorded on, for example, a computer storage medium, loaded into the above-mentioned computer device through the computer storage medium, and run therein.
[0192] It should be noted that the device provided in the above embodiment and the method provided in the above embodiment belong to the same concept. The specific manners in which each module and unit perform operations have been described in detail in the method embodiment, and will not be elaborated here.
[0193] The device provided in the above embodiment can be disposed in a terminal device or in a server. When constructing the conflict bitmap for each transaction, the device provided in the embodiments of this application, through the previously constructed read set dictionary, write set dictionary, read set sequence diagram, and write set sequence diagram, enables the construction of the conflict bitmap for each transaction without relying on the execution conflict situations of the transactions arranged before each transaction. Thus, it is possible to construct the conflict bitmap for each transaction in parallel. It can be seen that compared with the existing solutions that need to serially judge the execution conflict situations of transactions, the embodiments of this application can greatly shorten the time required to judge the execution conflict situations by constructing the conflict bitmap for each transaction in parallel, thereby achieving the purpose of improving the construction speed of the directed acyclic graph.
[0194] The embodiments of this application also provide an electronic device, including one or more processors and a storage device. Among them, the storage device is used to store one or more computer programs. When the one or more computer programs are executed by the one or more processors, the electronic device realizes the above-mentioned blockchain-based data processing method.
[0195] Figure 16 The structural schematic diagram of a computer system of an electronic device suitable for implementing the embodiments of the present application is shown.
[0196] It should be noted that Figure 16 The computer system 1600 of the shown electronic device is only an example, and should not impose any limitations on the functions and usage scope of the embodiments of the present application.
[0197] Such as Figure 16 As shown, the computer system 1600 includes a processor (Central Processing Unit, CPU) 1601, which can perform various appropriate actions and processes according to the program stored in the read-only memory (Read-Only Memory, ROM) 1602 or the program loaded from the storage section 1608 into the random access memory (Random Access Memory, RAM) 1603, such as executing the method in the above embodiments. In the RAM 1603, various programs and data required for system operations are also stored. The CPU 1601, ROM 1602, and RAM 1603 are connected to each other via a bus 1604. The input / output (Input / Output, I / O) interface 1605 is also connected to the bus 1604.
[0198] In some embodiments, the following components are connected to the I / O interface 1605: an input section 1606 including a keyboard, a mouse, etc.; an output section 1607 including such as a cathode ray tube (Cathode Ray Tube, CRT), a liquid crystal display (Liquid Crystal Display, LCD), etc. and a speaker; a storage section 1608 including a hard disk, etc.; and a communication section 1609 including a network interface card such as a LAN (Local Area Network, local area network) card, a modem, etc. The communication section 1609 performs communication processing via a network such as the Internet. A drive 1610 is also connected to the I / O interface 1605 as needed. A removable medium 1611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1610 as needed, so that the computer program read from it can be installed into the storage section 1608 as needed.
[0199] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer program. For example, an embodiment of the present application includes a computer program product that includes a computer program carried on a computer-readable medium, and the computer program includes a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication section 1609 and / or installed from the removable medium 1611. When the computer program is executed by the processor (CPU) 1601, various functions defined in the system of the present application are executed.
[0200] It should be noted that the computer-readable medium shown in the embodiments of the present application can be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable computer program. Such a propagated data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal medium can also be any computer-readable medium other than the computer-readable storage medium, and the computer-readable medium can send, propagate, or transmit a program for use by or in combination with an instruction execution system, apparatus, or device. The computer program included on the computer-readable medium can be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0201] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of apparatuses, methods, and computer program products according to various embodiments of the present application. In this context, each box in the flowchart or block diagram may represent a module, a segment of a program, or a part of code, and the above-mentioned module, segment of a program, or part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the boxes may occur in a different order than that marked in the accompanying drawings. For example, two consecutive boxes shown may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, as well as combinations of boxes in the block diagram or flowchart, may be implemented by a dedicated hardware-based system for performing the specified functions or operations, or may be implemented by a combination of dedicated hardware and a computer program.
[0202] The units or modules involved in the embodiments described in the present application may be implemented in software or in hardware, and the described units or modules may also be provided in a processor. Among them, the names of these units or modules do not, in some cases, constitute a limitation on the units or modules themselves.
[0203] Another aspect of the present application also provides a computer-readable medium having a computer program stored thereon, and when the computer program is executed by a processor, it implements the data processing method based on a blockchain as described above. The computer-readable medium may be included in the electronic device described in the above embodiments, or may exist separately without being assembled into the electronic device.
[0204] Embodiments of the present application provide a computer program product or a computer program. The computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The processor of the electronic device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, causing the electronic device to execute the method embodiments as described above Figure 3 and Figure 9 shown. Among them, the computer-readable storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM), etc.
[0205] It should be noted that although several modules or units of the device for action execution are mentioned in the above detailed description, such a division is not mandatory. In fact, according to the embodiments of the present application, the features and functions of the two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0206] Those skilled in the art will readily conceive of other embodiments of the present application after considering the specification and practicing the embodiments disclosed herein. The present application is intended to cover any variations, uses, or adaptations of the present application, which follow the general principles of the present application and include common general knowledge or conventional technical means in the technical field not disclosed in the present application.
[0207] The above content is only a preferred exemplary embodiment of the present application and is not used to limit the implementation of the present application. Those of ordinary skill in the art can easily make corresponding changes or modifications according to the main idea and spirit of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope required by the claims.
Claims
1. A blockchain-based data processing method, characterized in that, The method includes: Constructing a read set dictionary of the block based on read set transaction parameters required for each transaction execution in the block, and constructing a write set dictionary of the block based on write set transaction parameters required for updating each transaction; Constructing a read set order graph and a write set order graph of the block based on the arrangement order of each transaction in the block, the read set transaction parameters and the write set transaction parameters corresponding to each transaction; wherein, the read set order graph is used to represent the number of prior transactions that need to read each transaction parameter corresponding to each transaction, and the write set order graph is used to represent the number of prior transactions that need to update each transaction parameter corresponding to each transaction; Parallel constructing a conflict bitmap for each transaction based on the read set dictionary, the write set dictionary, the read set order graph and the write set order graph; wherein, the conflict bitmap of any one transaction includes transactions that have execution conflicts with the any one transaction; Constructing a directed acyclic graph of the block based on the conflict bitmap of each transaction.
2. The method according to claim 1, characterized in that, The parallel constructing a conflict bitmap for each transaction based on the read set dictionary, the write set dictionary, the read set order graph and the write set order graph includes: Parallel generating a read-write conflict result for each transaction based on the read set transaction parameters of each transaction, the write set dictionary and the write set order graph; Parallel generating a write-write conflict result for each transaction based on the write set transaction parameters of each transaction, the write set dictionary and the write set order graph; Parallel generating a write-read conflict result for each transaction based on the write set transaction parameters of each transaction, the read set dictionary and the read set order graph; Parallel constructing a conflict bitmap for each transaction according to the read-write conflict result, the write-write conflict result and the write-read conflict result of each transaction.
3. The method according to claim 2, characterized in that, The generating process of the read-write conflict result of each transaction includes: Obtaining the transaction corresponding to the read set transaction parameters of each transaction in the write set dictionary; If the obtained transaction includes transactions other than each transaction, obtaining a first quantity corresponding to each transaction in the write set order graph; wherein, the first quantity is used to represent the number of prior transactions that need to update the read set transaction parameters of each transaction; Generating a read-write conflict result for each transaction based on the relationship between the first quantity and a first preset threshold.
4. The method according to claim 3, wherein The generating a read-write conflict result for each transaction based on the relationship between the first quantity and a first preset threshold includes: If the first quantity is greater than the first preset threshold, selecting the transactions arranged before each transaction from the obtained transactions, and generating a read-write conflict result for representing the existence of read-write conflicts based on the arrangement order of each transaction in the block and the selected transactions; If the first quantity is less than or equal to the first preset threshold, generating a read-write conflict result for representing the non-existence of read-write conflicts.
5. The method according to claim 2, wherein The generating process of the write-write conflict result of each transaction includes: Obtaining the transaction corresponding to the write set transaction parameters of each transaction in the write set dictionary; If the obtained transaction contains a transaction other than each of the said transactions, obtain the second quantity corresponding to each of the said transactions in the write set sequence diagram; wherein, the second quantity is used to represent the number of prior transactions that need to update the write set transaction parameters of each of the said transactions; Generate the write-write conflict result of each of the said transactions based on the relationship between the second quantity and the second preset threshold.
6. The method according to claim 2, wherein The generation process of the write-read conflict result of each of the said transactions includes: Obtain the transaction corresponding to the write set transaction parameter of each of the said transactions in the read set dictionary. If the obtained transaction contains a transaction other than each of the said transactions, obtain the third quantity corresponding to each of the said transactions in the read set sequence diagram; wherein, the third quantity is used to represent the number of prior transactions that need to read the write set transaction parameters of each of the said transactions; Generate the write-read conflict result of each of the said transactions based on the relationship between the third quantity and the third preset threshold.
7. The method according to any one of claims 2 to 6, characterized in that, The parallel construction of the conflict bitmap for each of the said transactions according to the read-write conflict result, write-write conflict result, and write-read conflict result of each of the said transactions includes: For each transaction, construct the initial bitmap of the transaction; wherein, the initial bitmap of the transaction includes a plurality of cells to be assigned values, and each cell corresponds one-to-one to each transaction in the block; Based on the read-write conflict result, write-write conflict result, and write-read conflict result of the transaction, assign values to the cells in the initial bitmap for the transaction to obtain the conflict bitmap of the transaction.
8. The method according to any one of claims 1 to 6, characterized in that, The construction of the read set sequence diagram and write set sequence diagram of the block based on the arrangement order of each of the said transactions in the block, the read set transaction parameters and write set transaction parameters corresponding to each of the said transactions includes: Construct the read set dictionary based on the read set transaction parameters corresponding to each of the said transactions, and construct the write set dictionary based on the write set transaction parameters corresponding to each of the said transactions; Construct the read set sequence diagram of the block according to the read set dictionary and the transactions arranged before each of the said transactions; Construct the write set sequence diagram of the block according to the write set dictionary and the transactions arranged before each of the said transactions.
9. The method according to claim 8, wherein The construction of the read set sequence diagram of the block according to the read set dictionary and the transactions arranged before each of the said transactions includes: Construct the initial read set diagram according to the number of transactions in the read set dictionary whose corresponding transaction parameters are the same as the read set transaction parameters of each of the said transactions and are arranged before each of the said transactions; Update the initial read set diagram according to the number of transactions in the read set dictionary whose corresponding transaction parameters are the same as the write set transaction parameters of each of the said transactions and are arranged before each of the said transactions to obtain the read set sequence diagram of the block.
10. A data processing device based on a blockchain, characterized in that, The device includes an initial construction unit, a parallel construction unit, and a processing unit, wherein: The initial construction unit is used to construct the read set dictionary of the block based on the read set transaction parameters required for each transaction execution in the block, and construct the write set dictionary of the block based on the write set transaction parameters required for each transaction execution to be updated; The initial construction unit is used to construct a read set order graph and a write set order graph of the block based on the arrangement order of each transaction in the block, the read set transaction parameters and the write set transaction parameters corresponding to each transaction; wherein, the read set order graph is used to represent the number of prior transactions that need to read each transaction parameter corresponding to each transaction, and the write set order graph is used to represent the number of prior transactions that need to update each transaction parameter corresponding to each transaction; The parallel construction unit is used to construct a conflict bitmap of each transaction in parallel based on the read set dictionary, the write set dictionary, the read set order graph and the write set order graph; wherein, the conflict bitmap of any one transaction includes the transactions that have execution conflicts with the any one transaction; The processing unit is used to construct a directed acyclic graph of the block based on the conflict bitmaps of each transaction.
11. A computer-readable medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the blockchain-based data processing method according to any one of claims 1 to 9.
12. An electronic device, characterized in that, Comprising: One or more processors; A storage device for storing one or more programs, which when executed by the one or more processors, cause the one or more processors to implement the blockchain-based data processing method according to any one of claims 1 to 9.