Transaction processing method and apparatus, device, storage medium, and program product
By obtaining the expanded filter in the blockchain node, the problem of high misjudgment rate in deduplication of blockchain transactions is solved, the accuracy of deduplication is improved, the occupation of execution node resources is reduced, and the blockchain network is enhanced. stability and efficiency.
Patent Information
- Application Number
- PCT/CN2023/090469
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2022-07-19
- Filing Date
- 2023-04-25
- Publication Date
- 2024-09-12
AI Technical Summary
In the blockchain system, existing filters have a high misjudgment rate when used to deduplicate transactions. As the number of transactions increases, the misjudgment rate will increase significantly, resulting in a decrease in deduplication accuracy and affecting system performance.
When the expansion conditions are determined in the blockchain node, the expanded filter is obtained from the node with better performance and used to replace the filter of the execution node, thereby improving the accuracy of deduplication and reducing the occupation of execution node resources.
It improves the accuracy of transaction deduplication, reduces the business impact on nodes with lower performance, avoids database pressure, and enhances the stability and efficiency of the blockchain network.
Smart Images

Figure CN2023090469_12092024_PF_FP_ABST
Abstract
Description
Transaction processing method, device, equipment, storage medium and program product
[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on July 19, 2022, with application number 202210848919.0 and application name “Transaction Processing Method, Device, Electronic Device and Computer-Readable Storage Medium”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present disclosure relates to the field of computer and Internet technology, and in particular to transaction processing. Background Art
[0003] In blockchain systems, duplicate transactions are not permitted. Duplicate transactions can lead to the "double spend" problem, meaning the same amount of money is spent twice, which is absolutely prohibited in blockchain systems. Therefore, all blockchain systems perform a deduplication process to ensure that no duplicate transactions are recorded on the blockchain.
[0004] The so-called transaction deduplication is to determine whether the transaction already exists in the ledger of the current node.
[0005] Currently, the commonly used method in the industry is to use filters (such as Bloom filters) to filter transactions. However, this filter has a disadvantage: its misjudgment rate increases as the number of transactions increases. When the number of transactions reaches a certain scale, the misjudgment rate of the filter will be very high. At this time, most transactions will be misjudged, thus defeating the purpose of the filter.
[0006] Therefore, how to improve the accuracy of deduplication filtering has become an urgent problem to be solved.
[0007] Summary of the Invention
[0008] The purpose of the present disclosure is to provide a transaction processing method, device, electronic device, computer-readable storage medium and program product, which can improve the deduplication accuracy of nodes.
[0009] Other features and advantages of the present disclosure will become apparent from the following detailed description, or may be learned in part by practice of the present disclosure.
[0010] The present disclosure provides a transaction processing method, comprising: obtaining a first block to be uploaded to the blockchain; if it is determined that the first block satisfies a first expansion condition, determining a first node for executing filter expansion among nodes of the blockchain according to the first expansion condition;
[0011] Obtaining a first expansion filter from the first node, where the capacity of the first expansion filter is greater than the capacity of the first in-process filter in the execution node, and the first expansion filter is generated by the first node based on transactions already on the blockchain; loading the transactions in the first block into the first expansion filter, and using the first expansion filter as a second in-process filter, so as to deduplicate transactions to be on the blockchain through the second in-process filter.
[0012] An embodiment of the present disclosure provides a transaction processing device, including: a first block acquisition module, a first node determination module, a first expansion filter determination module, and a first block loading module.
[0013] Among them, the first block acquisition module is used to obtain the first block to be chained in the blockchain; the first node determination module is used to determine the first node for executing filter expansion among the nodes of the blockchain according to the first expansion condition when it is determined that the first block meets the first expansion condition; the first expansion filter determination module is used to obtain a first expansion filter from the first node, the capacity of the first expansion filter is greater than the capacity of the first processing filter in the execution node, and the first expansion filter is generated by the first node based on the transactions already chained in the blockchain; the first block loading module is used to load the transactions in the first block into the first expansion filter, and use the first expansion filter as the second processing filter, so as to deduplicate and filter the transactions to be chained in the blockchain through the second processing filter.
[0014] An embodiment of the present disclosure proposes an electronic device, which includes: one or more processors; a storage device for storing one or more computer programs, and when the one or more computer programs are executed by the one or more processors, the one or more processors implement any of the transaction processing methods described above.
[0015] An embodiment of the present disclosure provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the transaction processing method as described in any one of the above items is implemented.
[0016] The embodiment of the present disclosure provides a computer program product including a computer program, which, when executed on a computer, enables the computer device to execute the transaction processing method described above.
[0017] The transaction processing method, device, electronic device and computer-readable storage medium provided by the embodiments of the present disclosure, on the one hand, can promptly expand the filter when the first block meets the expansion conditions, and continue to perform deduplication filtering based on the expanded filter to improve the deduplication accuracy of the execution node; on the other hand, the expansion filter is constructed by other nodes in the blockchain, does not occupy the resources of the execution node, and will not have any impact on the business of the execution node (such as deduplication filtering business), which not only improves the deduplication accuracy rate for those nodes with lower performance (such as fewer cores) but also does not affect the node's own business.
[0018] It should be understood that the foregoing general description and the following detailed description are exemplary only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] FIG1A is a schematic diagram of the architecture of a transaction processing system provided in an embodiment of the present application;
[0020] FIG1B is a schematic diagram of the structure of a blockchain provided in an embodiment of the present application;
[0021] FIG1C is a schematic diagram of a process for generating a new block provided by an embodiment of the present application;
[0022] FIG2 is a schematic diagram of blockchain deduplication filtering according to related art;
[0023] FIG3 is a flow chart of a deduplication filtering method according to the related art;
[0024] FIG4 is a flow chart showing a transaction processing method according to an exemplary embodiment;
[0025] FIG5 is a flow chart showing a transaction processing method according to an exemplary embodiment;
[0026] FIG6 is a schematic diagram of a filter assembly according to an exemplary embodiment;
[0027] FIG7 is a schematic diagram of a blockchain according to an exemplary embodiment;
[0028] FIG8 is a flow chart showing a transaction processing method according to an exemplary embodiment;
[0029] FIG9 is a flowchart showing a method for determining a first capacity expansion filter according to an exemplary embodiment;
[0030] FIG10 is a flow chart showing a method for determining deduplication filtering according to an exemplary embodiment;
[0031] FIG11 is a flow chart showing a transaction processing method according to an exemplary embodiment;
[0032] FIG12 is a flow chart showing a method for constructing an expansion filter according to an exemplary embodiment;
[0033] FIG13 is a schematic diagram of a filter assembly according to an exemplary embodiment;
[0034] FIG14 is a flow chart showing a method for constructing an expansion filter according to an exemplary embodiment;
[0035] FIG15 is a schematic diagram of a filter assembly according to an exemplary embodiment;
[0036] FIG16 is a schematic diagram of a filter assembly according to an exemplary embodiment;
[0037] FIG17 is a flow chart showing a method for modifying expansion conditions according to an exemplary embodiment;
[0038] FIG18 is a schematic diagram showing a deduplication filtering method according to an exemplary embodiment;
[0039] FIG19 is a schematic diagram showing a deduplication filtering method according to an exemplary embodiment;
[0040] FIG20 is a flow chart showing a method for reloading a filter according to an exemplary embodiment;
[0041] FIG21 is a block diagram of a transaction processing device according to an exemplary embodiment;
[0042] FIG22 shows a schematic structural diagram of an electronic device suitable for implementing the embodiments of the present disclosure. DETAILED DESCRIPTION
[0043] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be embodied in many forms and should not be construed as limited to the embodiments set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete and will fully convey the concepts of the example embodiments to those skilled in the art. Like reference numerals in the drawings represent like or similar parts, and thus repetitive description thereof will be omitted.
[0044] The features, structures or characteristics described in the present disclosure may be combined in any suitable manner in one or more embodiments. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced while omitting one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known methods, devices, implementations or operations are not shown or described in detail to avoid obscuring various aspects of the present disclosure.
[0045] The accompanying drawings are merely schematic illustrations of the present disclosure. Identical reference numerals in the drawings denote identical or similar parts, and thus their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings do not necessarily correspond to physically or logically independent entities. These functional entities may be implemented in software, in one or more hardware modules or integrated circuits, or in a combination of at least one of different networks, processor devices, and microcontroller devices.
[0046] The flowcharts shown in the accompanying drawings are for illustrative purposes only and do not necessarily include all content and steps, nor must they be executed in the order described. For example, some steps may be decomposed, while others may be combined or partially combined. Therefore, the actual execution order may vary depending on the actual situation.
[0047] In the description of this application, unless otherwise specified, " / " means "or", for example, A / B can mean A or B. "And / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, "at least one" means one or more, and "a plurality" means two or more. The words "first", "second", etc. do not limit the quantity and execution order, and the words "first", "second", etc. do not limit them to be different; the terms "comprising", "including" and "having" are used to express open-ended inclusion and mean that in addition to the listed elements / components / etc., there may be other elements / components / etc.
[0048] In order to more clearly understand the above-mentioned purposes, features and advantages of the present application, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods. It should be noted that, unless there is a conflict, the embodiments of the present application and the features in the embodiments can be combined with each other.
[0049] In response to the problem of low deduplication accuracy of filters in current blockchains, an embodiment of the present application provides a transaction processing method that can promptly obtain expanded filters from other nodes when the first block meets the expansion conditions, so as to improve the deduplication accuracy of the filters while reducing the resources (memory resources or disk resources) occupied by the execution nodes.
[0050] Please refer to Figure 1A, which is a schematic diagram of the architecture of a transaction processing system provided by an embodiment of the present application. The transaction processing system includes a blockchain network 10 and a terminal device 20, wherein: the blockchain network 10 refers to a network for sharing data between nodes, and the blockchain network may include multiple nodes 101. Each node 101 can receive input information when performing normal work, and maintain the shared data (i.e., blockchain) within the blockchain network based on the received input information. In order to ensure information intercommunication within the blockchain network, an information connection can exist between each node, and peer-to-peer (P2P) communication can be achieved between any two nodes. Specifically, P2P communication can be performed through a wired communication link or a wireless communication link. For example, when any node in the blockchain network receives input information, other nodes 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 network are consistent.
[0051] The terminal device 20 can access the blockchain network and communicate with nodes in the blockchain network, for example, submitting transactions to be uploaded to the node, obtaining data from the node, etc. The terminal device 20 can specifically be a smartphone, tablet computer, laptop computer, desktop computer, in-vehicle smart terminal, etc., and the embodiments of the present application are not limited thereto.
[0052] It should be noted that the number of nodes shown in FIG1A is merely illustrative, and any number of nodes may be used.
[0053] Each node in a blockchain network has a corresponding node identifier, and each node in the blockchain network can store the node identifiers of other nodes in the blockchain network so that the generated blocks can be broadcast to other nodes in the blockchain network based on the node identifiers of other nodes. Each node can maintain a node identifier list as shown in the table below, and store the node name and node identifier in the node identifier list. The node identifier can be an Internet Protocol (IP) address or any other information that can be used to identify the node, such as an IP address.
[0054] Table 1
[0055] Each node in the blockchain network stores an identical blockchain. A blockchain can be composed of multiple blocks, as needed. See Figure 1B. A blockchain consists of multiple blocks. The genesis block includes a block header and a block body. The block header stores input information features, a version number, a timestamp, and a difficulty value, while the block body stores input information. The next block of the genesis block uses the genesis block as its parent block. The next block also includes a block header and a block body. The block header stores the input information features of the current block, the block header features, version number, timestamp, and difficulty value of the parent block, and so on. This ensures that the block data stored in each block in the blockchain is associated with the block data stored in the parent block, ensuring the security of the input information in the block.
[0056] When generating each block in the blockchain, as shown in FIG1C , the node in the blockchain verifies the input information upon receiving it. After verification, the node stores the input information in the memory pool and updates the hash tree used to record the input information. The node then updates the update timestamp to the time the input information was received, tries different random numbers, and calculates the eigenvalue multiple times so that the calculated eigenvalue satisfies the following formula:
[0057] SHA256(SHA256(version+prev_hash+merkle_root+ntime+nbits+x)) <TARGET。
[0058] Among them, SHA256 is the eigenvalue algorithm used to calculate the eigenvalue; version (version number) is the version information of the relevant block protocol in the blockchain; prev_hash is the block header eigenvalue of the parent block of the current block; merkle_root is the eigenvalue of the input information; ntime is the update time of the update timestamp; nbits is the current difficulty, which is a fixed value within a period of time and is determined again after exceeding the fixed time period; x is a random number; TARGET is the eigenvalue threshold, which can be determined based on nbits.
[0059] Once a random number that satisfies the above formula is calculated, the information can be stored accordingly, generating a block header and block body, resulting in the current block. Subsequently, the blockchain node sends the newly generated block to other nodes in the blockchain network based on their node identifiers. These other nodes then verify the newly generated block and, upon completion, add it to their stored blockchain.
[0060] Among them, smart contracts can be run on the nodes of the blockchain network. Smart contracts are code implementations that are executed when certain conditions are met. Developers can define the contract logic through programming languages and publish it to the blockchain (smart contract registration). According to the logic of the contract terms, they call keys or other events to trigger execution and complete the contract logic. At the same time, it also provides the function of upgrading and canceling smart contracts.
[0061] In some feasible implementations, a node 101 of the blockchain network can obtain summary information of the target transaction when receiving the target transaction submitted by the terminal device 20, and use N Bloom filters to query the summary information of the target transaction from the summary information corresponding to the processed transactions, where N is an integer greater than or equal to 1. If the summary information of the target transaction is queried, the target transaction is determined to be a processed transaction, and the target transaction is refused to be added to the transaction pool. The Bloom filter can be used to efficiently and accurately check whether the submitted transaction has already appeared in the ledger, thereby effectively avoiding duplicate transactions.
[0062] FIG2 is a schematic diagram of blockchain deduplication filtering according to related art.
[0063] As shown in Figure 2, the core of the blockchain deduplication filtering process in the relevant technology is to first use a filter (such as a Bloom filter or a cuckoo filter) to perform duplicate judgment on the transactions in the transaction pool. If it is determined that the transaction exists, a second judgment is performed through the database. The detailed processing flow is shown in Figure 3.
[0064] FIG3 is a flow chart showing a deduplication filtering method according to related art.
[0065] 3 , the above-mentioned deduplication filtering method may include the following steps.
[0066] S302, obtaining a transaction object.
[0067] S304, obtain the TxID (transaction unique key) in the transaction.
[0068] S306: Call the filtering component to perform transaction deduplication determination.
[0069] S308: Deduplication of transaction objects is performed using filters in the filtering component.
[0070] When the filter determines that the transaction object does not exist, S310 is executed to put the transaction object into the transaction pool.
[0071] When the filter determines that the transaction object exists, S312 is executed to perform deduplication determination on the transaction object through the ledger database of the blockchain.
[0072] The above-mentioned ledger database may refer to the ledger data on the blockchain.
[0073] When the account database determines that the transaction object does not exist, S310 is executed.
[0074] When the account database determines that the transaction object does not exist, S314 is executed to discard the transaction object.
[0075] Currently, the common method in the industry is to use filters combined with databases for filtering. However, this filter can have false positives when determining duplicate transactions. That is, if the filter determines that a transaction does not exist (negative), then it definitely does not exist. However, if the filter determines that a transaction does exist (positive), then it may or may not exist, requiring further evaluation (database evaluation).
[0076] Therefore, the filter itself has a disadvantage. As the number of transactions increases, the misjudgment rate of the filter will become higher and higher. When the number of transactions reaches a certain scale, the misjudgment rate of the filter will be very high. At this time, most transactions will be judged as positive, which defeats the purpose of the filter. In other words, it will lead to judgment breakdown and direct access to the database, which will cause huge pressure on the database.
[0077] To address the aforementioned technical issues, within the system architecture illustrated in Figures 1A to 1C, a transaction processing method is provided in the disclosed embodiments. This method can be executed by any node in any blockchain. The node serving as the execution subject can be any electronic device with computing and processing capabilities. For ease of explanation, in this embodiment, this node is referred to as the execution node. This execution node, along with the first and second nodes mentioned later, are all nodes in the same blockchain.
[0078] Fig. 4 is a flow chart showing a transaction processing method according to an exemplary embodiment.
[0079] 4 , the transaction processing method provided by the embodiment of the present disclosure may include the following steps.
[0080] S402: Obtain the first block to be uploaded to the blockchain.
[0081] The first block may be a block from the transaction pool of the execution node but not yet on the chain.
[0082] S404: When it is determined that the first block meets the first expansion condition, a first node for executing filter expansion is determined among the nodes of the blockchain according to the first expansion condition.
[0083] The first expansion condition may include the number of blocks or transactions set according to actual needs. For example, the number of blocks or transactions set according to the capacity of the filter may be set, and this disclosure does not impose any restrictions on this. It is understood that the larger the capacity of the filter, the greater the number of blocks set in the first expansion condition (i.e., under the same error rate, a filter with a larger capacity can process a greater number of transactions (or blocks)).
[0084] The first capacity expansion condition may specifically be: when the number of blocks in the blockchain exceeds a target block number threshold (or the number of transactions exceeds a target transaction number), capacity expansion is performed according to the target capacity. Those skilled in the art may set the target block number threshold, target transaction number, or target capacity based on actual needs, and this disclosure does not impose any limitations thereon.
[0085] S406: Obtain a first expansion filter from the first node.
[0086] The capacity of the first expansion filter is greater than the capacity of the first processing filter in the execution node, and the first expansion filter is generated by the first node based on the transactions that have been uploaded to the blockchain.
[0087] The first expansion filter or the filter in the first processing may be any filter that can perform deduplication filtering, such as a Bloom filter or a Cuckoo filter, and the present disclosure does not impose any limitation on this.
[0088] A Bloom filter is a data structure that determines whether a value exists. While this structure uses minimal memory, it can have a certain false positive rate, which increases as the amount of data in the Bloom filter increases. A Bloom filter can produce false positives: if a value is determined to be nonexistent, it is definitely not, and if it is determined to be present, it is not necessarily.
[0089] In some embodiments, the filter in the first process may be executed in the memory of the execution node, but the present disclosure is not limited thereto.
[0090] The first expansion filter can be generated by nodes with better performance (e.g., more cores, more memory, or more disk space) within the blockchain. The blockchain can determine which nodes construct the first expansion filter based on the performance of each node. In short, nodes with better performance can construct more expansion filters, while nodes with poor performance may not construct any expansion filters at all, thereby minimizing the impact of expansion filters on node operations.
[0091] S408: Load the transactions in the first block into the first expansion filter, and use the first expansion filter as the second processing filter, so as to perform deduplication filtering on the transactions to be uploaded to the blockchain through the second processing filter.
[0092] In some embodiments, the transactions in the first block can be hashed using multiple hash algorithms, and the calculation results are then loaded into the first expansion filter.
[0093] In some embodiments, the first expansion filter may be a Bloom filter. The core implementation of a Bloom filter consists of a very large bit array and several hash functions. In some embodiments, it can be assumed that the length of the bit array is m, the number of hash functions is k, where m is an integer greater than 1, and k is an integer greater than 1.
[0094] In some embodiments, the following example illustrates how transactions in the first block are loaded into the first expansion filter: First, the bit array corresponding to the first expansion filter is initialized, with each bit set to 0. For each transaction in the first block, the transaction is sequentially mapped through k hash functions. Each mapping generates a hash value corresponding to a point in the bit array, and the corresponding position in the bit array is then marked as 1.
[0095] In some embodiments, to query whether element W exists in the expanded filter, the same method is used to hash W to k points in the bit array. If any of the k points is not 1, it can be determined that the element is definitely not in the set. Conversely, if all k points are 1, the element is likely to exist in the set.
[0096] In some embodiments, the execution node may use the first expansion filter to replace the original first processing filter, so that the execution node dedupes the transactions to be uploaded to the blockchain through the first expansion filter.
[0097] In some embodiments, if the first expansion filter is not obtained from the first node, transactions already on the blockchain can be obtained; then the first expansion filter is constructed based on the transactions already on the blockchain, and the first expansion filter is used as the second processing filter to deduplicate transactions to be on the blockchain through the second processing filter.
[0098] The technical solution provided by this embodiment is that when the first block meets the first expansion condition (for example, the error rate of the filter in the first processing reaches a certain threshold), an expanded filter is obtained from the first node of the blockchain as the processing filter of the execution node to perform deduplication filtering on subsequent transactions on the chain. Through the above method, on the one hand, the execution node can timely expand the filter when the first block meets the expansion condition, and continuing to perform deduplication filtering based on the expanded filter can improve the deduplication accuracy of the execution node; on the other hand, the expansion filter is constructed by other nodes in the blockchain, does not occupy the resources of the execution node, and will not have any impact on the business of the execution node (such as deduplication filtering business). This improves the deduplication accuracy for those nodes with lower performance (such as fewer cores) without affecting the node's own business.
[0099] Fig. 5 is a flow chart showing a transaction processing method according to an exemplary embodiment.
[0100] 5 , the transaction processing method may include the following steps.
[0101] S502: Obtain the first block to be uploaded to the blockchain.
[0102] S504: When it is determined that the first block meets the first expansion condition, a first node for executing filter expansion is determined among the nodes of the blockchain according to the first expansion condition.
[0103] S506: Obtain a first expansion filter from the first node.
[0104] The capacity of the first expansion filter is greater than the capacity of the first processing filter in the execution node, and the first expansion filter is generated by the first node based on the transactions that have been uploaded to the blockchain.
[0105] S508 : When it is determined that the first block meets the first expansion condition, obtain a first processing filter from the memory of the execution node.
[0106] In some embodiments, the execution node can obtain the first in-process filter from a filtering component running in memory. As shown in Figure 6, the filtering component in the execution node's memory can include a in-process filter (e.g., the first in-process filter) and a ledger database. The in-process filter is generated based on transactions from block 0 to the currently on-chain block, and the ledger database can be generated based on transactions already on the blockchain.
[0107] Among them, the processing filter (such as the first processing filter) may refer to a Bloom filter that is currently performing deduplication filtering on transactions, and the Bloom filter will change as transactions are written to the ledger; the ledger database is a database that stores ledgers on a local node.
[0108] In some embodiments, when the first block meets the first expansion condition, it can be considered that the error rate of the filter in the first process has reached a certain threshold and it is not suitable to continue the deduplication filtering operation.
[0109] S510, reaching consensus on the filters in the first process.
[0110] In some embodiments, if it is determined that the first block meets the first expansion condition (or the error rate of the first processing filter of the execution node reaches a certain threshold, and then it is determined that the first processing filter is not suitable for continuing to load transactions), the first processing filter is consensus-based in the blockchain.
[0111] S512: After consensus is reached, the first filter in process is stored in the first block.
[0112] In some embodiments, the first-processing filter can be stored on the chain by the following method: the execution node initiates a transaction in the blockchain to put the first-processing filter on the chain; multiple consensus nodes in the blockchain (the consensus node is a node in the blockchain) perform consensus processing on the first-processing filter (for example, determining whether the first-processing filter uploaded by the execution node is consistent with the first-processing filter generated by itself, and if they are consistent, the consensus is passed); when the number of consensus nodes that pass the consensus exceeds the target threshold, it is considered that the consensus of the first-processing filter has passed; if the consensus of the first-processing filter has passed in the blockchain, the first-processing filter is stored in the block body of the first block in the transaction pool; finally, the first block in the transaction pool is put on the chain in the blockchain.
[0113] In some embodiments, the filters in the first process and the filters in the second process can be put on the chain for consensus in an appropriate manner for traceability, increasing the cost of malicious behavior of nodes or clients and reducing malicious behavior of nodes or clients.
[0114] In the above embodiment, when the first block meets the first expansion condition, the first processing filter can be consensus-uploaded to the chain and stored in the first block for subsequent tracing, thereby increasing the cost of node maliciousness (malicious refusal to chain or malicious chaining), and improving the authenticity and reliability of the blockchain chain data.
[0115] FIG7 is a schematic diagram of a blockchain according to an exemplary embodiment.
[0116] As shown in FIG7 , some blocks in the blockchain (such as the 99th block, the 199th block, the 299th block, etc.) can store filters so as to trace the malicious behavior when it is found that a node or client is doing malicious things.
[0117] S514: Load the transactions in the first block into the first expansion filter, and use the first expansion filter as the second processing filter, so as to perform deduplication filtering on the transactions to be uploaded to the blockchain through the second processing filter.
[0118] The technical solution proposed in this embodiment can, on the one hand, speed up the filter loading process at startup by storing the first processing filter in the block; on the other hand, it can trace malicious behavior to increase the cost of node malicious behavior, thereby avoiding node malicious behavior.
[0119] Fig. 8 is a flow chart showing a transaction processing method according to an exemplary embodiment.
[0120] 8 , the transaction processing method may include the following steps.
[0121] S802: Obtain the first block to be uploaded to the blockchain.
[0122] S804: When it is determined that the first block meets the first expansion condition, a first node for executing filter expansion is determined among the nodes of the blockchain according to the first expansion condition.
[0123] S806: Obtain a first expansion filter from the first node.
[0124] The capacity of the first expansion filter is greater than the capacity of the first processing filter in the execution node, and the first expansion filter is generated by the first node based on the transactions that have been uploaded to the blockchain.
[0125] S808: Load the transactions in the first block into the first expansion filter, and use the first expansion filter as the second processing filter, so as to perform deduplication filtering on the transactions to be uploaded to the blockchain through the second processing filter.
[0126] S810 : When it is determined that the first block does not meet the first expansion condition, obtain a first processing filter from a memory of an execution node.
[0127] S812: Load the transactions in the first block into the first processing filter, so as to perform deduplication filtering on the transactions to be uploaded to the blockchain through the first processing filter.
[0128] The technical solution provided in this embodiment continues to load the first block into the in-process filter of the execution node when the first block does not meet the first expansion condition (i.e., the error rate of the first in-process filter does not reach a certain threshold). Through this method, deduplication filtering can be directly performed when the locally stored first in-process filter meets the deduplication filtering conditions, eliminating the need to obtain new filters from other nodes, reducing the number of blockchain data interactions and improving the blockchain's on-chain efficiency.
[0129] In some embodiments, the plurality of nodes of the blockchain may include a first node. The first node may be a node in the blockchain with good device performance (such as a large number of cores, large memory, large disk, or strong computing power).
[0130] In some embodiments, the first node may be one or more nodes. In some embodiments, the first node may include a first execution node and a second execution node.
[0131] The following uses the first and second execution nodes as examples to explain how to obtain the first expansion filter from the first node. It is understood that the first node may also include a third, fourth, and so on. Those skilled in the art can easily extend the technical solutions provided in the following embodiments to also include third, fourth, and so on.
[0132] Fig. 9 is a flowchart showing a method for determining a first capacity expansion filter according to an exemplary embodiment.
[0133] 9 , the above-mentioned first capacity expansion filter determination method may include the following steps.
[0134] S902: Obtain a first target expansion filter from a first execution node.
[0135] S904: Perform a security check on the first target expansion filter.
[0136] In order to determine whether the first target expansion filter constructed by the first execution node is correct, a security check may be performed on the first target expansion filter provided by the first execution node.
[0137] In some embodiments, the first target expansion filter may be security-checked by the following method: constructing a candidate expansion filter based on transactions already on the blockchain, where the capacity of the candidate expansion filter is equal to the capacity of the first target expansion filter; and performing a security check on the first target expansion filter based on the candidate expansion filter.
[0138] In some embodiments, the first target expansion filter may be security-checked by the following method: obtaining at least one on-chain transaction from a blockchain; randomly constructing at least one virtual transaction; and performing security-checking on the first target expansion filter based on the at least one on-chain transaction and the at least one virtual transaction.
[0139] S906: If it is determined that the first target capacity expansion filter passes the security check, use the first target capacity expansion filter as the first capacity expansion filter.
[0140] In some embodiments, if the first capacity expansion filter passes the security check, the first capacity expansion filter may be directly used as the first capacity expansion filter.
[0141] S908 : When it is determined that the first target capacity expansion filter fails the security check, obtain a second target capacity expansion filter from the second execution node.
[0142] S910: Perform a security check on the second target expansion filter.
[0143] S912: If it is determined that the second target capacity expansion filter passes the security check, use the second target capacity expansion filter as the first capacity expansion filter.
[0144] Of course, if the first node has a third execution node and a fourth execution node, the expansion filter can be further obtained from the third execution node or the fourth execution node to obtain the first expansion filter.
[0145] S914: If it is determined that the second target expansion filter fails the security check, a candidate expansion filter is constructed based on transactions already on the blockchain. The capacity of the candidate expansion filter is equal to the capacity of the first target expansion filter.
[0146] S916: Use the candidate expansion filter as the first expansion filter.
[0147] In the above embodiment, on the one hand, security detection can be used to determine that the obtained first expansion filter has not been maliciously tampered with and is authentic and valid, thereby improving the accuracy of deduplication filtering; on the other hand, the first expansion filter can be obtained from multiple first nodes, which not only improves the authenticity of the first expansion filter, but also avoids problems such as low deduplication filtering efficiency caused by the execution node constructing the first expansion filter itself.
[0148] In other embodiments, the first node may include multiple execution nodes. The first expansion filter can be consensus-based among the multiple execution nodes and then sent to the execution node after consensus is reached (if consensus is not reached, it will not be sent to the execution node). After receiving the first expansion filter that has been consensus-based by the multiple execution nodes, the execution node will perform a security check on the received first expansion filter. After the security check passes, the first expansion filter will be used as a processing filter to deduplicate transactions on the blockchain. This solution can ensure that the first expansion filter records only all transactions that have been on the blockchain, prevent the first node from acting maliciously, and thus improve the effectiveness of deduplication filtering of blockchain data.
[0149] Fig. 10 is a flowchart showing a method for determining deduplication filtering according to an exemplary embodiment.
[0150] 10 , the above-mentioned deduplication filtering method may include the following steps.
[0151] S1002, obtaining the first transaction.
[0152] The first transaction includes a first transaction identifier.
[0153] The first transaction identifier may be Tx01, Tx02, Tx03, etc. in the block in FIG. 7 , and the present disclosure does not impose any limitation on this.
[0154] S1004: Perform deduplication filtering on the first transaction identifier through the filter in the second process.
[0155] In some embodiments, before deduplicating the first transaction identifier through the second in-process filter, the first transaction identifier needs to be deduplicated through the transaction pool of the execution node. If the transaction pool of the execution node determines that the first transaction identifier exists, the first transaction is discarded; if the transaction pool of the execution node determines that the first transaction does not exist, the first transaction identifier continues to be deduplicated through the second in-process filter.
[0156] S1006: In the second process, if the filter determines that the first transaction identifier does not exist on the blockchain, the first transaction is added to the transaction pool of the blockchain.
[0157] S1008, when the filter determines in the second process that the first transaction identifier exists on the blockchain, deduplication determination is performed on the first transaction identifier through the blockchain ledger database.
[0158] S1010: When it is determined through the ledger database that the first transaction identifier does not exist on the blockchain, the first transaction identifier is added to the transaction pool of the blockchain.
[0159] S1012: When it is determined through the ledger database that the first transaction identifier exists on the blockchain, the first transaction is discarded.
[0160] The technical solution provided in this embodiment, when the second processing filter determines that the first transaction identifier exists, will further deduplicate the first transaction identifier through the account database, thereby improving the accuracy of deduplication filtering in the execution node.
[0161] Fig. 11 is a flow chart showing a transaction processing method according to an exemplary embodiment.
[0162] 11 , the transaction processing method may include the following steps.
[0163] S1102, obtaining the first block to be uploaded to the blockchain.
[0164] S1104: When it is determined that the first block meets the first expansion condition, a first node for executing filter expansion is determined among the nodes of the blockchain according to the first expansion condition.
[0165] S1106: Obtain a first expansion filter from the first node.
[0166] The capacity of the first expansion filter is greater than the capacity of the first processing filter in the execution node, and the first expansion filter is generated by the first node based on the transactions that have been uploaded to the blockchain.
[0167] S1108: Load the transactions in the first block into the first expansion filter, and use the first expansion filter as the second processing filter, so as to perform deduplication filtering on the transactions to be uploaded to the blockchain through the second processing filter.
[0168] S1110, obtaining the second block to be uploaded to the chain.
[0169] S1112: When it is determined that the second block meets the second expansion condition, consensus is reached on the second processed filter and the filter is stored in the second block after the consensus is passed. The first expansion condition and the second expansion condition are different.
[0170] S1114: Determine a second node for executing filter expansion among the nodes of the blockchain according to the second expansion condition.
[0171] The second expansion condition may be the number of blocks or transactions set according to actual needs. For example, the number of blocks or transactions may be set based on the capacity of the filter, and this disclosure does not impose any restrictions on this. It is understood that the larger the capacity of the filter, the greater the number of blocks set in the second expansion condition (i.e., under the same error rate, a filter with a larger capacity can process larger transactions (or blocks)).
[0172] The first and second expansion conditions may be different, with the number of blocks and transactions set in the second expansion condition being greater than the number of blocks and transactions set in the first expansion condition. Furthermore, the capacity of the filter corresponding to the second expansion condition is also greater than the capacity of the filter corresponding to the first expansion condition.
[0173] S1116: Obtain a second capacity expansion filter from the second node. The capacity of the second capacity expansion filter is greater than that of the first capacity expansion filter.
[0174] The second expansion filter is generated by the second node based on transactions already on the blockchain, where the transactions already on the blockchain include transactions in the first block.
[0175] S1118, loading the transactions in the second block into the second expansion filter, and using the second expansion filter as the third processing filter, so as to perform deduplication filtering on the transactions to be uploaded to the blockchain through the third processing filter.
[0176] The improved technical solution of this embodiment can promptly expand the filter in the second process to improve the accuracy of the filter when the error rate of the filter in the second process is greater than a certain threshold (or the number of blocks or transactions in the blockchain is greater than a certain threshold).
[0177] In some embodiments, the first node that constructs the first expansion filter according to the first expansion condition may be the execution node in the present disclosure. That is, the first node constructs and uses the filter in the first process while executing the first expansion filter construction.
[0178] FIG12 is a flowchart showing a method for constructing an expansion filter according to an exemplary embodiment.
[0179] 12 , the above-mentioned method for constructing an expansion filter may include the following steps.
[0180] S1202: Obtain the third block to be uploaded to the chain.
[0181] Among them, the first node can be a node with better performance and more computing resources in the blockchain.
[0182] It is conceivable that the first expansion filter can be built in the background of the node with better performance and more computing resources in the blockchain. This will not affect the business in the first node, nor will the construction of the first expansion filter affect the business in other nodes.
[0183] S1204: If it is determined that the third block does not meet the first expansion condition, load the third block into the first processing filter.
[0184] S1206 , loading the third block into the first expansion filter, so that the first node constructs the first expansion filter while constructing the first processing filter.
[0185] As shown in Figure 13, the first node not only builds the filter in the first process but also builds the first expansion filter in the background (i.e., in memory). This completion of the first expansion filter construction does not affect the business (such as the efficiency and accuracy of business execution) of the node in the blockchain.
[0186] In some embodiments, the second node that constructs the second expansion filter according to the second expansion condition may be the execution node in the present disclosure. That is, the second node constructs and uses the filter in the second process while executing the second expansion filter construction.
[0187] FIG14 is a flowchart showing a method for constructing an expansion filter according to an exemplary embodiment.
[0188] 14 , the above-mentioned method for constructing an expansion filter may include the following steps.
[0189] S1402: Obtain the fourth block to be uploaded to the chain.
[0190] S1404 : When it is determined that the fourth block meets the first expansion condition but does not meet the second expansion condition, the fourth block is loaded into the second processing filter.
[0191] S1406 , loading the fourth block into the second expanded filter, so as to construct the second expanded filter while constructing the second in-process filter.
[0192] As shown in Figure 15, the second node not only executes the filter construction in the first process but also builds the second expansion filter in the background (i.e., in memory). This second expansion filter construction is completed without affecting the business (such as the execution efficiency and accuracy) of the node in the blockchain.
[0193] In other embodiments, some nodes, due to their high computing resources, not only execute the construction of the filter in the first process but also construct the first expansion filter and the second expansion filter in the background (i.e., in memory) (as shown in FIG16 ). Therefore, the first node and the second node can be the same node, and this disclosure does not impose any limitation on this.
[0194] FIG17 is a flowchart showing a method for modifying expansion conditions according to an exemplary embodiment.
[0195] 17 , the above-mentioned expansion condition modification method may include the following steps.
[0196] S1702: Obtain the actual error rate of the filter in the first process.
[0197] In some embodiments, the actual error rate of the filter in the first process can be determined based on the blocks or transactions that have been uploaded to the blockchain. The present disclosure does not limit the method for determining the above-mentioned actual error rate, and those skilled in the art can determine it according to actual needs.
[0198] S1704: Determine whether the actual error rate of the filter in the first process is lower than the target error rate.
[0199] In some embodiments, those skilled in the art may pre-set a target error rate, where the target error rate corresponds to the first capacity expansion condition.
[0200] In some embodiments, when it is determined that the actual error rate of the filter in the first process when the Nth block is chained is lower than the target error rate or higher than the target error rate, the first expansion condition can be modified, where N is a positive integer greater than 1.
[0201] For example, when setting the first expansion condition, it is assumed that the target error rate of the filter in the first process will reach a certain threshold when the Mth block is put on the chain, and the expansion should be performed before the first process is filtered on the Kth block. However, in actual operation, it is found that when the Mth block is put on the chain, the target error rate of the filter in the first process is much smaller than the target error rate. In this case, it can be considered that the filter in the first process can still be used and there is no need to expand the capacity in a hurry. In this case, the first expansion condition needs to be modified. Alternatively, in actual operation, it is found that when the Mth block is put on the chain, the target error rate of the filter in the first process is greater than the target error rate. In this case, it can be considered that the filter in the first process may not be able to continue to be used and needs to be expanded in time. In this case, the first expansion condition also needs to be modified.
[0202] S1706: Generate a second transaction based on the actual error rate.
[0203] S1708: Submit the second transaction to the blockchain so that the blockchain reaches a consensus on the second transaction.
[0204] S1710: After consensus is reached, modify the first expansion condition based on the content of the second transaction.
[0205] The technical solution provided in this embodiment can modify the first expansion condition by on-chain transaction, and can facilitate modification of the first expansion condition according to the actual error rate of the filter in the first processing, which is flexible and effective.
[0206] FIG18 is a schematic diagram showing a deduplication filtering method according to an exemplary embodiment.
[0207] 18 , the above-mentioned deduplication filtering method may include the following steps.
[0208] S1802, obtain the transaction object.
[0209] S1804, obtain the TxID (transaction unique key) in the transaction.
[0210] S1806: Call the filtering component to perform transaction deduplication determination.
[0211] S1808, obtaining the Bloom filter in processing.
[0212] S1810, lock the bloom filter in process.
[0213] S1812: Use Bloom filter to verify the deduplication of transactions.
[0214] S1814: Unlock the Bloom filter.
[0215] While S1814 is being executed, S1816 is executed to summarize the Bloom filter judgment results in the process.
[0216] If the transaction object exists in the summary result, execute S1818 to determine the transaction object through the account database.
[0217] If the transaction object does not exist in the summary result, S1820 is executed to add the transaction object to the transaction pool.
[0218] S1822, discarding ends.
[0219] The technical solution provided in this embodiment can accurately deduplicate transactions to be uploaded to the blockchain.
[0220] FIG19 is a schematic diagram showing a deduplication filtering method according to an exemplary embodiment.
[0221] 19 , the above-mentioned deduplication filtering method may include the following steps.
[0222] S1902, obtain the first block.
[0223] S1904: Determine whether the first block meets the target expansion condition.
[0224] If it is determined that the first block does not meet the target expansion condition, S1906 is executed to obtain the filter being processed from the memory.
[0225] S1908: Load the first block into the processing filter.
[0226] If it is determined that the first block meets the target expansion condition, S1910 is executed to obtain the processing filter from the memory, and the first block is stored in the processing filter after consensus is reached.
[0227] S1912, determining an expansion node in the target blockchain for performing filter expansion according to the target expansion condition.
[0228] S1914: Obtain the post-expansion filter from the expansion node.
[0229] S1916: The expanded filter is used as the processing filter.
[0230] S1918, loading the first block into the processing filter.
[0231] In the above embodiment, when the first block meets the first expansion condition (i.e., the error rate of the filter in processing reaches a certain threshold), an expanded filter is obtained from the first node of the blockchain as the filter in processing of the execution node to perform deduplication filtering on the subsequent transactions on the chain. Through the above method, on the one hand, the execution node can timely expand the filter when the first block meets the expansion condition, and continuing to perform deduplication filtering based on the expanded filter can improve the deduplication accuracy of the execution node; on the other hand, the expansion filter is constructed by other nodes in the blockchain, does not occupy the resources of the execution node, and will not have any impact on the business of the execution node (such as deduplication filtering business). For those nodes with lower performance (such as fewer cores), this improves the deduplication accuracy without affecting the node's own business; in addition, by storing the filter on the chain, malicious behavior can be traced to increase the cost of node malicious behavior, thereby reducing node malicious behavior.
[0232] Fig. 20 is a flow chart showing a method for reloading a filter according to an exemplary embodiment.
[0233] This embodiment provides a method for reloading a filter on a node.
[0234] 20 , the above-mentioned method of reloading a filter may include the following steps.
[0235] S2002, obtain the latest block LastestBlock of the target blockchain, load the filter stored therein, and set it to LBF.
[0236] S2004, determine whether LBF is empty.
[0237] If LBF is not empty, execute S2006 to obtain a filter from the latest block LastestBlock and use the filter as the filter in processing NBF.
[0238] S2008: Add the filter being processed to the filter component in the memory so that the on-chain transactions can be deduplicated through the filter component.
[0239] When the LBF is empty, S2010 is executed to create a blank Bloom filter (NBF).
[0240] S2012, set BC = LatestBlock.
[0241] S2014, traverses the transactions in BC and loads them into NBF after calculation.
[0242] S2016, set BC=BC-1.
[0243] S2018, determine whether BC is the 0th block.
[0244] When BC is the 0th block, execute S2020, traverse the transactions in BC, and load them into NBF after calculation.
[0245] When BC is not the 0th block, S2022 is executed in a loop to add NBF to the in-memory filtering component so that the on-chain transactions can be deduplicated through the filtering component.
[0246] After the above steps, the node can load the filter into memory (filter component) after startup.
[0247] Based on the same inventive concept, the present disclosure also provides a transaction processing device, such as the following embodiment. Since the principle of solving the problem in the device embodiment is similar to that in the above method embodiment, the implementation of the device embodiment can refer to the implementation of the above method embodiment, and the repeated parts will not be repeated.
[0248] Figure 21 is a block diagram of a transaction processing device according to an exemplary embodiment. Referring to Figure 21 , the transaction processing device 2100 provided in this embodiment may include: a first block acquisition module 2101, a first node determination module 2102, a first expansion filter determination module 2103, and a first block loading module 2104. The transaction processing device 2100 may be an execution node on a blockchain.
[0249] Among them, the first block acquisition module 2101 can be used to obtain the first block to be chained in the blockchain; the first node determination module 2102 can be used to determine the first node for executing filter expansion in the nodes of the blockchain according to the first expansion condition when it is determined that the first block meets the first expansion condition; the first expansion filter determination module 2103 can be used to obtain the first expansion filter from the first node, the capacity of the first expansion filter is greater than the capacity of the first processing filter in the execution node, and the first expansion filter is generated by the first node based on the transactions that have been chained in the blockchain; the first block loading module 2104 can be used to load the transactions in the first block into the first expansion filter, and use the first expansion filter as the second processing filter, so as to deduplicate and filter the transactions to be chained in the blockchain through the second processing filter.
[0250] It should be noted that the aforementioned first block acquisition module 2101, first node determination module 2102, first expansion filter determination module 2103, and first block loading module 210 correspond to S402 to S408 in the method embodiment. The examples and application scenarios implemented by these modules and corresponding steps are the same, but are not limited to the contents disclosed in the aforementioned method embodiment. It should be noted that these modules, as part of the apparatus, can be executed in a computer system, such as a set of computer-executable instructions.
[0251] In some embodiments, the transaction processing further includes: a filter acquisition module, a consensus module, and a storage module in the first process.
[0252] Among them, the first processing filter acquisition module can be used to obtain the first processing filter from the memory of the execution node before using the first expansion filter as the second processing filter; the consensus module can be used to reach a consensus on the first processing filter when it is determined that the first block meets the first expansion condition; the storage module can be used to store the first processing filter in the first block after the consensus is passed.
[0253] In some embodiments, the transaction processing device may further include: a first processing filter determination module and a first block loading module.
[0254] Among them, the first processing filter determination module can be used to obtain the first processing filter from the memory of the execution node when it is determined that the first block does not meet the first expansion condition; the first block loading module can be used to load the transactions in the first block into the first processing filter, so as to deduplicate and filter the blockchain's transactions to be on the chain through the first processing filter.
[0255] In some embodiments, the first node includes a first execution node; wherein the first expansion filter determination module 2103 may include: a first target expansion filter acquisition submodule, a security detection submodule, and a first expansion filter determination submodule.
[0256] Among them, the first target expansion filter acquisition submodule can be used to obtain the first target expansion filter from the first execution node; the security detection submodule can be used to perform a security detection on the first target expansion filter; and the first expansion filter determination submodule can be used to use the first target expansion filter as the first expansion filter if it is determined that the first target expansion filter passes the security detection.
[0257] In some embodiments, the first node further includes a second execution node; wherein the first expansion filter determination module 2103 may include: a second target expansion filter acquisition submodule, a second security detection submodule, a second target expansion filter conversion module, a candidate expansion filter generation submodule, and a candidate expansion filter conversion submodule.
[0258] Among them, the second target expansion filter acquisition submodule can be used to obtain the second target expansion filter from the second execution node when it is determined that the first target expansion filter fails the security check; the second security check submodule can be used to perform a security check on the second target expansion filter; the second target expansion filter conversion module can be used to use the second target expansion filter as the first expansion filter when it is determined that the second target expansion filter passes the security check; the candidate expansion filter generation submodule can be used to construct a candidate expansion filter based on the transactions already on the blockchain when it is determined that the second target expansion filter fails the security check, and the capacity of the candidate expansion filter is equal to the capacity of the first target expansion filter; the candidate expansion filter conversion submodule can be used to use the candidate expansion filter as the first expansion filter.
[0259] In some embodiments, the security detection submodule may include: a candidate expansion filter construction unit and a security detection unit.
[0260] Among them, the candidate expansion filter construction unit can be used to construct a candidate expansion filter based on the transactions already on the blockchain, and the capacity of the candidate expansion filter is equal to the capacity of the first target expansion filter; the security detection unit can be used to perform security detection on the first target expansion filter based on the candidate expansion filter.
[0261] In some embodiments, the security detection submodule may include: an on-chain transaction acquisition unit, a virtual transaction construction unit and a second security detection unit.
[0262] Among them, the on-chain transaction acquisition unit can be used to obtain at least one on-chain transaction from the blockchain; the virtual transaction construction unit can be used to randomly construct at least one virtual transaction; and the second security detection unit can be used to perform security detection on the first target expansion filter based on at least one on-chain transaction and at least one virtual transaction.
[0263] In some embodiments, the transaction processing device may further include: a transaction acquisition submodule and a first expansion filter construction submodule.
[0264] Among them, the transaction acquisition submodule can be used to obtain transactions that have been on the blockchain without obtaining the first expansion filter from the first node; the first expansion filter construction submodule can be used to construct the first expansion filter based on the transactions that have been on the blockchain.
[0265] In some embodiments, the transaction processing device may further include: a first transaction acquisition module, a deduplication filtering module, and a first judgment module.
[0266] Among them, the first transaction acquisition module can be used to obtain the first transaction, and the first transaction includes a first transaction identifier; the deduplication filtering module can be used to deduplication filter the first transaction identifier through the filter in the second processing; the first judgment module can be used to add the first transaction to the transaction pool of the blockchain when the filter in the second processing determines that the first transaction identifier does not exist on the blockchain.
[0267] In some embodiments, the transaction processing device may further include: a second judgment module, a third module and a fourth judgment module.
[0268] Among them, the second judgment module can be used to deduplicate the first transaction identifier through the blockchain's ledger database when the filter determines in the second processing that the first transaction identifier exists on the blockchain; the third judgment module can be used to add the first transaction identifier to the blockchain's transaction pool when it is determined through the ledger database that the first transaction identifier does not exist on the blockchain; the fourth judgment module can be used to discard the first transaction when it is determined through the ledger database that the first transaction identifier exists on the blockchain.
[0269] In some embodiments, the transaction processing device may further include: a second block acquisition module, a second processing filter consensus module, a second node determination module, a second expansion filter acquisition module and a second expansion filter loading module.
[0270] Among them, the second block acquisition module can be used to obtain the second block to be chained; the second processing filter consensus module can be used to reach a consensus on the second processing filter and store it in the second block after the consensus is passed when it is determined that the second block meets the second expansion condition. The first expansion condition and the second expansion condition are different; the second node determination module can be used to determine the second node that executes the filter expansion among the nodes of the blockchain according to the second expansion condition; the second expansion filter acquisition module can be used to obtain the second expansion filter from the second node. The capacity of the second expansion filter is greater than that of the first expansion filter. The second expansion filter is generated by the second node based on the transactions that have been chained in the blockchain. The transactions that have been chained in the blockchain include the transactions in the first block; the second expansion filter loading module can be used to load the transactions in the second block into the second expansion filter, and use the second expansion filter as the third processing filter, so as to deduplicate and filter the transactions to be chained in the blockchain through the third processing filter.
[0271] In some embodiments, the first node is an execution node; the transaction processing device may further include: a third block acquisition module and a simultaneous construction module.
[0272] The third block acquisition module can be used to enable the first node to acquire the third block to be uploaded to the chain before acquiring the first expansion filter from the first node; and the construction module can be used to load the third block into the first processing filter and the first expansion filter at the same time when it is determined that the third block does not meet the first expansion condition, so that the first node constructs the first expansion filter at the same time as constructing the first processing filter.
[0273] In some embodiments, the execution node is a second node that executes filter expansion according to the second expansion condition; the transaction processing device may also include: a fourth block acquisition module and a simultaneous construction module.
[0274] The fourth block acquisition module can be used to obtain the fourth block to be chained after the first expansion filter is used as the second processing filter; the construction module can be used to load the fourth block into the second processing filter when it is determined that the fourth block meets the first expansion condition but does not meet the second expansion condition; the fourth block is loaded into the second expansion filter so that the second expansion filter is also constructed while constructing the second processing filter.
[0275] In some embodiments, the transaction processing apparatus may further include: an expansion condition modification module, the expansion condition modification module being configured to:
[0276] Obtaining an actual error rate of the filter in the first process;
[0277] determining that an actual error rate of the filter in the first process is lower than a target error rate;
[0278] generating a second transaction based on the actual error rate;
[0279] Submitting the second transaction to the blockchain so that the blockchain reaches a consensus on the second transaction;
[0280] After consensus is reached, the first expansion condition is modified according to the content of the second transaction.
[0281] Since the functions of the apparatus 2100 have been described in detail in the corresponding method embodiments, they will not be described in detail in this disclosure.
[0282] The modules and / or submodules and / or units described in the embodiments of the present application may be implemented in software or hardware. The modules and / or submodules and / or units described may also be provided in a processor. The names of these modules and / or submodules and / or units do not, in certain circumstances, limit the modules and / or submodules and / or units themselves.
[0283] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the above-mentioned module, program segment, or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of the boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0284] Furthermore, the figures above are merely illustrative of the processes included in the methods according to exemplary embodiments of the present disclosure and are not intended to be limiting. It is readily understood that the processes illustrated in the figures above do not indicate or limit the temporal order of these processes. Furthermore, it is readily understood that these processes may be executed synchronously or asynchronously, for example, in multiple modules.
[0285] Figure 22 shows a schematic diagram of the structure of an electronic device suitable for implementing the embodiments of the present disclosure. It should be noted that the electronic device 2200 shown in Figure 22 is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0286] As shown in FIG22 , the electronic device 2200 includes a central processing unit (CPU) 2211, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 2212 or a program loaded from a storage portion 2218 into a random access memory (RAM) 2213. Various programs and data required for the operation of the electronic device 2200 are also stored in the RAM 2213. The CPU 2211, the ROM 2212, and the RAM 2213 are connected to each other via a bus 2214. An input / output (I / O) interface 2215 is also connected to the bus 2214.
[0287] The following components are connected to the I / O interface 2215: an input section 2216 including a keyboard, a mouse, and the like; an output section 2217 including devices such as a cathode ray tube (CRT), a liquid crystal display (LCD), and speakers; a storage section 2218 including a hard disk and the like; and a communication section 2219 including a network interface card such as a LAN card or a modem. The communication section 2219 performs communication processing via a network such as the Internet. A drive 2210 is also connected to the I / O interface 2215 as needed. Removable media 2211, such as a magnetic disk, an optical disk, a magneto-optical disk, or a semiconductor memory, is installed in the drive 2210 as needed, so that computer programs read therefrom can be installed in the storage section 2218 as needed.
[0288] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable storage medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 2219, and / or installed from the removable medium 2211. When the computer program is executed by the central processing unit (CPU) 2211, the above-mentioned functions defined in the system of the present application are executed.
[0289] It should be noted that the computer-readable storage medium shown in the present disclosure can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this application, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, device or device. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. This propagated data signal can take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable storage medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device. Program code contained on a computer-readable storage medium may be transmitted using any suitable medium, including but not limited to wireless, wireline, optical cable, RF, or any suitable combination thereof.
[0290] In addition, an embodiment of the present application further provides a storage medium, which is used to store a computer program, and the computer program is used to execute the method provided by the above embodiment.
[0291] An embodiment of the present application further provides a computer program product including a computer program, which, when executed on a computer, enables the computer to execute the method provided in the above embodiment.
[0292] Through the description of the above embodiments, it is easy for those skilled in the art to understand that the example embodiments described here can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution of the embodiment of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.), including a number of instructions for causing a computing device (which can be a personal computer, a server, a mobile terminal, or a smart device, etc.) to execute the method according to the embodiment of the present disclosure, such as the steps shown in one or more of Figures 4, 6, 8 to 12, 14, or 17 to 19.
[0293] Other embodiments of the present disclosure will readily occur to those skilled in the art after considering the specification and practicing the disclosure herein. This disclosure is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art not claimed herein. The specification and examples are to be considered as exemplary only, with the true scope and spirit of the present disclosure being indicated by the claims.
[0294] It should be understood that the present disclosure is not limited to the detailed structures, drawings or implementations shown herein, but rather is intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims.
Claims
1. A transaction processing method, the transaction processing method being executed by an execution node on a blockchain, the method comprising: Obtaining the first block to be uploaded to the blockchain; When it is determined that the first block satisfies a first expansion condition, determining a first node for executing filter expansion among the nodes of the blockchain according to the first expansion condition; Acquire a first expansion filter from the first node, wherein the capacity of the first expansion filter is greater than the capacity of the first processing filter in the execution node, and the first expansion filter is generated by the first node according to the transactions that have been uploaded to the blockchain; Loading transactions in the first block to the first expansion filter, and using the first expansion filter as a second processing filter, so as to perform deduplication filtering on transactions to be uploaded to the blockchain through the second processing filter.
2. The method according to claim 1, before using the first expansion filter as the second processing filter, the method further comprises: Obtaining the first processing filter from the memory of the execution node; When it is determined that the first block satisfies the first expansion condition, consensus is reached on the first processing filter; After consensus is passed, the first in-process filter is stored in the first block.
3. The method according to claim 1, further comprising: When it is determined that the first block does not satisfy the first expansion condition, obtaining the first processing filter from the memory of the execution node; The transactions in the first block are loaded into the first processing filter so as to perform deduplication filtering on the to-be-uploaded transactions of the blockchain through the first processing filter.
4. The method according to claim 1, wherein the first node comprises a first execution node; Acquiring a first capacity expansion filter from the first node includes: Acquire a first target expansion filter from the first execution node; Performing a safety check on the first target expansion filter; When it is determined that the first target capacity expansion filter passes the security check, the first target capacity expansion filter is used as the first capacity expansion filter.
5. The method according to claim 4, wherein the first node further comprises a second execution node; wherein: Acquiring a first capacity expansion filter from the first node includes: When it is determined that the first target capacity expansion filter fails the security check, obtaining a second target capacity expansion filter from the second execution node; Performing a safety check on the second target expansion filter; If it is determined that the second target capacity expansion filter passes the security detection, using the second target capacity expansion filter as the first capacity expansion filter; When it is determined that the second target expansion filter fails the security check, a candidate expansion filter is constructed according to the transactions that have been uploaded to the blockchain, and the capacity of the candidate expansion filter is equal to the capacity of the first target expansion filter; The candidate expansion filter is used as the first expansion filter.
6. According to the method of claim 4, the step of performing security detection on the first target expansion filter comprises: Constructing a candidate expansion filter according to the transactions on the blockchain, wherein the capacity of the candidate expansion filter is equal to the capacity of the first target expansion filter; A security check is performed on the first target capacity expansion filter according to the candidate capacity expansion filter.
7. According to the method of claim 4, the step of performing security detection on the first target expansion filter comprises: Obtain at least one on-chain transaction from the blockchain; Randomly construct at least one dummy transaction; Perform security detection on the first target expansion filter according to the at least one on-chain transaction and the at least one virtual transaction.
8. The method according to any one of claims 1 to 7, further comprising: Without obtaining the first expansion filter from the first node, obtaining transactions that have been uploaded to the blockchain; The first expansion filter is constructed according to the transactions that have been uploaded to the blockchain.
9. The method according to any one of claims 1 to 8, further comprising: Acquire a first transaction, where the first transaction includes a first transaction identifier; Performing deduplication filtering on the first transaction identifier by using the filter in the second processing; In the second process, if the filter determines that the first transaction identifier does not exist on the blockchain, the first transaction is added to the transaction pool of the blockchain.
10. The method according to claim 9, further comprising: In the second process, when the filter determines that the first transaction identifier exists on the blockchain, deduplication determination is performed on the first transaction identifier through the ledger database of the blockchain; When it is determined through the account database that the first transaction identifier does not exist on the blockchain, adding the first transaction identifier to the transaction pool of the blockchain; When it is determined through the account database that the first transaction identifier exists on the blockchain, the first transaction is discarded.
11. The method according to any one of claims 1 to 10, further comprising: Get the second block to be uploaded to the chain; When it is determined that the second block satisfies a second expansion condition, consensus is reached on the second processing filter and the second expansion condition is stored in the second block after consensus is passed, and the first expansion condition and the second expansion condition are different; Determining a second node for executing filter expansion among the nodes of the blockchain according to the second expansion condition; Acquire a second expansion filter from the second node, wherein the capacity of the second expansion filter is greater than that of the first expansion filter, and the second expansion filter is generated by the second node according to transactions that have been put on the blockchain, and the transactions that have been put on the blockchain include transactions in the first block; The transactions in the second block are loaded into the second expansion filter, and the second expansion filter is used as a third processing filter, so as to perform deduplication filtering on the transactions to be uploaded to the blockchain through the third processing filter.
12. The method according to any one of claims 1 to 11, wherein the first node is the execution node; Before acquiring the first capacity expansion filter from the first node, the method further includes: Get the third block to be uploaded to the chain; If it is determined that the third block does not satisfy the first capacity expansion condition, loading the third block into the first processing filter; The third block is loaded into the first extended filter so that the first node constructs the first extended filter while constructing the first in-process filter.
13. The method according to any one of claims 1 to 12, wherein the execution node is a second node that executes filter expansion according to a second expansion condition; wherein, After using the first capacity expansion filter as a second processing filter, the method further includes: Get the fourth block to be uploaded to the chain; If it is determined that the fourth block satisfies the first capacity expansion condition but does not satisfy the second capacity expansion condition, loading the fourth block into the second processing filter; The fourth block is loaded into the second expanded filter, so that the second expanded filter is constructed while the second in-process filter is constructed.
14. The method according to any one of claims 1 to 13, further comprising: Obtaining an actual error rate of the filter in the first process; determining that an actual error rate of the filter in the first process is lower than a target error rate; generating a second transaction based on the actual error rate; Submitting the second transaction to the blockchain so that the blockchain reaches a consensus on the second transaction; After consensus is reached, the first expansion condition is modified according to the content of the second transaction.
15. A transaction processing device, the transaction processing device being an execution node on a blockchain, comprising: A first block acquisition module, used to acquire a first block to be uploaded to the blockchain; A first node determination module, configured to determine, when it is determined that the first block satisfies a first expansion condition, a first node for executing filter expansion among the nodes of the blockchain according to the first expansion condition; A first expansion filter determination module is used to obtain a first expansion filter from the first node, wherein the capacity of the first expansion filter is greater than the capacity of the first processing filter in the execution node, and the first expansion filter is generated by the first node according to the transactions that have been uploaded to the blockchain; The first block loading module is used to load the transactions in the first block into the first expansion filter, and use the first expansion filter as a second processing filter, so as to perform deduplication filtering on the transactions to be uploaded to the blockchain through the second processing filter.
16. An electronic device comprising: Memory; as well as A processor coupled to the memory, the processor being configured to execute the transaction processing method according to any one of claims 1 to 14 based on a computer program stored in the memory.
17. A computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the transaction processing method according to any one of claims 1 to 14.
18. A computer program product, comprising a computer program, wherein the computer program is stored in a computer-readable storage medium, and when the computer program is executed by a processor, the method according to any one of claims 1 to 14 is implemented.
