Transaction data acquisition method and device, electronic equipment and computer program product

By obtaining the ordered block stream of the target account and generating supplementary blocks, the problem of low efficiency in transaction data collection in the existing technology is solved, and efficient and complete transaction data acquisition is achieved.

CN120780700AActive Publication Date: 2025-10-14HANGZHOU HIGH-TECH ZONE (BINJIANG) INSTITUTE OF BLOCKCHAIN & DATA SECURITY
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202511293326.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-11
Publication Date
2025-10-14
Estimated Expiration
2045-09-11

AI Technical Summary

Technical Problem

Existing technologies for obtaining transaction data for a specified account suffer from long processing times, high network and computing resource overhead, and low efficiency, especially for accounts with frequent transactions or long time spans.

Method used

By obtaining the ordered block stream corresponding to the target account, identifying the missing time slots and generating supplementary blocks, the time slot continuity of the block stream is ensured, and the asynchronous queue and paging mechanism is used to obtain the missing transaction data, generate and add supplementary blocks to achieve complete transaction data collection.

Benefits of technology

It improves the efficiency and completeness of acquiring target account transaction data, reduces the overhead of network and computing resources, and improves the efficiency and accuracy of data collection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120780700A_ABST
    Figure CN120780700A_ABST
Patent Text Reader

Abstract

The embodiment of the invention is suitable for the technical field of block chains, and provides a transaction data collection method and device, electronic equipment and a computer program product, and the method comprises the steps: obtaining an ordered block flow corresponding to a target account; the block sequence in the ordered block stream corresponds to the size of the time slot recorded in the block; acquiring missing transaction data corresponding to the missing time slot under the condition that the missing time slot exists; generating a supplementary block according to the missing transaction data; and adding the supplementary block to the ordered block flow to obtain an ordered block flow with continuous time slots, the block flow containing the transaction data of the target account in the block chain can be efficiently obtained, and the transaction data of the target account missing in the block flow can be detected and re-obtained.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application belong to the field of blockchain technology, and in particular, relate to transaction data collection methods, devices, electronic devices, and computer program products. Background Art

[0002] Blockchain is a decentralized, tamper-proof distributed ledger technology. It consists of multiple linked blocks, each of which records transaction data.

[0003] When you need to obtain transaction data for a specified account, you can usually use the following two methods: 1. Pull the complete transaction data for each block from the blockchain, then filter and select transactions involving a specified account in all blocks to obtain the transaction data for the specified account. This method requires downloading and processing a large amount of irrelevant transaction data, which is time-consuming, consumes a lot of network and computing resources, and is inefficient.

[0004] 2. By calling the signature list acquisition API, the transaction signature list is retrieved in reverse order based on the address of the specified account, starting from the most recent time. However, this signature list acquisition API has a throughput bottleneck and high call time. This method is particularly inefficient when processing accounts with frequent transactions or long time spans.

[0005] Therefore, there is an urgent need for an efficient method for collecting transaction data related to a specified account. Summary of the Invention

[0006] In view of this, embodiments of the present application provide a transaction data collection method, apparatus, electronic device, and computer program product to improve the efficiency and integrity of obtaining transaction data of a target account from a blockchain.

[0007] A first aspect of an embodiment of the present application provides a transaction data collection method, comprising: Obtaining an ordered block stream corresponding to a target account; the order of blocks in the ordered block stream corresponds to the size of the time slot recorded in the block; In the case of a missing time slot, obtaining missing transaction data corresponding to the missing time slot; Generating a supplementary block based on the missing transaction data; The supplementary block is added to the ordered block stream to obtain an ordered block stream with continuous time slots.

[0008] In some implementations of the first aspect, obtaining the ordered block stream corresponding to the target account includes: Upon receiving a new block corresponding to the target account, determining the current latest time slot corresponding to the new block; Determine the latest historical time slot; When the current latest time slot is greater than the historical latest time slot, determining the new block as the target block, and updating the historical latest time slot according to the current latest time slot; According to the target blocks being determined in sequence, an ordered block stream is generated.

[0009] In some implementations of the first aspect, obtaining the missing transaction data corresponding to the missing time slot includes: Dividing the missing time slots into at least one time slot group; Determine the missing transaction signature information corresponding to each time slot group; Obtain missing transaction data corresponding to the missing transaction signature.

[0010] In some implementations of the first aspect, the missing transaction signature information is obtained by calling a preset transaction signature collection interface; and dividing the missing time slots into at least one time slot group includes: Determine the time slot span; The missing time slots are divided according to the time slot span to obtain at least one time slot group.

[0011] In some implementations of the first aspect, determining missing transaction signature information corresponding to each time slot group includes: Determining a start time slot and an end time slot of the time slot group; Determine the last transaction signature in the time slot before the starting time slot as the starting signature boundary; Determine the first transaction signature in the next time slot of the starting time slot as the end signature boundary; Obtain missing transaction signature information between the start signature boundary and the end signature boundary.

[0012] In some implementations of the first aspect, obtaining the missing transaction data corresponding to the missing transaction signature includes: Establishing a data acquisition task for each transaction signature in the missing transaction signature information; Execute the data acquisition task to obtain the missing transaction data corresponding to each transaction signature.

[0013] In some implementations of the first aspect, the data acquisition task is located in an asynchronous queue, and the data acquisition tasks in the asynchronous queue are sorted in ascending order of time slots; and generating a supplementary block based on the missing transaction data includes: receiving missing transaction data output from the asynchronous queue; When the time slot of the currently received missing transaction data is inconsistent with the time slot of the last received missing transaction data, a supplementary block is generated according to each missing transaction data having the same time slot as the last received missing transaction data.

[0014] A second aspect of an embodiment of the present application provides a transaction data collection device, including: An ordered block stream acquisition module, configured to acquire an ordered block stream corresponding to a target account; the order of blocks in the ordered block stream corresponds to the size of the time slots recorded in the blocks; a missing transaction data acquisition module, which acquires the missing transaction data corresponding to the missing time slot when there is a missing time slot; A supplementary block generation module, configured to generate a supplementary block based on the missing transaction data; The continuous ordered block stream generating module is used to add the supplementary block to the ordered block stream to obtain an ordered block stream with continuous time slots.

[0015] A third aspect of an embodiment of the present application provides an electronic device, comprising a processor, a memory, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the electronic device implements the transaction data collection method described in the first aspect above.

[0016] A fourth aspect of an embodiment of the present application provides a computer program product, including a computer program. When the computer program is run, the transaction data collection method described in the first aspect is executed.

[0017] A fifth aspect of an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the transaction data collection method as described in the first aspect above is implemented.

[0018] The embodiments of the present application have the following beneficial effects: By obtaining an ordered block stream corresponding to a target account; the order of blocks in the ordered block stream corresponds to the size of the time slot recorded in the block; in the case of a missing time slot, obtaining the missing transaction data corresponding to the missing time slot; generating a supplementary block based on the missing transaction data; adding the supplementary block to the ordered block stream to obtain an ordered block stream with continuous time slots, thereby obtaining the ordered block stream of the target account from the blockchain, and in the case of determining that there is a missing time slot, that is, missing transaction data, in the ordered block stream, obtaining the missing transaction data corresponding to the missing time slot, and generating a supplementary block for the missing transaction data, thereby obtaining a complete ordered block stream, obtaining the complete transaction data of the target account under continuous time slots, and improving the efficiency and integrity of obtaining the transaction data of the target account. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] To more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the embodiments or descriptions of the prior art. Obviously, the drawings described below are only some embodiments of the present application, and those skilled in the art can derive other drawings based on these drawings without inventive effort.

[0020] Figure 1 This is a schematic diagram of a transaction data collection method provided in an embodiment of the present application; Figure 2 This is a flowchart of a transaction data collection method provided by an embodiment of the present application; Figure 3 This is a schematic diagram of a transaction data collection device provided in an embodiment of the present application; Figure 4 This is a schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0021] In the following description, specific details such as specific system structures and techniques are provided for purposes of illustration rather than limitation to facilitate a thorough understanding of the embodiments of the present application. However, it will be apparent to those skilled in the art that the present application may be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid obscuring the description of the present application with unnecessary detail.

[0022] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or collections thereof.

[0023] It will also be understood that the term "and / or" used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.

[0024] As used in this specification and the appended claims, the term "if" can be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]," depending on the context.

[0025] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.

[0026] References to "one embodiment" or "some embodiments" in this specification mean that a particular feature, structure, or characteristic described in conjunction with that embodiment is included in one or more embodiments of the present application. Thus, phrases such as "in one embodiment," "in some embodiments," "in other embodiments," and "in other embodiments" appearing in various places in this specification do not necessarily refer to the same embodiment, but rather mean "one or more but not all embodiments," unless otherwise specifically emphasized. The terms "including," "comprising," "having," and variations thereof all mean "including but not limited to," unless otherwise specifically emphasized.

[0027] In some blockchains, time slots are used to identify the time when a block is produced on the blockchain, and these slots follow an increasing rule. Time slots can be numerically numbered, so during the block production process, time slots are strictly numbered (e.g., 0, 1, 2, ...). This allows different blocks to be identified by their time slots, and the order in which they are produced is determined by the time slots.

[0028] The technical solution of this application is described below through specific embodiments.

[0029] Reference Figure 1 , which shows a schematic diagram of a transaction data collection method provided by an embodiment of the present application, which may specifically include the following steps: Step 101: Obtain an ordered block stream corresponding to a target account; the order of blocks in the ordered block stream corresponds to the size of the time slot recorded in the block; The target account is an account that needs to obtain transaction data. The target account can be identified by unique address information.

[0030] As an example, a user can determine the address information of the user's own account, and take the address information as the target account and obtain the ordered block stream corresponding to the target account from the blockchain.

[0031] The target account-related blocks can be obtained from the RPC (Remote Procedure Call) nodes of multiple blockchains in a subscription manner, and the blocks are processed to obtain an ordered block chain. The block stream is a data stream composed of multiple blocks, and the time slots of the blocks in the ordered block stream are sorted in ascending order.

[0032] Step 102, in the case of missing time slots, obtaining missing transaction data corresponding to the missing time slots; Since the time slot is used to identify the time of the block opportunity on the blockchain, and the time slot follows the incremental rule, the presence or absence of missing time slots can be determined by the size of each time slot in the ordered block stream.

[0033] In the case where the ordered block stream does not have missing time slots, the difference between the time slots of adjacent blocks in the ordered block stream is the same. If the difference between the time slots of adjacent blocks is greater than the time slot incremental size, there are missing time slots.

[0034] For example, the time slot increment is 1. If the difference between the time slots of adjacent blocks is 1, there is no missing time slot between the adjacent blocks; if the difference between the time slots of adjacent blocks is not 1, there is a missing time slot between the adjacent blocks. For example, the ordered block chain sequentially sorts block A and block B, the time slot of block A is X, and the time slot of block B is Y. If Y=X+1, the time slot of block A is continuous with the time slot of block B, and there is no missing time slot between block A and block B. If Y=X+N, and N is a positive integer not less than 1, the time slot of block A is not continuous with the time slot of block B, and there is a missing time slot between block A and block B.

[0035] In the case where the ordered block stream has missing time slots, it indicates that the transaction data of the target account corresponding to the missing time slots has not been received, and the missing transaction data corresponding to the missing time slots can be pulled from the blockchain.

[0036] Step 103, generating a supplementary block according to the missing transaction data; According to the format of each block in the ordered block stream, the obtained missing transaction data is processed to generate a supplementary block, and one supplementary block corresponds to one missing time slot.

[0037] Step 104: Add the supplementary block to the ordered block stream to obtain an ordered block stream with continuous time slots.

[0038] Based on the size of the missing time slot, the position of the missing time slot in the ordered block stream is determined. The missing block data is then added to the ordered block stream according to the position, resulting in an ordered block stream with continuous time slots. This means that the complete transaction data for the target account in the continuous time slots is obtained. This complete transaction data is then pushed to the designated user, including but not limited to the user corresponding to the target account.

[0039] In an embodiment of the present application, an ordered block stream corresponding to a target account is obtained; the order of blocks in the ordered block stream corresponds to the size of the time slot recorded in the block; in the case of a missing time slot, missing transaction data corresponding to the missing time slot is obtained; a supplementary block is generated based on the missing transaction data; the supplementary block is added to the ordered block stream to obtain an ordered block stream with continuous time slots, thereby obtaining an ordered block stream of the target account from the blockchain, and in the case of determining that there is a missing time slot, that is, missing transaction data, in the ordered block stream, the missing transaction data corresponding to the missing time slot is obtained, and a supplementary block is generated for the missing transaction data, thereby obtaining a complete ordered block stream, obtaining complete transaction data of the target account under continuous time slots, and improving the efficiency and integrity of obtaining the transaction data of the target account.

[0040] Reference Figure 2 , shows a flow chart of a transaction data collection method provided by an embodiment of the present application, the following is combined with Figure 2 The embodiments of the present application are explained in more detail.

[0041] In some implementations of the embodiments of the present application, step 101 includes: upon receiving a new block corresponding to a target account, determining the current latest time slot corresponding to the new block; determining the historical latest time slot; if the current latest time slot is greater than the historical latest time slot, determining the new block as the target block, and updating the historical latest time slot according to the current latest time slot; and generating an ordered block stream based on the sequential determination of the target blocks.

[0042] You can first build an unordered pipeline, and use the unordered pipeline storage to receive multiple blocks from multiple RPC nodes of the blockchain through subscription.

[0043] Unordered channels may receive duplicate, out-of-order, or delayed blocks. Therefore, a time slot filter component must be configured for the unordered pipeline to continuously monitor and read blocks from the pipeline. Specifically, when a new block is received, the new block's time slot is determined to be the latest time slot. The time slot of the last block output from the unordered pipeline to the ordered pipeline is set as the latest time slot in history. The ordered pipeline is used to store the ordered block stream.

[0044] If the current latest time slot is not greater than the historical latest time slot, the new block is a duplicate or outdated block and is deleted. If the current latest time slot is greater than the historical latest time slot, the new block does not exist in the ordered block stream and is used as the target block. Based on the target blocks output to the ordered pipeline determined at different times, the ordered pipeline is used to output a block stream with monotonically increasing time slots and no duplication, thus obtaining the latest and only ordered block stream.

[0045] It should be noted that in blockchains applicable to embodiments of the present application, in addition to recording a unique timestamp identifying the block itself, each block also contains a parent timestamp, which identifies the immediate predecessor block of the block. Specifically, the parent timestamp is the timestamp of the parent block on which the block is based. Normally, the satisfied timestamp in each block = parent timestamp + 1. If timestamp - parent timestamp > 1, one or more intermediate timestamps were skipped, and no blocks corresponding to these skipped timestamps were generated on the blockchain. Therefore, in embodiments of the present application, when the current latest timestamp is greater than the historical latest timestamp, the parent timestamp of the new block is determined. If the difference between the parent timestamp and the current latest timestamp is greater than 1, this indicates that a skipped timestamp exists, meaning that no consecutive blocks are generated on the blockchain. To ensure the integrity of the perceived chain state in embodiments of the present application, empty block data (e.g., BlockUpdate{slot=X, is_empty=true}) is generated for the skipped timestamps to indicate that the timestamp was skipped, not omitted.

[0046] The embodiments of the present application obtain an ordered block stream through subscription. As a fault-tolerant compensation strategy, the embodiments of the present application adopt an active pull mechanism. The time slots of each block in the ordered pipeline are continuously monitored. If there are missing time slots (the time slots in the ordered block stream are discontinuous), the active pull strategy is automatically triggered to obtain the missing transaction data corresponding to the missing time slots through a three-level pipeline. The first-level pipeline is used for paging and concurrent asynchronous acquisition of transaction signatures; the second-level pipeline is used for concurrent asynchronous acquisition of missing transaction data; and the third-level pipeline assembles the missing transaction data into supplementary blocks in block format. The active pull strategy is further explained below.

[0047] In some implementations of the embodiments of the present application, obtaining the missing transaction data corresponding to the missing time slot includes: dividing the missing time slot into at least one time slot group; determining the missing transaction signature information corresponding to each time slot group; and obtaining the missing transaction data corresponding to the missing transaction signature.

[0048] In the blockchain, the transaction signature collection interface can be used to obtain transaction signatures within a specified range. If time slots in the ordered block stream are discontinuous, the missing time slots are identified as missing time slots. To improve the efficiency of obtaining missing transaction data and reduce the throughput impact of the missing transaction signature collection interface, the missing time slots are divided into pages, with at least one paging task assigned to each time slot group. The transaction signature collection interface is called asynchronously and concurrently to obtain missing transaction signature information for each time slot group. Missing transaction signature information includes multiple missing transaction signatures.

[0049] When obtaining the missing transaction signature information, actively pull the missing transaction data corresponding to each missing transaction signature from the RPC node.

[0050] In some implementations of the embodiments of the present application, the missing transaction signature information is obtained by calling a preset transaction signature collection interface; dividing the missing time slot into at least one time slot group includes: determining a time slot span; dividing the missing time slot according to the time slot span to obtain at least one time slot group.

[0051] The time slot span is determined according to a preset method, and the missing time slots are divided into multiple time slot groups with the time slot span as a step length, and each time slot group is an independent paging task.

[0052] As an example, a default value (e.g., 100) can be set for the time slot span, which can then be dynamically adjusted based on real-time monitoring of the complete, ordered pipeline. The adjustment strategy could be to estimate the appropriate time slot span based on the number of time slots involved in the last 1,000 transaction data entries, ensuring that the transaction signatures returned by each paging segment are as close as possible to the transaction signature collection interface throughput, thereby improving interface utilization.

[0053] In some implementations of the embodiments of the present application, determining the missing transaction signature information corresponding to each time slot group includes: determining a starting time slot and an ending time slot of the time slot group; determining the last transaction signature in the time slot before the starting time slot as a starting signature boundary; determining the first transaction signature in the time slot after the starting time slot as an ending signature boundary; and obtaining the missing transaction signature information located between the starting signature boundary and the ending signature boundary.

[0054] Each time slot group corresponds to a time slot range, for example: [start_slot, end_slot]. When asynchronously calling a specific interface to query, the last transaction signature in the time slot before the start time slot (the block containing start_slot - 1) is used as the start signature boundary. When asynchronously calling a specific interface to query, the first transaction signature in the time slot after the end time slot (the block containing end_slot + 1) is used as the end signature boundary. The transaction signature collection interface is called to retrieve multiple transaction signatures between the start and end signature boundaries in a paged manner, and these multiple transaction signatures are identified as missing transaction signature information.

[0055] To improve processing efficiency, the first-level pipeline is implemented based on a concurrent asynchronous task queue. Each paging task is submitted to the task queue for execution asynchronously in paging order (i.e., from smallest to largest time slot). The concurrency limit can be dynamically set based on the number of available RPC nodes (for example, 5 times the number of nodes) to balance concurrency performance and interface load. To ensure the timing consistency of subsequent transaction data processing, a strategy is adopted to wait for asynchronous task results in an orderly manner starting from the bottom of the task queue. This strategy prioritizes the aggregation of paging task results with smaller starting time slots and then advances them to the top of the task queue. This strategy ensures the sequential consistency of transaction signature lists when they are distributed to downstream pipelines, avoiding the risk of data misalignment caused by out-of-order processing. Furthermore, once a task in the task queue is completed, unexecuted paging tasks can be immediately scheduled into the queue in order, thus achieving efficient reuse of the task pool and continuous advancement of the pipeline.

[0056] In some implementations of the embodiments of the present application, obtaining the missing transaction data corresponding to the missing transaction signature includes: establishing a data acquisition task for each transaction signature in the missing transaction signature information in turn; and executing the data acquisition task to obtain the missing transaction data corresponding to each transaction signature.

[0057] In the secondary pipeline, each missing transaction signature received from the upstream is treated as an independent data acquisition task and stored in an asynchronous queue. The RPC interface is asynchronously called to obtain the missing transaction data corresponding to each data acquisition task.

[0058] Among them, all tasks are submitted to the task pool for execution in an asynchronous manner. The size of the task pool can be dynamically set according to the number of available RPC nodes. For example, the task pool size is set to 20 times the number of nodes to balance the concurrent throughput and network resource load.

[0059] Similar to the first-level pipeline, by utilizing a concurrent asynchronous task queue, the embodiment of the present application can wait for the return results of each task in an orderly manner according to the order in which the transaction signatures are received (i.e., the paging order of the first-level pipeline) while tasks are running at high concurrency, thereby ensuring the subsequent processing of missing transaction data and the sequential consistency of the time series aggregation process.

[0060] When an asynchronous task is completed and transaction data is successfully obtained, it is pushed to the downstream pipeline in order. If there are idle resources in the task pool, the signature tasks that have not yet been distributed are immediately scheduled in order to continuously fill the task queue.

[0061] In some implementations of the embodiments of the present application, the data acquisition task is located in an asynchronous queue, and the data acquisition tasks in the asynchronous queue are sorted from small to large according to time slots; generating a supplementary block based on the missing transaction data includes: receiving the missing transaction data output from the asynchronous queue; when the time slot of the currently received missing transaction data is inconsistent with the time slot of the last missing transaction data received, generating a supplementary block based on each missing transaction data with the same time slot as the last missing transaction data received.

[0062] A three-stage pipeline is used to assemble a supplementary block containing missing transaction data in block format. Specifically, since the secondary pipeline ensures that transaction data arrives in signature order and contains time slots, upon receiving missing transaction data output by the secondary pipeline, it is possible to determine whether the time slot of the currently received missing transaction data is consistent with the time slot in which the missing transaction data was previously received. If the time slot of the currently received missing transaction data is different from the time slot in which the missing transaction data was previously received, it indicates that the three-stage pipeline has completed the reception of each missing transaction data in the time slot in which the missing transaction data was previously received. The missing transaction data that matches the time slot in which the missing transaction data was previously received are then aggregated to generate a complete block of data and pushed to the final ordered data pipeline. The block assembly for the next time slot begins, and the cycle continues.

[0063] It should be noted that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

[0064] Reference Figure 3 , shows a schematic diagram of a transaction data collection device provided by an embodiment of the present application, which may specifically include an ordered block stream acquisition module 301, a missing transaction data acquisition module 302, a supplementary block generation module 303, and a continuous ordered block stream generation module 304, wherein: An ordered block stream acquisition module 301 is configured to acquire an ordered block stream corresponding to a target account; the order of blocks in the ordered block stream corresponds to the size of the time slots recorded in the blocks; A missing transaction data acquisition module 302 acquires missing transaction data corresponding to a missing time slot when there is a missing time slot; A supplementary block generation module 303 is configured to generate a supplementary block based on the missing transaction data; The continuous ordered block stream generating module 304 is configured to add the supplementary block to the ordered block stream to obtain an ordered block stream with continuous time slots.

[0065] In some implementations of the embodiments of the present application, the ordered block stream acquisition module 301 includes: A current latest time slot determination submodule, configured to, upon receiving a new block corresponding to a target account, determine the current latest time slot corresponding to the new block; The historical latest time slot determination submodule is used to determine the historical latest time slot; a target block determination submodule, configured to determine the new block as the target block if the current latest time slot is greater than the historical latest time slot, and update the historical latest time slot according to the current latest time slot; The ordered block stream generating submodule is used to generate an ordered block stream according to sequentially determining the target blocks.

[0066] In some implementations of the embodiments of the present application, the missing transaction data acquisition module 302 includes: A time slot group division submodule, configured to divide the missing time slot into at least one time slot group; A missing transaction signature information determination submodule is used to determine the missing transaction signature information corresponding to each time slot group; The missing transaction data acquisition submodule is used to acquire the missing transaction data corresponding to the missing transaction signature.

[0067] In some implementations of the embodiments of the present application, the missing transaction signature information is obtained by calling a preset transaction signature collection interface; the time slot group division submodule includes: A time slot span determining unit, configured to determine a time slot span; The time slot group division unit is configured to divide the missing time slots according to the time slot span to obtain at least one time slot group.

[0068] In some implementations of the embodiments of the present application, the missing transaction signature information determination submodule includes: a time slot determining unit, configured to determine a start time slot and an end time slot of the time slot group; a starting signature boundary determining unit, configured to determine the last transaction signature in the time slot preceding the starting time slot as the starting signature boundary; an end signature boundary determining unit, configured to determine the first transaction signature in the next time slot of the start time slot as the end signature boundary; The missing transaction signature information acquiring unit is configured to acquire the missing transaction signature information between the start signature boundary and the end signature boundary.

[0069] In some implementations of the embodiments of the present application, the missing transaction data acquisition submodule includes: a data acquisition task establishing unit, configured to establish a data acquisition task for each transaction signature in the missing transaction signature information; The missing transaction data acquisition unit is used to execute the data acquisition task and acquire the missing transaction data corresponding to each transaction signature.

[0070] In some implementations of the embodiments of the present application, the data acquisition task is located in an asynchronous queue, and the data acquisition tasks in the asynchronous queue are sorted from small to large according to time slots; the supplementary block generation module 303 includes: a missing transaction data receiving submodule, configured to receive the missing transaction data output from the asynchronous queue; The supplementary block generation submodule is used to generate a supplementary block based on each missing transaction data with the same time slot as the last missing transaction data received when the time slot of the missing transaction data currently received is inconsistent with the time slot of the last missing transaction data received.

[0071] An embodiment of the present application provides a transaction data collection device, and by using this device, each step in the aforementioned method embodiments can be implemented.

[0072] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiment part.

[0073] Reference Figure 4 , shows a schematic diagram of an electronic device provided by an embodiment of the present application. Figure 4 As shown, the electronic device 400 in the embodiment of the present application includes: a processor 410, a memory 420, and a computer program 421 stored in the memory 420 and executable on the processor 410. When the processor 410 executes the computer program 421, the steps in each embodiment of the transaction data collection method described above are implemented, such as Figure 1Alternatively, when the processor 410 executes the computer program 421, the functions of the modules / units in the above-mentioned device embodiments are realized, for example, Figure 3 Functions of modules 301 to 304 are shown.

[0074] Exemplarily, the computer program 421 may be divided into one or more modules / units, which are stored in the memory 420 and executed by the processor 410 to complete the present application. The one or more modules / units may be a series of computer program instruction segments capable of performing specific functions, which may be used to describe the execution process of the computer program 421 in the electronic device 400. For example, the computer program 421 may be divided into an ordered block stream acquisition module, a missing transaction data acquisition module, a supplementary block generation module, and a continuous ordered block stream generation module. The specific functions of each module are as follows: An ordered block stream acquisition module, configured to acquire an ordered block stream corresponding to a target account; the order of blocks in the ordered block stream corresponds to the size of the time slots recorded in the blocks; a missing transaction data acquisition module, which acquires the missing transaction data corresponding to the missing time slot when there is a missing time slot; A supplementary block generation module, configured to generate a supplementary block based on the missing transaction data; The continuous ordered block stream generating module is used to add the supplementary block to the ordered block stream to obtain an ordered block stream with continuous time slots.

[0075] The electronic device 400 may be a computing device such as a desktop computer or a cloud server. The electronic device 400 may include, but is not limited to, a processor 410 and a memory 420. It will be understood by those skilled in the art that Figure 4 It is only an example of the electronic device 400 and does not constitute a limitation of the electronic device 400. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the electronic device 400 may also include input and output devices, network access devices, buses, etc.

[0076] The processor 410 may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor.

[0077] The memory 420 may be an internal storage unit of the electronic device 400, such as a hard drive or memory of the electronic device 400. The memory 420 may also be an external storage device of the electronic device 400, such as a plug-in hard drive, a Smart Media Card (SMC), a Secure Digital (SD) card, a flash memory card, etc. equipped on the electronic device 400. Furthermore, the memory 420 may include both an internal storage unit of the electronic device 400 and an external storage device. The memory 420 is used to store the computer program 421 and other programs and data required by the electronic device 400. The memory 420 may also be used to temporarily store data that has been output or is about to be output.

[0078] An embodiment of the present application further discloses a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the transaction data collection method as described in the aforementioned embodiments is implemented.

[0079] An embodiment of the present application further discloses a computer program product, including a computer program. When the computer program is run, the transaction data collection method described in the above embodiments is executed.

[0080] The above embodiments are intended only to illustrate the technical solutions of the present application and are not intended to limit them. Although the present application has been described in detail with reference to the above embodiments, those skilled in the art should understand that they may still modify the technical solutions described in the above embodiments or replace some of the technical features therein with equivalents; and such modifications or replacements do not deviate from the spirit and scope of the technical solutions of the embodiments of the present application and should be included within the scope of protection of the present application.

Claims

1. A transaction data collection method, characterized in that: include: Get the ordered block stream corresponding to the target account; The order of blocks in the ordered block stream corresponds to the size of the time slots recorded in the blocks; In the case of a missing time slot, obtaining missing transaction data corresponding to the missing time slot; Generating a supplementary block based on the missing transaction data; The supplementary block is added to the ordered block stream to obtain an ordered block stream with continuous time slots.

2. The method according to claim 1, characterized in that The step of obtaining the ordered block stream corresponding to the target account includes: Upon receiving a new block corresponding to the target account, determining the current latest time slot corresponding to the new block; Determine the latest historical time slot; When the current latest time slot is greater than the historical latest time slot, determining the new block as the target block, and updating the historical latest time slot according to the current latest time slot; According to the target blocks being determined in sequence, an ordered block stream is generated.

3. The method according to claim 1, characterized in that The acquiring of missing transaction data corresponding to the missing time slot comprises: Dividing the missing time slots into at least one time slot group; Determine the missing transaction signature information corresponding to each time slot group; Obtain missing transaction data corresponding to the missing transaction signature.

4. The method according to claim 3, characterized in that The missing transaction signature information is obtained by calling a preset transaction signature collection interface; and the dividing the missing time slot into at least one time slot group includes: Determine the time slot span; The missing time slots are divided according to the time slot span to obtain at least one time slot group.

5. The method according to claim 3 or 4, characterized in that Determining the missing transaction signature information corresponding to each time slot group includes: Determining a start time slot and an end time slot of the time slot group; Determine the last transaction signature in the time slot before the starting time slot as the starting signature boundary; Determine the first transaction signature in the next time slot of the starting time slot as the end signature boundary; Obtain missing transaction signature information between the start signature boundary and the end signature boundary.

6. The method according to claim 3, characterized in that The acquiring of missing transaction data corresponding to the missing transaction signature includes: Establishing a data acquisition task for each transaction signature in the missing transaction signature information; Execute the data acquisition task to obtain the missing transaction data corresponding to each transaction signature.

7. The method according to claim 6, characterized in that The data acquisition tasks are located in an asynchronous queue, and the data acquisition tasks in the asynchronous queue are sorted in ascending order according to time slots. Generating a supplementary block based on the missing transaction data includes: receiving missing transaction data output from the asynchronous queue; When the time slot of the currently received missing transaction data is inconsistent with the time slot of the last received missing transaction data, a supplementary block is generated according to each missing transaction data having the same time slot as the last received missing transaction data.

8. A transaction data collection device, characterized in that: include: The ordered block stream acquisition module is used to obtain the ordered block stream corresponding to the target account; The order of blocks in the ordered block stream corresponds to the size of the time slots recorded in the blocks; a missing transaction data acquisition module, which acquires the missing transaction data corresponding to the missing time slot when there is a missing time slot; A supplementary block generation module, configured to generate a supplementary block based on the missing transaction data; The continuous ordered block stream generating module is used to add the supplementary block to the ordered block stream to obtain an ordered block stream with continuous time slots.

9. An electronic device, characterized in that: The electronic device comprises a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the electronic device implements the method according to any one of claims 1 to 7.

10. A computer program product, characterized in that The invention comprises a computer program, which, when being executed, enables the method according to any one of claims 1 to 7 to be performed.

Citation Information

Patent Citations

  • Data processing method and device, equipment, storage medium and program product

    CN117595997A

  • Alliance chain randomization alternate consensus method based on VRF

    CN118300769A

  • Method and system for desynchronization recovery for permissioned blockchains using bloom filters

    US20170344435A1

  • Blockchain state data synchronization method and apparatus, and electronic device

    WO2021017436A1