Data processing method, apparatus and device, medium, product

By identifying parallel execution conditions in the blockchain and separating parallel and serial transaction data processing, the throughput and consensus performance of the blockchain system are improved, solving the problem of low performance caused by serial processing of transaction data in existing technologies.

CN117408694BActive Publication Date: 2026-11-06TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202210797362.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-07
Publication Date
2026-11-06
Estimated Expiration
2042-07-07

AI Technical Summary

Technical Problem

In existing technologies, blockchain consensus nodes process transaction data serially, which prevents effective parallel processing and reduces the throughput and consensus performance of the blockchain.

Method used

By identifying the conditions for parallel execution, transaction data is separated into first transaction data that can be executed in parallel and second transaction data that cannot be executed in parallel. A block awaiting consensus is generated, the first transaction data is processed in parallel, and the second transaction data is processed serially, thereby improving data processing efficiency.

Benefits of technology

It improves the throughput and consensus performance of the blockchain system and solves the performance problem caused by serial execution.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117408694B_ABST
    Figure CN117408694B_ABST
Patent Text Reader

Abstract

This application proposes a data processing method, apparatus, device, medium, and product. The method includes: acquiring N transaction data to be processed and executing the N transaction data, where N is a positive integer; determining M first transaction data points from the N transaction data points that satisfy the parallel execution condition based on the transaction execution result of each transaction data point, where M is a positive integer and M≤N; packaging the N transaction data points to generate a consensus block, in which the M first transaction data points and N-M second transaction data points (excluding the M first transaction data points) are recorded based on a distinguishing record rule; and broadcasting the consensus block to a consensus node set, so that the consensus nodes in the consensus node set can perform parallel consensus processing on the M first transaction data points in the consensus block and serial consensus processing on the N-M second transaction data points based on the distinguishing record rule. This application can improve the efficiency of data processing and increase the system's throughput.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of blockchain technology, and in particular to a data processing method, a data processing device, a computer device, a computer-readable storage medium, and a computer program product. Background Technology

[0002] A block can consist of multiple transaction data. Before the packaging node writes the block into the blockchain, it needs to reach a consensus on the block through consensus nodes in the consensus network. That is, these consensus nodes need to verify each transaction data in the block.

[0003] Currently, when these consensus nodes verify the transaction data in this block, they often need to package these transaction data (e.g., transaction data 1, transaction data 2, and transaction data 3) into a single block. During the consensus process, processing is generally sequential to ensure that each transaction data is processed. For example, each consensus node must execute transaction data 1 first, then transaction data 2, and then transaction data 3.

[0004] The method by which consensus nodes execute transaction data in blocks sequentially is not flexible enough and cannot handle transaction data that can be processed in parallel in some cases. The current method of packaging transaction data in a general way to facilitate sequential consensus processing reduces the consensus performance of these consensus nodes, thereby reducing the throughput of the blockchain. Summary of the Invention

[0005] This application provides a data processing method, apparatus, computer equipment, computer-readable storage medium, and computer program product, which can improve the efficiency of data processing and increase the throughput of the system.

[0006] On one hand, embodiments of this application provide a data processing method, the method comprising:

[0007] Retrieve N transaction data to be processed and execute N transaction data, where N is a positive integer;

[0008] Based on the transaction execution result of each transaction data, determine the M first transaction data that meet the parallel execution conditions from the N transaction data, where M is a positive integer and M≤N;

[0009] Pack N transaction data into a block to be consensused. The block to be consensused records M first transaction data and NM second transaction data other than the M first transaction data, based on the distinguishing recording rule.

[0010] The block to be consensused is broadcast to the consensus node set, so that the consensus nodes in the consensus node set can perform parallel consensus processing on the M first transaction data in the block to be consensused based on the distinguished record rules, and perform serial consensus processing on the NM second transaction data.

[0011] On one hand, embodiments of this application provide a data processing method, the method comprising:

[0012] Obtain the consensus block sent by the packaging node. The consensus block is generated by the packaging node after packaging N transaction data to be processed. The consensus block records M first transaction data and NM second transaction data based on the distinction recording rule. The M first transaction data are determined based on the transaction execution result of each transaction data after the N transaction data are executed in parallel. N and M are both positive integers, and M ≤ N.

[0013] Parallel consensus processing is performed on the M first transaction data in the consensus block to obtain the first transaction execution result for each first transaction data.

[0014] The NM second transaction data in the consensus block are processed sequentially to obtain the second transaction execution result for each second transaction data.

[0015] The execution results of each first transaction and each second transaction are merged to obtain the merged execution result.

[0016] On one hand, embodiments of this application provide a data processing apparatus, the apparatus comprising:

[0017] The acquisition unit is used to acquire N transaction data to be processed and execute N transaction data, where N is a positive integer;

[0018] The processing unit is used to determine M first transaction data that meet the parallel execution conditions from N transaction data based on the transaction execution result of each transaction data, where M is a positive integer and M≤N;

[0019] The processing unit is also used to package N transaction data to generate a block to be consensused. In the block to be consensused, M first transaction data and NM second transaction data other than the M first transaction data are recorded based on the distinction recording rule.

[0020] The sending unit is used to broadcast the block to be reached to the consensus node set, so that the consensus nodes in the consensus node set can perform parallel consensus processing on the M first transaction data in the block to be reached based on the distinguished record rule, and perform serial consensus processing on the NM second transaction data.

[0021] In one possible implementation, the distinction recording rules include: arrangement rules and label setting rules; the processing unit packages N transaction data, generates a block to be reached for consensus, and performs the following operations:

[0022] Pack N transaction data according to the arrangement rules to generate a block awaiting consensus;

[0023] Among them, after packaging N transaction data according to the arrangement rules, any first transaction data in the consensus block will be processed in the consensus process before any second transaction data.

[0024] Furthermore, the label setting rules are used to indicate that any second transaction data packaged into the block awaiting consensus is set with a target label.

[0025] In one possible implementation, before the processing unit executes N transaction data, it is also used to perform the following operations:

[0026] Create a corresponding transaction read cache and transaction write cache for each of the N transaction data;

[0027] The transaction read cache stores the read dataset for any transaction data, which indicates the call information of the smart contract corresponding to the transaction data. The transaction write cache stores the write dataset for any transaction data, which stores the transaction execution result obtained after calling the smart contract to execute the transaction data.

[0028] In one possible implementation, the processing unit is also used to perform the following operations:

[0029] Retrieve the read dataset of the target transaction data from the transaction read cache, and based on the call information in the read dataset of the target transaction data, obtain the target smart contract used to execute the target transaction data;

[0030] The target smart contract is invoked to execute the target transaction data, and the execution result of the target transaction is obtained. The execution result of the target transaction is used as the write dataset of the target transaction data.

[0031] In one possible implementation, the execution result of any transaction data is stored in the corresponding transaction write cache in the form of key-value pairs; the processing unit is also used to perform the following operations:

[0032] Retrieve the write key for each transaction from the transaction write cache, and perform a hash operation on the write key for each transaction to obtain the first hash string for each transaction.

[0033] Write the first hash string of each transaction data into the Bloom filter.

[0034] In one possible implementation, the read dataset of any transaction data is stored in the corresponding transaction read cache in the form of key-value pairs;

[0035] Based on the transaction execution result of each transaction, the processing unit determines M first transaction data that meet the parallel execution conditions from the N transaction data, and uses them to perform the following operations:

[0036] Iterate through the read dataset for each transaction and perform a hash operation on the read key for each transaction to obtain the second hash string for each transaction.

[0037] For each transaction data's second hash string, a matching process is performed with each of the first hash strings in the Bloom filter, and based on the matching results, M first transaction data that satisfy the parallel execution conditions are determined from the N transaction data.

[0038] In one possible implementation, the processing unit determines M first transaction data that satisfy the parallel execution conditions from N transaction data based on the matching results, and uses them to perform the following operations:

[0039] The second hash string of the target transaction data is matched with each of the first hash strings in the Bloom filter;

[0040] If the matching result is unsuccessful, then the target transaction data is determined to meet the conditions for parallel execution, and the target transaction data is determined as the first transaction data;

[0041] If the matching result is successful, it is determined that the target transaction data does not meet the conditions for parallel execution, and the target transaction data is determined as the second transaction data.

[0042] In one possible implementation, after the sending unit broadcasts the block to be agreed upon to the consensus node set, the processing unit is also used to perform the following operations:

[0043] Execute NM second transaction data points out of N transaction data points sequentially to obtain the second transaction execution result for each second transaction data point.

[0044] From the transaction execution results of each transaction data, obtain the first transaction execution results of M first transaction data;

[0045] The execution results of each first transaction and each second transaction are merged to obtain the merged execution result.

[0046] On one hand, embodiments of this application provide a data processing apparatus, the apparatus comprising:

[0047] The acquisition unit is used to acquire the consensus block sent by the packaging node. The consensus block is generated by the packaging node after packaging N transaction data to be processed. The consensus block records M first transaction data and NM second transaction data based on the distinction recording rule. The M first transaction data are determined based on the transaction execution result of each transaction data after the N transaction data are executed in parallel. N and M are both positive integers, and M≤N.

[0048] The processing unit is used to perform parallel consensus processing on the M first transaction data in the consensus block to obtain the first transaction execution result of each first transaction data.

[0049] The processing unit is also used to perform serial consensus processing on the NM second transaction data in the consensus block to obtain the second transaction execution result for each second transaction data;

[0050] The processing unit is also used to merge the execution results of each first transaction and each second transaction to obtain a merged execution result.

[0051] In one possible implementation, the processing unit performs parallel consensus processing on the M first transaction data in the consensus block to obtain the first transaction execution result for each first transaction data, and then performs the following operations:

[0052] The validity of the parallel consensus processing is verified. If the verification fails, the execution results of each first transaction and each second transaction are deleted.

[0053] Perform serial consensus processing on N transaction data to obtain the transaction execution result for each transaction data.

[0054] In one possible implementation, the processing unit verifies the validity of the parallel consensus processing procedure by performing the following operations:

[0055] Traverse the transaction read cache of the target second transaction data to obtain the read dataset of the target second transaction data. The read dataset is stored in the transaction read cache in the form of key-value pairs.

[0056] Perform a hash operation on the read key of the target second transaction data to obtain the verification hash string of the target second transaction data;

[0057] The verification hash string is matched against the first hash string stored by the Bloom filter. If the match is successful, the parallel execution process is considered to have passed verification.

[0058] On one hand, embodiments of this application provide a computer device, which includes a memory and a processor. The memory stores a computer program, and when the computer program is executed by the processor, the processor performs the data processing method described above.

[0059] On one hand, embodiments of this application provide a computer-readable storage medium storing a computer program, which, when read and executed by a processor of a computer device, causes the computer device to perform the aforementioned data processing method.

[0060] On one hand, embodiments of this application provide a computer program product or computer program that includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the aforementioned data processing method.

[0061] In this embodiment, N transaction data to be agreed upon can be obtained and executed, where N is a positive integer. Then, based on the execution result of each transaction data, M first transaction data that meet the parallel execution conditions are determined from the N transaction data, where M is a positive integer and M≤N. Next, the N transaction data are packaged to generate a block to be agreed upon, which includes the M first transaction data and NM second transaction data other than the M first transaction data. Finally, the block to be agreed upon can be broadcast to a consensus node set, so that the consensus nodes in the consensus node set can perform parallel consensus processing on the M first transaction data in the block to be agreed upon and perform serial consensus processing on the NM second transaction data. Therefore, in this embodiment, multiple transaction data can be pre-executed, and then the transaction data that can be parallelized can be identified according to the transaction execution results. Then, the parallelizable transaction data (i.e., the first transaction data) and the non-parallelizable transaction data (i.e., the second transaction data) are packaged into a block. Finally, the packaged block is broadcast to multiple consensus nodes, so that the consensus nodes can execute the first transaction data in parallel and then execute the second transaction data serially. This consensus method can perform parallel consensus processing on the parallelizable transaction data. Compared with executing all transaction data serially, this application can improve the efficiency of data processing, thereby increasing the throughput of the system. Attached Figure Description

[0062] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0063] Figure 1 This is a schematic diagram of the structure of a blockchain node system provided in an embodiment of this application;

[0064] Figure 2 This is a schematic diagram of a blockchain structure provided in an embodiment of this application;

[0065] Figure 3 This is a schematic diagram illustrating the principle of a data processing scheme provided in an embodiment of this application;

[0066] Figure 4 This is a flowchart illustrating a data processing method provided in an embodiment of this application;

[0067] Figure 5a This is a schematic diagram of a process for parallel execution of transaction data provided in an embodiment of this application;

[0068] Figure 5b This is a flowchart illustrating the execution process of transaction data according to an embodiment of this application;

[0069] Figure 6 This is a schematic diagram of the principle of a Bloom filter provided in an embodiment of this application;

[0070] Figure 7a This is a schematic diagram of a process for determining second transaction data provided in an embodiment of this application;

[0071] Figure 7b This is a schematic diagram of a process for determining first transaction data provided in an embodiment of this application;

[0072] Figure 8 This is a schematic diagram of a process for generating a block to be reached for consensus, provided in an embodiment of this application;

[0073] Figure 9 This is a flowchart illustrating another data processing method provided in an embodiment of this application;

[0074] Figure 10 This is a schematic diagram of the structure of a data processing device provided in an embodiment of this application;

[0075] Figure 11 This is a schematic diagram of another data processing device provided in an embodiment of this application;

[0076] Figure 12 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation

[0077] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application.

[0078] The data processing solution in this application can be combined with blockchain technology. The following section provides a detailed introduction to the blockchain technology involved in the data processing solution provided in this application:

[0079] I. Blockchain Node System:

[0080] The data processing system involved in the embodiments of this application can be a distributed system (i.e., a blockchain node system) formed by multiple nodes connected through network communication. The following is a reference to the appendix... Figure 1 A detailed introduction to the technologies involved in the blockchain node system:

[0081] Please see Figure 1 , Figure 1 This is a schematic diagram of a blockchain node system provided in an embodiment of this application. Blockchain is a novel application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. It is mainly used to organize data in chronological order and encrypt it into a ledger, making it tamper-proof and forgery-proof. It also allows for data verification, storage, and updating. Essentially, a blockchain is a decentralized database where each node stores an identical blockchain record. The blockchain network includes consensus nodes, which are responsible for achieving consensus across the entire blockchain network.

[0082] like Figure 1 The blockchain node system shown can correspond to a blockchain network, which may include, but is not limited to, blockchain networks corresponding to consortium blockchains, public blockchains, and private blockchains. A blockchain node system refers to a system used for data sharing between blockchain nodes. This system can include multiple nodes, specifically nodes 101, 102, 103, ..., 10n, which can be collectively referred to as blockchain nodes. It is understood that nodes can establish communication connections through information connections. The specific connection method is not limited; for example, they can be connected directly or indirectly through wired communication, wireless communication, or other methods. This application does not impose any restrictions on these methods.

[0083] In a blockchain node system, each node receives input information during normal operation and maintains shared data based on this information. To ensure interoperability within the system, interconnected information links exist between nodes, enabling data transmission. For example, when any node receives input information, other nodes in the system retrieve this information according to a consensus algorithm and store it as part of the shared data, ensuring data consistency across all nodes.

[0084] Understandably, a blockchain network can establish information connections between nodes based on node identifiers. Each node in a blockchain node system has a corresponding node identifier, and each node can store the node identifiers of other nodes in the blockchain node system. This allows for the subsequent broadcasting of generated blocks to other nodes in the blockchain node system based on their node identifiers. Each node can maintain a node identifier list as shown in the table below, storing the node name and node identifier in this list.

[0085] The node identifier can be an IP (Internet Protocol) address or any other information that can be used to identify a node in the blockchain network. Table 1 uses IP addresses as an example. For instance, node 1 (e.g., node 1 can be...) Figure 1 Node 101 (as shown) can send data to Node 2 (for example, Node 2 can be a node with the node identifier 000.000.000.000) via the node identifier 000.000.000. Figure 1 Node 102 (as shown) sends information (e.g., blocks), and Node 2 can determine that the information was sent by Node 1 by the node identifier 111.111.111.111.

[0086] Table 1. Node Identifier List

[0087] Node Name Node identifier Node 1 000.000.000.000 Node 2 111.111.111.111 … … Node N xxx.xxx.xxx.xxx

[0088] It is understandable that a blockchain system can include smart contracts. A smart contract in a blockchain system can be understood as code that all nodes in the blockchain (including consensus nodes, which are nodes that possess all the ledger information and participate in the consensus-building process) can understand and execute. It can execute arbitrary logic and produce results. It should be understood that a blockchain can include one or more smart contracts. These smart contracts can be distinguished by an identity document (ID) or a name, and transaction data requests can carry the smart contract's identity document or name to specify the smart contract that the blockchain needs to run.

[0089] II. Blockchain Structure:

[0090] See Figure 2 , Figure 2 This is a schematic diagram of a blockchain structure provided in an embodiment of this application. For example... Figure 2 As shown, a blockchain consists of multiple blocks (including the genesis block). The genesis block includes a block header and a block body. The block header stores input information feature values, version number, timestamp, and difficulty value, while the block body stores the input information. The next block after the genesis block takes the genesis block as its parent block. The next block also includes a block header and a block body. The block header stores the input information feature values ​​of the current block, the block header feature values ​​of the parent block, version number, timestamp, and difficulty value, and so on. This ensures that the block data stored in each block of the blockchain is related to the block data stored in the parent block, guaranteeing the security of the input information in the blocks.

[0091] Understandably, a block is a data packet that carries transaction data on a blockchain network. It is a data structure that is marked with a timestamp and the hash value of the previous block. The transactions in the block are verified and confirmed by the network's consensus mechanism.

[0092] It is understood that the transaction data processing method provided in this application embodiment can be executed by computer equipment, which includes, but is not limited to, terminal equipment or servers. Terminal equipment may include, but is not limited to: mobile phones, tablets, laptops, PDAs, mobile internet devices (MIDs), smart voice interaction devices, in-vehicle terminals, roadside equipment, aircraft, wearable devices, smart home appliances, or wearable devices with network configuration management functions such as smartwatches, smart bracelets, and pedometers, etc. Servers may be independent physical servers, server clusters or distributed systems composed of multiple physical servers, or cloud servers providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms.

[0093] It should be understood that in blockchain, before a block (i.e., a block awaiting consensus) is added to the chain, it needs to pass consensus among the consensus nodes in the blockchain network. Only after consensus is reached can the block be added to the blockchain. It is understandable that when blockchain is used in scenarios involving government or commercial institutions, not all participating nodes in the blockchain (i.e., the blockchain nodes in the aforementioned blockchain node system) have sufficient resources and the necessity to become consensus nodes. For example, in... Figure 1 In the blockchain node system shown, nodes 101, 102, and 103 can be used as consensus nodes in the blockchain node system. Node 101 can be used as a packaging node to generate blocks, and nodes 102 and 103 can be used as consensus nodes to participate in the consensus.

[0094] Understandably, the packaging node (which is a consensus node) of the blockchain can send the newly generated block to other consensus nodes in the blockchain node system based on the node identifiers of other consensus nodes in the blockchain node system. The consensus nodes then reach a consensus on the newly generated block and add it to their stored blockchain after successful consensus.

[0095] Based on the above description, this application provides a data processing solution; please refer to [link / reference]. Figure 3 , Figure 3 This is a schematic diagram illustrating the principle of a data processing scheme provided in an embodiment of this application. Figure 3As shown, the principle of this data processing scheme is as follows: The packaging node (the current block-producing node, which is also a consensus node) can obtain N transaction data to be agreed upon and execute these N transaction data, where N is a positive integer. Then, based on the transaction execution result of each transaction data, M first transaction data that meet the parallel execution conditions are determined from the N transaction data, where M is a positive integer and M≤N. Next, the N transaction data are packaged to generate a block to be agreed upon, which includes M first transaction data and NM second transaction data other than the M first transaction data. Finally, the block to be agreed upon can be broadcast to the consensus node set (including at least one consensus node), so that the consensus nodes in the consensus node set can perform consensus verification processing on the block to be agreed upon. The consensus verification processing includes: parallel consensus processing of the M first transaction data in the block to be agreed upon and serial consensus processing of the NM second transaction data. Finally, each consensus node can also verify the validity of the parallel consensus process. If the verification passes, the transaction execution results of each transaction data (first transaction data and second transaction data) can be merged.

[0096] Therefore, in this embodiment, the packaging node can pre-execute multiple transaction data, then identify the parallelizable transaction data based on the transaction execution results, and then package the parallelizable transaction data (i.e., the first transaction data) and the non-parallelizable transaction data (i.e., the second transaction data) into a block. Finally, the packaged block is broadcast to multiple consensus nodes. Then, after receiving the block to be consensus sent by the packaging node, the consensus node can execute the first transaction data in parallel, and then execute the second transaction data serially. This consensus method solves the problem of low performance and low system throughput caused by the need to serially execute a large amount of transaction data. Because this application can execute transaction data in parallel, it improves the execution efficiency of the blockchain and greatly increases the system throughput.

[0097] It should be noted that in the subsequent specific embodiments of this application, when data related to object information (such as the object's identity) is applied to specific products or technologies, permission or consent from the object is required, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.

[0098] Based on the above description of the data processing scheme and system, this application proposes a data processing method. See also... Figure 4 As shown, Figure 4This is a flowchart illustrating a data processing method provided in an embodiment of this application. This data processing method can be applied to a blockchain and can be executed by the aforementioned blockchain nodes (e.g., packaging nodes). For ease of explanation, the following description will use a computer device executing this data processing method as an example. The data processing method may include the following steps S401 to S404:

[0099] S401. Obtain N transaction data to be processed and execute N transaction data, where N is a positive integer.

[0100] In this embodiment of the application, the computer device can obtain N transaction data from the transaction cache pool. These N transaction data can be some or all of the transaction data in the transaction cache pool. If the N transaction data are some of the transaction data in the transaction cache pool, the computer device can obtain these N transaction data in the following ways: sequentially obtain N transaction data from the transaction cache pool according to the transaction generation timestamp, or randomly obtain N transaction data from the transaction cache pool.

[0101] Specifically, the execution of N transaction data by a computer device can include the parallel execution of N transaction data. Assuming the N transaction data are represented as transaction data 1, transaction data 2, ..., transaction data n, then the parallel execution of N transaction data specifically includes executing transaction data 2, transaction data 3, ..., transaction data n simultaneously with executing transaction data 1.

[0102] In one possible implementation, before the computer device executes n transaction data, it can create a corresponding transaction read cache and transaction write cache for each of the N transaction data. The transaction read cache stores the read dataset for any given transaction data, which indicates the call information of the smart contract corresponding to the executed transaction data. The transaction write cache stores the write dataset for any given transaction data, which stores the transaction execution result obtained after calling the smart contract to execute the transaction data. The call information may include, but is not limited to, the smart contract's calling address and contract identifier (e.g., contract name).

[0103] Specifically, the computer device can retrieve the read dataset of the target transaction data from the transaction read cache, and based on the call information in the read dataset of the target transaction data, obtain the target smart contract for executing the target transaction data; then, the computer device can call the target smart contract to execute the target transaction data, obtain the target transaction execution result, and the target transaction execution result is used as the write dataset of the target transaction data. Here, the target transaction data refers to any one of N transaction data sets.

[0104] It should be understood that, assuming any two transactions out of N are represented as the first transaction and the second transaction, the transaction read cache corresponding to the first transaction includes the corresponding read dataset. Therefore, the computer device (packaging node) can obtain the read dataset corresponding to the first transaction from the transaction read cache. Based on the contract call address and contract name in the read dataset, it can obtain the smart contract for executing the first transaction, call the smart contract to execute the first transaction, and thus obtain the transaction execution result. This result can be added to the transaction write cache of the first transaction, and the write dataset corresponding to the first transaction can be constructed based on the data stored in the write cache.

[0105] Please see Figure 5a , Figure 5a This is a schematic diagram illustrating a process for parallel execution of transaction data provided in an embodiment of this application. For example... Figure 5a As shown, computer devices can create corresponding transaction read caches and transaction write caches for each transaction based on the ledger cache, with one transaction data corresponding to one transaction read cache and one transaction write cache. For example, there are transaction 1 read cache, transaction 2 read cache, ..., transaction n read cache, and transaction 1 write cache, transaction 2 write cache, ..., transaction n write cache.

[0106] Next, taking any transaction data (the first transaction data or the second transaction data) as an example, we will explain its execution process in detail by calling a smart contract. Please see [link / reference]. Figure 5b , Figure 5b This is a flowchart illustrating the execution process of transaction data provided in an embodiment of this application. Figure 5b As shown, the process of calling a smart contract to execute any transaction data may include the following steps S1-S6:

[0107] S1, trigger the contract.

[0108] In practice, the computer device can obtain the read dataset corresponding to the first transaction data from the transaction read cache corresponding to the first transaction data, and trigger the call of its corresponding smart contract based on the read dataset corresponding to the first transaction data.

[0109] S2, Analyze the transaction.

[0110] In practice, the computer device obtains the smart contract (including contract name, contract method, and contract input information) used to execute the first transaction data based on the contract call address and contract name in the read dataset corresponding to the first transaction data.

[0111] S3, Load the contract's storage information and the contract's bytecode.

[0112] In practice, the computer device obtains the corresponding contract bytecode and contract input from the first transaction data and status database.

[0113] S4, Execute the contract.

[0114] In practice, the contract code is executed on a computer device to complete the business logic corresponding to the first transaction data.

[0115] S5. Return the results and update the status database.

[0116] In practice, the computer equipment writes the transaction execution results back to the status database to update the business status.

[0117] S6. Create the Merkel tree root and store it in the block.

[0118] In practice, when all transaction data (first transaction data and second transaction data) in the consensus block have been executed, the system will store the hash digest of the current state of the state database as an authentication record in the blockchain.

[0119] In the above manner, for each transaction data (which may include the first transaction data and the second transaction data), by calling the corresponding smart contract to execute the relevant business operations, the transaction execution result of each transaction data can be obtained, and the transaction execution result of each transaction data can be written to the transaction write cache, thereby using the transaction execution result as the data in its write dataset.

[0120] S402. Based on the transaction execution result of each transaction data, determine the M first transaction data that meet the parallel execution conditions from the N transaction data, where M is a positive integer and M≤N.

[0121] In one possible implementation, the execution result of any transaction data is stored in the corresponding transaction write cache as a key-value pair, i.e., key = value. The computer device can also retrieve the write key for each transaction data from the transaction write cache, perform a hash operation on the write key for each transaction data, and obtain a first hash string for each transaction data. Then, the first hash string for each transaction data can be written to a Bloom filter. It should be noted that by writing the first hash string of each transaction data to a Bloom filter, it can be used to identify and classify each transaction data, thereby determining the first transaction data that meets the parallel execution conditions from N transactions, and the second transaction data that does not meet the parallel execution conditions from N transactions.

[0122] Specifically, a Bloom filter is a bit vector or a bit array. The data structure of a Bloom filter is shown in Table 2 below:

[0123] Table 2. Data Structure of Bloom Filters

[0124] 0 0 0 0 0 0 0 0 0 0 0

[0125] Based on Table 2, the principle of a Bloom filter is roughly as follows: A Bloom filter is an array containing multiple (e.g., 11) bits, and the value of each bit in the initialized Bloom filter is 0. If a value needs to be added to the Bloom filter, multiple hash values ​​need to be generated using multiple different hash functions, and the bit value pointed to by each generated hash value is set to 1.

[0126] For example, in this embodiment of the application, for any write keyword key1 corresponding to any transaction data (e.g., transaction data 1), one or more hash functions can be used to perform hash operations to obtain the corresponding hash string. Please refer to [link to relevant documentation]. Figure 6 , Figure 6 This is a schematic diagram illustrating the principle of a Bloom filter provided in an embodiment of this application. Figure 6 As shown, assuming the Bloom filter is an 11-bit bit array and contains 5 hash functions, the first hash string obtained after hashing the write key 'key1' corresponding to transaction data 1 is 10101010100. This first hash string 10101010100 is then written into the Bloom filter. It's understandable that the detailed process of writing each transaction data to the Bloom filter is as described above, and will not be repeated here.

[0127] In one possible implementation, the read dataset of any transaction data is stored in the corresponding transaction read cache as key-value pairs. The computer device, based on the transaction execution result of each transaction data, determines M first transactions from N transactions that satisfy the parallel execution condition. Specifically, this may include: first, traversing the read dataset of each transaction data and performing a hash operation on the read key of each transaction data to obtain a second hash string for each transaction data; then, matching the second hash string of each transaction data with each first hash string in the Bloom filter, and determining the M first transactions from the N transactions that satisfy the parallel execution condition based on the matching results.

[0128] Specifically, if any transaction data is represented as target transaction data, the computer device determines M first transaction data that satisfy the parallel execution conditions from N transaction data based on the matching results. This can specifically include: matching the second hash string of the target transaction data with each of the first hash strings in the Bloom filter; if the matching result is unsuccessful, then the target transaction data is determined to satisfy the parallel execution conditions and is identified as the first transaction data; if the matching result is successful, then the target transaction data is determined not to satisfy the parallel execution conditions and is identified as the second transaction data.

[0129] For example, see Figure 7a , Figure 7a This is a schematic diagram of a process for determining second transaction data provided in an embodiment of this application. Figure 7a As shown, the read key 'key2' of transaction data 2 is retrieved from the transaction read cache of transaction data 2. This key 'key2' is then hashed using one or more hash functions (e.g., five), resulting in a second hash string, let's say 10101010100. Next, this second hash string is compared with each of the first hash strings in the Bloom filter. Since the second hash string of transaction data 2 is identical to the first hash string '10101010100' of transaction data 1 in the Bloom filter, it can be determined that transaction data 2 has read the data written by transaction data 1. Therefore, transaction data 2 needs to be executed after transaction data 1, making transaction data 2 a transaction that does not meet the conditions for parallel execution (i.e., the second transaction data).

[0130] For example, please see Figure 7b , Figure 7b This is a schematic diagram of a process for determining first transaction data provided in an embodiment of this application. Figure 7b As shown, the read key 'key3' of transaction data 3 is retrieved from the transaction read cache of transaction data 3. Then, one or more hash functions (e.g., five) are used to perform a hash operation on the read key 'key3', resulting in a second hash string, assumed to be 0101010101011. Next, this second hash string is compared with each of the first hash strings in the Bloom filter. Since the second hash string of transaction data 3 is different from any of the first hash strings in the Bloom filter, it can be determined that transaction data 3 is the transaction data that satisfies the parallel execution condition (i.e., the first transaction data).

[0131] Using the above method, transaction data that meets the conditions for parallel execution can be identified as first transaction data from N transaction data, and transaction data that does not meet the conditions for parallel execution can be identified as second transaction data, thus obtaining M first transaction data and NM second transaction data.

[0132] S403. Pack N transaction data to generate a block to be consensused. In the block to be consensused, M first transaction data and NM second transaction data other than the M first transaction data are recorded based on the distinction recording rule.

[0133] In one possible implementation, the distinguishing record rules include: an arrangement rule and a label setting rule. A computer device packages N transaction data to generate a block awaiting consensus. Specifically, this may include the following steps: packaging N transaction data according to the arrangement rule to generate a block awaiting consensus. Specifically, after packaging N transaction data based on the arrangement rule, any first transaction data in the block awaiting consensus will be processed for consensus before any second transaction data; and the label setting rule is used to indicate that any second transaction data packaged into the block awaiting consensus has a target label set.

[0134] Specifically, after identifying M first transactions and NM second transactions from N transactions, the M first transactions that meet the parallel execution conditions can be prioritized and packaged into a block. Then, the NM second transactions that do not meet the parallel execution conditions can be packaged into a block, thus generating a block awaiting consensus. During the packaging of the M first transactions into a block, they can be ordered sequentially from earliest to latest based on their transaction generation time. Similarly, during the packaging of the NM second transactions into a block, they can be ordered sequentially from earliest to latest based on their transaction generation timestamp. Furthermore, each second transaction can be assigned a target label, such as NeedRedo. Conversely, each first transaction can be left unlabeled or assigned a different label than the target label, such as unNeedRedo.

[0135] For example, please see Figure 8 , Figure 8 This is a schematic diagram illustrating a process for generating blocks to be reached for consensus, provided in an embodiment of this application. For example... Figure 8 As shown, suppose N transaction data are represented as: transaction data a, transaction data b, transaction data c, transaction data d, and transaction data e. Transaction data a, c, and e are identified as the first type of transaction data, which can be executed in parallel; transaction data b and d are identified as the second type of transaction data, which cannot be executed in parallel (i.e., must be executed sequentially). Then, transaction data a, c, and e can be packaged into a block first, and then transaction data b and d can be packaged into a block, thus generating a block as shown below. Figure 8 The block awaiting consensus is shown.

[0136] S404. Broadcast the block to be reached to the consensus node set so that the consensus nodes in the consensus node set can perform parallel consensus processing on the M first transaction data in the block to be reached, and perform serial consensus processing on the NM second transaction data.

[0137] The consensus node set includes one or more consensus nodes. After the computer device (packaging node, which is also a consensus node) broadcasts the block to be agreed upon to the consensus node set, it enables all or some of the consensus nodes in the consensus node set to perform parallel consensus processing on the M first transaction data in the block to be agreed upon, and to perform serial consensus processing on the NM second transaction data.

[0138] In one possible implementation, after the computer device broadcasts the block to be agreed upon to the consensus node set, it can also perform the following steps: serially execute NM second transaction data out of N transaction data to obtain the second transaction execution result of each second transaction data; obtain the first transaction execution results of M first transaction data from the transaction execution results of each transaction data; merge the first transaction execution results and the second transaction execution results to obtain the transaction merged execution result.

[0139] The so-called serial execution of NM second transaction data (assuming they are represented as second transaction data a, second transaction data b, ..., second transaction data x) can include: after executing second transaction data a, then executing second transaction data b, then executing second transaction data c, and so on, executing all NM second transaction data in sequence. The execution order can refer to the order in which the transaction generation timestamps of each second transaction data are arranged from earliest to latest.

[0140] Furthermore, the computer equipment can merge the execution results of each first transaction and each second transaction according to their order of appearance in the consensus block, resulting in a merged execution result. The order of appearance of the transactions can refer to the order of their timestamps from earliest to latest.

[0141] In this embodiment, N transaction data to be agreed upon can be obtained and executed, where N is a positive integer. Then, based on the execution result of each transaction data, M first transaction data that meet the parallel execution conditions are determined from the N transaction data, where M is a positive integer and M≤N. Next, the N transaction data are packaged to generate a block to be agreed upon, which includes the M first transaction data and NM second transaction data other than the M first transaction data. Finally, the block to be agreed upon can be broadcast to a consensus node set, so that the consensus nodes in the consensus node set can perform parallel consensus processing on the M first transaction data in the block to be agreed upon and perform serial consensus processing on the NM second transaction data. Therefore, in this embodiment, multiple transaction data can be executed in parallel in advance. Then, the transaction data that can be executed in parallel is identified according to the transaction execution results. Then, the transaction data that can be executed in parallel (i.e., the first transaction data) and the transaction data that cannot be executed in parallel (i.e., the second transaction data) are packaged into a block. Finally, the packaged block is broadcast to multiple consensus nodes, so that the consensus nodes can execute the first transaction data in parallel and then execute the second transaction data serially. This consensus method can perform parallel consensus processing on the transaction data that can be executed in parallel. Compared with executing all transaction data serially, this application can improve the efficiency of data processing.

[0142] Please see Figure 9 , Figure 9 This is a flowchart illustrating another data processing method provided in this application embodiment. This data processing method can be applied to a blockchain and can be executed by the aforementioned blockchain nodes (e.g., any consensus node other than the packaging node). For ease of explanation, the following description will use a computer device executing this data processing method as an example. The data processing method may include the following steps S901 to S904:

[0143] S901. Obtain the consensus block sent by the packaging node.

[0144] Among them, the consensus block is generated by the packaging node after packaging N transaction data to be processed. The consensus block records M first transaction data and NM second transaction data based on the distinction recording rule. The M first transaction data are determined according to the transaction execution result of each transaction data after the N transaction data are executed in parallel. N and M are both positive integers, and M≤N.

[0145] The distinguishing record rules include: arrangement rules and label setting rules. The arrangement rules indicate how to package N transaction data into a block awaiting consensus, while the label setting rules indicate that any second transaction data packaged into the block awaiting consensus is assigned a target label. For example, the target label carried by any second transaction data could be NeedRedo.

[0146] It should be noted that the computer equipment determines the specific execution steps for the M first transaction data based on the transaction execution results of each transaction data. For details, please refer to the above. Figure 4 The specific steps performed in step S402 of the embodiment will not be repeated here.

[0147] S902. Perform parallel consensus processing on the M first transaction data in the consensus block to obtain the first transaction execution result for each first transaction data.

[0148] In specific implementation, the parallel consensus processing of M first transaction data by computer equipment includes: executing M first transaction data in parallel. Assuming that the M first transaction data are represented as: first transaction data 1, first transaction data 2, ..., first transaction data m, then the parallel execution of these M first transaction data specifically includes: while executing first transaction data 1, also executing first transaction data 2, first transaction data 3, ..., first transaction data m.

[0149] In one possible implementation, before performing parallel consensus processing on the M first transaction data in the consensus block, the computer device also obtains the node identifier of the packaging node and verifies the packaging node based on the obtained node identifier. If the verification passes, the step of performing parallel consensus processing on the M first transaction data in the consensus block to obtain the first transaction execution result for each first transaction data is triggered; if the verification fails, the consensus block is deleted. By verifying the identity information of the packaging node before consensus processing, the accuracy of the data processing can be improved.

[0150] Specifically, in the consensus block, any first transaction data does not carry a target label, while any second transaction data carries a target label. After the computer device obtains the consensus block, it identifies the transaction data without a target label as the first transaction data that meets the parallel execution conditions. Then, by executing these first transactions (i.e., M first transactions), the execution result for each first transaction data can be obtained. It should be noted that the specific steps for the computer device to execute any first transaction data to obtain the corresponding first transaction execution result are detailed above. Figure 4 The relevant content described in the embodiments will not be repeated here.

[0151] In one possible implementation, the computer device performs parallel consensus processing on M first transaction data in the consensus block to obtain the first transaction execution result for each first transaction data. After obtaining the first transaction execution result for each first transaction data, it is also used to perform the following steps: verify the validity of the parallel consensus processing process. If the verification fails, delete each first transaction execution result and each second transaction execution result; perform serial consensus processing on N transaction data to obtain the transaction execution result for each transaction data.

[0152] Specifically, the computer device verifies the validity of the parallel consensus processing process, which may include: traversing the transaction read cache of the target second transaction data to obtain the read dataset of the target second transaction data, wherein the read dataset is stored in the transaction read cache in the form of key-value pairs; performing a hash operation on the read key of the target second transaction data to obtain the verification hash string of the target second transaction data; and performing a matching process on the verification hash string based on the first hash string stored in the Bloom filter. If the match is successful, it is determined that the parallel execution process has passed the verification; if the match is unsuccessful, it is determined that the parallel execution process has failed the verification.

[0153] It should be understood that any transaction data (first transaction data, second transaction data) corresponds to a transaction read cache and a transaction write cache. The transaction read cache is used to store the read dataset of any transaction data, and the read dataset is used to indicate the call information of the smart contract corresponding to the transaction data (such as contract name, call address, etc.). The transaction write cache is used to store the write dataset of any transaction data, and the write dataset is used to store the transaction execution result obtained after calling the smart contract to execute the transaction data.

[0154] It should be noted that the detailed process of how the Bloom filter saves the first hash string can be found in the above. Figure 4 In this embodiment, the computer device writes the first hash string of each transaction data into the relevant content of the Bloom filter, which will not be described in detail here.

[0155] S903. Perform serial consensus processing on the NM second transaction data in the consensus block to obtain the second transaction execution result for each second transaction data.

[0156] In specific implementation, the computer device performs serial consensus processing on NM second transaction data, which includes: serially executing NM first transaction data. Assuming that the NM second transaction data are represented as: second transaction data a, second transaction data b, ..., second transaction data x, then the parallel execution of these NM second transaction data specifically includes: after executing second transaction data a, then executing second transaction data b, and after executing second transaction data b, then executing second transaction data c, and so on, until second transaction data x is executed.

[0157] It is understandable that any second transaction data in the consensus block is assigned a target label (e.g., NeedRedo). After the computer device obtains the consensus block, it identifies the transaction data carrying the target label as second transaction data that does not meet the conditions for parallel execution (i.e., needs to be executed serially). Then, after executing these second transaction data (i.e., NM second transaction data), the execution result of each second transaction data can be obtained. It should be noted that the specific steps for the computer device to execute any second transaction data to obtain the corresponding second transaction execution result are detailed above. Figure 4 The relevant content described in the embodiments will not be repeated here.

[0158] S904. Merge the execution results of each first transaction and each second transaction to obtain the merged execution result.

[0159] In one possible implementation, the computer device can merge the execution results of each first transaction and each second transaction according to their order of appearance in the consensus block to obtain a merged execution result. The order of appearance can refer to the order of the transaction generation timestamps from earliest to latest. For example, N transaction data include: transaction data 1, transaction data 2, and transaction data 3, where the transaction generation timestamp of transaction data 1 is t1, that of transaction data 2 is t2, and that of transaction data 3 is t3, and t1 < t2 < t3. Then, when merging the execution results s1 of transaction data 1, s2 of transaction data 2, and s3 of transaction data 3, s1 and s2 can be merged first to obtain s12, then s12 and s3 can be merged to obtain s123, and so on, until the merged execution results of all transaction data are obtained.

[0160] In one possible implementation, the computer device can also write the transaction merge execution results back to the blockchain's state database. This allows the state database to update the business state based on the transaction execution results of each transaction in the latest block (the consensus block). For example, if any transaction in the consensus block is: object A transfers m units of virtual resources to object B's account, then after obtaining the transaction execution result and writing it to the state database, the business state update operation performed in the state database could include: deducting m units of virtual resources from object A's account and adding m units of virtual resources to object B's account.

[0161] In this embodiment, after receiving the block to be agreed upon from the packaging node, the consensus node in the blockchain can execute a portion of the transaction data in the block in parallel, and then execute the remaining transaction data in the block serially. This consensus method solves the problem of low performance and low system throughput caused by the need to serially execute a large amount of transaction data. Because this application can execute transaction data in parallel, it improves the execution efficiency of the blockchain and greatly increases the system throughput.

[0162] Please see Figure 10 , Figure 10 This is a schematic diagram of a data processing apparatus provided in an embodiment of this application. The data processing apparatus 1000 can be applied to the computer device (e.g., a packaging node) in the foregoing embodiments. The data processing apparatus 1000 can be a computer program (including program code) running on the computer device; for example, the data processing apparatus 1000 is an application software. The data processing apparatus 1000 can be used to execute corresponding steps in the data processing method provided in the embodiments of this application. The data processing apparatus 1000 may include:

[0163] Acquisition unit 1001 is used to acquire N transaction data to be processed and execute N transaction data, where N is a positive integer;

[0164] Processing unit 1002 is used to determine M first transaction data that meet the parallel execution conditions from N transaction data based on the transaction execution result of each transaction data, where M is a positive integer and M≤N;

[0165] Processing unit 1002 is also used to package N transaction data to generate a block to be consensused. In the block to be consensused, M first transaction data and NM second transaction data other than the M first transaction data are recorded based on the distinction recording rule.

[0166] The sending unit 1003 is used to broadcast the block to be reached to the consensus node set, so that the consensus nodes in the consensus node set can perform parallel consensus processing on the M first transaction data in the block to be reached based on the distinguished record rule, and perform serial consensus processing on the NM second transaction data.

[0167] In one possible implementation, the distinction recording rules include: arrangement rules and label setting rules; processing unit 1002 packages N transaction data to generate a block to be reached for consensus, which is used to perform the following operations:

[0168] Pack N transaction data according to the arrangement rules to generate a block awaiting consensus;

[0169] Among them, after packaging N transaction data according to the arrangement rules, any first transaction data in the consensus block will be processed in the consensus process before any second transaction data.

[0170] Furthermore, the label setting rules are used to indicate that any second transaction data packaged into the block awaiting consensus is set with a target label.

[0171] In one possible implementation, before the processing unit 1002 executes N transaction data, it is also used to perform the following operations:

[0172] Create a corresponding transaction read cache and transaction write cache for each of the N transaction data;

[0173] The transaction read cache stores the read dataset for any transaction data, which indicates the call information of the smart contract corresponding to the transaction data. The transaction write cache stores the write dataset for any transaction data, which stores the transaction execution result obtained after calling the smart contract to execute the transaction data.

[0174] In one possible implementation, the processing unit 1002 is further configured to perform the following operations:

[0175] Retrieve the read dataset of the target transaction data from the transaction read cache, and based on the call information in the read dataset of the target transaction data, obtain the target smart contract used to execute the target transaction data;

[0176] The target smart contract is invoked to execute the target transaction data, and the execution result of the target transaction is obtained. The execution result of the target transaction is used as the write dataset of the target transaction data.

[0177] In one possible implementation, the execution result of any transaction data is stored in the corresponding transaction write cache in the form of key-value pairs; the processing unit 1002 is also used to perform the following operations:

[0178] Retrieve the write key for each transaction from the transaction write cache, and perform a hash operation on the write key for each transaction to obtain the first hash string for each transaction.

[0179] Write the first hash string of each transaction data into the Bloom filter.

[0180] In one possible implementation, the read dataset of any transaction data is stored in the corresponding transaction read cache in the form of key-value pairs;

[0181] Based on the transaction execution result of each transaction, the processing unit 1002 determines M first transaction data that meet the parallel execution conditions from N transaction data, and performs the following operations:

[0182] Iterate through the read dataset for each transaction and perform a hash operation on the read key for each transaction to obtain the second hash string for each transaction.

[0183] For each transaction data's second hash string, a matching process is performed with each of the first hash strings in the Bloom filter, and based on the matching results, M first transaction data that satisfy the parallel execution conditions are determined from the N transaction data.

[0184] In one possible implementation, the processing unit 1002 determines M first transaction data that satisfy the parallel execution conditions from N transaction data based on the matching results, and performs the following operations:

[0185] The second hash string of the target transaction data is matched with each of the first hash strings in the Bloom filter;

[0186] If the matching result is unsuccessful, then the target transaction data is determined to meet the conditions for parallel execution, and the target transaction data is determined as the first transaction data;

[0187] If the matching result is successful, it is determined that the target transaction data does not meet the conditions for parallel execution, and the target transaction data is determined as the second transaction data.

[0188] In one possible implementation, after the sending unit 1003 broadcasts the block to be agreed upon to the consensus node set, the processing unit 1002 is further configured to perform the following operations:

[0189] Execute NM second transaction data points out of N transaction data points sequentially to obtain the second transaction execution result for each second transaction data point.

[0190] From the transaction execution results of each transaction data, obtain the first transaction execution results of M first transaction data;

[0191] The execution results of each first transaction and each second transaction are merged to obtain the merged execution result.

[0192] In this embodiment, N transaction data to be agreed upon can be obtained and executed, where N is a positive integer. Then, based on the execution result of each transaction data, M first transaction data that meet the parallel execution conditions are determined from the N transaction data, where M is a positive integer and M≤N. Next, the N transaction data are packaged to generate a block to be agreed upon, which includes the M first transaction data and NM second transaction data other than the M first transaction data. Finally, the block to be agreed upon can be broadcast to a consensus node set, so that the consensus nodes in the consensus node set can perform parallel consensus processing on the M first transaction data in the block to be agreed upon and perform serial consensus processing on the NM second transaction data. Therefore, in this embodiment, multiple transaction data can be pre-executed, and then the transaction data that can be parallelized can be identified according to the transaction execution results. Then, the parallelizable transaction data (i.e., the first transaction data) and the non-parallelizable transaction data (i.e., the second transaction data) are packaged into a block. Finally, the packaged block is broadcast to multiple consensus nodes, so that the consensus nodes can execute the first transaction data in parallel and then execute the second transaction data serially. This consensus method can perform parallel consensus processing on the parallelizable transaction data. Compared with executing all transaction data serially, this application can improve the efficiency of data processing, thereby increasing the throughput of the system.

[0193] Please see Figure 11 , Figure 11 This is a schematic diagram of another data processing apparatus provided in an embodiment of this application. The data processing apparatus 1100 can be applied to the computer device (e.g., a consensus node) in the foregoing embodiments. The data processing apparatus 1100 can be a computer program (including program code) running on the computer device; for example, the data processing apparatus 1100 is an application software. The data processing apparatus 1100 can be used to execute corresponding steps in the data processing method provided in the embodiments of this application. The data processing apparatus 1100 may include:

[0194] The acquisition unit 1101 is used to acquire the consensus block sent by the packaging node. The consensus block is generated by the packaging node after packaging N transaction data to be processed. The consensus block records M first transaction data and NM second transaction data based on the distinction recording rule. The M first transaction data are determined according to the transaction execution result of each transaction data after the N transaction data are executed in parallel. N and M are both positive integers, and M≤N.

[0195] Processing unit 1102 is used to perform parallel consensus processing on M first transaction data in the consensus block to obtain the first transaction execution result of each first transaction data;

[0196] Processing unit 1102 is also used to perform serial consensus processing on NM second transaction data in the consensus block to obtain the second transaction execution result of each second transaction data;

[0197] The processing unit 1102 is also used to merge the execution results of each first transaction and the execution results of each second transaction to obtain a merged execution result.

[0198] In one possible implementation, after processing unit 1102 performs parallel consensus processing on the M first transaction data in the consensus block to obtain the first transaction execution result for each first transaction data, it is also used to perform the following operations:

[0199] The validity of the parallel consensus processing is verified. If the verification fails, the execution results of each first transaction and each second transaction are deleted.

[0200] Perform serial consensus processing on N transaction data to obtain the transaction execution result for each transaction data.

[0201] In one possible implementation, processing unit 1102 verifies the validity of the parallel consensus processing procedure by performing the following operations:

[0202] Traverse the transaction read cache of the target second transaction data to obtain the read dataset of the target second transaction data. The read dataset is stored in the transaction read cache in the form of key-value pairs.

[0203] Perform a hash operation on the read key of the target second transaction data to obtain the verification hash string of the target second transaction data;

[0204] The verification hash string is matched against the first hash string stored by the Bloom filter. If the match is successful, the parallel execution process is considered to have passed verification.

[0205] In this embodiment, after receiving the block to be agreed upon from the packaging node, the consensus node in the blockchain can execute a portion of the transaction data in the block in parallel, and then execute the remaining transaction data in the block serially. This consensus method solves the problem of low performance and low system throughput caused by the need to serially execute a large amount of transaction data. Because this application can execute transaction data in parallel, it improves the execution efficiency of the blockchain and greatly increases the system throughput.

[0206] Please see Figure 12 , Figure 12 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. The computer device 1200 is used to execute the steps performed by the packaging node and consensus node in the aforementioned method embodiments. The computer device 1200 includes: one or more processors 1210; one or more input devices 1220; one or more output devices 1230; and a memory 1240. The processors 1210, input devices 1220, output devices 1230, and memory 1240 are connected via a bus 1250. The memory 1240 is used to store a computer program, which includes program instructions. The processor 1210 is used to call the program instructions stored in the memory 1240 to perform the following operations:

[0207] Retrieve N transaction data to be processed and execute N transaction data, where N is a positive integer;

[0208] Based on the transaction execution result of each transaction data, determine the M first transaction data that meet the parallel execution conditions from the N transaction data, where M is a positive integer and M≤N;

[0209] Pack N transaction data into a block to be consensused. The block to be consensused records M first transaction data and NM second transaction data other than the M first transaction data, based on the distinguishing recording rule.

[0210] The block to be consensused is broadcast to the consensus node set, so that the consensus nodes in the consensus node set can perform parallel consensus processing on the M first transaction data in the block to be consensused based on the distinguished record rules, and perform serial consensus processing on the NM second transaction data.

[0211] In one possible implementation, the distinguishing record rules include: arrangement rules and label setting rules; processor 1210 packages N transaction data to generate a block awaiting consensus, which is used to perform the following operations:

[0212] Pack N transaction data according to the arrangement rules to generate a block awaiting consensus;

[0213] Among them, after packaging N transaction data according to the arrangement rules, any first transaction data in the consensus block will be processed in the consensus process before any second transaction data.

[0214] Furthermore, the label setting rules are used to indicate that any second transaction data packaged into the block awaiting consensus is set with a target label.

[0215] In one possible implementation, before the processor 1210 executes N transaction data, it is also used to perform the following operations:

[0216] Create a corresponding transaction read cache and transaction write cache for each of the N transaction data;

[0217] The transaction read cache stores the read dataset for any transaction data, which indicates the call information of the smart contract corresponding to the transaction data. The transaction write cache stores the write dataset for any transaction data, which stores the transaction execution result obtained after calling the smart contract to execute the transaction data.

[0218] In one possible implementation, the processor 1210 is also used to perform the following operations:

[0219] Retrieve the read dataset of the target transaction data from the transaction read cache, and based on the call information in the read dataset of the target transaction data, obtain the target smart contract used to execute the target transaction data;

[0220] The target smart contract is invoked to execute the target transaction data, and the execution result of the target transaction is obtained. The execution result of the target transaction is used as the write dataset of the target transaction data.

[0221] In one possible implementation, the execution result of any transaction data is stored in the corresponding transaction write cache in the form of key-value pairs; the processor 1210 is also used to perform the following operations:

[0222] Retrieve the write key for each transaction from the transaction write cache, and perform a hash operation on the write key for each transaction to obtain the first hash string for each transaction.

[0223] Write the first hash string of each transaction data into the Bloom filter.

[0224] In one possible implementation, the read dataset of any transaction data is stored in the corresponding transaction read cache in the form of key-value pairs;

[0225] Based on the transaction execution result of each transaction, processor 1210 determines M first transaction data that meet the parallel execution conditions from N transaction data, and performs the following operations:

[0226] Iterate through the read dataset for each transaction and perform a hash operation on the read key for each transaction to obtain the second hash string for each transaction.

[0227] For each transaction data's second hash string, a matching process is performed with each of the first hash strings in the Bloom filter, and based on the matching results, M first transaction data that satisfy the parallel execution conditions are determined from the N transaction data.

[0228] In one possible implementation, the processor 1210 determines M first transaction data that satisfy the parallel execution conditions from N transaction data based on the matching results, and uses them to perform the following operations:

[0229] The second hash string of the target transaction data is matched with each of the first hash strings in the Bloom filter;

[0230] If the matching result is unsuccessful, then the target transaction data is determined to meet the conditions for parallel execution, and the target transaction data is determined as the first transaction data;

[0231] If the matching result is successful, it is determined that the target transaction data does not meet the conditions for parallel execution, and the target transaction data is determined as the second transaction data.

[0232] In one possible implementation, after broadcasting the block to be reached to the consensus node set, the processor 1210 is also used to perform the following operations:

[0233] Execute NM second transaction data points out of N transaction data points sequentially to obtain the second transaction execution result for each second transaction data point.

[0234] From the transaction execution results of each transaction data, obtain the first transaction execution results of M first transaction data;

[0235] The execution results of each first transaction and each second transaction are merged to obtain the merged execution result.

[0236] In one possible implementation, processor 1210 is used to call program instructions stored in memory 1240, and also to perform the following operations:

[0237] Obtain the consensus block sent by the packaging node. The consensus block is generated by the packaging node after packaging N transaction data to be processed. The consensus block records M first transaction data and NM second transaction data based on the distinction recording rule. The M first transaction data are determined based on the transaction execution result of each transaction data after the N transaction data are executed in parallel. N and M are both positive integers, and M ≤ N.

[0238] Parallel consensus processing is performed on the M first transaction data in the consensus block to obtain the first transaction execution result for each first transaction data.

[0239] The NM second transaction data in the consensus block are processed sequentially to obtain the second transaction execution result for each second transaction data.

[0240] The execution results of each first transaction and each second transaction are merged to obtain the merged execution result.

[0241] In one possible implementation, the processor 1210 performs parallel consensus processing on the M first transaction data in the consensus block, and after obtaining the first transaction execution result for each first transaction data, it is also used to perform the following operations:

[0242] The validity of the parallel consensus processing is verified. If the verification fails, the execution results of each first transaction and each second transaction are deleted.

[0243] Perform serial consensus processing on N transaction data to obtain the transaction execution result for each transaction data.

[0244] In one possible implementation, the processor 1210 performs validity verification on the parallel consensus processing procedure to perform the following operations:

[0245] Traverse the transaction read cache of the target second transaction data to obtain the read dataset of the target second transaction data. The read dataset is stored in the transaction read cache in the form of key-value pairs.

[0246] Perform a hash operation on the read key of the target second transaction data to obtain the verification hash string of the target second transaction data;

[0247] The verification hash string is matched against the first hash string stored by the Bloom filter. If the match is successful, the parallel execution process is considered to have passed verification.

[0248] In this embodiment, N transaction data to be agreed upon can be obtained and executed, where N is a positive integer. Then, based on the execution result of each transaction data, M first transaction data that meet the parallel execution conditions are determined from the N transaction data, where M is a positive integer and M≤N. Next, the N transaction data are packaged to generate a block to be agreed upon, which includes the M first transaction data and NM second transaction data other than the M first transaction data. Finally, the block to be agreed upon can be broadcast to a consensus node set, so that the consensus nodes in the consensus node set can perform parallel consensus processing on the M first transaction data in the block to be agreed upon and perform serial consensus processing on the NM second transaction data. Therefore, in this embodiment, multiple transaction data can be pre-executed, and then the transaction data that can be parallelized can be identified according to the transaction execution results. Then, the parallelizable transaction data (i.e., the first transaction data) and the non-parallelizable transaction data (i.e., the second transaction data) are packaged into a block. Finally, the packaged block is broadcast to multiple consensus nodes, so that the consensus nodes can execute the first transaction data in parallel and then execute the second transaction data serially. This consensus method can perform parallel consensus processing on the parallelizable transaction data. Compared with executing all transaction data serially, this application can improve the efficiency of data processing, thereby increasing the throughput of the system.

[0249] Furthermore, it should be noted that this application also provides a computer storage medium storing a computer program, which includes program instructions. When the processor executes these program instructions, it can perform the methods described in the preceding embodiments. Therefore, further details will not be provided here. For technical details not disclosed in the embodiments of the computer storage medium involved in this application, please refer to the description of the method embodiments of this application. As an example, the program instructions can be deployed on a computer device, executed on multiple computer devices located in one location, or executed on multiple computer devices distributed in multiple locations and interconnected through a communication network.

[0250] According to one aspect of this application, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods described in the preceding embodiments; therefore, further details will not be provided here.

[0251] Those skilled in the art will understand that implementing all or part of the processes in the above embodiments can be accomplished by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.

[0252] The above-disclosed embodiments are merely preferred embodiments of this application and should not be construed as limiting the scope of this application. Therefore, any equivalent variations made in accordance with the claims of this application shall still fall within the scope of this application.

Claims

1. A data processing method, characterized in that, include: Obtain N transaction data to be processed, and execute the N transaction data, where N is a positive integer; Both the read and write datasets of any transaction data are stored in the form of key-value pairs. The read dataset is used to indicate the call information of the smart contract corresponding to the transaction data, and the write dataset is used to store the transaction execution result obtained after calling the smart contract to execute the transaction data. The first hash string corresponding to the write key of each transaction data is written to the Bloom filter. Based on the transaction execution result of each transaction data, M first transaction data that satisfy the parallel execution condition are determined from the N transaction data, where M is a positive integer and M≤N; the parallel execution condition means that the second hash string corresponding to the read key of the transaction data does not match any of the first hash strings in the Bloom filter. The N transaction data are packaged to generate a block to be consensused. In the block to be consensused, M first transaction data and NM second transaction data other than the M first transaction data are recorded based on the distinction recording rule. The block to be reached is broadcast to the consensus node set, so that the consensus nodes in the consensus node set can perform parallel consensus processing on M first transaction data in the block to be reached based on the distinguishing record rule, and perform serial consensus processing on NM second transaction data.

2. The method as described in claim 1, characterized in that, The distinction recording rules include: arrangement rules and label setting rules; the packaging of the N transaction data to generate a block to be reached for consensus includes: The N transaction data are packaged according to the arrangement rules to generate a block awaiting consensus. In this process, after the N transaction data are packaged according to the arrangement rules, any first transaction data in the consensus block will be processed in a consensus process before any second transaction data. Furthermore, the label setting rules are used to indicate that any second transaction data packaged into the consensus block is set with a target label.

3. The method as described in claim 1, characterized in that, Before executing the N transaction data, the process also includes: Create a corresponding transaction read cache and transaction write cache for each of the N transaction data; The transaction read cache is used to store the read dataset of any transaction data, and the transaction write cache is used to store the write dataset of any transaction data.

4. The method as described in claim 3, characterized in that, The method further includes: Retrieve the read dataset of the target transaction data from the transaction read cache, and based on the call information in the read dataset of the target transaction data, obtain the target smart contract for executing the target transaction data; The target smart contract is invoked to execute the target transaction data, and the target transaction execution result is obtained. The target transaction execution result is used as the write dataset of the target transaction data.

5. The method as described in claim 4, characterized in that, The execution result of any transaction data is stored in the corresponding transaction write cache in the form of key-value pairs; the method further includes: Retrieve the write key for each transaction from the transaction write cache, and perform a hash operation on the write key for each transaction to obtain the first hash string for each transaction. Write the first hash string of each transaction data into the Bloom filter.

6. The method as described in claim 5, characterized in that, The read dataset of any transaction data is stored in the corresponding transaction read cache in the form of key-value pairs; The step of determining M first transaction data that satisfy the parallel execution condition from the N transaction data based on the transaction execution result of each transaction data includes: Iterate through the read dataset for each transaction and perform a hash operation on the read key for each transaction to obtain the second hash string for each transaction. For each transaction data's second hash string, a matching process is performed with each of the first hash strings in the Bloom filter, and based on the matching results, M first transaction data that satisfy the parallel execution conditions are determined from the N transaction data.

7. The method as described in claim 6, characterized in that, The step of determining M first transaction data that satisfy the parallel execution conditions from the N transaction data based on the matching results includes: The second hash string of the target transaction data is matched with each of the first hash strings in the Bloom filter; If the matching result is unsuccessful, then the target transaction data is determined to meet the parallel execution conditions, and the target transaction data is determined as the first transaction data; If the matching result is successful, it is determined that the target transaction data does not meet the conditions for parallel execution, and the target transaction data is determined as the second transaction data.

8. The method as described in claim 1, characterized in that, After broadcasting the block to be reached for consensus to the consensus node set, the method further includes: Execute NM second transaction data points out of the N transaction data points sequentially to obtain the second transaction execution result for each second transaction data point. Obtain the first transaction execution results of M first transaction data from the transaction execution results of each of the transaction data; The execution results of each first transaction and each second transaction are merged to obtain the merged execution result.

9. A data processing method, characterized in that, include: Obtain the consensus block sent by the packaging node. The consensus block is generated by the packaging node after packaging N transaction data to be processed. The consensus block records M first transaction data and NM second transaction data based on the distinction recording rule. The M first transaction data are the transaction data that meet the parallel execution conditions after the N transaction data are executed in parallel. N and M are both positive integers, and M≤N. In this system, both the read and write datasets for any transaction data are stored in key-value pairs. The read dataset is used to indicate the call information of the smart contract corresponding to the transaction data, and the write dataset is used to store the transaction execution result obtained after calling the smart contract to execute the transaction data. The first hash string corresponding to the write key of each transaction data is written to a Bloom filter. The condition of parallel execution is met when the second hash string corresponding to the read key of the transaction data does not match any of the first hash strings in the Bloom filter. Parallel consensus processing is performed on the M first transaction data in the block to be consensused to obtain the first transaction execution result for each first transaction data. The NM second transaction data in the block to be reached are processed sequentially to obtain the second transaction execution result for each second transaction data. The execution results of each first transaction and each second transaction are merged to obtain the merged execution result.

10. The method as described in claim 9, characterized in that, After performing parallel consensus processing on the M first transaction data in the consensus block to obtain the first transaction execution result for each first transaction data, the process further includes: The validity of the parallel consensus processing is verified. If the verification fails, the execution results of each first transaction and each second transaction are deleted. The N transaction data are processed sequentially through consensus to obtain the transaction execution result for each transaction data.

11. The method as described in claim 10, characterized in that, The validity verification of the parallel consensus processing process includes: Traverse the transaction read cache of the target second transaction data to obtain the read dataset of the target second transaction data, wherein the read dataset is stored in the transaction read cache in the form of key-value pairs; Perform a hash operation on the read keyword key of the target second transaction data to obtain the verification hash string of the target second transaction data; The verification hash string is matched against the first hash string stored by the Bloom filter. If the match is successful, the parallel execution process is verified.

12. A data processing apparatus, characterized in that, include: An acquisition unit is used to acquire N transaction data to be processed and execute the N transaction data, where N is a positive integer; Both the read and write datasets of any transaction data are stored in the form of key-value pairs. The read dataset is used to indicate the call information of the smart contract corresponding to the transaction data, and the write dataset is used to store the transaction execution result obtained after calling the smart contract to execute the transaction data. The first hash string corresponding to the write key of each transaction data is written to the Bloom filter. The processing unit is configured to determine, based on the transaction execution result of each transaction data, M first transaction data that satisfy the parallel execution condition from the N transaction data, where M is a positive integer and M≤N; the parallel execution condition means that the second hash string corresponding to the read key of the transaction data does not match any of the first hash strings in the Bloom filter. The processing unit is also used to package the N transaction data to generate a block to be consensused, wherein the block to be consensused records M first transaction data and NM second transaction data other than the M first transaction data based on the distinction recording rule; The sending unit is used to broadcast the block to be reached to a consensus node set, so that the consensus nodes in the consensus node set can perform parallel consensus processing on M first transaction data in the block to be reached based on the distinguishing record rule, and perform serial consensus processing on NM second transaction data.

13. A data processing apparatus, characterized in that, include: The acquisition unit is used to acquire the consensus block sent by the packaging node. The consensus block is generated by the packaging node after packaging N transaction data to be processed. The consensus block records M first transaction data and NM second transaction data based on the distinction recording rule. The M first transaction data are the transaction data that meet the parallel execution conditions after the N transaction data are executed in parallel. N and M are both positive integers, and M≤N. In this system, both the read and write datasets for any transaction data are stored in key-value pairs. The read dataset is used to indicate the call information of the smart contract corresponding to the transaction data, and the write dataset is used to store the transaction execution result obtained after calling the smart contract to execute the transaction data. The first hash string corresponding to the write key of each transaction data is written to a Bloom filter. The condition of parallel execution is met when the second hash string corresponding to the read key of the transaction data does not match any of the first hash strings in the Bloom filter. The processing unit is used to perform parallel consensus processing on M first transaction data in the block to be consensused, and to obtain the first transaction execution result of each first transaction data. The processing unit is also used to perform serial consensus processing on the NM second transaction data in the block to be consensused, and to obtain the second transaction execution result for each second transaction data. The processing unit is also used to merge the execution results of each first transaction and each second transaction to obtain a merged execution result.

14. A computer device, characterized in that, include: A processor, adapted to execute computer programs; A computer-readable storage medium storing a computer program that, when executed by the processor, implements the data processing method as described in any one of claims 1-8 or 9-11.

15. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, the computer program including program instructions that, when executed by a processor, cause the processor to perform the data processing method as described in any one of claims 1-8 or 9-11.

16. A computer program product, characterized in that, The computer program product includes computer instructions stored in a computer-readable storage medium, which, when read and executed by a processor of a computer device, cause the computer device to perform the data processing method as described in any one of claims 1-8 or 9-11.

Citation Information

Patent Citations

  • Parallel execution method and system for blockchain transaction, and storage medium

    CN110728578A

  • Transaction data processing method and device and computer equipment

    CN112508573A

  • Virus detection method and device, electronic equipment and storage medium

    CN113051568A