WO2024007856A1 - 数据处理方法、装置及设备、介质、产品 - Google Patents

数据处理方法、装置及设备、介质、产品 Download PDF

Info

Publication number
WO2024007856A1
WO2024007856A1 PCT/CN2023/101379 CN2023101379W WO2024007856A1 WO 2024007856 A1 WO2024007856 A1 WO 2024007856A1 CN 2023101379 W CN2023101379 W CN 2023101379W WO 2024007856 A1 WO2024007856 A1 WO 2024007856A1
Authority
WO
WIPO (PCT)
Prior art keywords
transaction data
transaction
data
group
consensus
Prior art date
Application number
PCT/CN2023/101379
Other languages
English (en)
French (fr)
Inventor
刘区城
王宗友
朱耿良
时一防
刘汉卿
廖志勇
Original Assignee
腾讯科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 腾讯科技(深圳)有限公司 filed Critical 腾讯科技(深圳)有限公司
Priority to US18/490,697 priority Critical patent/US20240045849A1/en
Publication of WO2024007856A1 publication Critical patent/WO2024007856A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/40Authorisation, e.g. identification of payer or payee, verification of customer or shop credentials; Review and approval of payers, e.g. check credit lines or negative lists
    • G06Q20/401Transaction verification
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2379Updates performed during online database operations; commit processing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • G06F16/2255Hash tables
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24552Database cache management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/64Protecting data integrity, e.g. using checksums, certificates or signatures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/40Authorisation, e.g. identification of payer or payee, verification of customer or shop credentials; Review and approval of payers, e.g. check credit lines or negative lists
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3236Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions
    • H04L9/3239Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions involving non-keyed hash functions, e.g. modification detection codes [MDCs], MD5, SHA or RIPEMD
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/50Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using hash chains, e.g. blockchains or hash trees

Definitions

  • This application relates to the field of blockchain technology, and in particular, to a data processing method, device, computer equipment, computer-readable storage medium and computer program product.
  • a block can be composed of multiple sets of transaction data. Before the packaging node writes the block to the blockchain, it needs to separately agree on the block through the consensus nodes in the consensus network, that is, these consensus nodes need to separately agree on the block. Each set of transaction data in the block is subject to transaction verification.
  • each consensus node needs to execute transaction data 1 first, then execute transaction data 2, and after executing transaction data After 2, continue to execute transaction data 3.
  • embodiments of the present application provide a data processing method, which method includes:
  • each group of transaction data determine at least one group of first transaction data that meets the preset execution conditions from the multiple groups of transaction data;
  • Package multiple sets of transaction data to generate a block to be agreed upon; each set of first transaction data and at least one set of second transaction data are recorded in the block to be consensus; the second transaction data is different from the first transaction data in multiple sets of transaction data transaction data;
  • embodiments of the present application provide a data processing method, which method includes:
  • the block to be agreed upon is generated by packaging multiple sets of transaction data to be processed by the packaging node. At least one set of first transaction data and at least one set of second transaction data are recorded in the block to be agreed upon. Transaction data, the first transaction data is determined based on the transaction execution results of each group of transaction data after parallel execution of multiple groups of transaction data;
  • Each first transaction execution result and each second transaction execution result are merged to obtain a transaction merge execution result.
  • embodiments of the present application provide a data processing device, which includes:
  • the acquisition unit is used to acquire multiple sets of transaction data to be processed and execute multiple sets of transaction data
  • a processing unit configured to determine at least one set of first transaction data that satisfies the preset execution conditions from multiple sets of transaction data based on the transaction execution results of each set of transaction data;
  • the processing unit is also used to package multiple sets of transaction data and generate a block to be agreed upon; each set of first transaction data and at least one set of second transaction data are recorded in the block to be agreed upon; the second transaction data is one of the multiple sets of transaction data. Transaction data that is different from the first transaction data;
  • the sending unit is used to broadcast the block to be agreed to to the consensus node set, so that the consensus nodes in the consensus node set perform the first consensus processing on each set of first transaction data in the to-be-consensus block, and perform the first consensus processing on each set of second transaction data.
  • a second consensus process different from the first consensus process is performed.
  • embodiments of the present application provide a data processing device, which includes:
  • the acquisition unit is used to obtain the consensus block sent by the packaging node.
  • the consensus block is generated by packaging multiple sets of transaction data to be processed by the packaging node. At least one set of first transaction data and the transaction data are recorded in the consensus block. At least one set of second transaction data, the first transaction data is determined based on the transaction execution results of each set of transaction data after parallel execution of multiple sets of transaction data;
  • a processing unit configured to perform first consensus processing on each set of first transaction data in the consensus block to obtain the first transaction execution result of each set of first transaction data
  • the processing unit is also configured to perform a second consensus process different from the first consensus process on each set of second transaction data in the consensus block to obtain a second transaction execution result for each set of second transaction data;
  • the processing unit is also used to merge each first transaction execution result and each second transaction execution result to obtain a transaction merge execution result.
  • inventions of the present application provide a computer device.
  • the computer device includes a memory and one or more processors.
  • the memory stores computer-readable instructions. When executed by the processor, the computer-readable instructions cause one or more The processor performs the steps in the above data processing method.
  • embodiments of the present application provide one or more non-volatile computer-readable storage media.
  • the computer-readable storage media stores computer-readable instructions. When the computer-readable instructions are executed by one or more processors, , causing one or more processors to execute the steps in the above data processing method.
  • inventions of the present application provide a computer program product.
  • the computer program product includes computer readable instructions. When the computer readable instructions are executed by a processor, the steps in the above data processing method are implemented.
  • Figure 1 is a schematic structural diagram of a blockchain node system provided by an embodiment of the present application.
  • Figure 2 is a schematic structural diagram of a blockchain provided by an embodiment of this application.
  • Figure 3 is a schematic diagram of the principle of a data processing method provided by an embodiment of the present application.
  • Figure 4 is a schematic flowchart of a data processing method provided by an embodiment of the present application.
  • Figure 5a is a schematic flowchart of a parallel execution of transaction data provided by an embodiment of the present application.
  • Figure 5b is a schematic flowchart of a transaction data execution process provided by an embodiment of the present application.
  • Figure 6 is a schematic diagram of the principle of a Bloom filter provided by an embodiment of the present application.
  • Figure 7a is a schematic flowchart of determining second transaction data provided by an embodiment of the present application.
  • Figure 7b is a schematic flowchart of determining first transaction data provided by an embodiment of the present application.
  • Figure 8 is a schematic flowchart of generating blocks to be agreed upon according to an embodiment of the present application.
  • FIG. 9 is a schematic flowchart of another data processing method provided by an embodiment of the present application.
  • Figure 10 is a schematic structural diagram of a data processing device provided by an embodiment of the present application.
  • Figure 11 is a schematic structural diagram of another data processing device provided by an embodiment of the present application.
  • Figure 12 is a schematic structural diagram of a computer device provided by an embodiment of the present application.
  • the data processing method of this application can be combined with blockchain technology.
  • blockchain technology involved in the data processing method provided in this application will be introduced in detail:
  • the data processing system involved in the embodiment of the present application may be a distributed system (ie, a blockchain node system) formed by multiple nodes connected through network communication.
  • a distributed system ie, a blockchain node system
  • the relevant technologies involved in the blockchain node system will be introduced in detail with reference to Figure 1:
  • FIG. 1 is a schematic structural diagram of a blockchain node system provided by an embodiment of the present application.
  • Blockchain is a new application model of computer technology such as distributed data storage, point-to-point transmission, consensus mechanism and encryption algorithm. It is mainly used to organize data in chronological order and encrypt it into a ledger, making it impossible to be tampered with and forged. , and data verification, storage and update can be performed at the same time.
  • the blockchain is essentially a decentralized database. Each node in the database stores an identical blockchain.
  • the blockchain network includes consensus nodes, which are responsible for the consensus of the entire blockchain network.
  • the blockchain node system shown in Figure 1 may correspond to a blockchain network, which may include but is not limited to blockchain networks corresponding to alliance chains, public chains, private chains, etc.
  • the blockchain node system refers to a system used for data sharing between blockchain nodes.
  • the blockchain node system can include multiple nodes, and the multiple nodes can specifically include node 101 and node 102. , node 103,..., node 10n, where each node among node 101, node 102, node 103,..., node 10n can be collectively referred to as a blockchain node.
  • Communication connections can be established between nodes through information connections.
  • the above-mentioned information connections are not limited to specific connection methods. For example, they can be connected directly or indirectly through wired communication methods, or directly or indirectly through wireless communication methods. The connection can also be through other connection methods, which are not limited in this application.
  • each node in the blockchain node system can receive input information when performing normal work, and maintain shared data within the blockchain node system based on the received input information.
  • there can be information connections between each node in the blockchain node system and information can be transmitted between nodes through the above information connections. For example, when any node in the blockchain node system receives input information, other nodes in the blockchain node system obtain the input information according to the consensus algorithm and store the input information as data in the shared data, so that The data stored on all nodes in the blockchain node system is consistent.
  • the blockchain network can realize information connection between nodes based on node identification.
  • Each node in the blockchain node system has a corresponding node identification, and each node in the blockchain node system can store There are node identifiers of other nodes in the blockchain node system, so that the generated blocks can be subsequently broadcast to other nodes in the blockchain node system based on the node identifiers of other nodes.
  • Each node can maintain a node ID list as shown in the following table, and store the node name and node ID correspondingly in the node ID list.
  • the node identifier can be an IP (Internet Protocol, a protocol for interconnection between networks) address and any other information that can be used to identify the node in the blockchain network.
  • Table 1 only takes the IP address as an example for explanation.
  • node 1 for example, node 1 can be node 101 shown in Figure 1
  • information for example, zone block
  • node 2 can determine that the information is sent by node 1 through the node identifier 111.111.111.111.
  • the blockchain system can include smart contracts.
  • the smart contract can be understood as a kind of blockchain node (including consensus node) in the blockchain system.
  • the so-called consensus node refers to the person who owns all the nodes in the blockchain system. Ledger information, and nodes participating in the accounting consensus) can understand and execute code that can execute arbitrary logic and obtain results.
  • the blockchain can include one or more smart contracts, and these smart contracts can be distinguished by identification numbers (Identity document, ID) or names, and the transaction data request can carry the identification number or name of the smart contract to The smart contracts this specified blockchain needs to run.
  • FIG. 2 is a schematic structural diagram of a blockchain provided by an embodiment of the present application.
  • the blockchain consists of multiple blocks (including the genesis block).
  • the genesis block includes the block header and the block body.
  • the block header stores the input information feature value, version number, timestamp and difficulty value. , the input information is stored in the block body; the next block of the genesis block has the genesis block as the parent block, and the next block also includes the block header and the block body, and the input information of the current block is stored in the block header.
  • Characteristic value, block header characteristic value of the parent block, version number, timestamp and difficulty value, and so on so that the block data stored in each block in the blockchain is consistent with the area stored in the parent block.
  • Block data is associated, ensuring the security of the information entered in the block.
  • Block is a data packet that carries transaction data on the blockchain network. It is a data structure marked with a timestamp and the hash value of the previous block. The block is verified and determined by the network's consensus mechanism. transactions in the block.
  • the transaction data processing method provided by the embodiment of the present application can be executed by computer equipment, including but not limited to terminal equipment or servers.
  • terminal devices can include but are not limited to: mobile phones, tablet computers, laptops, PDAs, mobile Internet devices (Mobile Internet Device, MID), intelligent voice interaction devices, vehicle-mounted terminals, roadside equipment, aircraft, wearable devices, Smart home appliances, or wearable devices with network configuration management functions such as smart watches, smart bracelets, pedometers, etc.
  • the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also provide cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, and cloud communications. , middleware services, domain name services, security services, CDN (Content Delivery Network, content distribution network), and cloud servers for basic cloud computing services such as big data and artificial intelligence platforms.
  • the packaging node where the blockchain is located can send the newly generated blocks to other consensus nodes in the blockchain node system where the packaging node is located based on the node identifiers of other consensus nodes in the blockchain node system, and the consensus nodes will The newly generated block is consensused, and after the consensus is successful, the newly generated block is added to the blockchain where it is stored.
  • Figure 3 is a schematic diagram of the principle of a data processing method provided by an embodiment of this application.
  • the principle of this data processing method is as follows: the packaging node can obtain N sets of transaction data to be agreed upon, and execute these N sets of transaction data, where N is a positive integer. Then, based on the transaction execution results of each group of transaction data, determine from N groups of transaction data that satisfy M sets of first transaction data of preset execution conditions, M is a positive integer and M ⁇ N. Next, N groups of transaction data are packaged to generate a block to be agreed upon.
  • the block to be agreed upon includes an M group of first transaction data and an NM group of second transaction data in addition to the M group of first transaction data.
  • the block to be consensus can be The block is broadcast to a consensus node set, and the consensus node set includes at least one consensus node, so that the consensus nodes in the consensus node set perform consensus verification processing on the consensus block.
  • the consensus verification process includes: performing first consensus processing on the M group of first transaction data in the consensus block, and performing serial consensus processing on the NM group of second transaction data.
  • Each consensus node can also verify the validity of the parallel consensus process. If the verification passes, the transaction execution results of each group of first transaction data and each group of second transaction data can be merged.
  • the packaging node can execute multiple sets of transaction data in advance, and then identify the transaction data that can be parallelized according to the transaction execution results, and then combine the transaction data that can be parallelized in these transaction data (i.e., the first transaction data ) and non-parallel transaction data (i.e. the second transaction data) are packaged into blocks, and finally the packaged blocks are broadcast to the consensus node. Then, after the consensus node receives the block to be agreed upon sent by the packaging node, the consensus node can execute the first transaction data in parallel and the second transaction data in series.
  • This consensus method solves the problems of low performance and low system throughput caused by serial execution of large amounts of transaction data. Since this application can execute transaction data in parallel, it improves the execution efficiency of the blockchain and improves the system throughput.
  • FIG. 4 is a schematic flowchart of a data processing method provided by an embodiment of the present application.
  • This data processing method can be applied to a blockchain and can be executed by the above-mentioned blockchain node (such as a packaging node). Since the block The chain nodes belong to computer equipment.
  • the subsequent description will be based on the example of the computer equipment executing the data processing method.
  • the data processing method may include the following steps S401 to S404:
  • multiple sets of transaction data refer to at least two sets of transaction data, for example, N sets of transaction data, where N is a positive integer.
  • the computer device can execute the multiple sets of transaction data in parallel, and of course, can also execute each transaction data in series.
  • the computer device can obtain N sets of transaction data from the transaction cache pool. These N sets of transaction data can be part or all of the transactions in the transaction cache pool. Data, where if N sets of transaction data are part of the transaction data in the transaction cache pool, then the computer device can obtain these N sets of transaction data by: sequentially acquiring N sets of transaction data from the transaction cache pool according to the transaction generation timestamp, Or randomly obtain N sets of transaction data from the transaction cache pool.
  • the computer device executing N sets of transaction data may specifically include: executing N sets of transaction data in parallel.
  • N groups of transaction data are respectively represented as: transaction data 1, transaction data 2...transaction data N
  • the so-called parallel execution of N groups of transaction data specifically includes: while executing transaction data 1, transaction data 2, Transaction data 3... Transaction data N.
  • the subject that executes each transaction data in this embodiment is a packaging node.
  • the subject that executes each transaction data may be another subject that is different from the subject that executes this method.
  • it can be any blockchain node.
  • Each transaction data can be executed by the same blockchain node or by different blockchains.
  • the first transaction data is one or more groups, and multiple groups refers to at least two groups. For example, there are M groups of first transaction data, M is a positive integer and M ⁇ N.
  • the first transaction data is the transaction data that satisfies the preset execution conditions among the multiple sets of transaction data.
  • the preset execution conditions may be conditions that need to be met for parallel execution, so the preset execution conditions may also be called parallel execution conditions.
  • S403. Pack the multiple sets of transaction data and generate a block to be agreed. Each first transaction data and at least one set of second transaction data are recorded in the block to be agreed upon. The second transaction data is different from the first set of transaction data in the multiple sets of transaction data.
  • the second transaction data is the transaction data among the plurality of sets of transaction data that does not meet the preset execution conditions.
  • the first transaction data and the second transaction data are recorded separately in the block to be agreed upon. Differential recording can be implemented through different recording rules. Based on the difference recording rules in the block to be agreed upon Each first transaction data and each second transaction data are recorded.
  • the computer device may set different tags for the first transaction data and the second transaction data respectively to record the first transaction data and the second transaction data differently.
  • the label can be set as needed, and the label can be a number or a string. For example, the label of the first transaction data is 1, and the label of the second transaction data is 0.
  • S404 Perform first consensus processing on each first transaction data, and perform second consensus processing different from the first consensus processing on each second transaction data.
  • the first consensus processing and the second consensus processing are two different consensus processing methods.
  • the first consensus processing is a parallel consensus processing method, that is, the first consensus processing can be a parallel consensus processing
  • the second consensus processing is The method of performing consensus in series, that is, the second consensus process can be a serial consensus process.
  • the consensus node set includes one or more consensus nodes.
  • the consensus node set includes at least two consensus nodes. After the computer device (i.e., the packaging node) broadcasts the block to be agreed upon to the consensus node set, it can cause all or part of the consensus nodes in the consensus node set to perform parallel consensus processing on each first transaction data in the consensus block to be processed, and The second transaction data undergoes serial consensus processing.
  • the consensus nodes in the consensus node set can perform parallel consensus processing on each first transaction data in the consensus block and perform serial consensus processing on each second transaction data based on the differential recording rules.
  • the computer device when there are multiple sets of first transaction data, the computer device performs first consensus processing on each set of first transaction data respectively, such as performing parallel consensus processing respectively.
  • the computer device when there are multiple sets of second transaction data, the computer device performs second consensus processing on each set of second transaction data, such as performing serial consensus processing respectively.
  • the computer device can broadcast the block to be agreed upon to a consensus node set, so that the consensus nodes in the consensus node set perform parallel consensus processing on each first transaction data in the consensus block, and perform consensus processing on each second transaction Data undergoes serial consensus processing.
  • multiple sets of transaction data are executed in advance, and then parallelizable transaction data are identified according to the transaction execution results, and then the parallelizable transaction data (i.e., the first transaction data) and the non-parallelizable transactions in these transaction data are
  • the data i.e., the second transaction data
  • the packaged blocks are 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 in series.
  • This consensus can perform parallel consensus processing on part of the transaction data that can be executed in parallel. Compared with serial execution of all transaction data, it improves the efficiency of data processing, thus improving the throughput of the blockchain system.
  • the first transaction data and the second transaction data are recorded in the block to be agreed based on different recording rules, and the different recording rules include: arrangement rules and label setting rules.
  • the computer equipment packages multiple sets of transaction data and generates a block to be agreed upon, which may include the following steps: packages multiple sets of transaction data according to arrangement rules to generate a block to be agreed upon; each second transaction data in the block to be agreed upon is set with a target tag , the target tag is set based on the tag setting rules; among them, after multiple sets of transaction data are packaged based on the arrangement rules, any set of first transaction data in the block to be agreed upon will be prioritized over any set of second transaction data for consensus processing.
  • the tag setting rule is used to indicate that any set of second transaction data packaged in the block to be consensus is set with a target tag. After each group of first transaction data and each group of second transaction data are determined from the multiple groups of transaction data, each group of first transaction data that meets the preset execution conditions can be packaged into the block first, and then those that do not meet the preset execution conditions can be packaged into blocks. Each set of second transaction data with preset execution conditions is packaged into a block, thereby generating a block to be agreed upon.
  • the process of packaging each group of first transaction data into a block can be sorted and packaged according to the transaction generation time of each group of first transaction data from early to late; the process of packaging each group of second transaction data into a block , the second transaction data can be sorted and packaged in order from earliest to latest according to the transaction generation timestamp of each set of second transaction data.
  • any set of second transaction data can also be set with a target tag, such as NeedRedo.
  • NeedRedo a target tag
  • no tag may be set on it, or a tag different from the target tag may be set on it. The same as other tags, such as unNeedRedo.
  • FIG. 8 is a schematic flowchart of generating blocks to be agreed upon according to an embodiment of the present application.
  • N groups of transaction data are respectively represented as: transaction data a, transaction data b, transaction data c, transaction data d, and transaction data e.
  • transaction data a, transaction data c, and transaction data e are determined as the first transaction data, that is, transaction data that can be executed in parallel;
  • transaction data b and transaction data d are determined as the second transaction data, that is, they cannot be executed in parallel (that is, (requires serial execution) transaction data, then the transaction data a, transaction data c.
  • Transaction data e is first packaged into the block, and then transaction data b and transaction data d are packaged into the block again, thereby generating the block to be agreed upon as shown in Figure 8.
  • the computer device may also create a corresponding transaction read cache and transaction write cache for each set of transaction data in the multiple sets of transaction data.
  • the transaction read cache corresponding to the transaction data is used to store the read data set of the transaction data.
  • the read data set is used to trigger the call of the smart contract to execute the transaction data;
  • the transaction write cache corresponding to the transaction data is used to store the transaction data.
  • Write data set is used to store the transaction execution results obtained after calling the smart contract to execute the transaction data.
  • the calling information may include but is not limited to at least one of the calling address of the smart contract and the contract identifier, such as the contract name.
  • the read data set is used to indicate the call information of the smart contract corresponding to the execution transaction data.
  • a corresponding transaction read cache and transaction write cache are created for each group of transaction data, thereby providing cache resources for the execution of each group of transaction data, so that the execution of each group of transaction data can proceed smoothly, and the execution of transaction data can be improved. s efficiency.
  • the computer device can obtain the read data set of the target transaction data from the transaction read cache, and obtain the target smart contract for executing the target transaction data based on the call information in the read data set of the target transaction data; then, The computer device can call the target smart contract to execute the target transaction data and obtain the target transaction execution result.
  • the target transaction execution result is used as the write data set of the target transaction data.
  • the target transaction data refers to any set of transaction data among the multiple sets of transaction data.
  • the transaction read cache corresponding to the target transaction data includes the read data set corresponding to the target transaction data. Therefore, the computer device can obtain the read data set corresponding to the target transaction data from the transaction read cache corresponding to the target transaction data, and obtain the data set for executing the target transaction data based on the contract call address and contract name in the read data set corresponding to the target transaction data. Smart contract calls the smart contract to execute the target transaction data, so that the transaction execution result corresponding to the target transaction data can be obtained, and the transaction execution result can be added to the transaction write cache of the target transaction data, and then based on the transaction write cache stored in the transaction write cache Data construction obtains the write data set corresponding to the target transaction data.
  • Figure 5a is a schematic flowchart of parallel execution of transaction data provided by an embodiment of the present application.
  • the computer device can create corresponding transaction read caches and transaction write caches for each set of transaction data based on the ledger cache.
  • a set of transaction data corresponds to a set of transaction read caches and a set of transaction write caches. For example, if the multiple sets of transaction data are N sets of transaction data, 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 cache.
  • FIG. 5b is a schematic flowchart of a transaction data execution process provided by an embodiment of the present application.
  • the execution process of calling the smart contract to execute the target transaction data may include the following steps S1-S6:
  • the computer device can obtain the read data set corresponding to the target transaction data from the transaction read cache corresponding to the target transaction data, and trigger the call of its corresponding smart contract based on the read data set corresponding to the target transaction data.
  • the computer device obtains the smart contract for executing the target transaction data based on the contract calling address and contract name in the read data set corresponding to the target transaction data.
  • the smart contract includes at least one of the contract name, contract method or contract input.
  • the computer device obtains the corresponding contract bytecode and contract input from the target transaction data and status database.
  • the contract code is executed in the computer device to complete the business logic corresponding to the target transaction data.
  • the computer device writes the transaction execution results back to the status database to complete the update of the business status.
  • the system will store the hash digest of the current state of the state database as a certified record in the blockchain.
  • the transaction execution result of each group of transaction data can be obtained, and the transaction execution result of each group of transaction data is written to the transaction write In the cache, the transaction execution results are used as data in its write data set, which improves the efficiency of executing transaction data.
  • the transaction execution results of each group of transaction data are stored in the corresponding transaction write cache in the form of key-value pairs.
  • the read data set of each group of transaction data is stored in the form of key-value pairs.
  • the corresponding transaction is read from the cache.
  • the computer device determines at least one set of first transaction data that satisfies the preset execution conditions from the multiple sets of transaction data based on the transaction execution results of each set of transaction data.
  • the computer device can also obtain each set of transaction data from the transaction write cache.
  • Write keywords of transaction data and perform a hash operation on the write keywords of each group of transaction data to obtain the first hash string of each group of transaction data; write keywords refer to the key-value pair corresponding to the transaction execution result.
  • the computer device traverses the read data set of each group of transaction data and performs a hash operation on the read keyword of each group of transaction data to obtain the second hash string of each group of transaction data; the read keyword refers to the read data set The key in the corresponding key-value pair; then, the computer device matches the second hash string of each set of transaction data with each first hash string, and determines from the multiple sets of transaction data based on the matching results. At least one set of first transaction data that meets preset execution conditions.
  • the key-value pair consists of key and value.
  • the writing keyword refers to the key in the key-value pair corresponding to the transaction execution result, that is, the writing keyword is key.
  • the computer device can also obtain the write key of each set of transaction data from the transaction write cache, and perform a hash operation on the write key of each set of transaction data to obtain the first hash of each set of transaction data.
  • the computer device can write the first hash string of each set of transaction data into the Bloom filter. It should be noted that by writing the first hash string of each set of transaction data to the Bloom filter, it can be used to identify and classify each set of transaction data, thereby determining from the multiple sets of transaction data The first transaction data that satisfies the preset execution conditions is obtained, and the second transaction data that does not satisfy the preset execution conditions is determined from the plurality of sets of transaction data.
  • a Bloom Filter is a bit vector or bit array. Among them, the data structure of the Bloom filter can be shown in Table 2 below:
  • a Bloom filter is an array containing multiple (for example, 11) bits, and the value of each bit in the initialized Bloom filter is 0. If you need to add a value to the Bloom filter, you need to use multiple different hash functions to generate multiple hash values, and set the bit pointed to by each generated hash value to 1.
  • FIG. 6 is a schematic diagram of the principle of a Bloom filter provided by an embodiment of the present application. As shown in Figure 6, assuming that the Bloom filter is an 11-bit bit array and the hash function contains 5, then after hashing the write keyword key1 corresponding to the transaction data 1, the first The hash string is: 10101010100, and then the first hash string 10101010100 is written into the Bloom filter. For each set of transaction data, the detailed process of writing it to the Bloom filter is as shown above.
  • the second hash string of each group of transaction data is matched with each first hash string, and each group that satisfies the preset execution conditions is determined from multiple groups of transaction data based on the matching results.
  • the first transaction data can be quickly determined through the matching results between character strings, thereby improving the efficiency of determining the first transaction data.
  • the computer device may write the first hash string of each set of transaction data into the bloom filter.
  • Matching the second hash string of each group of transaction data with each first hash string includes: matching the second hash string of each group of transaction data, Matches each first hash string in the bloom filter.
  • the read data set of each set of transaction data is stored in the corresponding transaction read cache in the form of key-value pairs.
  • the computer device determines each group of first transaction data that meets the preset execution conditions from multiple groups of transaction data based on the transaction execution results of each group of transaction data.
  • it may include: first, traversing the read data set of each group of transaction data, and Perform a hash operation on the read keywords of each group of transaction data to obtain the second hash string of each group of transaction data; the read keyword refers to reading the key in the key-value pair corresponding to the data set; then, for each group of transactions The second hash string of the data is matched with each first hash string in the Bloom filter, and each group of first transactions that meets the preset execution conditions is determined from multiple groups of transaction data based on the matching results. data.
  • the second hash string of each set of transaction data is matched with each first hash string in the Bloom filter.
  • the strings can be quickly matched based on the Bloom filter to improve improve matching efficiency.
  • determining at least one set of first transaction data that satisfies preset execution conditions from multiple sets of transaction data based on the matching results includes: a second hash string of the transaction data, and a second hash string in the Bloom filter. Each first hash string is matched; if the matching result is unsuccessful, it is determined that the transaction data meets the preset execution conditions, and the transaction data is determined as the first transaction data; if the matching result is successful, the target is determined The transaction data does not meet the preset execution conditions, and the target transaction data is determined as the second transaction data.
  • the transaction data is determined to be the first transaction data. If the second hash string of the transaction data matches any first hash string, the transaction data is determined to be the second transaction data.
  • FIG. 7a is a schematic flowchart of determining second transaction data provided by an embodiment of the present application.
  • the read keyword key2 of transaction data 2 is obtained from the transaction read cache of transaction data 2, and one or more hash functions (for example, 5) are used to perform a hash operation on the read keyword key2.
  • the second hash string obtained is assumed to be: 10101010100.
  • the first hash string 10101010100 is the same, then it can be determined that transaction data 2 has read the data written by transaction data 1, so transaction data 2 needs to be executed after transaction data 1, then transaction data 2 is transaction data that does not meet the preset execution conditions (i.e. the second transaction data).
  • FIG. 7b is a schematic flowchart of determining the first transaction data provided by an embodiment of the present application.
  • the read keyword key3 of transaction data 3 is obtained from the transaction read cache of transaction data 3, and one or more hash functions (for example, 5) are used to perform a hash operation on the read keyword key3.
  • the second hash string obtained is assumed to be: 0101010101011.
  • the first transaction data and the second transaction data are accurately determined from each transaction data.
  • the computer device after the computer device broadcasts the block to be agreed to to the consensus node set, it can also perform the following steps: serially execute each set of second transaction data to obtain the second transaction of each set of second transaction data. Execution results; obtain the first transaction execution results of each group of first transaction data from the transaction execution results of each group of transaction data; merge each first transaction execution result and each second transaction execution result to obtain the transaction merge execution result .
  • each second transaction data is represented as second transaction data a, second transaction data b, ..., second transaction data x
  • the second transaction data is executed b, then execute the second transaction data c, and so on, until each set of second transaction data is executed in sequence.
  • the execution order may refer to the order from earliest to latest according to the transaction generation timestamp of each set of second transaction data.
  • the computer device can merge each first transaction execution result and each second transaction execution result according to the transaction order of each set of transaction data in the block to be agreed, to obtain a transaction merge execution result.
  • the so-called transaction arrangement order may refer to the order from earliest to latest based on transaction generation timestamps of each set of transaction data.
  • each first transaction execution result and each second transaction execution result are merged to obtain a transaction merge execution result.
  • the total execution result of the multiple sets of transaction data is obtained, and the efficiency of obtaining the execution results of the multiple sets of transaction data is improved.
  • FIG. 9 is a schematic flowchart of another data processing method provided by an embodiment of the present application.
  • This data processing method can be applied to the blockchain and can be executed by the above-mentioned blockchain nodes (for example, any consensus node except the packaging node).
  • the data processing method will be executed by computer equipment in the following. Take an example to illustrate. Among them, the data processing method may include the following steps S901 to S904:
  • the block to be consensus is generated by the packaging node after packaging multiple sets of transaction data to be processed.
  • the multiple sets of transaction data include the first transaction data and the second transaction data.
  • each group is recorded based on the differential recording rules.
  • the first transaction data and each group of second transaction data the first transaction data is determined based on the transaction execution result of each group of transaction data after parallel execution of the multiple groups of transaction data.
  • the multiple sets of transaction data are N sets of transaction data, and the N sets of transaction data include M sets of first transaction data and N-M sets of second transaction data. N and M are both positive integers, and M ⁇ N.
  • the distinguishing recording rules include: arrangement rules and label setting rules; among them, the arrangement rules are used to instruct the multiple sets of transaction data to be packaged and generate blocks to be agreed upon, and the label setting rules are used to instruct any of the blocks to be packaged into the blocks to be agreed upon.
  • a second set of transaction data is set with a target tag.
  • the target label carried by any set of second transaction data may be NeedRedo.
  • the computer device determines the specific execution steps of each set of first transaction data based on the transaction execution results of each set of transaction data. For details, please refer to the specific steps executed in step S402 in the embodiment of FIG. 4 above.
  • S902 Perform first consensus processing on each set of first transaction data in the consensus block to obtain the first transaction execution result of each set of first transaction data.
  • the parallel consensus processing of the M sets of first transaction data by the computer device includes: executing the M sets of first transaction data in parallel, assuming that the M sets of first transaction data respectively represent are: first transaction data 1, first transaction data 2... first transaction data M, then executing these M sets of first transaction data in parallel specifically includes: while executing first transaction data 1, also execute first Transaction data 2, first transaction data 3... first transaction data M.
  • the computer device before performing parallel consensus processing on the M sets of first transaction data in the consensus block, the computer device is also used to obtain the node identification of the packaging node, and perform the processing on the packaging node based on the obtained node identification. Verification, if the verification passes, triggers the execution of the step of performing parallel consensus processing on the M sets of first transaction data in the consensus block to obtain the first transaction execution result of each set of first transaction data; if the verification fails, delete the Awaiting consensus block. In this way, the identity information of the packaging nodes is verified before consensus processing, which can improve the accuracy of the data processing process.
  • any set of first transaction data in the block to be agreed upon does not carry a target tag
  • any set of second transaction data carries a target tag.
  • the computer device obtains the block to be agreed upon, it determines the transaction data that does not carry the target tag as the first transaction data that meets the preset execution conditions.
  • each group of first transaction data can be obtained respectively.
  • the first transaction execution result of transaction data It should be noted that for the specific steps for the computer device to execute any first transaction data to obtain the corresponding first transaction execution result, please refer to the relevant content described in the embodiment of FIG. 4 for details.
  • the computer device performs the second consensus processing on the N-M group of second transaction data including: serially executing the N-M group of first transaction data. It is assumed that the N-M group of second transaction data are respectively represented as: second transaction data a, second transaction data b...the second transaction data After data b, the second transaction data c is then executed, and so on, until the second transaction data x is executed.
  • Any set of second transaction data in the block to be consensus is set with a target tag (such as NeedRedo). Then, after the computer device obtains the block to be agreed upon, it determines the transaction data carrying the target tag as the second transaction data that does not meet the preset execution conditions (that is, requires serial execution), and then executes these second transaction data (that is, After NM group of second transaction data), the second transaction data of each group can be obtained respectively. 2. Transaction execution results. It should be noted that for the specific steps for the computer device to execute any second transaction data to obtain the corresponding second transaction execution result, please refer to the relevant content described in the embodiment of FIG. 4 above for details.
  • the computer device can calculate each first transaction execution result and each second transaction according to the order of transaction arrangement of each set of transaction data (first transaction data, second transaction data) in the block to be agreed upon.
  • the execution results are merged to obtain the transaction merge execution results.
  • the so-called transaction arrangement order may refer to the order from earliest to latest based on transaction generation timestamps of each set of transaction data.
  • N groups of transaction data include: transaction data 1, transaction data 2, and transaction data 3. Among them, the transaction generation timestamp of transaction data 1 is t1, the transaction generation timestamp of transaction data 2 is t2, and the transaction generation timestamp of transaction data 3 is t2.
  • the timestamp is t3, and t1 ⁇ t2 ⁇ t3.
  • the computer device can also write the transaction merger execution result back to the state database of the blockchain, so that the state database can be based on the latest block currently written (block to be agreed upon).
  • the transaction execution results of each group of transaction data are used to update the business status.
  • any transaction data included in the block to be agreed upon is: Object A transfers m units of virtual resources to Object B's account.
  • the update operation of the business status performed in the status database may include: deducting m units of virtual resources from the account of object A, and writing the transaction status to the status database. Add m units of virtual resources to B's account.
  • the consensus node in the blockchain after receiving the block to be agreed from the packaging node, the consensus node in the blockchain can execute part of the transaction data in the block to be agreed in parallel, and then execute the remaining blocks in the block to be agreed in series.
  • This consensus method solves the problems of low performance and low system throughput caused by the need to serially execute a large amount of transaction data. Since this application can execute transaction data in parallel, it improves the execution efficiency of the blockchain and greatly improves the throughput of the system.
  • the computer device performs first consensus processing on each set of first transaction data in the consensus block, and after obtaining the first transaction execution result of each set of first transaction data, is also used to perform the following steps : Verify the validity of the first consensus processing process. If the verification fails, delete each first transaction execution result and each second transaction execution result; perform second consensus processing on the multiple sets of transaction data to obtain each set of transaction data. transaction execution results.
  • the validity of the first consensus processing process is verified. If the verification fails, each first transaction execution result and each second transaction execution result are deleted, thereby improving the accuracy of the transaction execution results.
  • the computer device performs validity verification on the first consensus processing process, which may specifically include: traversing the transaction read cache of the second transaction data, and obtaining the read data set of the second transaction data.
  • the read data set is based on the key Stored in the transaction read cache in the form of value pairs; perform a hash operation on the read keyword of the second transaction data to obtain the verification hash string of the second transaction data; based on the first hash character saved by the Bloom filter
  • the verification hash string is matched against the string. If the match is successful, it is determined that the verification of the first consensus process has passed.
  • any transaction data corresponds to a transaction read cache and a transaction write cache, where the transaction read cache is used to store the read data set of any set of transaction data, and the read data set is used to indicate the execution of the smart contract corresponding to the transaction data.
  • the call information (such as contract name, call address, etc.); the transaction write cache is used to store the write data set of any set of transaction data, and the write data set is used to store the transaction execution results obtained after calling the smart contract to execute the transaction data.
  • FIG. 10 is a schematic structural diagram of a data processing device provided by an embodiment of the present application.
  • the data processing device 1000 can be applied to Computer equipment (such as packaging nodes) in the previous embodiments.
  • the data processing device 1000 can be a computer program (including program code) running in a computer device, for example, the data processing device 1000 is an application software; the data processing device 1000 can be used to execute the data processing method provided by the embodiment of the present application. corresponding steps in .
  • the data processing device 1000 may include:
  • the acquisition unit 1001 is used to acquire multiple sets of transaction data to be processed.
  • the processing unit 1002 is configured to determine at least one set of first transaction data that satisfies preset execution conditions from multiple sets of transaction data based on the transaction execution results of each set of transaction data.
  • the processing unit 1002 is also used to package multiple sets of transaction data and generate a block to be agreed upon; each set of first transaction data and at least one set of second transaction data are recorded in the block to be agreed upon; the second transaction data is multiple sets of transaction data. transaction data that is different from the first transaction data.
  • the sending unit 1003 is configured to perform first consensus processing on the first transaction data, and perform second consensus processing different from the first consensus processing on each set of second transaction data.
  • the first transaction data and the second transaction data are recorded in the block to be agreed upon based on different recording rules.
  • the different recording rules include: arrangement rules and label setting rules; the processing unit 1002 packages multiple sets of transaction data, Generate blocks to be agreed upon to perform the following operations:
  • each second transaction data in the block to be agreed upon is set with a target label, and the target label is set based on the label setting rules;
  • any set of first transaction data in the block to be agreed upon will be prioritized over any set of second transaction data for consensus processing.
  • the processing unit 1002 before executing multiple sets of transaction data, is also configured to perform the following operations:
  • the transaction read cache corresponding to the transaction data is used to store the read data set of the transaction data.
  • the read data set is used to trigger the call of the smart contract to execute the transaction data;
  • the transaction write cache corresponding to the transaction data is used to store the write data set of the transaction data.
  • the write data set is used to store the transaction execution results obtained after calling the smart contract to execute the transaction data.
  • processing unit 1002 is also used to perform the following operations:
  • the target transaction data is any of the multiple sets of transaction data.
  • the target smart contract to execute the target transaction data and obtain the target transaction execution result; the target transaction execution result is used to obtain the write data set of the target transaction data.
  • the transaction execution results of each group of transaction data are stored in the corresponding transaction write cache in the form of key-value pairs; the read data set of each group of transaction data is stored in the form of key-value pairs. to the corresponding transaction read cache; the processing unit 1002 is also used to perform the following operations:
  • the write keywords of each group of transaction data from the transaction write cache, and perform a hash operation on the write keywords of each group of transaction data to obtain the first hash string of each group of transaction data;
  • the write keyword refers to transaction execution The key in the key-value pair corresponding to the result; traverse the read data set of each group of transaction data, and perform a hash operation on the read keyword of each group of transaction data to obtain the second hash string of each group of transaction data; read the key The word refers to the key in the key-value pair corresponding to the read data set; the second hash string of each set of transaction data is matched with each first hash string, and based on the matching results, the second hash string of each set of transaction data is extracted from multiple sets of transaction data. Each set of first transaction data that meets the preset execution conditions is determined.
  • the processing unit 1002 is also configured to write the first hash string of each set of transaction data into the Bloom filter; for the second hash string of each set of transaction data, and Each first hash string in the Bloom filter is matched.
  • the processing unit 1002 determines at least one set of first transaction data that meets the preset execution conditions from multiple sets of transaction data based on the matching results, for performing the following operations:
  • the transaction data is determined as the second transaction data.
  • the processing unit 1002 is also configured to perform the following operations:
  • Each first transaction execution result and each second transaction execution result are merged to obtain a transaction merge execution result.
  • FIG 11 is a schematic structural diagram of another data processing device provided by an embodiment of the present application.
  • the data processing device 1100 can be applied to the computer equipment (such as a consensus node) in the aforementioned embodiments.
  • the data processing device 1100 can be a computer program (including program code) running in a computer device.
  • the data processing device 1100 is an application software; the data processing device 1100 can be used to execute the data processing method provided by the embodiment of the present application. corresponding steps in .
  • the data processing device 1100 may include:
  • the acquisition unit 1101 is used to obtain the block to be agreed upon sent by the packaging node.
  • the block to be agreed upon is generated by packaging multiple sets of transaction data to be processed by the packaging node. At least one set of first transaction data and at least one set of transaction data are recorded in the block to be agreed upon.
  • a set of second transaction data, the first transaction data is determined based on the transaction execution results of each set of transaction data after parallel execution of multiple sets of transaction data.
  • the processing unit 1102 is configured to perform first consensus processing on each set of first transaction data in the consensus block to obtain the first transaction execution result of each set of first transaction data.
  • the processing unit 1102 is also configured to perform a second consensus process different from the first consensus process on each set of second transaction data in the consensus block to obtain a second transaction execution result for each set of second transaction data.
  • the processing unit 1102 is also configured to merge each first transaction execution result and each second transaction execution result to obtain a transaction merge execution result.
  • the processing unit 1102 performs first consensus processing on each set of first transaction data in the consensus block, and after obtaining the first transaction execution result of each set of first transaction data, is also used to perform the following: operate:
  • the processing unit 1102 performs validity verification on the first consensus processing process to perform the following operations:
  • the read data set is stored in the transaction read cache in the form of key-value pairs;
  • the verification hash string is matched based on the first hash string saved by the Bloom filter. If the match is successful, it is determined that the verification of the first consensus processing process has passed.
  • Figure 12 is a schematic structural diagram of a computer device provided by an embodiment of the present application.
  • the computer device 1200 is used to perform the steps performed by the packaging node and the consensus node in the aforementioned method embodiments.
  • the computer device 1200 includes: one or more processors 1210; one or more input devices 1220, and one or more output devices 1230 and memory 1240.
  • the above-mentioned processor 1210, input device 1220, output device 1230 and memory 1240 are connected through a bus 1250.
  • the memory 1240 is used to store computer programs.
  • the computer programs include program instructions.
  • the processor 1210 is used to call the program instructions stored in the memory 1240 to execute steps in the data processing method.
  • Embodiments of the present application also provide a computer storage medium, and computer-readable instructions are stored in the computer storage medium.
  • the processor executes the computer-readable instructions, it can execute the method in the corresponding embodiment.
  • computer readable instructions may be deployed in Execute on one computer device, or on multiple computer devices located at one location, or on multiple computer devices distributed at multiple locations and interconnected through a communication network.
  • a computer program product including computer readable instructions stored in a computer readable storage medium.
  • the processor of the computer device reads the computer-readable instructions from the computer-readable storage medium, and the processor executes the computer-readable instructions, so that the computer device can perform the method in the corresponding embodiment above.
  • the above programs can be stored in computer-readable storage media.
  • the programs When executed, , may include the processes of the above method embodiments.
  • the above-mentioned storage media can be a magnetic disk, an optical disk, a read-only memory (Read-Only Memory, ROM) or a random access memory (Random Access Memory, RAM), etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Data Mining & Analysis (AREA)
  • Accounting & Taxation (AREA)
  • Signal Processing (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Software Systems (AREA)
  • Finance (AREA)
  • General Business, Economics & Management (AREA)
  • Strategic Management (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Computational Linguistics (AREA)
  • Computing Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Signal Processing For Digital Recording And Reproducing (AREA)

Abstract

本申请提出一种数据处理方法、装置及设备、介质、产品。该方法包括:获取待处理的多组交易数据(S401);根据每组交易数据的交易执行结果,从该多组交易数据中确定出满足预设执行条件的至少一组第一交易数据(S402);打包该多组交易数据,生成待共识区块,待共识区块中记录各组第一交易数据和至少一组第二交易数据;第二交易数据,为多组交易数据中不同于第一交易数据的交易数据(S403);对各第一交易数据进行第一共识处理,对各第二交易数据进行不同于第一共识处理的第二共识处理(S404)。

Description

数据处理方法、装置及设备、介质、产品
本申请要求于2022年07月07日提交中国专利局,申请号为202210797362.2,申请名称为“数据处理方法、装置及设备、介质、产品”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及区块链技术领域,尤其涉及一种数据处理方法、装置、计算机设备、计算机可读存储介质及计算机程序产品。
背景技术
一个区块可以由多组交易数据构成,当打包节点将该区块写入区块链之前,需要通过共识网络中的共识节点分别对该区块进行共识,即需要这些共识节点分别对该区块中的每组交易数据进行交易验证。
目前,当这些共识节点对该区块中的这些交易数据进行交易验证时,往往需要将这些交易数据(例如,交易数据1、交易数据2和交易数据3)统一打包到区块中。在共识过程中,也一般是串行处理,确保每组交易数据都会被处理到,例如,每个共识节点均需要先执行完交易数据1之后,再执行交易数据2,且在执行完交易数据2之后,再继续执行交易数据3。
共识节点通过串行执行区块中的这些交易数据的方式,不够灵活,针对存在并行处理的交易数据的情况,目前笼统地进行交易数据打包以便于串行进行共识处理,降低了这些共识节点的共识性能,从而降低了区块链的吞吐量。
发明内容
根据本申请提供的各种实施例,提出了一种数据处理方法、装置、计算机设备、计算机可读存储介质及计算机程序产品。
一方面,本申请实施例提供了一种数据处理方法,该方法包括:
获取待处理的多组交易数据,并执行多组交易数据;
根据每组交易数据的交易执行结果,从多组交易数据中确定出满足预设执行条件的至少一组第一交易数据;
打包多组交易数据,生成待共识区块;待共识区块中记录各组第一交易数据和至少一组第二交易数据;第二交易数据,为多组交易数据中不同于第一交易数据的交易数据;
将待共识区块广播至共识节点集合,以使共识节点集合中的共识节点对待共识区块中的各组第一交易数据进行第一共识处理,对各组第二交易数据进行不同于所述第一共识处理的第二共识处理。
另一方面,本申请实施例提供了一种数据处理方法,该方法包括:
获取打包节点发送的待共识区块,待共识区块是所述打包节点对待处理的多组交易数据打包后生成的,待共识区块中记录至少一组第一交易数据和至少一组第二交易数据,第一交易数据是在对多组交易数据并行执行后,根据每组交易数据的交易执行结果确定出来的;
对待共识区块中的各组第一交易数据进行第一共识处理,得到每组第一交易数据的第一交易执行结果;
对待共识区块中的各组第二交易数据进行不同于所述第一共识处理的第二共识处理,得到每组第二交易数据的第二交易执行结果;
对各第一交易执行结果和各第二交易执行结果进行合并处理,得到交易合并执行结果。
另一方面,本申请实施例提供了一种数据处理装置,该装置包括:
获取单元,用于获取待处理的多组交易数据,并执行多组交易数据;
处理单元,用于根据每组交易数据的交易执行结果,从多组交易数据中确定出满足预设执行条件的至少一组第一交易数据;
处理单元,还用于打包多组交易数据,生成待共识区块;待共识区块中记录各组第一交易数据和至少一组第二交易数据;第二交易数据,为多组交易数据中不同于第一交易数据的交易数据;
发送单元,用于将待共识区块广播至共识节点集合,以使共识节点集合中的共识节点对待共识区块中的各组第一交易数据进行第一共识处理,对各组第二交易数据进行不同于所述第一共识处理的第二共识处理。
另一方面,本申请实施例提供了一种数据处理装置,该装置包括:
获取单元,用于获取打包节点发送的待共识区块,待共识区块是所述打包节点对待处理的多组交易数据打包后生成的,待共识区块中记录至少一组第一交易数据和至少一组第二交易数据,第一交易数据是在对多组交易数据并行执行后,根据每组交易数据的交易执行结果确定出来的;
处理单元,用于对待共识区块中的各组第一交易数据进行第一共识处理,得到每组第一交易数据的第一交易执行结果;
处理单元,还用于对待共识区块中的各组第二交易数据进行不同于所述第一共识处理的第二共识处理,得到每组第二交易数据的第二交易执行结果;
处理单元,还用于对各个第一交易执行结果和各个第二交易执行结果进行合并处理,得到交易合并执行结果。
另一方面,本申请实施例提供一种计算机设备,该计算机设备包括存储器和一个或多个处理器,存储器存储有计算机可读指令,计算机可读指令被处理器执行时,使得一个或多个处理器执行上述的数据处理方法中的步骤。
另一方面,本申请实施例提供一个或多个非易失性计算机可读存储介质,该计算机可读存储介质存储有计算机可读指令,该计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行上述的数据处理方法中的步骤。
另一方面,本申请实施例提供了一种计算机程序产品,该计算机程序产品包括计算机可读指令,该计算机可读指令被处理器执行时实现上述数据处理方法中的步骤。
本申请的一个或多个实施例的细节在下面的附图和描述中提出。本申请的其他特征、目的和优点将从说明书、附图以及权利要求书变得明显。
附图说明
为了更清楚地说明本申请实施例技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1是本申请实施例提供的一种区块链节点系统的结构示意图;
图2是本申请实施例提供的一种区块链的结构示意图;
图3是本申请实施例提供的一种数据处理方法的原理示意图;
图4是本申请实施例提供的一种数据处理方法的流程示意图;
图5a是本申请实施例提供的一种并行执行交易数据的流程示意图;
图5b是本申请实施例提供的一种交易数据的执行过程的流程示意图;
图6是本申请实施例提供的一种布隆过滤器的原理示意图;
图7a是本申请实施例提供的一种确定第二交易数据的流程示意图;
图7b是本申请实施例提供的一种确定第一交易数据的流程示意图;
图8是本申请实施例提供的一种生成待共识区块的流程示意图;
图9是本申请实施例提供的另一种数据处理方法的流程示意图;
图10是本申请实施例提供的一种数据处理装置的结构示意图;
图11是本申请实施例提供的另一种数据处理装置的结构示意图;
图12是本申请实施例提供的一种计算机设备的结构示意图。
具体实施方式
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本申请相一致的所有实施方式。
本申请的数据处理方法可以与区块链技术相结合。接下来,对本申请提供的数据处理方法涉及到的区块链技术进行详细介绍:
一、区块链节点系统:
本申请实施例所涉及的数据处理系统可以是由多个节点通过网络通信的形式连接形成的分布式系统(即区块链节点系统)。接下来结合附图1对区块链节点系统所涉及的相关技术进行详细介绍:
图1是本申请实施例提供的一种区块链节点系统的结构示意图。区块链是一种分布式数据存储、点对点传输、共识机制以及加密算法等计算机技术的新型应用模式,主要用于对数据按时间顺序进行整理,并加密成账本,使其不可被篡改和伪造,同时可进行数据的验证、存储和更新。区块链本质上是一个去中心化的数据库,该数据库中的每个节点均存储一条相同的区块链,区块链网络中包括共识节点,共识节点负责区块链全网的共识。
如图1所示的区块链节点系统可以对应于区块链网络,该区块链网络可以包括但不限于联盟链、公有链、私有链等所对应的区块链网络。区块链节点系统是指用于进行区块链节点与区块链节点之间数据共享的系统,该区块链节点系统中可以包括多个节点,多个节点具体可以包括节点101、节点102、节点103、…、节点10n,这里的节点101、节点102、节点103、…、节点10n中的每个节点可以统称为区块链节点。节点与节点之间可以通过信息连接的方式建立通信连接,上述的信息连接不限定具体的连接方式,例如可以通过有线通信方式进行直接或间接地连接,也可以通过无线通信方式进行直接或间接地连接,还可以通过其他连接方式,本申请在此不做限制。
其中,区块链节点系统中的每个节点在进行正常工作时可以接收到输入信息,并基于接收到的输入信息维护该区块链节点系统内的共享数据。为了保证区块链节点系统内的信息互通,区块链节点系统中的每个节点之间可以存在信息连接,节点之间可以通过上述信息连接进行信息传输。例如,当区块链节点系统中的任意节点接收到输入信息时,区块链节点系统中的其他节点便根据共识算法获取该输入信息,将该输入信息作为共享数据中的数据进行存储,使得区块链节点系统中全部节点上存储的数据均一致。
区块链网络可以基于节点标识实现节点之间的信息连接,对于区块链节点系统中的每个节点,均具有与其对应的节点标识,而且区块链节点系统中的每个节点均可以存储有区块链节点系统中其他节点的节点标识,以便后续根据其他节点的节点标识,将生成的区块广播至区块链节点系统中的其他节点。每个节点中可维护一个如下表所示的节点标识列表,将节点名称和节点标识对应存储至该节点标识列表中。
其中,节点标识可为IP(Internet Protocol,网络之间互联的协议)地址以及其他任一种能够用于标识区块链网络中节点的信息,表1中仅以IP地址为例进行说明。例如,节点1(例如,节点1可以为图1所示的节点101)可以通过节点标识000.000.000.000向节点2(例如,节点2可以为图1所示的节点102)发送信息(例如,区块),且节点2可以通过节点标识111.111.111.111确定该信息是由节点1所发送的。
表1.节点标识列表

区块链系统中可以包括有智能合约,该智能合约在区块链系统中可以理解为是一种区块链各节点(包括共识节点,所谓共识节点是指在区块链系统中,拥有全量账本信息,并且参与记账共识的节点)可以理解并执行的代码,可以执行任意逻辑并得到结果。应当理解,区块链中可以包括一个或多个智能合约,这些智能合约可以标识号(Identity document,ID)或名称来进行区分,而交易数据请求中可以携带智能合约的标识号或名称,以此指定区块链需要运行的智能合约。
二、区块链结构:
图2是本申请实施例提供的一种区块链的结构示意图。如图2所示,区块链由多个区块(包括创始块)组成,创始块中包括区块头和区块主体,区块头中存储有输入信息特征值、版本号、时间戳和难度值,区块主体中存储有输入信息;创始块的下一区块以创始块为父区块,下一区块中同样包括区块头和区块主体,区块头中存储有当前区块的输入信息特征值、父区块的区块头特征值、版本号、时间戳和难度值,并以此类推,使得区块链中每个区块中存储的区块数据均与父区块中存储的区块数据存在关联,保证了区块中输入信息的安全性。
区块(Block)是在区块链网络上承载交易数据的数据包,是一种被标记上时间戳和之前一个区块的哈希值的数据结构,区块经过网络的共识机制验证并确定区块中的交易。
本申请实施例所提供的交易数据处理方法可以由计算机设备执行,计算机设备包括但不限于终端设备或服务器。其中,终端设备可以包括但不限于:手机、平板电脑、笔记本电脑、掌上电脑、移动互联网设备(Mobile Internet Device,MID)、智能语音交互设备、车载终端、路边设备、飞行器、可穿戴设备、智能家电、或者例如智能手表、智能手环、计步器等具有网络配置管理功能的可穿戴设备,等等。其中,服务器可以是独立的物理服务器,也可以是多个物理服务器构成的服务器集群或者分布式系统,还可以是提供云服务、云数据库、云计算、云函数、云存储、网络服务、云通信、中间件服务、域名服务、安全服务、CDN(Content Delivery Network,内容分发网络)、以及大数据和人工智能平台等基础云计算服务的云服务器。
应当理解,在区块链中,在将一个区块(即待共识区块)进行上链之前,该区块需要经过区块链网络中的共识节点进行共识,在共识通过后才能将该区块添加到区块链上。当区块链被用于政府或者商业机构的一些场景中时,并非区块链中的所有参与节点(即上述区块链节点系统中的区块链节点)都有足够的资源和必要性成为区块链的共识节点。例如,在图1所示的区块链节点系统中,可以将节点101、节点102、节点103作为该区块链节点系统中的共识节点,其中,节点101可以作为打包生成区块的打包节点,节点102和节点103可以作为参与共识的共识节点。打包节点属于共识节点。
区块链所在的打包节点可以根据区块链节点系统中其他共识节点的节点标识,将新生成的区块分别发送给打包节点所在的区块链节点系统中的其他共识节点,由共识节点对新生成的区块进行共识,并在共识成功后将新生成的区块添加至其存储的区块链。
基于以上描述,本申请提供了一种数据处理方法,图3是本申请实施例提供的一种数据处理方法的原理示意图。如图3所示,该数据处理方法的原理如下:打包节点可以获取待共识的N组交易数据,并执行这N组交易数据,N为正整数。然后,根据每组交易数据的交易执行结果,从N组交易数据中确定出满足 预设执行条件的M组第一交易数据,M为正整数且M≤N。接下来,打包N组交易数据,生成待共识区块,待共识区块中包括M组第一交易数据和除M组第一交易数据以外的N-M组第二交易数据;最后,可以将待共识区块广播至共识节点集合,共识节点集合包括至少一个共识节点,以使共识节点集合中的共识节点对待共识区块进行共识验证处理。共识验证处理包括:对待共识区块中的M组第一交易数据进行第一共识处理,对N-M组第二交易数据进行串行共识处理。各个共识节点还可以对并行共识过程进行有效性验证,若验证通过,则可以合并各组第一交易数据和各组第二交易数据的交易执行结果。
由此可见,本申请实施例中打包节点可以预先执行多组交易数据,然后按照交易执行结果识别出可并行的交易数据,然后再将这些交易数据中可并行的交易数据(即第一交易数据)和不可并行的交易数据(即第二交易数据)打包至区块中,最后将打包好的区块广播至共识节点。然后,共识节点在接收到打包节点发送的待共识区块后,共识节点可以并行执行第一交易数据,并串行执行第二交易数据。这种共识方式解决了因串行执行较多交易数据所带来的性能低下、系统吞吐量低的问题,由于本申请可并行执行交易数据,从而提升了区块链的执行效率,提高了系统的吞吐量。
特别需要说明的是,在本申请的后续具体实施方式中,涉及到交易数据,当本申请以上实施例运用到具体产品或技术中时,交易数据的收集、使用和处理需要遵守相关国家和地区的相关法律法规和标准。
基于上述对数据处理方法和系统的相关描述,本申请实施例提出了一种数据处理方法。图4是本申请实施例提供的一种数据处理方法的流程示意图,该数据处理方法可应用于区块链中,可由上述所提及的区块链节点(例如打包节点)执行,由于区块链节点属于计算机设备,为便于阐述,后续均以计算机设备执行该数据处理方法为例进行说明。其中,该数据处理方法可包括如下步骤S401~S404:
S401、获取待处理的多组交易数据。
其中,多组交易数据是指至少两组交易数据,例如为N组交易数据,N为正整数。计算机设备可以并行执行该多组交易数据,当然,也可以串行执行各交易数据。
以该多组交易数据为N组交易数据为例,本申请实施例中,计算机设备可以从交易缓存池中获取N组交易数据,这N组交易数据可以是交易缓存池中部分或全部的交易数据,其中,若N组交易数据是交易缓存池中的部分交易数据,那么计算机设备获取这N组交易数据的方式可以为:按照交易生成时间戳从交易缓存池中依次获取N组交易数据,或者从交易缓存池中随机获取N组交易数据。
其中,计算机设备执行N组交易数据具体可以包括:并行执行N组交易数据。假设N组交易数据分别表示为:交易数据1、交易数据2...交易数据N,那么,所谓并行执行N组交易数据具体包括:在执行交易数据1的同时,也在执行交易数据2、交易数据3...交易数据N。
在一些实施例中,本实施例中执行各交易数据的主体为打包节点,当然执行各交易数据的主体可以是不同于本方法执行主体的其他主体。例如,可以是任一的区块链节点。各交易数据可以是同一个区块链节点执行的,也可以是不同的区块链执行的。
S402、根据每组交易数据的交易执行结果,从该多组交易数据中确定出满足预设执行条件的至少一组第一交易数据。
其中,第一交易数据为一组或多组,多组是指至少两组,例如有M组第一交易数据,M为正整数且M≤N。第一交易数据为该多组交易数据中满足预设执行条件的交易数据。预设执行条件可以是并行执行所需要满足的条件,故预设执行条件也可以称为并行执行条件。
S403、打包该多组交易数据,生成待共识区块,待共识区块中记录各第一交易数据和至少一组第二交易数据;第二交易数据,为该多组交易数据中不同于第一交易数据的交易数据。
其中,第二交易数据是该多组交易数据中不满足预设执行条件的交易数据。待共识区块中区别记录第一交易数据和第二交易数据。区别记录可以是通过区别记录规则实现的。在待共识区块中基于区别记录规 则记录了各第一交易数据和各第二交易数据。计算机设备可以为第一交易数据和第二交易数据分别设置不同的标签,来区别记录第一交易数据和第二交易数据。标签可以根据需要设置,标签可以是数字或字符串,例如,第一交易数据的标签为1,第二交易数据的标签为0。
S404、对各第一交易数据进行第一共识处理,对各第二交易数据进行不同于第一共识处理的第二共识处理。
其中,第一共识处理与第二共识处理为两种不同的共识处理的方法,例如,第一共识处理为并行进行共识的方法,即第一共识处理可以为并行共识处理,第二共识处理为串行进行共识的方法,即第二共识处理可以为串行共识处理。共识节点集合中包括一个或多个共识节点,例如,共识节点集合中包括至少两个共识节点。计算机设备(即打包节点)将待共识区块广播至共识节点集合中后,可以使得共识节点集合中的全部或部分共识节点对待共识区块中的各第一交易数据进行并行共识处理,并对第二交易数据进行串行共识处理。
具体地,共识节点集合中的共识节点可以基于区别记录规则对待共识区块中的各第一交易数据进行并行共识处理,对各第二交易数据进行串行共识处理。
在一些实施例中,当存在多组第一交易数据时,计算机设备对各组第一交易数据分别进行第一共识处理,比如分别进行并行共识处理。当存在多组第二交易数据时,计算机设备对各组第二交易数据分别进行第二共识处理,比如分别进行串行共识处理。
在一些实施例中,计算机设备可以将待共识区块广播至共识节点集合,以使共识节点集合中的共识节点对待共识区块中的各第一交易数据进行并行共识处理,对各第二交易数据进行串行共识处理。
本申请实施例中,预先执行多组交易数据,然后按照交易执行结果识别出可并行的交易数据,然后再将这些交易数据中可并行的交易数据(即第一交易数据)和不可并行的交易数据(即第二交易数据)打包至区块中,最后将打包好的区块广播至多个共识节点,使得共识节点可以并行执行第一交易数据,然后串行执行第二交易数据,这种共识方式可以对可并行执行的部分交易数据进行并行共识处理,相比于对所有的交易数据均串行执行而言,提高了数据处理的效率,从而提高了区块链系统的吞吐量。
在一种可能的实现方式中,待共识区块中基于区别记录规则记录第一交易数据和第二交易数据,区别记录规则包括:排列规则和标签设置规则。计算机设备打包多组交易数据,生成待共识区块,具体可以包括如下步骤:按照排列规则打包多组交易数据,生成待共识区块;待共识区块中的各第二交易数据设置有目标标签,目标标签是基于标签设置规则设置的;其中,基于排列规则打包多组交易数据之后,待共识区块中任意一组第一交易数据会优先于任一组第二交易数据被执行共识处理。
具体地,标签设置规则用于指示被打包至待共识区块中的任一组第二交易数据被设置有目标标签。在从该多组交易数据中确定出各组第一交易数据和各组第二交易数据后,可以优先将满足预设执行条件的各组第一交易数据打包到区块,然后再将不满足预设执行条件的各组第二交易数据打包到区块,从而生成待共识区块。其中,将各组第一交易数据打包到区块的过程中,可以按照每组第一交易数据的交易生成时间由早到晚依次排序打包;将各组第二交易数据打包到区块的过程中,可以按照每组第二交易数据的交易生成时间戳由早到晚依次排序打包。并且,任一组第二交易数据还可以被设置有目标标签,例如NeedRedo,当然,针对任一组第一交易数据而言,可以不对其设置任何标签,也可以对其设置有与目标标签不相同的其它标签,例如unNeedRedo。
举例来说,图8是本申请实施例提供的一种生成待共识区块的流程示意图。如图8所示,假设N组交易数据分别表示为:交易数据a、交易数据b、交易数据c、交易数据d、交易数据e。其中,交易数据a、交易数据c、交易数据e被确定为第一交易数据,即可并行执行的交易数据;交易数据b、交易数据d被确定为第二交易数据,即不可并行执行(即需串行执行)的交易数据,那么,可以将交易数据a、交易数据 c、交易数据e优先打包至区块中,然后将交易数据b、交易数据d再打包至区块中,从而生成如图8所示的待共识区块。
本实施例中,基于排列规则和标签设置规则快速对多组交易数据打包生成待共识区块,并在待共识区块中将第一交易数据和第二交易数据进行了区分,提高了生成待共识区块的效率。
在一种可能的实现方式中,在执行该多组交易数据之前,计算机设备还可以为该多组交易数据中的每组交易数据创建对应的交易读缓存和交易写缓存。其中,交易数据对应的交易读缓存,用于存储该交易数据的读数据集,读数据集用于触发调用智能合约以执行交易数据;交易数据对应的交易写缓存,用于存储该交易数据的写数据集,写数据集用于存储调用智能合约执行交易数据后得到的交易执行结果。
其中,调用信息可以包括但不限于智能合约的调用地址、合约标识中的至少一个,合约标识例如合约名称。读数据集用于指示执行交易数据所对应的智能合约的调用信息。
本实施例中,为每组交易数据创建对应的交易读缓存和交易写缓存,从而为每组交易数据的执行提供了缓存资源,以便于每组交易数据的执行顺利进行,提高了执行交易数据的效率。
在一些实施例中,计算机设备可以从交易读缓存中获取目标交易数据的读数据集,并基于目标交易数据的读数据集中的调用信息,获取用于执行目标交易数据的目标智能合约;然后,计算机设备可以调用目标智能合约执行目标交易数据,得到目标交易执行结果,目标交易执行结果被作为目标交易数据的写数据集。其中,目标交易数据是指该多组交易数据中的任一组交易数据。
应当理解,目标交易数据对应的交易读缓存中包括目标交易数据对应的读数据集。因此,计算机设备可以从目标交易数据对应的交易读缓存中获取目标交易数据对应的读数据集,基于目标交易数据对应的读数据集中的合约调用地址以及合约名称,获取用于执行目标交易数据的智能合约,调用该智能合约执行目标交易数据,从而可以得到目标交易数据对应的交易执行结果,并可以将交易执行结果添加至目标交易数据的交易写缓存,进而可以基于交易写缓存中所存储的数据构建得到目标交易数据对应的写数据集。
图5a是本申请实施例提供的一种并行执行交易数据的流程示意图。如图5a所示,计算机设备可以基于账本缓存为每组交易数据分别创建对应的交易读缓存和交易写缓存,一组交易数据对应一组交易读缓存和一组交易写缓存。例如,若该多组交易数据为N组交易数据,则有交易1读缓存、交易2读缓存、…、交易N读缓存,以及,交易1写缓存、交易2写缓存、…、交易N写缓存。
图5b是本申请实施例提供的一种交易数据的执行过程的流程示意图。如图5b所示,调用智能合约执行目标交易数据的执行过程可以包括如下步骤S1-S6:
S1、触发合约。
具体地,计算机设备可以从目标交易数据对应的交易读缓存中获取目标交易数据对应的读数据集,基于目标交易数据对应的读数据集触发调用其相应的智能合约。
S2、分析交易。
具体地,计算机设备基于目标交易数据对应的读数据集中的合约调用地址以及合约名称,获取用于执行目标交易数据的智能合约。
其中,智能合约包括合约名、合约方法或合约输入等中的至少一个。
S3、载入合约的存储信息和合约的字节码。
具体地,计算机设备从目标交易数据和状态数据库中获取相应的合约字节码和合约输入。
S4、执行合约。
具体地,合约代码在计算机设备中执行,完成对应目标交易数据的业务逻辑。
S5、返回结果更新状态数据库。
具体地,计算机设备将交易执行结果写回到状态数据库中,完成业务状态的更新。
S6、制作默克尔树树根,存储在区块中。
具体地,当待共识区块中的所有的交易数据都已执行时,系统会将状态数据库的当前状态的哈希摘要作为认证记录存储在区块链中。
本实施例中,针对每组交易数据,通过调用相应的智能合约执行相关的业务操作,即可得到每组交易数据的交易执行结果,并将每组交易数据的交易执行结果写入至交易写缓存中,从而将交易执行结果作为其写数据集中的数据,提高了执行交易数据的效率。
在一种可能的实现方式中,每组交易数据的交易执行结果是以键值对的形式存储至相应的交易写缓存中的每组交易数据的读数据集是以键值对的形式存储至相应的交易读缓存中的。计算机设备根据每组交易数据的交易执行结果,从多组交易数据中确定出满足预设执行条件的至少一组第一交易数据,具体可以包括:计算机设备还可以从交易写缓存中获取每组交易数据的写关键字,并对每组交易数据的写关键字进行哈希运算,得到每组交易数据的第一哈希字符串;写关键字是指交易执行结果对应的键值对中的键;计算机设备遍历每组交易数据的读数据集,并对每组交易数据的读关键字进行哈希运算,得到每组交易数据的第二哈希字符串;读关键字是指读数据集对应的键值对中的键;然后,计算机设备对每组交易数据的第二哈希字符串,与各个第一哈希字符串进行匹配处理,并根据匹配结果从多组交易数据中确定出满足预设执行条件的至少一组第一交易数据。
其中,键值对由键(key)和值(value)组成。写关键字是指交易执行结果对应的键值对中的键,即写关键字为key。
在一些实施例中,计算机设备还可以从交易写缓存中获取每组交易数据的写关键字,并对每组交易数据的写关键字进行哈希运算,得到每组交易数据的第一哈希字符串,计算机设备可以将每组交易数据的第一哈希字符串写入至布隆过滤器中。需要说明的是,通过将每组交易数据的第一哈希字符串写入至布隆过滤器的方式,可以用于对每组交易数据进行识别分类处理,从而从该多组交易数据中确定出满足预设执行条件的第一交易数据,以及从该多组交易数据中确定出不满足预设执行条件的第二交易数据。具体地,布隆过滤器(Bloom Filter)是一个比特(bit)向量或者说比特数组。其中,布隆过滤器的数据结构可以如下表2所示:
表2.布隆过滤器的数据结构
基于表2所示,布隆过滤器的原理大致如下:布隆过滤器是一个包含多个(例如11个)比特位的数组,且初始化的布隆过滤器中的各个比特位的值均为0,若需要向布隆过滤器添加一个值时,则需要使用多个不同的哈希函数生成多个哈希值,并对每个生成的哈希值指向的比特位设置为1。
举例来说,本申请实施例中,针对任一交易数据(例如交易数据1)对应的写关键字key1,可以利用一个或多个哈希函数分别进行哈希运算,得到对应的哈希字符串,多个是指至少两个。图6是本申请实施例提供的一种布隆过滤器的原理示意图。如图6所示,假设布隆过滤器为11个比特位的比特数组,且哈希函数包含5个,那么对该交易数据1对应的写关键字key1进行哈希运算后,得到的第一哈希字符串为:10101010100,然后将第一哈希字符串10101010100写入至布隆过滤器中。针对每组交易数据,其对应写入至布隆过滤器的详细过程如上所示。
本实施例中,对每组交易数据的第二哈希字符串,与各个第一哈希字符串进行匹配处理,并根据匹配结果从多组交易数据中确定出满足预设执行条件的各组第一交易数据,从而可以通过字符串之间的匹配结果快速的确定第一交易数据,提高了确定第一交易数据的效率。
在一些实施例中,计算机设备可以将每组交易数据的第一哈希字符串写入至布隆过滤器中。对每组交易数据的第二哈希字符串,与各个第一哈希字符串进行匹配处理包括:对每组交易数据的第二哈希字符串, 与布隆过滤器中的各个第一哈希字符串进行匹配处理。
在一种可能的实现方式中,每组交易数据的读数据集是以键值对的形式存储至相应的交易读缓存中的。计算机设备根据每组交易数据的交易执行结果,从多组交易数据中确定出满足预设执行条件的各组第一交易数据,具体可以包括:首先,遍历每组交易数据的读数据集,并对每组交易数据的读关键字进行哈希运算,得到每组交易数据的第二哈希字符串;读关键字是指读数据集对应的键值对中的键;然后,对每组交易数据的第二哈希字符串,与布隆过滤器中的各个第一哈希字符串进行匹配处理,并根据匹配结果从多组交易数据中确定出满足预设执行条件的各组第一交易数据。
本实施例中,对每组交易数据的第二哈希字符串,与布隆过滤器中的各个第一哈希字符串进行匹配处理,可以基于布隆过滤器快速进行字符串进行匹配,提高了匹配效率。
在一些实施例中,根据匹配结果从多组交易数据中确定出满足预设执行条件的至少一组第一交易数据包括:对交易数据的第二哈希字符串,与布隆过滤器中的各个第一哈希字符串进行匹配处理;若匹配结果为匹配不成功,则确定交易数据满足预设执行条件,并将交易数据确定为第一交易数据;若匹配结果为匹配成功,则确定目标交易数据不满足预设执行条件,并将目标交易数据确定为第二交易数据。
具体地,针对每组交易数据,若交易数据的第二哈希字符串与各个第一哈希字符串均不匹配,则确定该交易数据为第一交易数据。若交易数据的第二哈希字符串与任一第一哈希字符串匹配,则确定该交易数据为第二交易数据。
例如,图7a是本申请实施例提供的一种确定第二交易数据的流程示意图。如图7a所示,从交易数据2的交易读缓存中获取交易数据2的读关键字key2,并利用一个或多个哈希函数(例如5个)对该读关键字key2进行哈希运算后,得到第二哈希字符串假设为:10101010100。接下来,将该第二哈希字符串与布隆过滤器中各个第一哈希字符串进行比对,由于该交易数据2的第二哈希字符串与布隆过滤器中交易数据1的第一哈希字符串10101010100相同,那么可以确定交易数据2读到了交易数据1写的数据,因此交易数据2需要在交易数据1之后执行,则交易数据2为不满足预设执行条件的交易数据(即第二交易数据)。
又如,图7b是本申请实施例提供的一种确定第一交易数据的流程示意图。如图7b所示,从交易数据3的交易读缓存中获取交易数据3的读关键字key3,并利用一个或多个哈希函数(例如5个)对该读关键字key3进行哈希运算后,得到第二哈希字符串假设为:0101010101011。接下来,将该第二哈希字符串与布隆过滤器中各个第一哈希字符串进行比对,由于该交易数据3的第二哈希字符串与布隆过滤器中任一第一哈希字符串均不同,那么可以确定交易数据3为满足预设执行条件的交易数据(即第一交易数据)。
本实施例中,通过第一哈希字符串和第二哈希字符串的匹配结果,准确的从各交易数据中确定出了第一交易数据和第二交易数据。
在一种可能的实现方式中,计算机设备将待共识区块广播至共识节点集合之后,还可以执行如下步骤:串行执行各组第二交易数据,得到每组第二交易数据的第二交易执行结果;从每组交易数据的交易执行结果中获取各组第一交易数据的第一交易执行结果;对各个第一交易执行结果和各个第二交易执行结果进行合并处理,得到交易合并执行结果。
举例说明,假设各第二交易数据分别表示为第二交易数据a、第二交易数据b、...、第二交易数据x,则在执行完第二交易数据a之后,执行第二交易数据b,接下来执行第二交易数据c,以此类推,依次执行完各组第二交易数据。其中,执行顺序可以是指按照每组第二交易数据的交易生成时间戳由早到晚的顺序。
另外,计算机设备可以按照每组交易数据在待共识区块中的交易排列顺序对各个第一交易执行结果和各个第二交易执行结果进行合并处理,得到交易合并执行结果。其中,所谓的交易排列顺序可以是指基于各组交易数据的交易生成时间戳由早到晚的顺序。
本实施例中,对各个第一交易执行结果和各个第二交易执行结果进行合并处理,得到交易合并执行结 果,从而得到了该多组交易数据的总的执行结果,提高了得到该多组交易数据的执行结果的效率。
图9是本申请实施例提供的另一种数据处理方法的流程示意图。该数据处理方法可应用于区块链中,可由上述所提及的区块链节点(例如除打包节点以外的任一共识节点)执行,为便于阐述,后续均以计算机设备执行该数据处理方法为例进行说明。其中,该数据处理方法可包括如下步骤S901~S904:
S901、获取打包节点发送的待共识区块。
其中,待共识区块是打包节点对待处理的多组交易数据打包后生成的,该多组交易数据包括第一交易数据和第二交易数据,待共识区块中基于区别记录规则记录了各组第一交易数据和各组第二交易数据,第一交易数据是在对该多组交易数据并行执行后,根据每组交易数据的交易执行结果确定出来的。例如,该多组交易数据为N组交易数据,该N组交易数据中包括M组第一交易数据和N-M组第二交易数据。N、M均为正整数,且M≤N。
其中,区别记录规则包括:排列规则和标签设置规则;其中,排列规则用于指示打包该多组交易数据并生成待共识区块,标签设置规则用于指示被打包至待共识区块中的任一组第二交易数据被设置有目标标签。举例来说,任一组第二交易数据所携带的目标标签可以为NeedRedo。
需要说明的是,计算机设备根据每组交易数据的交易执行结果确定出各组第一交易数据的具体执行步骤,详细可以参考上述图4实施例中步骤S402中所执行的具体步骤。
S902、对待共识区块中的各组第一交易数据进行第一共识处理,得到每组第一交易数据的第一交易执行结果。
具体地,若多组交易数据包括M组第一交易数据,则计算机设备对M组第一交易数据进行并行共识处理包括:并行执行M组第一交易数据,假设M组第一交易数据分别表示为:第一交易数据1、第一交易数据2...第一交易数据M,那么,并行执行这M组第一交易数据具体包括:在执行第一交易数据1的同时,也执行第一交易数据2、第一交易数据3...第一交易数据M。
在一种可能的实现方式中,计算机设备对待共识区块中的M组第一交易数据进行并行共识处理之前,还用于获取打包节点的节点标识,并基于获取到的节点标识对打包节点进行验证,若验证通过,则触发执行对待共识区块中的M组第一交易数据进行并行共识处理,得到每组第一交易数据的第一交易执行结果的步骤;若验证不通过,则删除该待共识区块。通过这种方式,在共识处理之前对打包节点的身份信息进行校验,可以提高数据处理过程的准确性。
具体地,待共识区块中的任一组第一交易数据不携带目标标签,任一组第二交易数据携带有目标标签。那么,计算机设备获取到待共识区块之后,将不携带有目标标签的交易数据确定为满足预设执行条件的第一交易数据,然后执行这些第一交易数据后,可以分别得到每组第一交易数据的第一交易执行结果。需要说明的是,计算机设备执行任一第一交易数据,从而得到相应的第一交易执行结果的具体步骤,详细可以参考上述图4实施例中所描述的相关内容。
S903、对待共识区块中的各组第二交易数据进行不同于第一共识处理的第二共识处理,得到每组第二交易数据的第二交易执行结果。
具体地,计算机设备对N-M组第二交易数据进行第二共识处理包括:串行执行N-M组第一交易数据,假设N-M组第二交易数据分别表示为:第二交易数据a、第二交易数据b...第二交易数据x,那么,并行执行这N-M组第二交易数据具体包括:在执行完第二交易数据a之后,然后执行第二交易数据b,以及,在执行完第二交易数据b之后,然后执行第二交易数据c,以此类推,直至执行完第二交易数据x。
待共识区块中的任一组第二交易数据被设置有目标标签(例如NeedRedo)。那么,计算机设备获取到待共识区块之后,将携带有目标标签的交易数据确定为不满足预设执行条件(即需要串行执行)的第二交易数据,然后执行这些第二交易数据(即N-M组第二交易数据)后,可以分别得到每组第二交易数据的第 二交易执行结果。需要说明的是,计算机设备执行任一第二交易数据,从而得到相应的第二交易执行结果的具体步骤,详细可以参考上述图4实施例中所描述的相关内容。
S904、对各个第一交易执行结果和各个第二交易执行结果进行合并处理,得到交易合并执行结果。
在一种可能的实现方式中,计算机设备可以按照每组交易数据(第一交易数据、第二交易数据)在待共识区块中的交易排列顺序对各个第一交易执行结果和各个第二交易执行结果进行合并处理,得到交易合并执行结果。其中,所谓的交易排列顺序可以是指基于各组交易数据的交易生成时间戳由早到晚的顺序。例如,N组交易数据包括:交易数据1、交易数据2、交易数据3,其中,交易数据1的交易生成时间戳为t1,交易数据2的交易生成时间戳为t2,交易数据3的交易生成时间戳为t3,且t1<t2<t3,那么,在对交易数据1的交易执行结果s1、交易数据2的交易执行结果s2、交易数据3的交易执行结果s3进行合并处理时,可以首先将s1与s2进行合并得到s12,然后再将s12与s3合并得到S123,以此类推,将所有交易数据的交易执行结果合并后,即可得到交易合并执行结果。
在一种可能的实现方式中,计算机设备还可以将交易合并执行结果写回至区块链的状态数据库中,以使状态数据库可以根据当前写入的最新的区块(待共识区块)中的各组交易数据的交易执行结果,实现业务状态的更新。例如,待共识区块中所包括的任一交易数据为:对象A向对象B的账户转移m个单位的虚拟资源。那么,在得到该交易数据的交易执行结果并写入至状态数据库后,在状态数据库中所执行业务状态的更新操作可以包括:从对象A的账户中扣除m个单位的虚拟资源,并在对象B的账户中增加m个单位的虚拟资源。
本申请实施例中,区块链中的共识节点在接收到打包节点发送的待共识区块后,可以并行执行待共识区块中的部分交易数据,然后再串行执行待共识区块中剩余的交易数据,这种共识方式解决了因需串行执行大量交易数据所带来的性能低下,系统吞吐量低的问题。由于本申请可并行执行交易数据,从而提升了区块链的执行效率,大大提高了系统的吞吐量。
在一种可能的实现方式中,计算机设备对待共识区块中的各组第一交易数据进行第一共识处理,得到每组第一交易数据的第一交易执行结果之后,还用于执行以下步骤:对第一共识处理过程进行有效性验证,若验证不通过,则删除各个第一交易执行结果和各个第二交易执行结果;对该多组交易数据进行第二共识处理,得到每组交易数据的交易执行结果。
本实施例中,对第一共识处理过程进行有效性验证,若验证不通过,则删除各个第一交易执行结果和各个第二交易执行结果,提高了交易执行结果的正确性。
在一些实施例中,计算机上设备对第一共识处理过程进行有效性验证,具体可以包括:遍历第二交易数据的交易读缓存,获取第二交易数据的读数据集,读数据集是以键值对的形式存储至交易读缓存中的;对第二交易数据的读关键字进行哈希运算,得到第二交易数据的验证哈希字符串;基于布隆过滤器保存的第一哈希字符串对验证哈希字符串进行匹配处理,若匹配成功,则确定第一共识处理过程验证通过。
其中,若匹配不成功,则确定第一共识处理过程验证不通过。
应当理解,任一交易数据对应一个交易读缓存和一个交易写缓存,其中,交易读缓存用于存储任一组交易数据的读数据集,读数据集用于指示执行交易数据所对应的智能合约的调用信息(例如合约名称、调用地址等信息);交易写缓存用于存储任一组交易数据的写数据集,写数据集用于存储调用智能合约执行交易数据后得到的交易执行结果。
需要说明的是,关于布隆过滤器保存的第一哈希字符串的具体过程详细可以参考上述图4实施例中,计算机设备将每组交易数据的第一哈希字符串写入至布隆过滤器中的相关内容。
本实施例中,若匹配成功,则确定第一共识处理过程验证通过,准确的对并行共识处理过程进行了有效性验证。图10是本申请实施例提供的一种数据处理装置的结构示意图。该数据处理装置1000可应用于 前述实施例中的计算机设备(例如打包节点)。数据处理装置1000可以是运行于计算机设备中的一个计算机程序(包括程序代码),例如该数据处理装置1000为一个应用软件;该数据处理装置1000可以用于执行本申请实施例提供的数据处理方法中的相应步骤。该数据处理装置1000可包括:
获取单元1001,用于获取待处理的多组交易数据。
处理单元1002,用于根据每组交易数据的交易执行结果,从多组交易数据中确定出满足预设执行条件的至少一组第一交易数据。
处理单元1002,还用于打包多组交易数据,生成待共识区块;待共识区块中记录各组第一交易数据和至少一组第二交易数据;第二交易数据,为多组交易数据中不同于第一交易数据的交易数据。
发送单元1003,用于对第一交易数据进行第一共识处理,对各组第二交易数据进行不同于第一共识处理的第二共识处理。
在一种可能的实现方式中,待共识区块中基于区别记录规则记录第一交易数据和第二交易数据,区别记录规则包括:排列规则和标签设置规则;处理单元1002打包多组交易数据,生成待共识区块,用于执行以下操作:
按照排列规则打包多组交易数据,生成待共识区块;待共识区块中的各第二交易数据设置有目标标签,目标标签是基于标签设置规则设置的;
其中,基于排列规则打包多组交易数据之后,待共识区块中任意一组第一交易数据会优先于任一组第二交易数据被执行共识处理。
在一种可能的实现方式中,处理单元1002执行多组交易数据之前,还用于执行以下操作:
为多组交易数据中的每组交易数据创建对应的交易读缓存和交易写缓存;
其中,交易数据对应的交易读缓存,用于存储交易数据的读数据集,读数据集用于触发调用智能合约以执行交易数据;交易数据对应的交易写缓存用于存储交易数据的写数据集,写数据集用于存储调用智能合约执行交易数据后得到的交易执行结果。
在一种可能的实现方式中,处理单元1002还用于执行以下操作:
从交易读缓存中获取目标交易数据的读数据集,并基于目标交易数据的读数据集中的调用信息,获取用于执行目标交易数据的目标智能合约;目标交易数据为多组交易数据中的任一交易数据;
调用目标智能合约执行目标交易数据,得到目标交易执行结果;目标交易执行结果用于得到目标交易数据的写数据集。
在一种可能的实现方式中,每组交易数据的交易执行结果是以键值对的形式存储至相应的交易写缓存中的;每组交易数据的读数据集是以键值对的形式存储至相应的交易读缓存中的;处理单元1002还用于执行以下操作:
从交易写缓存中获取每组交易数据的写关键字,并对每组交易数据的写关键字进行哈希运算,得到每组交易数据的第一哈希字符串;写关键字是指交易执行结果对应的键值对中的键;遍历每组交易数据的读数据集,并对每组交易数据的读关键字进行哈希运算,得到每组交易数据的第二哈希字符串;读关键字是指读数据集对应的键值对中的键;对每组交易数据的第二哈希字符串,与各个第一哈希字符串进行匹配处理,并根据匹配结果从多组交易数据中确定出满足预设执行条件的各组第一交易数据。
在一种可能的实现方式中,处理单元1002还用于将每组交易数据的第一哈希字符串写入至布隆过滤器中;对每组交易数据的第二哈希字符串,与布隆过滤器中的各个第一哈希字符串进行匹配处理。
在一种可能的实现方式中,处理单元1002根据匹配结果从多组交易数据中确定出满足预设执行条件的至少一组第一交易数据,用于执行以下操作:
若交易数据的匹配结果为匹配不成功,则确定交易数据满足预设执行条件,并将交易数据确定为第一 交易数据;
若交易数据的匹配结果为匹配成功,则确定交易数据不满足预设执行条件,并将交易数据确定为第二交易数据。
在一种可能的实现方式中,在发送单元1003将待共识区块广播至共识节点集合之后,处理单元1002还用于执行以下操作:
串行执行各组第二交易数据,得到每组第二交易数据的第二交易执行结果;
从每组交易数据的交易执行结果中获取各组第一交易数据的第一交易执行结果;
对各个第一交易执行结果和各个第二交易执行结果进行合并处理,得到交易合并执行结果。
图11是本申请实施例提供的另一种数据处理装置的结构示意图。该数据处理装置1100可应用于前述实施例中的计算机设备(例如共识节点)。数据处理装置1100可以是运行于计算机设备中的一个计算机程序(包括程序代码),例如该数据处理装置1100为一个应用软件;该数据处理装置1100可以用于执行本申请实施例提供的数据处理方法中的相应步骤。该数据处理装置1100可包括:
获取单元1101,用于获取打包节点发送的待共识区块,待共识区块是打包节点对待处理的多组交易数据打包后生成的,待共识区块中记录至少一组第一交易数据和至少一组第二交易数据,第一交易数据是在对多组交易数据并行执行后,根据每组交易数据的交易执行结果确定出来的。
处理单元1102,用于对待共识区块中的各组第一交易数据进行第一共识处理,得到每组第一交易数据的第一交易执行结果。
处理单元1102,还用于对待共识区块中的各组第二交易数据进行不同于第一共识处理的第二共识处理,得到每组第二交易数据的第二交易执行结果。
处理单元1102,还用于对各个第一交易执行结果和各个第二交易执行结果进行合并处理,得到交易合并执行结果。
在一种可能的实现方式中,处理单元1102对待共识区块中的各组第一交易数据进行第一共识处理,得到每组第一交易数据的第一交易执行结果之后,还用于执行以下操作:
对第一共识处理过程进行有效性验证,若验证不通过,则删除各个第一交易执行结果和各个第二交易执行结果;
对多组交易数据进行第二共识处理,得到每组交易数据的交易执行结果。
在一种可能的实现方式中,处理单元1102对第一共识处理过程进行有效性验证,用于执行以下操作:
遍历第二交易数据的交易读缓存,获取第二交易数据的读数据集,读数据集是以键值对的形式存储至交易读缓存中的;
对第二交易数据的读关键字进行哈希运算,得到目标第二交易数据的验证哈希字符串;
基于布隆过滤器保存的第一哈希字符串对验证哈希字符串进行匹配处理,若匹配成功,则确定第一共识处理过程验证通过。
图12是本申请实施例提供的一种计算机设备的结构示意图。该计算机设备1200用于执行前述方法实施例中打包节点、共识节点所执行的步骤,该计算机设备1200包括:一个或多个处理器1210;一个或多个输入设备1220,一个或多个输出设备1230和存储器1240。上述处理器1210、输入设备1220、输出设备1230和存储器1240通过总线1250连接。存储器1240用于存储计算机程序,计算机程序包括程序指令,处理器1210用于调用存储器1240存储的程序指令,执行数据处理方法中的步骤。
本申请实施例还提供了一种计算机存储介质,且计算机存储介质中存储有计算机可读指令,当处理器执行上述计算机可读指令时,能够执行前文所对应实施例中的方法。对于本申请所涉及的计算机存储介质实施例中未披露的技术细节,请参照本申请方法实施例的描述。作为示例,计算机可读指令可以被部署在 一个计算机设备上,或者在位于一个地点的多个计算机设备上执行,又或者,在分布在多个地点且通过通信网络互连的多个计算机设备上执行。
根据本申请的一个方面,提供了一种计算机程序产品,该计算机程序产品包括计算机可读指令,该计算机可读指令存储在计算机可读存储介质中。计算机设备的处理器从计算机可读存储介质读取该计算机可读指令,处理器执行该计算机可读指令,使得该计算机设备可以执行前文所对应实施例中的方法。
本领域普通技术对象可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,上述程序可存储于计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,上述存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)或随机存储记忆体(Random Access Memory,RAM)等。
以上所揭露的仅为本申请较佳实施例而已,当然不能以此来限定本申请之权利范围,因此依本申请权利要求所作的等同变化,仍属本申请所涵盖的范围。

Claims (16)

  1. 一种数据处理方法,其特征在于,由计算机设备执行,包括:
    获取待处理的多组交易数据;
    根据每组交易数据的交易执行结果,从所述多组交易数据中确定出满足预设执行条件的至少一组第一交易数据;
    打包所述多组交易数据,生成待共识区块,所述待共识区块中记录各组所述第一交易数据和至少一组第二交易数据,所述第二交易数据为所述多组交易数据中不同于所述第一交易数据的交易数据;
    对所述第一交易数据进行第一共识处理,对所述第二交易数据进行不同于所述第一共识处理的第二共识处理。
  2. 如权利要求1所述的方法,其特征在于,所述待共识区块中基于区别记录规则记录第一交易数据和第二交易数据,所述区别记录规则包括:排列规则和标签设置规则;所述打包所述多组交易数据,生成待共识区块,包括:
    按照所述排列规则打包所述多组交易数据,生成待共识区块;所述待共识区块中的各所述第二交易数据设置有目标标签,所述目标标签是基于所述标签设置规则设置的;
    其中,基于所述排列规则打包所述多组交易数据之后,待共识区块中任意一组所述第一交易数据会优先于任一组所述第二交易数据被执行共识处理。
  3. 如权利要求1-2中任一项所述的方法,其特征在于,在执行所述多组交易数据之前,还包括:
    为所述多组交易数据中的每组交易数据创建对应的交易读缓存和交易写缓存;
    其中,所述交易数据对应的交易读缓存,用于存储所述交易数据的读数据集,所述读数据集用于触发调用智能合约以执行交易数据智能合约;所述交易数据对应的交易写缓存用于存储所述交易数据的写数据集,所述写数据集用于存储调用智能合约执行交易数据后得到的交易执行结果。
  4. 如权利要求3所述的方法,其特征在于,所述方法还包括:
    从交易读缓存中获取目标交易数据的读数据集,并基于目标交易数据的读数据集中的调用信息,获取用于执行所述目标交易数据的目标智能合约;所述目标交易数据为所述多组交易数据中的任一交易数据;
    调用所述目标智能合约执行所述目标交易数据,得到目标交易执行结果;所述目标交易执行结果用于得到所述目标交易数据的写数据集。
  5. 如权利要求4所述的方法,其特征在于,每组所述交易数据的交易执行结果是以键值对的形式存储至相应的交易写缓存中的;每组所述交易数据的读数据集是以键值对的形式存储至相应的交易读缓存中的;
    所述根据每组交易数据的交易执行结果,从所述多组交易数据中确定出满足预设执行条件的至少一组第一交易数据,包括:
    从交易写缓存中获取每组交易数据的写关键字,并对每组交易数据的写关键字进行哈希运算,得到每组交易数据的第一哈希字符串;所述写关键字是指交易执行结果对应的键值对中的键;
    遍历每组交易数据的读数据集,并对每组所述交易数据的读关键字进行哈希运算,得到每组所述交易数据的第二哈希字符串;所述读关键字是指读数据集对应的键值对中的键;
    对每组所述交易数据的第二哈希字符串,与各个所述第一哈希字符串进行匹配处理,并根据匹配结果从所述多组交易数据中确定出满足预设执行条件的至少一组第一交易数据。
  6. 如权利要求5所述的方法,其特征在于,所述方法还包括:
    将所述每组交易数据的第一哈希字符串写入至布隆过滤器中;
    所述对每组所述交易数据的第二哈希字符串,与各个所述第一哈希字符串进行匹配处理包括:
    对每组所述交易数据的第二哈希字符串,与所述布隆过滤器中的各个所述第一哈希字符串进行匹配处理。
  7. 如权利要求5所述的方法,其特征在于,所述根据匹配结果从所述多组交易数据中确定出满足预设执行条件的至少一组第一交易数据,包括:
    若所述交易数据的匹配结果为匹配不成功,则确定所述交易数据满足预设执行条件,并将所述交易数据确定为第一交易数据;
    若所述交易数据的匹配结果为匹配成功,则确定所述交易数据不满足预设执行条件,并将所述交易数据确定为第二交易数据。
  8. 如权利要求1-7中任一项所述的方法,其特征在于,所述将所述待共识区块广播至共识节点集合 之后,还包括:
    串行执行各组所述第二交易数据,得到每组所述第二交易数据的第二交易执行结果;
    从所述每组交易数据的交易执行结果中获取各所述第一交易数据的第一交易执行结果;
    对各个所述第一交易执行结果和各个所述第二交易执行结果进行合并处理,得到交易合并执行结果。
  9. 一种数据处理方法,其特征在于,由计算机设备执行,包括:
    获取打包节点发送的待共识区块,所述待共识区块是所述打包节点对待处理的多组交易数据打包后生成的,所述待共识区块中记录至少一组第一交易数据和至少一组第二交易数据,所述第一交易数据是在对所述多组交易数据并行执行后,根据每组交易数据的交易执行结果确定出来的;
    对所述待共识区块中的各第一交易数据进行第一共识处理,得到各所述第一交易数据的第一交易执行结果;
    对所述待共识区块中的各第二交易数据进行不同于所述第一共识处理的第二共识处理,得到各所述第二交易数据的第二交易执行结果;
    对各所述第一交易执行结果和各所述第二交易执行结果进行合并处理,得到交易合并执行结果。
  10. 如权利要求9所述的方法,其特征在于,所述对所述待共识区块中的各第一交易数据进行第一共识处理,得到各所述第一交易数据的第一交易执行结果之后,还包括:
    对第一共识处理过程进行有效性验证,若验证不通过,则删除各组所述第一交易执行结果和各组所述第二交易执行结果;
    对所述多组交易数据进行第二共识处理,得到每组交易数据的交易执行结果。
  11. 如权利要求10所述的方法,其特征在于,所述对第一共识处理过程进行有效性验证,包括:
    遍历第二交易数据的交易读缓存,获取第二交易数据的读数据集,所述读数据集是以键值对的形式存储至所述交易读缓存中的;
    对所述第二交易数据的读关键字进行哈希运算,得到所述第二交易数据的验证哈希字符串;
    基于布隆过滤器保存的第一哈希字符串对所述验证哈希字符串进行匹配处理,若匹配成功,则确定所述第一共识处理过程验证通过。
  12. 一种数据处理装置,其特征在于,包括:
    获取单元,用于获取待处理的多组交易数据;
    处理单元,用于根据每组交易数据的交易执行结果,从所述多组交易数据中确定出满足预设执行条件的至少一组第一交易数据;
    所述处理单元,还用于打包所述多组交易数据,生成待共识区块;所述待共识区块中记录各组第一交易数据和至少一组第二交易数据;所述第二交易数据,为所述多组交易数据中不同于所述第一交易数据的交易数据;
    发送单元,用于对所述第一交易数据进行第一共识处理,对各所述第二交易数据进行第二共识处理。
  13. 一种数据处理装置,其特征在于,包括:
    获取单元,用于获取打包节点发送的待共识区块,所述待共识区块是所述打包节点对待处理的多组交易数据打包后生成的,所述待共识区块中记录至少一组第一交易数据和至少一组第二交易数据,所述第一交易数据是在对所述多组交易数据并行执行后,根据每组交易数据的交易执行结果确定出来的;
    处理单元,用于对所述待共识区块中的各组第一交易数据进行第一共识处理,得到每组第一交易数据的第一交易执行结果;
    所述处理单元,还用于对所述待共识区块中的各组第二交易数据进行不同于第一共识处理的第二共识处理,得到每组第二交易数据的第二交易执行结果;
    所述处理单元,还用于对各个第一交易执行结果和各个第二交易执行结果进行合并处理,得到交易合并执行结果。
  14. 一种计算机设备,其特征在于,包括存储器和一个或多个处理器,所述存储器存储有计算机可读指令,所述计算机可读指令被所述处理器执行时,使得所述一个或多个处理器实现如权利要求1-8或9-11任一项所述的数据处理方法。
  15. 一个或多个非易失性计算机可读存储介质,其特征在于,所述计算机可读存储介质存储有计算机可读指令,所述计算机可读指令被一个或多个处理器执行时,使所述一个或多个处理器执行如权利要求1-8或9-11任一项所述的数据处理方法。
  16. 一种计算机程序产品,包括计算机可读指令,其特征在于,该计算机可读指令被处理器执行时实现权利要求1-8或9-11中任一项所述的方法的步骤。
PCT/CN2023/101379 2022-07-07 2023-06-20 数据处理方法、装置及设备、介质、产品 WO2024007856A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US18/490,697 US20240045849A1 (en) 2022-07-07 2023-10-19 Data processing method and apparatus, device, and medium

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210797362.2A CN117408694A (zh) 2022-07-07 2022-07-07 数据处理方法、装置及设备、介质、产品
CN202210797362.2 2022-07-07

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US18/490,697 Continuation US20240045849A1 (en) 2022-07-07 2023-10-19 Data processing method and apparatus, device, and medium

Publications (1)

Publication Number Publication Date
WO2024007856A1 true WO2024007856A1 (zh) 2024-01-11

Family

ID=89454191

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/101379 WO2024007856A1 (zh) 2022-07-07 2023-06-20 数据处理方法、装置及设备、介质、产品

Country Status (3)

Country Link
US (1) US20240045849A1 (zh)
CN (1) CN117408694A (zh)
WO (1) WO2024007856A1 (zh)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190386834A1 (en) * 2017-03-03 2019-12-19 Nec Corporation Blockchain management apparatus, blockchain management method, and program
CN112381649A (zh) * 2020-11-17 2021-02-19 深圳前海微众银行股份有限公司 基于区块链的交易共识方法、装置及设备
CN113064730A (zh) * 2021-04-30 2021-07-02 支付宝(杭州)信息技术有限公司 区块链交易执行方法、区块链节点及控制装置
CN113568981A (zh) * 2021-09-24 2021-10-29 腾讯科技(深圳)有限公司 一种交易数据处理方法、装置、设备以及介质
WO2022041900A1 (zh) * 2020-08-28 2022-03-03 平安科技(深圳)有限公司 区块链的区块存储方法、装置、节点设备及存储介质

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190386834A1 (en) * 2017-03-03 2019-12-19 Nec Corporation Blockchain management apparatus, blockchain management method, and program
WO2022041900A1 (zh) * 2020-08-28 2022-03-03 平安科技(深圳)有限公司 区块链的区块存储方法、装置、节点设备及存储介质
CN112381649A (zh) * 2020-11-17 2021-02-19 深圳前海微众银行股份有限公司 基于区块链的交易共识方法、装置及设备
CN113064730A (zh) * 2021-04-30 2021-07-02 支付宝(杭州)信息技术有限公司 区块链交易执行方法、区块链节点及控制装置
CN113568981A (zh) * 2021-09-24 2021-10-29 腾讯科技(深圳)有限公司 一种交易数据处理方法、装置、设备以及介质

Also Published As

Publication number Publication date
CN117408694A (zh) 2024-01-16
US20240045849A1 (en) 2024-02-08

Similar Documents

Publication Publication Date Title
CN109034809B (zh) 区块链的生成方法、装置、区块链节点及存储介质
EP3659086B1 (en) Computer-implemented system and method for managing a large distributed memory pool in a blockchain network
KR102433285B1 (ko) 이벤트들의 삭제를 가능하게 하는 분산 데이터베이스를 위한 방법 및 장치
WO2023045620A1 (zh) 一种交易数据处理方法、装置、计算机设备以及存储介质
CN108984789B (zh) 分布式记账的方法、装置、存储介质及电子设备
US20170132257A1 (en) Methods and apparatus for a distributed database within a network
CN114944932A (zh) 将区块添加到被许可的区块链的方法和系统
WO2022242457A1 (zh) 一种交易验证方法、装置、设备及存储介质
US20230259526A1 (en) Block-chain-based data processing
WO2023045617A1 (zh) 一种交易数据处理方法、装置、设备以及介质
WO2023011019A1 (zh) 基于区块链的数据处理方法、装置、设备、可读存储介质及计算机程序产品
US20230370285A1 (en) Block-chain-based data processing method, computer device, computer-readable storage medium
CN110597922A (zh) 数据处理方法、装置、终端及存储介质
WO2023040453A1 (zh) 一种交易信息处理方法及装置
CN111241590A (zh) 一种数据库系统、节点和方法
CN115114372A (zh) 基于区块链的数据处理方法、装置、设备及可读存储介质
CN112667753B (zh) 一种挖掘实体节点路径的方法及计算机设备
WO2024007856A1 (zh) 数据处理方法、装置及设备、介质、产品
WO2023142605A1 (zh) 一种基于区块链的数据处理方法和相关装置
CN117010889A (zh) 数据处理方法、装置及设备、介质、产品
Ren et al. Improving the performance of blockchain sharding protocols with collaborative transaction verification
Li et al. CoralDB: A Collaborative Database for Data Sharing based on Permissioned Blockchain
CN110889040B (zh) 用于推送信息的方法和装置
WO2023160040A1 (zh) 基于区块链的数据处理方法、装置、设备及可读存储介质
Valkanov et al. Modelling Distributed Fault-Tolerant High Availability Storage Cluster Based on Block-Chain Concepts for Tracking Scientific-Research Progress

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 23834630

Country of ref document: EP

Kind code of ref document: A1