Method for pulling transaction data from a blockchain and related devices

By employing a segmented and bucketed multi-task processing method, transaction data is efficiently retrieved from the blockchain, solving the problem of low efficiency in existing technologies and enabling fast and flexible data processing.

CN114549204BActive Publication Date: 2026-01-13ANT BLOCKCHAIN TECHNOLOGY (SHANGHAI) CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202210168921.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-23
Publication Date
2026-01-13
Estimated Expiration
2042-02-23

AI Technical Summary

Technical Problem

Existing technologies are inefficient at pulling transaction data from blockchains and cannot cope with the rapid growth in the number of industry chains and transaction data, resulting in severe delays.

Method used

The method employs segmentation and bucketing to pull transaction data from the blockchain through multi-task processing. The specific steps include obtaining the current latest block height, processing the transaction data of each segment in parallel, and allocating the segments to multiple buckets for independent multi-task processing.

Benefits of technology

It improves the efficiency of pulling blockchain transaction data, enabling the processing of large amounts of data in real time or near real time, and flexibly responding to the growth in the number of blockchains and transactions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114549204B_ABST
    Figure CN114549204B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a method for pulling transaction data from a blockchain and related devices. A method for pulling transaction data from a blockchain includes: accessing a node of the blockchain to obtain a current latest block height of the blockchain; dividing a range of to-be-pulled block heights of the blockchain from a current starting block height to the current latest block height into one or more segments, the current starting block height being equal to a previous latest block height plus one, the previous latest block height being a latest block height obtained when transaction data is last pulled from the blockchain; distributing the one or more segments into a plurality of buckets, each bucket of the plurality of buckets being configured to separately perform multitasking to pull transaction data of blocks included in each segment distributed to the bucket; and separately enabling multitasking in each bucket to pull transaction data of blocks included in the segments distributed into each bucket.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to one or more embodiments of methods, apparatus, edge servers, computing devices, and storage media for retrieving transaction data from a blockchain. Background Technology

[0002] Blockchain is a novel application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and cryptographic algorithms. Due to its decentralized, tamper-proof, and autonomous characteristics, blockchain is receiving increasing attention and application.

[0003] Based on the fundamental characteristics of blockchain, a blockchain typically consists of several blocks. Each block records a timestamp corresponding to its creation time, and all blocks strictly adhere to these timestamps, forming a temporally ordered data chain. Real-world data can be formatted into a standard transaction format supported by the blockchain and then published to the blockchain. The nodes in the blockchain process the received transactions through consensus, and after reaching a consensus, the nodes acting as ledger nodes package the transaction into a block for persistent storage within the blockchain.

[0004] With the rapid development of blockchain technology, more and more industry chains are being developed, each containing a large amount of transaction data. Because blockchain provides a distributed ledger, there is a need to pull transaction data from the chain. Summary of the Invention

[0005] One of the objectives of this disclosure is to provide a method, apparatus, edge server, computing device, and storage medium for retrieving transaction data from a blockchain.

[0006] According to one aspect of one or more embodiments of this disclosure, a method for pulling transaction data from a blockchain is provided, comprising: accessing a node of the blockchain to obtain the current latest block height of the blockchain; dividing a range of block heights to be pulled from the current starting block height to the current latest block height into one or more segments, wherein the current starting block height is equal to the previous latest block height plus one, and the previous latest block height is the latest block height obtained when previously pulling transaction data from the blockchain; and enabling multitasking to pull transaction data of blocks included in each of the one or more segments respectively.

[0007] According to another aspect of one or more embodiments of this disclosure, an apparatus for pulling transaction data from a blockchain is provided, comprising: an acquisition module configured to access nodes of the blockchain to acquire the current latest block height of the blockchain; an allocation module configured to divide a range of block heights to be pulled from the current starting block height to the current latest block height into one or more segments, wherein the current starting block height is equal to the previous latest block height plus one, and the previous latest block height is the latest block height acquired when previously pulling transaction data from the blockchain; and a pull module configured to enable multitasking to pull transaction data of blocks included in each of the one or more segments.

[0008] According to another aspect of one or more embodiments of this disclosure, an edge server for pulling transaction data from a blockchain is provided. The edge server includes a storage device and a processing device. The storage device is configured to store a blockchain information database, a segment information database, and a transaction information database. The blockchain information database stores the IP address and port number of each node in the blockchain, as well as the public and private keys corresponding to the block-pulling roles configured on the blockchain. The processing device is configured to: retrieve the IP address and port number of the blockchain nodes and the public and private keys corresponding to the block-pulling roles configured on the blockchain from the blockchain information database of the storage device, thereby accessing the blockchain nodes to obtain the current latest block height of the blockchain; divide the range of the blockchain to be pulled from the current starting block height to the current latest block height into one or more segments, where the current starting block height is equal to the previous latest block height plus one, and the previous latest block height is the latest block height obtained when previously pulling transaction data from the blockchain; and allocate the one or more segments to... In a plurality of buckets, each bucket is configured to perform multitasking independently to pull transaction data of blocks included in each segment allocated to that bucket; the segment information of each segment and the identification information of the allocated bucket are stored in the segment information database of the storage device, the segment information including the identification information of the blockchain to which the segment belongs, the block height range of the blocks included in the segment, and the processing status of the segment; and multitasking is enabled in each bucket to pull transaction data of blocks included in the segment allocated to each bucket and store the transaction data in the transaction information database of the storage device.

[0009] According to another aspect of one or more embodiments of the present disclosure, a computing apparatus for retrieving transaction data from a blockchain is provided, comprising: one or more processors; and a memory storing computer-executable instructions, which, when executed by the one or more processors, cause the one or more processors to perform the method according to any embodiment of the present disclosure.

[0010] According to another aspect of one or more embodiments of the present disclosure, a non-transient storage medium having computer-executable instructions stored thereon, the computer-executable instructions causing a computer to perform the method described according to any embodiment of the present disclosure when executed by the computer.

[0011] Other features and advantages of this disclosure will become clear from the following detailed description of exemplary embodiments with reference to the accompanying drawings. Attached Figure Description

[0012] The accompanying drawings, which form part of this specification, illustrate one or more embodiments of this disclosure and, together with the specification, serve to explain the principles of one or more embodiments of this disclosure.

[0013] One or more embodiments of this disclosure can be more clearly understood with reference to the accompanying drawings and the following detailed description, wherein:

[0014] Figure 1 It is a schematic diagram of the structure of a system in which one or more exemplary embodiments of the present disclosure can be applied;

[0015] Figure 2 This is a flowchart illustrating a method for retrieving transaction data from a blockchain according to one or more exemplary embodiments of this disclosure;

[0016] Figure 3 It is a schematic diagram of the structure of a system in which one or more exemplary embodiments of the present disclosure can be applied;

[0017] Figure 4 This is a flowchart illustrating a method for retrieving transaction data from a blockchain according to one or more exemplary embodiments of this disclosure;

[0018] Figure 5 This is a flowchart illustrating a method for retrieving transaction data from a segment in a bucket, according to one or more exemplary embodiments of this disclosure.

[0019] Figure 6 The implementation process of a method for pulling transaction data from multiple blockchains according to one or more exemplary embodiments of this disclosure is illustrated schematically.

[0020] Figure 7 This is a schematic block diagram of an apparatus for pulling transaction data from a blockchain according to one or more exemplary embodiments of this disclosure;

[0021] Figure 8 This is a schematic block diagram illustrating a computer system on which one or more exemplary embodiments of the present disclosure may be implemented;

[0022] Figure 9This is a schematic block diagram of a computing apparatus for pulling transaction data from a blockchain according to one or more exemplary embodiments of the present disclosure. Detailed Implementation

[0023] To enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments in this specification, and not all of them. However, it should be understood that one or more embodiments of this disclosure can be presented in many different ways and are not limited to the embodiments described below. It should also be understood that one or more embodiments of this disclosure can be combined in various ways to provide more additional embodiments. Based on the embodiments in this specification, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of this specification.

[0024] It should be understood that the same reference numerals denote the same elements in all the accompanying drawings. For clarity, the dimensions of certain features may be modified in the drawings.

[0025] It should be understood that the terminology used herein is for describing specific embodiments only and is not intended to be limiting. All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art unless otherwise defined. For the sake of brevity and / or clarity, well-known functions or structures may not be described in detail.

[0026] In this document, the term "connection" is intended to encompass a physical, electrical, and / or communicative connection between one feature and another feature, and there may or may not be an intermediate feature between the two features. When the connection is a communicative connection, even if A and B are mentioned as "directly connected," it is only intended to emphasize that the connection between A and B does not involve one or more features emphasized in one or more embodiments of this disclosure, but does not imply a limitation that A and B can be connected without any components. Those skilled in the art will understand that A and B can be connected via cables, routers, gateways, channels, links, networks, etc. It should be noted that in the accompanying drawings of one or more embodiments of this disclosure, whether the connection between A and B is direct or indirect, it is represented by a straight line or other graphic element connecting A and B.

[0027] In this document, the term “A or B” includes both “A and B” and “A or B”, rather than exclusively including only “A” or only “B”, unless otherwise specified.

[0028] In this document, the term "exemplary" means "used as an example, instance, or illustration," and not as a "model" to be precisely copied. Any implementation described herein is not necessarily to be construed as preferred or advantageous over other implementations. Moreover, one or more embodiments of this disclosure are not limited to any expressed or implied theory given in the foregoing technical field, background, summary of invention, or detailed description.

[0029] In this document, the term "substantially" means any minor variation caused by design or manufacturing defects, device or component tolerances, environmental influences, and / or other factors. The term "substantially" also allows for differences from the perfect or ideal situation due to parasitic effects, noise, and other practical considerations that may exist in actual implementations.

[0030] Additionally, terms such as “first,” “second,” etc., may be used in this document for reference purposes only and are not intended to be limiting. For example, unless the context clearly indicates otherwise, the words “first,” “second,” and other such numerical terms relating to structures or elements do not imply order or sequence.

[0031] It should also be understood that when the term “including / contains” is used herein, it indicates the presence of the indicated feature, whole, step, operation, unit and / or component, but does not preclude the presence or addition of one or more other features, wholes, steps, operations, units and / or components and / or combinations thereof.

[0032] For ease of understanding, the terminology used in one or more embodiments of this disclosure will be described below.

[0033] Blockchain network: A system in which multiple participants on a distributed network jointly maintain chain-like data based on blockchain technology through consensus rules.

[0034] Blockchain node: A network node in a blockchain network, which may be referred to simply as a node in this article. Each blockchain node has a complete copy of the ledger and has the ability to participate in blockchain network consensus and ledger maintenance.

[0035] Block height: Also known as the block number. In a blockchain, the block height refers to the number of blocks between that block and the genesis block. The genesis block has a block height of 0. Block height accurately describes a block's position within the blockchain.

[0036] With the rapid development of blockchain technology, more and more industry blockchains (also referred to as industry chains in this article) have been developed for different application scenarios across various industries. As businesses in various industries grow rapidly, the transaction data on each industry chain is increasing. Based on the fundamental characteristics of blockchain, each node in a blockchain stores the complete data of that blockchain (i.e., a complete copy of the ledger). The traditional method for pulling on-chain transaction data off-chain is to access a specific node of a blockchain and sequentially pull the transaction data from each block, starting from the earliest block, to the local machine. Because blocks on a blockchain have a chronological order, it is generally assumed that transaction data in a subsequent block cannot be pulled until the transaction data in a previous block has been successfully pulled. If the pulling of transaction data for a certain block fails, the process retryes pulling the transaction data at the current block height until it is successfully pulled before moving to the next block height. This traditional method uses a single thread to execute the sequential pulling process. However, as the number of blocks on each industry chain increases (i.e., the amount of transaction data increases) and / or the number of industry chains connected increases, the retrieval efficiency of this traditional method becomes very low, resulting in a serious delay between on-chain and off-chain transaction data. This makes it unable to cope with the rapid growth in the number of industry chains and the rapid growth in transactions on individual industry chains.

[0037] Therefore, this disclosure provides an improved method for fetching transaction data from a blockchain. The method according to this disclosure has improved block fetching efficiency, enabling the fetching of transaction data from one or more blockchains in real-time or near real-time, and flexibly responding to the rapid growth in the number of blockchains and the rapid growth in transactions on a single blockchain. Various embodiments according to this disclosure will now be described in detail with reference to the accompanying drawings.

[0038] Figure 1 This is a schematic diagram of the structure of a system in which one or more exemplary embodiments according to this disclosure can be applied. The system includes a first blockchain 110, and a blockchain network of the first blockchain 110 includes multiple blockchain nodes 111, 112, 113, and 114. It should be understood that, although... Figure 1 and the description that follows Figure 3The example describes a blockchain network with four blockchain nodes, but this is merely an example, and a blockchain network can have more or fewer blockchain nodes. As mentioned earlier, based on the fundamental characteristics of blockchain, each blockchain node 111, 112, 113, and 114 stores the complete data of the first blockchain 110. Therefore, any blockchain node 111, 112, 113, or 114 in the blockchain network can retrieve transaction data from the first blockchain 110. However, due to the computational bottleneck of blockchain nodes, additional computing resources can be built and directly connected to the blockchain nodes to retrieve transaction data from them. As a non-limiting example, Figure 1 The system also includes an edge server 100. The edge server 100 may include a storage device 101 and a processing device 102. The edge server 100 may be implemented as, for example, but not limited to, a web server. Figure 1 As shown, edge server 100 (e.g., via a communication device not shown) is communicatively coupled to blockchain node 111, thereby enabling it to access blockchain node 111 to pull transaction data from the first blockchain 110. As previously described, edge server 100 may alternatively be communicatively coupled to other blockchain nodes 112, 113, and 114. It is understood that although the following description primarily uses edge server 100 performing the method for pulling transaction data from the blockchain according to various embodiments of this disclosure as an example, any other suitable computing resources besides the edge server, or even the node device itself at blockchain node 111, may be used to perform the method for pulling transaction data from the blockchain according to various embodiments of this disclosure to pull transaction data from the first blockchain 110.

[0039] Figure 2 A method 200 for pulling transaction data from a blockchain according to some embodiments of this disclosure is illustrated. An edge server 100 can execute method 200 to pull transaction data from a first blockchain 110. Specifically, method 200 may include accessing a node of the blockchain at step S202 to obtain the current latest block height of the blockchain. The current latest block height of the blockchain refers to the block height of the latest block of the blockchain at the time of the current access. In some embodiments, the node accessing the blockchain may include blockchain information configured to access the blockchain. The blockchain information can be used to directly connect to the blockchain node. The blockchain information may include, for example, the IP address and port number of the blockchain node, and the public and private keys corresponding to the block-pulling roles configured on the blockchain. For example, in Figure 1In this embodiment, the storage device 101 of the edge server 100 can be configured to store a blockchain information database 1011. This database can store blockchain information for each blockchain, including the IP address and port number of the blockchain nodes, as well as the public and private keys corresponding to the block-pulling roles configured on that blockchain. When the blockchain information database 1011 contains blockchain information for the first blockchain 110, the processing device 102 of the edge server 100 can be configured to retrieve the IP address and port number of the blockchain node 111 of the first blockchain 110, as well as the public and private keys corresponding to the block-pulling roles configured on the first blockchain 110, from the blockchain information database 1011 of the storage device 101, thereby accessing the blockchain node 111 of the first blockchain 110 to obtain the current latest block height of the first blockchain 110.

[0040] Method 200 further includes dividing the range of block heights to be pulled from the current starting block height to the current latest block height in the blockchain into one or more segments at step S204. The current starting block height is equal to the previous latest block height plus one. The previous latest block height is the latest block height obtained when transaction data was previously pulled from the blockchain. Each of the one or more segments corresponds to a subset of the range of block heights to be pulled from the blockchain, and these subsets do not overlap with each other and together constitute the complete range of block heights to be pulled. For example, for a newly developed industry chain, if the latest block height of the industry chain obtained during the initial pull is 1000, then for the second pull, if the previous latest block height is 1000, the current starting block height is 1001. If the latest block height of the industry chain obtained during the second pull is 2000, then the current latest block height is 2000, and the range of block heights to be pulled at this time is 1001 to 2000.

[0041] In some embodiments, between steps S202 and S204, the current latest block height can be compared with the previous latest block height. If the current latest block height is less than or equal to the previous latest block height (indicating that no new block has been generated since the previous fetch), then only the latest fetch time needs to be updated without performing step S204.

[0042] Any suitable segmentation strategy can be adopted to divide the range of block heights to be pulled from the current starting block height to the current latest block height into one or more segments. In some embodiments, the segmentation strategy can be one of the following: an equal-length strategy, where each segment includes the same number of blocks (this same number can be called the step size of the equal-length strategy); an equal-frequency strategy, where each segment includes blocks generated within a time period of the same length (this same time period can be called the step size of the equal-frequency strategy). Other custom segmentation strategies are also possible. When the step size of the equal-length strategy is 1, it can also be called a single-block segmentation strategy. In the foregoing example, if an equal-length strategy with a step size of 100 is used, the range of block heights to be pulled from 1001 to 2000 can be divided into 10 segments, each segment including 100 blocks. In some embodiments, method 200 may further include determining a segmentation strategy for the blockchain based on the blockchain's identification information; and dividing the range of block heights to be pulled from the blockchain into one or more segments according to the segmentation strategy. Different segmentation strategies can be pre-configured for different types of blockchains. For example, an equal-length strategy can be applied to blockchains with stable block growth, while an equal-frequency strategy can be applied to blockchains with rapid block growth. A default segmentation strategy can also be set, so that it is automatically adopted when no segmentation strategy is pre-configured for a certain type of blockchain. For example, the default segmentation strategy can be set to an equal-length strategy with a step size of 10. Setting an appropriate segmentation strategy can help blockchains with different performance levels control block pull efficiency, preventing the blockchain from being overwhelmed by pull operations. The longer each segment is, the lower the performance requirements for the blockchain. Furthermore, the segmentation strategy for the same blockchain is not necessarily constant; it can be adjusted according to changes in the blockchain's performance (e.g., the type and step size of the segmentation strategy).

[0043] For example, in Figure 1In some embodiments, the processing unit 102 of the edge server 100 can be configured to divide the range of the unpullable block height of the first blockchain 110 from the current starting block height to the current latest block height into one or more segments. In some examples, the storage unit 101 of the edge server 100 can also be configured to store a segmentation strategy database 1014, which can store segmentation strategies for various types of blockchains and default segmentation strategies for blockchains that do not belong to the various types. The processing unit 102 of the edge server 100 can be configured to determine the type of the first blockchain 110 based on the identification information of the first blockchain 110, retrieve a segmentation strategy for the first blockchain 110 from the segmentation strategy database 1014 of the storage unit 101, and divide the unpullable block height range of the first blockchain 110 into one or more segments according to the segmentation strategy. In some examples, the storage unit 101 of the edge server 100 can also be configured to store a segment information database 1012. The segment information database 1012 can store segment information of the first blockchain 110, ranging from the current starting block height to the current latest block height, including the range of block heights to be pulled. For example, it can store the range of block heights from the initial block height to the final block height of each segment, associated with the identification information (i.e., chain ID) of the first blockchain 110. The initial block height refers to the block height of the earliest block in the segment, while the final block height refers to the block height of the latest block in the segment.

[0044] Method 200 further includes enabling multitasking at step S206 to fetch transaction data for blocks included in each of the one or more segments. Multitasking can enable a separate task for each segment to fetch transaction data. In some examples, each individual task can fetch transaction data for each block in the segment sequentially from the segment's initial block height to the segment's terminating block height. The individual tasks can be performed in parallel. A non-limiting example of multitasking can be multithreaded processing, and of course, any suitable technique now known or developed hereafter can be used to implement multitasking. For example, in Figure 1 In some embodiments, the storage device 101 of the edge server 100 may also be configured to store a transaction information database 1013, and the processing device 102 of the edge server 100 may be configured to enable multitasking to pull transaction data of blocks included in each of the one or more segments of the block height range to be pulled from the first blockchain 110 and store the transaction data in the transaction information database 1013 of the storage device 101.

[0045] Therefore, method 200 can improve the efficiency of pulling transaction data from the blockchain by dividing the blockchain into high-range segments and processing these segments in parallel through multi-task processing.

[0046] When the length of a blockchain grows rapidly, the number of segments can become extremely large. In this case, it may become impossible to continuously maintain or improve block fetching efficiency by simply increasing the number of multitasking tasks, and it could even cause a cascading failure of blockchain nodes. Furthermore, as more and more blockchains are connected, multitasking may become congested, meaning that if one blockchain's block fetching efficiency is low, other blockchains will also be unable to fetch blocks efficiently. For example, as... Figure 3 As shown, with Figure 1 In comparison, the system further includes a second blockchain 120 and a third blockchain 130. The blockchain network of the second blockchain 120 includes multiple blockchain nodes 121, 122, 123, and 124, and the blockchain network of the third blockchain 130 includes multiple blockchain nodes 131, 132, 133, and 134. The edge server 100 is communicatively coupled not only to blockchain node 111 of the first blockchain 110, but also to blockchain node 122 of the second blockchain 120 and blockchain node 134 of the third blockchain 130.

[0047] Therefore, this disclosure further adds a bucketing operation after the segmentation operation in step S204 of method 200. By distributing the multiple segments obtained from the segmentation operation into multiple buckets that can be processed independently for multiple tasks, the multitasking of segments in different buckets can be made independent of each other. This block fetching method of segmenting first and then bucketing can further improve the block fetching efficiency.

[0048] Specifically, in some embodiments, before enabling multitasking to pull transaction data of blocks included in each of the one or more segments, the following operations may be performed: setting up multiple buckets, each of which is capable of independent multitasking to pull transaction data of blocks included in each segment assigned to that bucket; and allocating the one or more segments to the multiple buckets. In this way, even if transactions on a single blockchain grow very rapidly, transaction data can be pulled from that blockchain in real-time or near real-time. Furthermore, this segmentation-then-bucketing block retrieval method can also be applied to multiple blockchains. In some embodiments, the segmentation operation described above can be performed on each of the multiple blockchains first, and after dividing the high range of blocks to be pulled from each blockchain into one or more segments, all segments of the multiple blockchains are allocated to the multiple buckets.

[0049] The following is combined with Figure 4A method 300 for pulling transaction data from a blockchain according to other embodiments of this disclosure is described in detail. Method 300 adds a bucketing operation to the segmentation operation compared to method 200. Method 300 includes: at step S302, accessing a node of the blockchain to obtain the current latest block height of the blockchain; at step S304, dividing the range of the blockchain to be pulled from the current starting block height to the current latest block height into one or more segments; at step S306, allocating the one or more segments to a plurality of buckets, each of the plurality of buckets being configured to perform multitasking independently to pull transaction data of the blocks included in that segment from each segment allocated to that bucket; and at step S308, enabling multitasking in each bucket to pull transaction data of the blocks included in that segment from the segment allocated to each bucket.

[0050] Steps S302 and S304 of method 300 are similar to steps S202 and S204 of method 200, and will not be described again here. A non-limiting example of a bucket providing multi-tasking processing could be a thread pool providing multi-threaded processing; of course, any suitable technology known now or developed in the future can be used to implement a bucket providing multi-tasking processing. In some embodiments, the number of buckets can be set according to the number of blockchains. For example, buckets can be added as the number of blockchains increases. This allows for flexible adaptation to rapid growth in the number of blockchains. In some embodiments, the task processing performance of each bucket can be adjusted according to the number of segments in each bucket, which can include, for example, the number of tasks that the bucket can perform individually and / or the processing efficiency of each task. This allows control over the frequency of processing segments within the bucket, preventing the performance of the blockchain itself from being dragged down by pull operations and avoiding a cascading failure of blockchain nodes.

[0051] In some embodiments, segments belonging to the same blockchain can be assigned to the same bucket. In some embodiments, segments from different blockchains can be mixed together and assigned to multiple buckets. In some embodiments, the bucket corresponding to the blockchain can be pre-configured in the blockchain information, thereby all segments of the blockchain can be assigned to the corresponding bucket. In some embodiments, any other suitable bucketing strategy can also be adopted, such as random bucketing, round-robin bucketing, etc. Different bucketing strategies can be pre-configured for different types of blockchains. A default bucketing strategy can also be set so that the default bucketing strategy can be automatically adopted when no bucketing strategy is pre-configured for a certain type of blockchain. In some examples, the default bucketing strategy can be the following bucketing strategy: determine the number of the plurality of buckets as N, where N is a positive integer; calculate the hash value H of one of the following associated with the segment: the identification information of the blockchain to which the segment belongs, the segment's starting block height, the segment's ending block height, or any combination thereof; perform a modulo operation (H%(N-1)) on the hash value H associated with the segment; assign the segment to the (H%(N-1))th bucket among the plurality of buckets. For example, assuming there are 16 buckets, if we calculate the hash value H1 of the blockchain's identifier information, then all segments within the height range of the blocks to be pulled from that blockchain can be assigned to the (H1%15)th bucket among these 16 buckets. If we calculate the hash value H2 of the starting block height of a segment, then each segment can be assigned to the (H2%15)th bucket among these 16 buckets accordingly. In this case, different segments from the same blockchain may be assigned to different buckets. The above bucketing strategy combining hash operations and modulo operations is merely a non-limiting example; other mapping rules can also be used to assign multiple segments to multiple buckets.

[0052] In some embodiments, method 300 further includes storing segment information and the identifier information of the allocated bucket for each segment. The segment information includes the identifier information of the blockchain to which the segment belongs, the block height range of the blocks included in the segment, and the processing status of the segment. The processing status of a segment may include, for example, unprocessed, processing, and processed. For example, when the number of segments in a bucket exceeds the number of tasks that the bucket's multitasking can handle individually, all tasks can be occupied by the corresponding segments, and the processing status of these segments changes to processing, while the processing status of the remaining segments remains unprocessed. When the transaction data of some segments has been retrieved, the processing status of these segments can change to processed, and the corresponding tasks can each select a segment from the remaining unprocessed segments for processing when they become idle.

[0053] For example, in Figure 1In this embodiment, the processing device 102 of the edge server 100 may further be configured to: allocate the one or more segments to multiple buckets, each of the multiple buckets being configured to perform multitasking independently to pull transaction data of the blocks included in each segment allocated to the bucket; store the segment information of each segment and the identification information of the allocated bucket in the segment information database 1012 of the storage device 101, the segment information including the identification information of the blockchain to which the segment belongs, the block height range of the blocks included in the segment, and the processing status of the segment; and enable multitasking in each bucket to pull transaction data of the blocks included in the segment from the segment allocated to each bucket and store the transaction data in the transaction information database 1013 of the storage device 101. In some embodiments, the storage device 101 of the edge server 100 may also be configured to store a bucketing strategy database 1015, which may store bucketing strategies for various types of blockchains and default bucketing strategies for blockchains that do not belong to the various types of blockchains. The processing device 102 may also be configured to: determine the type of the blockchain based on the identification information of the blockchain, retrieve a bucketing strategy for the blockchain from the bucketing strategy database 1015 of the storage device 101; and allocate the one or more segments to the plurality of buckets according to the bucketing strategy.

[0054] It should be understood that the blockchain information database 1011, segment information database 1012, transaction information database 1013, segmentation strategy database 1014, and bucketing strategy database 1015 stored in the storage device 101 of the edge server 100 can take any suitable organizational form; for example, they can be represented as multiple data tables. Furthermore, one or more of the blockchain information database 1011, segment information database 1012, transaction information database 1013, segmentation strategy database 1014, and bucketing strategy database 1015 can be merged into a single database, and any one of the blockchain information database 1011, segment information database 1012, transaction information database 1013, segmentation strategy database 1014, and bucketing strategy database 1015 can also be further split into multiple databases. Therefore, exemplarily dividing the information stored in the storage device 101 into the blockchain information database 1011, segment information database 1012, transaction information database 1013, segmentation strategy database 1014, and bucketing strategy database 1015 facilitates management but is not a limitation. The information in storage device 101 can be maintained in any other suitable management manner.

[0055] Specifically, in Figure 3In this embodiment, in order to retrieve transaction data from the first blockchain 110, the second blockchain 120, and the third blockchain 130, the processing device 102 of the edge server 100 can be configured to: retrieve the IP address and port number of the blockchain node 111 of the first blockchain 110, as well as the public and private keys corresponding to the block retrieval role configured on the first blockchain 110, from the blockchain information database 1011 of the storage device 101 to access the blockchain node 111 of the first blockchain 110 to obtain the current latest block height of the first blockchain 110; retrieve the IP address and port number of the blockchain node 122 of the second blockchain 120, as well as the public and private keys corresponding to the block retrieval role configured on the second blockchain 120, from the blockchain information database 1011 of the storage device 101 to access the blockchain node 122 of the second blockchain 120 to obtain the current latest block height of the second blockchain 120; and retrieve the IP address and port number of the blockchain node 134 of the third blockchain 130, as well as the public and private keys corresponding to the block retrieval role configured on the third blockchain 130, from the blockchain information database 1011 of the storage device 101. The public and private keys corresponding to the block pull role are used to access the blockchain node 134 of the third blockchain 130 to obtain the current latest block height of the third blockchain 130; the block height range to be pulled from the current starting block height to the current latest block height of the first blockchain 110, the second blockchain 120, and the third blockchain 130 are divided into one or more segments; the segments of the first blockchain 110, the second blockchain 120, and the third blockchain 130 are allocated to multiple buckets, and each of the multiple buckets is configured to perform multi-task processing independently. The system retrieves transaction data of blocks included in each segment allocated to the bucket; stores the segment information of each segment and the identification information of the allocated bucket in the segment information database 1012 of the storage device 101, wherein the segment information includes the identification information of the blockchain to which the segment belongs, the block height range of the blocks included in the segment, and the processing status of the segment; and enables multi-task processing in each bucket to retrieve transaction data of blocks included in each segment allocated to each bucket and store the transaction data in the transaction information database 1013 of the storage device 101.

[0056] In some embodiments, method 300 may further include: when a segment with an unprocessed status is selected as a separate task for processing in one of the plurality of buckets: updating the processing status of the segment to processing; sequentially fetching transaction data of each block included in the segment from the segment's initial block height to the segment's terminating block height within the segment's block height range; updating the processing status of the segment to processed when the transaction data of all blocks included in the segment has been successfully fetched; and resetting the processing status of the segment to unprocessed when the transaction data of at least one block included in the segment has not been successfully fetched. Figure 5This is a flowchart illustrating a method 400 for retrieving transaction data from segments in a bucket according to one or more exemplary embodiments of this disclosure. First, at step S401, it is determined whether there are any segments in the bucket with an unprocessed status. If not, at step S413, after waiting for a predetermined time, the process returns to step S401 to determine again whether there are any segments in the bucket with an unprocessed status. This predetermined time can be set according to actual circumstances. If it is determined at step S401 that there are still segments in the bucket with an unprocessed status, then at step S402, it is determined whether there are any idle tasks in the bucket. If all tasks are occupied, at step S414, after waiting for a predetermined time, the process returns to step S402 to determine again whether there are any idle tasks in the bucket. This predetermined time can also be set according to actual circumstances. If it is determined at step S402 that there are still idle tasks in the bucket, then at step S403, a segment with an unprocessed status can be selected from the bucket and assigned to the idle task. Next, at step S404, the processing status of the segment selected at step S403 is updated to "processing". In step S405, the current block height is set equal to the initial block height of the segment selected in step S403. Then, in step S406, transaction data from the blocks of the current block height is retrieved. For example, a list of all transactions in the blocks of the current block height can be returned and all transaction lists can be saved locally, such as the transaction information database 1013 of the storage device 101 of the edge server 100. In step S407, it is determined whether the retrieval in step S406 was successful. If successful, in step S408, the process can proceed to the next block height, that is, the current block height is incremented by one, and in step S409, it is determined whether the current block height is greater than the segment termination block height of the segment selected in step S403. If the current block height is greater than the segment termination block height, it means that the transaction data of all blocks of the segment selected in step S403 has been retrieved, and in step S410, the processing status of the segment selected in step S403 can be updated to processed, and then the process returns to step S401. If the current block height is not greater than the segment termination block height, the process can return to step S406 to continue fetching transaction data from the block with the current block height. Alternatively, if a fetching failure is determined in step S407, a retry can be performed, i.e., re-fetching transaction data from the block with the current block height. Then, at step S411, it is determined whether the number of retries exceeds a predetermined threshold. This predetermined threshold can be set according to the actual situation. For example, when the predetermined threshold is set to zero, it means that retries are not allowed. If it is determined at step S411 that the number of retries is not greater than the predetermined threshold, the process can return to step S406 to retry. If it is determined at step S411 that the number of retries exceeds the predetermined threshold, the processing status of the segment selected in step S403 can be reset to unprocessed at step S412, and then the process returns to step S401. The segment reset to unprocessed returns to the bucket's list of segments waiting to be processed.

[0057] The bucket-based fetching method disclosed herein can effectively isolate low-performance blockchains to prevent them from dragging down high-performance blockchains. If a fetch of a blockchain triggers a low-performance warning, the segment of that blockchain can be downgraded to a low-performance bucket for processing. Blockchain performance can be evaluated using transaction fetching time. In some embodiments, the following operations can be performed: prioritizing multiple buckets according to task processing performance, wherein the task processing performance of a bucket decreases as the bucket's priority decreases; determining that the cumulative processing time of a segment in one of the multiple buckets exceeds a predetermined threshold; resetting the processing state of the segment to unprocessed and moving the segment from the original bucket to a bucket with a lower priority than the original bucket. In some embodiments, if it is determined that the cumulative processing time of a segment in one of the multiple buckets exceeds a predetermined threshold, the processing state of all segments of the blockchain to which the segment belongs can also be reset to unprocessed and all segments of the blockchain to which the segment belongs can be moved from their current buckets to buckets with a lower priority than the current bucket. In some embodiments, when there is no bucket with a lower priority than the stated bucket among the plurality of buckets, the segment may not be removed from the stated bucket. In such cases, the number of tasks that the stated bucket can perform independently can be increased. Additionally or alternatively, in some embodiments, the segmentation strategy for the blockchain can be adjusted based on a comparison of the cumulative processing time of each segment in the blockchain with a predetermined threshold. This prevents the performance of a single blockchain from being too low and hindering the transaction data retrieval of other blockchains.

[0058] Figure 6A specific example of applying this disclosure is illustrated. Assume the first blockchain 110 is a logistics finance blockchain, with a block height range of 10001 to 20000. Querying the identification information of this logistics finance blockchain 110 reveals a pre-configured equal-length strategy with a step size of 100, so it is divided into 100 segments. Assume the second blockchain 120 is a judicial blockchain, with a block height range of 501 to 1000. Querying the identification information of this judicial blockchain 120 reveals no pre-configured segmentation strategy, so it is divided into 50 segments according to the default segmentation strategy (equal-length strategy with a step size of 10). Assume the third blockchain 130 is an emerging digital goods blockchain with rapid development, with a block height range of 1 to 100000. Querying the identification information of this digital goods blockchain 130 reveals a pre-configured equal-frequency strategy with a step size of hour, so it is divided into 200 segments. Then, 16 buckets are provided, prioritized according to task processing performance, each bucket independently providing multi-task processing. If the blockchain information of Logistics Finance Chain 110 is configured with a corresponding bucket 4, then all 100 segments of Logistics Finance Chain 110 will be assigned to bucket 4. If a pre-configured random bucketing strategy is found by querying the identification information of Judicial Chain 120, then the 50 segments of Judicial Chain 120 will be randomly assigned to these 16 buckets. If no pre-assigned bucket number or pre-configured bucketing strategy is found by querying the identification information of Digital Commodity Chain 130, then the 200 segments of Digital Commodity Chain 130 can be assigned to the ((hash value of the identification information of Digital Commodity Chain 130)%15)th bucket according to the default bucketing strategy.

[0059] Scheduled tasks can be set to periodically execute methods for pulling transaction data from a blockchain according to various embodiments of this disclosure. When multiple blockchains exist, corresponding scheduled tasks can be set for each blockchain separately. That is, the time for pulling transaction data from each blockchain does not need to be the same. Even if a segment in a bucket is not completely processed, a new segment can be allocated to the bucket. Moreover, even if a certain pull of a blockchain is not completely completed, a new pull can be performed, at which time segments from different pull periods of that blockchain may exist in multiple buckets. For example, suppose the bucket is processing the transaction data of blocks 1001 to 2000 of a blockchain. These blocks are divided into 100 segments and allocated to the bucket. After a period of time, there may still be 20 segments that have not been processed. However, at this time, the node of that blockchain can still be accessed again to obtain the current latest block height of the blockchain, such as 3000. Then, blocks 2001 to 3000 of that blockchain can still be divided into 100 segments and allocated to the bucket, and they can be processed or wait to be processed together with the 20 segments that were not processed before.

[0060] The method for fetching transaction data from the blockchain by segmenting and then bucketing according to this disclosure exhibits excellent horizontal and vertical scalability. Regarding horizontal scalability, the method allows for flexible adjustment of the number of buckets to accommodate expansions in the number of blockchains, enabling efficient on-chain transaction fetching across multiple blockchains. Regarding vertical scalability, the method controls the frequency of processing segments within each bucket by adjusting the number of tasks processed in each bucket, preventing a cascading failure of blockchain nodes. Since the method provides real-time or near-real-time on-chain transaction fetching, the latency between on-chain and off-chain transactions is minimal or nonexistent, enabling the provision of excellent on-chain transaction query services.

[0061] The following is combined with Figure 7 This invention introduces an apparatus 500 for pulling transaction data from a blockchain according to one or more exemplary embodiments of the present disclosure. Apparatus 500 may be a node device of the blockchain, or a computing resource or computing device communicatively coupled to a node of the blockchain, such as an edge server. Apparatus 500 may include an acquisition module 502, an allocation module 504, and a pull module 506. Acquisition module 502 is configured to access a node of the blockchain to obtain the current latest block height of the blockchain. Allocation module 504 is configured to divide the range of block heights to be pulled from the current starting block height to the current latest block height into one or more segments, wherein the current starting block height is equal to the previous latest block height plus one, and the previous latest block height is the latest block height obtained when transaction data was previously pulled from the blockchain. Pull module 506 is configured to enable multitasking to pull transaction data of blocks included in each of the one or more segments. As previously described, allocation module 504 may also be configured to perform bucketing operations. Specifically, in some embodiments, the allocation module 504 is further configured to: set up a plurality of buckets, each of the plurality of buckets being capable of independent multitasking to pull transaction data of blocks included in each segment allocated to that bucket; and allocate the one or more segments to the plurality of buckets. In such an embodiment, the pull module 506 may be configured to enable multitasking in each bucket to pull transaction data of blocks included in each segment from the segment allocated to each bucket.

[0062] The embodiments of device 500 are basically similar to the aforementioned method embodiments, so they will not be repeated here. For relevant details, please refer to the description in the method embodiment section.

[0063] Figure 8This is a schematic block diagram illustrating a computer system 600 on which one or more exemplary embodiments of the present disclosure may be implemented. For example, an edge server 100 may be implemented by the computer system 600. The computer system 600 includes a bus 602 or other communication mechanism for transmitting information, and a processing means 604 coupled to the bus 602 for processing information. The computer system 600 also includes a memory 606 coupled to the bus 602 for storing instructions to be executed by the processing means 604. The memory 606 may be random access memory (RAM) or other dynamic storage device. The memory 606 may also be used to store temporary variables or other intermediate information during the execution of instructions to be executed by the processing means 604. The computer system 600 also includes a read-only memory (ROM) 608 or other static storage device coupled to the bus 602 for storing static information and instructions for the processing means 604. A storage device 610, such as a disk or optical disk, is provided and coupled to the bus 602 for storing information and instructions. Computer system 600 may be coupled via bus 602 to output device 612 for providing output to a user, such as, but not limited to, a display (such as a cathode ray tube (CRT) or liquid crystal display (LCD)), speakers, etc. Input device 614, such as a keyboard, mouse, microphone, etc., is coupled to bus 602 for transmitting information and command selections to processing device 604. Computer system 600 may perform embodiments of this disclosure. Consistent with certain implementations of this disclosure, results are provided by computer system 600 in response to processing device 604 executing one or more sequences of one or more instructions contained in memory 606. Such instructions may be read into memory 606 from another computer-readable medium, such as storage device 610. Execution of the sequence of instructions contained in memory 606 causes processing device 604 to perform the methods described herein. Alternatively, the teachings may be implemented using hard-wired circuitry instead of or in combination with software instructions. Therefore, implementations of this disclosure are not limited to any particular combination of hardware circuitry and software. In various embodiments, computer system 600 can be connected across a network to one or more other computer systems, such as computer system 600, to form a networked system via network interface 616. This network may include a private network or a public network such as the Internet. In a networked system, one or more computer systems can store data and supply data to other computer systems. As used herein, the term "computer-readable medium" refers to any medium that participates in providing instructions to processing device 604 for execution. Such media can take many forms, including but not limited to non-volatile media, volatile media, and transmission media. Non-volatile media include, for example, optical discs or magnetic disks such as storage device 610. Volatile media include dynamic memory such as memory 606.Transmission media include coaxial cable, copper wire, and optical fiber, including cabling containing bus 602. Common forms of computer-readable media or computer program products include, for example, floppy disks, flexible disks, hard disks, magnetic tape, or any other magnetic media, CD-ROMs, digital video discs (DVDs), Blu-ray discs, any other optical media, thumb drives, memory cards, RAM, PROMs and EPROMs, fast EPROMs, any other memory chips or cartridges, or any other tangible media from which a computer can read. Various forms of computer-readable media may be involved when carrying one or more sequences of one or more instructions to processing device 604 for execution. For example, instructions may initially be carried on a disk of a remote computer. The remote computer may load the instructions into its dynamic memory and transmit them over a telephone line using a modem. A modem local to computer system 600 may receive data over a telephone line and convert the data into an infrared signal using an infrared transmitter. An infrared detector coupled to bus 602 may receive the data carried in the infrared signal and place the data on bus 602. Bus 602 carries data to memory 606, and processing device 604 retrieves instructions from memory 606 and executes the instructions. Optionally, instructions received by memory 606 may be stored on storage device 610 before or after execution by processing device 604.

[0064] According to various embodiments, instructions configured to be executed by a processing device to perform a method are stored on a computer-readable medium. The computer-readable medium may be a device for storing digital information. For example, a computer-readable medium includes a compact disc read-only memory (CD-ROM) as known in the art for storing software. The computer-readable medium is accessed by a processor adapted to execute the instructions configured to be executed.

[0065] For example, this disclosure may also provide a computing device that may include one or more processors and a memory storing computer-executable instructions, which, when executed by the one or more processors, cause the one or more processors to perform the methods described according to any of the foregoing embodiments of this disclosure. Figure 9As shown, computing device 700 may include one or more processors 701 and memory 702 storing computer-executable instructions that, when executed by one or more processors 701, cause one or more processors 701 to perform the methods described in any of the foregoing embodiments of this disclosure. The one or more processors 701 may be, for example, a central processing unit (CPU) of computing device 700. The one or more processors 701 may be any type of general-purpose processor, or may be a processor specifically designed to pull transaction data from a blockchain, such as an application-specific integrated circuit (“ASIC”). Memory 702 may include various computer-readable media accessible by one or more processors 701. In various embodiments, memory 702 described herein may include volatile and non-volatile media, removable and non-removable media. For example, memory 702 may include any combination of random access memory (“RAM”), dynamic RAM (“DRAM”), static RAM (“SRAM”), read-only memory (“ROM”), flash memory, cache memory, and / or any other type of non-transitory computer-readable media. The memory 702 may store information that, when executed by the processor 701, causes the processor 701 to perform the methods described in any of the foregoing embodiments of this disclosure.

[0066] In addition, this disclosure may provide a non-transient storage medium having computer-executable instructions stored thereon, which, when executed by a computer, cause the computer to perform the method described in any of the foregoing embodiments of this disclosure.

[0067] The foregoing has described one or more exemplary embodiments of this disclosure. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0068] In the 1990s, improvements to a technology could be clearly distinguished as either hardware improvements (e.g., improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the methodology). However, with technological advancements, many methodological improvements today can be considered direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved methodology into the hardware circuit. Therefore, it cannot be said that a methodological improvement cannot be implemented using hardware physical modules. For example, a Programmable Logic Device (PLD) (such as a Field Programmable Gate Array (FPGA)) is such an integrated circuit whose logic function is determined by the user programming the device. Designers can program and "integrate" a digital system onto a PLD themselves, without needing chip manufacturers to design and manufacture dedicated integrated circuit chips. Furthermore, nowadays, instead of manually manufacturing integrated circuit chips, this programming is mostly implemented using "logic compiler" software. Similar to the software compiler used in program development, the original code before compilation must be written in a specific programming language, called a Hardware Description Language (HDL). There are many HDLs, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, and RHDL (Ruby Hardware Description Language). Currently, the most commonly used are VHDL (Very-High-Speed ​​Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should understand that by simply performing some logic programming on the method flow using one of these hardware description languages ​​and programming it into an integrated circuit, the hardware circuit implementing the logical method flow can be easily obtained.

[0069] The controller can be implemented in any suitable manner. For example, it can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro)processor, logic gates, switches, application-specific integrated circuits (ASICs), programmable logic controllers, and embedded microcontrollers. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicon Labs C8051F320. A memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art will also recognize that, in addition to implementing the controller in purely computer-readable program code form, the same functionality can be achieved by logically programming the method steps to make the controller take the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers. Therefore, such a controller can be considered a hardware component, and the means included therein for implementing various functions can also be considered as structures within the hardware component. Alternatively, the means for implementing various functions can be considered as both software modules implementing the method and structures within the hardware component.

[0070] The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or physical entities, or by products with certain functions. A typical implementation device is a server system. Of course, this application does not exclude the possibility that, with the future development of computer technology, the computer implementing the functions of the above embodiments can be, for example, a personal computer, a laptop computer, an in-vehicle human-machine interaction device, a cellular phone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or any combination of these devices.

[0071] While one or more embodiments of this specification provide the operational steps of the methods described in the embodiments or flowcharts, more or fewer operational steps may be included based on conventional or non-inventive means. The order of steps listed in the embodiments is merely one possible order of execution among many steps and does not represent the only possible order. In actual device or end product execution, the methods shown in the embodiments or drawings may be executed sequentially or in parallel (e.g., in a parallel processor or multi-threaded processing environment, or even a distributed data processing environment). The terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, product, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, product, or apparatus. Without further limitations, the presence of other identical or equivalent elements in the process, method, product, or apparatus that includes the elements is not excluded. For example, the use of terms such as "first," "second," etc., is to denote names and does not indicate any particular order.

[0072] For ease of description, the above devices are described in terms of function, divided into various modules. Of course, when implementing one or more of these specifications, the functions of each module can be implemented in one or more software and / or hardware components, or a module that performs the same function can be implemented by a combination of multiple sub-modules or sub-units. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division; in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, indirect coupling or communication connection between devices or units, and may be electrical, mechanical, or other forms.

[0073] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0074] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0075] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0076] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0077] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0078] Computer-readable media, including both permanent and non-permanent, removable and non-removable media, can store information using any method or technology. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage, graphene storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.

[0079] Those skilled in the art will understand that one or more embodiments of this specification can be provided as a method, system, or computer program product. Therefore, one or more embodiments of this specification may take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, one or more embodiments of this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0080] One or more embodiments of this specification can be described in the general context of computer-executable instructions, such as program modules, that are executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform a particular task or implement a particular abstract data type. One or more embodiments of this specification can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In a distributed computing environment, program modules can reside in local and remote computer storage media, including storage devices.

[0081] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, system embodiments are basically similar to method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments. In the description of this specification, the terms "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of this specification. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described can be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification and the features of different embodiments or examples.

[0082] The above description is merely an embodiment of one or more embodiments of this specification and is not intended to limit the scope of this specification. Various modifications and variations can be made to the one or more embodiments of this specification by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this specification should be included within the scope of the claims.

Claims

1. A method for retrieving transaction data from a blockchain, comprising: Access a node in the blockchain to obtain the current latest block height of the blockchain; Divide the range of the blockchain from the current starting block height to the current latest block height into one or more segments. The current starting block height is equal to the previous latest block height plus one. The previous latest block height is the latest block height obtained when the transaction data was previously pulled from the blockchain. Multiple buckets are set up, and each of the multiple buckets can perform multitasking independently to pull transaction data of the blocks included in each segment allocated to the bucket. Assign the one or more segments to the plurality of buckets; as well as Multitasking is enabled in each of the plurality of buckets to pull transaction data of blocks included in each segment from the segments allocated to each bucket. The blockchain includes multiple blockchains, each with different performance characteristics. Furthermore, the method further includes: After dividing the height range of the blocks to be pulled from each of the plurality of blockchains into one or more segments, all segments of the plurality of blockchains are assigned to the plurality of buckets; The buckets are prioritized according to their task processing performance, wherein the task processing performance of a bucket decreases as the bucket's priority decreases. The cumulative time that a segment in one of the plurality of buckets has been in a processing state exceeds a predetermined threshold; and The processing status of the segment is reset to unprocessed, and the segment is moved from the bucket to a bucket with a lower priority than the bucket to avoid the segment hindering the retrieval of transaction data for other segments in the bucket.

2. The method according to claim 1, further comprising: The segmentation strategy for the blockchain is determined based on the blockchain's identification information; as well as The blockchain's block height range to be pulled is divided into one or more segments according to the segmentation strategy.

3. The method according to claim 2, wherein, The segmentation strategy is one of the following: Equal-length strategy, where each segment consists of the same number of blocks; An equal-frequency strategy, where each segment comprises blocks generated within a time period of equal length.

4. The method according to claim 1, wherein, Nodes that access the blockchain include those configured with blockchain information to access the blockchain. The blockchain information includes the IP address and port number of the nodes in the blockchain, as well as the public and private keys corresponding to the block retrieval roles configured on the blockchain.

5. The method according to claim 1, further comprising: The system stores segment information and the identifier information of the assigned bucket for each segment. The segment information includes the identifier information of the blockchain to which the segment belongs, the block height range of the blocks included in the segment, and the processing status of the segment.

6. The method according to claim 5, further comprising: When selecting a segment with an unprocessed status from one of the multiple buckets as a separate task for processing: Update the processing status of this segment to "Processing"; From the initial block height to the final block height of the segment, sequentially retrieve the transaction data of each block included in the segment; When all the transaction data of the blocks included in this segment have been successfully retrieved, the processing status of this segment is updated to processed; If the transaction data of at least one block included in the segment is not successfully retrieved, the processing status of the segment is reset to unprocessed.

7. The method according to claim 1, further comprising: The processing status of all segments in the blockchain to which the given segment belongs is reset to unprocessed, and all segments in the blockchain to which the given segment belongs are moved from their current bucket to a bucket with a lower priority than the current bucket.

8. The method according to claim 1, further comprising: When the cumulative time that a segment in one of the multiple buckets is in the processing state exceeds a predetermined threshold, the processing state of all segments of the blockchain to which the segment belongs is reset to unprocessed, and all segments of the blockchain to which the segment belongs are moved from their current bucket to a bucket with a lower priority than the current bucket.

9. The method according to claim 1, wherein, The number of buckets is set according to the number of blockchains.

10. The method according to claim 1, wherein, The number of tasks that a bucket can perform individually and / or the processing efficiency of each task are adjusted based on the number of segments in each of the plurality of buckets.

11. The method according to claim 1, wherein, Assigning the one or more segments to the plurality of buckets includes: The number of the plurality of buckets is determined to be N, where N is a positive integer; Calculate the hash value H of one of the following items associated with the segment: The identifier information of the blockchain to which the segment belongs. Segment starting block height, Segment termination block height, or combinations thereof; Perform a modulo operation (H%(N-1)) on the hash value H associated with this segment; The segment is assigned to the (H%(N-1))th bucket among the plurality of buckets.

12. The method according to claim 1, wherein, Each of the multiple buckets is a thread pool, and the multitasking of the buckets is implemented by multiple threads.

13. The method according to claim 1, further comprising: The segmentation strategy for the blockchain is adjusted by comparing the cumulative time of each segment in the processing state of one or more segments of the blockchain with a predetermined threshold.

14. A device for pulling transaction data from a blockchain, comprising: The acquisition module is configured to access nodes in the blockchain to obtain the current latest block height of the blockchain; The allocation module is configured to be used for: The range of the blockchain to be pulled, from the current starting block height to the current latest block height, is divided into one or more segments. The current starting block height is equal to the previous latest block height plus one, and the previous latest block height is the latest block height obtained when transaction data was previously pulled from the blockchain. Multiple buckets are configured, each capable of independent multitasking to pull transaction data from each segment allocated to that bucket, specifically the blocks included in that segment. Assign the one or more segments to the plurality of buckets; as well as The pull module is configured to enable multitasking in each of the plurality of buckets to pull transaction data of blocks included in each segment from each segment allocated to each bucket. The blockchain includes multiple blockchains, each with different performance characteristics. Furthermore, the allocation module is also configured to: After dividing the height range of the blocks to be pulled from each of the plurality of blockchains into one or more segments, all segments of the plurality of blockchains are assigned to the plurality of buckets; The buckets are prioritized according to their task processing performance, wherein the task processing performance of a bucket decreases as the bucket's priority decreases. The cumulative time that a segment in one of the plurality of buckets has been in a processing state exceeds a predetermined threshold; and The processing status of the segment is reset to unprocessed, and the segment is moved from the bucket to a bucket with a lower priority than the bucket to avoid the segment hindering the retrieval of transaction data for other segments in the bucket.

15. An edge server for pulling transaction data from a blockchain, comprising: The storage device is configured to store a blockchain information database, a segment information database, and a transaction information database. The blockchain information database stores the IP address and port number of each node in the blockchain, as well as the public and private keys corresponding to the block retrieval roles configured on the blockchain. as well as Processing apparatus, the processing apparatus being configured to: The storage device retrieves the IP address and port number of the blockchain node from its blockchain information database, as well as the public and private keys corresponding to the block retrieval roles configured on the blockchain, thereby accessing the blockchain node to obtain the current latest block height of the blockchain. Divide the range of the blockchain from the current starting block height to the current latest block height into one or more segments. The current starting block height is equal to the previous latest block height plus one. The previous latest block height is the latest block height obtained when the transaction data was previously pulled from the blockchain. The one or more segments are assigned to multiple buckets, and each of the multiple buckets is configured to perform multitasking independently to pull transaction data of the blocks included in each segment assigned to that bucket. The segment information and the identifier information of the allocated bucket for each segment are stored in the segment information database of the storage device. The segment information includes the identifier information of the blockchain to which the segment belongs, the block height range of the blocks included in the segment, and the processing status of the segment; and Multitasking is enabled in each bucket to pull transaction data of blocks included in the segments allocated to each bucket and store the transaction data in the transaction information database of the storage device. The blockchain includes multiple blockchains, each with different performance characteristics. Furthermore, the processing device is configured to: After dividing the height range of the blocks to be pulled from each of the plurality of blockchains into one or more segments, all segments of the plurality of blockchains are assigned to the plurality of buckets; The buckets are prioritized according to their task processing performance, wherein the task processing performance of a bucket decreases as the bucket's priority decreases. The cumulative time that a segment in one of the plurality of buckets has been in a processing state exceeds a predetermined threshold; and The processing status of the segment is reset to unprocessed, and the segment is moved from the bucket to a bucket with a lower priority than the bucket to avoid the segment hindering the retrieval of transaction data for other segments in the bucket.

16. The edge server according to claim 15, wherein, The storage device is further configured to store a segmentation strategy database and a bucketing strategy database. The segmentation strategy database stores segmentation strategies for various types of blockchains and a default segmentation strategy for blockchains that do not belong to the various types of blockchains. The bucketing strategy database stores bucketing strategies for various types of blockchains and a default bucketing strategy for blockchains that do not belong to the various types of blockchains. The processing device is further configured to: The type of the blockchain is determined based on the blockchain's identification information, so that segmentation strategies and bucketing strategies for the blockchain can be retrieved from the segmentation strategy database and bucketing strategy database of the storage device, respectively. The blockchain's block height is divided into one or more segments according to the segmentation strategy; and The one or more segments are assigned to the multiple buckets according to the bucketing strategy.

17. A computing device for pulling transaction data from a blockchain, comprising: One or more processors; as well as A memory storing computer-executable instructions, which, when executed by the one or more processors, cause the one or more processors to perform the method according to any one of claims 1 to 13.

18. A non-transient storage medium having stored thereon computer-executable instructions, which, when executed by a computer, cause the computer to perform the method according to any one of claims 1 to 13.

Citation Information

Patent Citations

  • Offline block chain system operation method, device and equipment and storage medium

    CN109871263A

  • Bank data sharing method based on block chain and related equipment

    CN110224808A

  • Block storage method and device

    CN110597912A