Blockchain data analysis method, device and electronic device

By dynamically adjusting the number of concurrent parsing blocks for blockchain data parsing, the problem of parsing failure caused by too many blocks is solved, and the efficiency and stability of blockchain data parsing are improved.

CN115037813BActive Publication Date: 2024-08-23BEIJING ZHIFAN TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210649617.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-08
Publication Date
2024-08-23
Estimated Expiration
2042-06-08

AI Technical Summary

Technical Problem

During the blockchain data parsing process, due to memory limitations due to too many blocks read in each batch, the program parsing fails, affecting parsing efficiency.

Method used

By obtaining the number of concurrent parsing blocks, parsing time, expected minimum and maximum parsing time of the current batch, calculate the parsing time adjustment coefficient and the concurrent parsing block number adjustment coefficient, and dynamically adjust the number of concurrent parsing blocks in the next batch. Avoid parsing failures and improve efficiency.

Benefits of technology

It effectively avoids parsing failures caused by too many blocks, ensures the parsing efficiency of blockchain data, and ensures the stability and speed of data processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115037813B
    Figure CN115037813B
Patent Text Reader

Abstract

The present invention discloses a blockchain data parsing method, device and electronic device, the method comprising: when block data parsing is required for a blockchain to be parsed, obtaining blocks of the number of concurrent parsed blocks corresponding to the current batch from the blockchain to be parsed and responding to the block parsing operation of the current batch; obtaining the parsing time consumed when the parsing operation is performed on the blocks of the current batch; determining a parsing time adjustment coefficient according to the parsing time and the expected shortest parsing time and the expected longest parsing time corresponding to data parsing of the blockchain to be parsed; determining a concurrent parsing block number adjustment coefficient corresponding to the next batch according to the parsing time adjustment coefficient and the concurrent parsing block number adjustment coefficient corresponding to the current batch; determining the concurrent parsing block number corresponding to the next batch according to the concurrent parsing block number adjustment coefficient corresponding to the next batch and the concurrent parsing block number corresponding to the current batch.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of blockchain technology, and in particular to a blockchain data parsing method, device and electronic device. Background Art

[0002] Blockchain is a secure and shared distributed ledger database in which data is recorded in blocks. When analyzing block data, the usual practice is to read block information one by one in batches according to the order of block height, read several blocks of data information in each batch, and then process and analyze the data concurrently. The number of blocks read in each batch determines the subsequent processing speed. The more blocks read in each batch, the greater the program throughput and the faster the processing speed; however, when the number of blocks read in each batch reaches a limit, the program parsing will fail due to memory limitations. Therefore, it is urgent to propose a blockchain data parsing method to determine the number of concurrent parsed blocks in each batch to avoid affecting the parsing efficiency. Summary of the invention

[0003] Therefore, the present invention provides a blockchain data parsing method, device and electronic device to determine the number of concurrent parsed blocks in each batch.

[0004] According to a first aspect, an embodiment of the present invention discloses a blockchain data parsing method, which is applied to a blockchain data parsing device, wherein the blockchain data parsing device is associated with a blockchain to be parsed, and is used to obtain a block to be parsed from the blockchain to be parsed; comprising: when it is necessary to perform block data parsing on the blockchain to be parsed, obtaining a block corresponding to the number of concurrent parsed blocks of the current batch from the blockchain to be parsed and responding to a block parsing operation on the current batch; obtaining a parsing time consumed when performing a parsing operation on the blocks of the current batch; determining a parsing time adjustment coefficient according to the parsing time and an expected minimum parsing time and an expected maximum parsing time corresponding to data parsing on the blockchain to be parsed; determining a concurrent parsing block number adjustment coefficient corresponding to the next batch according to the parsing time adjustment coefficient and the concurrent parsing block number adjustment coefficient corresponding to the current batch; determining a concurrent parsing block number corresponding to the next batch according to the concurrent parsing block number adjustment coefficient corresponding to the next batch and the concurrent parsing block number corresponding to the current batch.

[0005] Optionally, the method also includes: if the current batch is an initial batch, obtaining performance data of the blockchain data parsing device and attribute data of the blockchain to be parsed; determining parsing parameters corresponding to the initial batch according to the performance data of the blockchain data parsing device and the attribute data of the blockchain to be parsed, the parsing parameters including: the expected shortest parsing time, the expected longest parsing time, the number of concurrent parsing blocks corresponding to the initial batch, and an adjustment coefficient of the number of concurrent parsing blocks corresponding to the initial batch.

[0006] Optionally, the method further includes: repeating the steps of obtaining the block with the number of concurrently parsed blocks corresponding to the current batch from the blockchain to be parsed and responding to the block parsing operation of the current batch to determining the number of concurrently parsed blocks corresponding to the next batch according to the adjustment coefficient of the number of concurrently parsed blocks corresponding to the next batch and the number of concurrently parsed blocks corresponding to the current batch, until all the block data in the blockchain to be parsed are parsed.

[0007] Optionally, obtaining blocks of the number of concurrently parsed blocks corresponding to the current batch from the blockchain to be parsed and responding to the block parsing operation of the current batch includes: performing a parsing operation on the blocks of the current batch and responding to a storage operation on the block data parsed from the current batch.

[0008] According to the second aspect, an embodiment of the present invention further discloses a blockchain data parsing device, which is applied to a blockchain data parsing device, wherein the blockchain data parsing device is associated with a blockchain to be parsed, and is used to obtain a block to be parsed from the blockchain to be parsed; comprising: a first parsing module, which is used to obtain a block corresponding to the number of concurrent parsed blocks of the current batch from the blockchain to be parsed when block data parsing of the blockchain to be parsed is required, and respond to the block parsing operation of the current batch; a first acquisition module, which is used to obtain the parsing time consumed when the parsing operation is performed on the blocks of the current batch; a first determination module, which is used to determine a parsing time adjustment coefficient according to the parsing time and the expected shortest parsing time and the expected longest parsing time corresponding to the data parsing of the blockchain to be parsed; a second determination module, which is used to determine a concurrent parsing block number adjustment coefficient corresponding to the next batch according to the parsing time adjustment coefficient and the concurrent parsing block number adjustment coefficient corresponding to the current batch; a third determination module, which is used to determine the number of concurrent parsing blocks corresponding to the next batch according to the concurrent parsing block number adjustment coefficient corresponding to the next batch and the number of concurrent parsing blocks corresponding to the current batch.

[0009] Optionally, the device also includes: a second acquisition module, used to obtain the performance data of the blockchain data parsing device and the attribute data of the blockchain to be parsed if the current batch is an initial batch; a fourth determination module, used to determine the parsing parameters corresponding to the initial batch according to the performance data of the blockchain data parsing device and the attribute data of the blockchain to be parsed, and the parsing parameters include: the expected shortest parsing time, the expected longest parsing time, the number of concurrent parsing blocks corresponding to the initial batch, and the concurrent parsing block number adjustment coefficient corresponding to the initial batch.

[0010] Optionally, the device further includes: a second parsing module, configured to repeat the steps of obtaining the blocks of the number of concurrently parsed blocks corresponding to the current batch from the blockchain to be parsed and responding to the block parsing operation of the current batch to the step of determining the number of concurrently parsed blocks corresponding to the next batch according to the concurrently parsed block number adjustment coefficient corresponding to the next batch and the number of concurrently parsed blocks corresponding to the current batch, until all block data in the blockchain to be parsed are parsed.

[0011] Optionally, the first parsing module is further configured to perform a parsing operation on the blocks of the current batch and respond to a storage operation on the block data parsed from the current batch.

[0012] According to the third aspect, an embodiment of the present invention further discloses an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor performs the steps of the blockchain data parsing method as described in the first aspect or any optional implementation manner of the first aspect.

[0013] According to the fourth aspect, an embodiment of the present invention further discloses a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the blockchain data parsing method as described in the first aspect or any optional embodiment of the first aspect are implemented.

[0014] The technical solution of the present invention has the following advantages:

[0015] The blockchain data parsing method / device provided by the present invention is applied to a blockchain data parsing device, the blockchain data parsing device is associated with a blockchain to be parsed, and is used to obtain a block to be parsed from the blockchain to be parsed; when block data parsing of the blockchain to be parsed is required, a block corresponding to the number of concurrent parsed blocks of the current batch is obtained from the blockchain to be parsed and a block parsing operation of the current batch is responded to, the parsing time consumed when the parsing operation is performed on the blocks of the current batch is obtained, a parsing time adjustment coefficient is determined according to the parsing time and an expected minimum parsing time and an expected maximum parsing time corresponding to data parsing of the blockchain to be parsed, a concurrent parsing block number adjustment coefficient corresponding to the next batch is determined according to the parsing time adjustment coefficient and the concurrent parsing block number adjustment coefficient corresponding to the current batch, and the concurrent parsing block number corresponding to the next batch is determined according to the concurrent parsing block number adjustment coefficient corresponding to the next batch and the concurrent parsing block number corresponding to the current batch. By determining the parsing time of the blocks in the current batch combined with the parsing time adjustment parameters and the concurrent parsing block number adjustment coefficient, the number of concurrent parsing blocks corresponding to the next batch can be flexibly adjusted and determined, thereby avoiding the situation where the parsing fails due to too many blocks read in any batch, and ensuring the parsing efficiency of the block data of the blockchain to be parsed. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0017] Figure 1 This is a flowchart of a specific example of the blockchain data parsing method in an embodiment of the present invention;

[0018] Figure 2 This is a principle block diagram of a specific example of a blockchain data parsing device in an embodiment of the present invention;

[0019] Figure 3 FIG. 4 is a specific example diagram of an electronic device in an embodiment of the present invention. DETAILED DESCRIPTION

[0020] The technical solution of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance.

[0021] In addition, the technical features involved in the different embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0022] The embodiment of the present invention discloses a blockchain data parsing method, which is applied to a blockchain data parsing device. The blockchain data parsing device is associated with a blockchain to be parsed, and is used to obtain a block to be parsed from the blockchain to be parsed. The blockchain data parsing device can be a node in the blockchain to be parsed, or can be connected to any node in the blockchain to be parsed to obtain a block to be parsed from the blockchain to be parsed. In the embodiment of the present application, the blockchain data parsing device can be a server, on which a blockchain data parsing program is pre-configured, and the server is connected to a database for storing blockchain data. Figure 1 As shown, the method comprises the following steps:

[0023] Step 101, when it is necessary to perform block data parsing on the blockchain to be parsed, obtain the block corresponding to the current batch from the blockchain to be parsed, and respond to the block parsing operation on the current batch; illustratively, the number of concurrent parsed blocks corresponding to the current batch can be determined based on the historical parsing data of the blockchain storing the same type of data by the parsing device with the same configuration, or can be determined based on the number of batches corresponding to the case where the program parsing fails when the parsing device with the same configuration performs data parsing on the blockchain storing the same type of data; or if the performance configuration of the blockchain data parsing device currently in use is different from that of the device performing data parsing historically and / or the attributes of the parsed blockchain data are different, the number of concurrent parsed blocks in the current parsing process can be flexibly adjusted and determined based on the difference in performance configuration and / or the difference in blockchain data attributes.

[0024] As an optional implementation of the present invention, the method further includes: if the current batch is an initial batch, obtaining the performance data of the blockchain data parsing device and the attribute data of the blockchain to be parsed; illustratively, the performance data of the blockchain data parsing device includes but is not limited to the CPU computing power and memory size of the device; the attribute data of the blockchain to be parsed includes but is not limited to the complexity of the block data structure of the blockchain to be parsed, the block size, the throughput of the data nodes in the blockchain, and the network connection speed of the blockchain network. Different blockchains will adopt different data structure designs according to their source code and system structure. The data structure design scheme may include but is limited to data nesting level, update logic, uniqueness generation method, encryption method, etc. The complexity of the block structure can be determined according to the complexity of the data nesting level, update logic complexity, and the complexity of the encryption algorithm used in the data structure design scheme. These may also cause additional computing power consumption in the process from synchronization data to plaintext data and from serialized data to structured data. After synchronizing the open source data of the nodes on the chain, targeted data parsing needs to be performed according to the characteristics and design of the chain, and it is impossible to use a general method to cover all blockchain parsing problems. In addition, the unique design of some blockchains, such as the rollback mechanism of the ETH chain, requires extra attention to whether the blocks are confirmed immediately and the changes in the number of transactions when parsing them, which will also create additional burdens in the calculation process.

[0025] The parsing parameters corresponding to the initial batch are determined according to the performance data of the blockchain data parsing device and the attribute data of the blockchain to be parsed, and the parsing parameters include: the expected shortest parsing time, the expected maximum parsing time, the number of concurrent parsed blocks corresponding to the initial batch, and the concurrent parsed block number adjustment coefficient corresponding to the initial batch.

[0026] Exemplarily, the expected shortest parsing time (T ) corresponding to the blockchain to be parsed is determined according to the performance of the server where the blockchain data parsing program is located and the attribute data of the blockchain to be parsed. min ), expected maximum parsing time (T max ), the number of concurrent parsed blocks corresponding to the initial batch (X0), and the adjustment coefficient of the number of concurrent parsed blocks corresponding to the initial batch (K0).

[0027] The expected shortest parsing time (T min ), the expected maximum parsing time (T max), the number of concurrent parsed blocks corresponding to the initial batch (X0) can be determined by comparing the performance data of the blockchain data parsing device and the attribute data of the blockchain to be parsed with the historical data; for example, it can be determined according to the parsing time consumed when a program parsing fails when a parsing device with the same configuration performs data parsing on a blockchain storing the same type of data, and the expected maximum parsing time is less than the parsing time consumed when the program parsing fails; similarly, the above-mentioned parsing parameters can also be determined according to the difference between the parsing devices with different performance or the blockchain to be parsed with different data attributes in the historical data, and the adjustment coefficient of the number of concurrent parsed blocks corresponding to the initial batch can be set to 1, so as to adjust the number of corresponding batches in time during the subsequent parsing process.

[0028] Step 102, obtaining the parsing time consumed when performing the parsing operation on the blocks of the current batch; illustratively, responding to the timing operation when performing the parsing operation on the blocks of the current batch, and obtaining the parsing time consumed during the parsing operation of the current batch according to the timing operation result (f n (X)).

[0029] Step 103, determining a parsing time adjustment coefficient according to the parsing time and the expected shortest parsing time and the expected longest parsing time corresponding to data parsing of the blockchain to be parsed;

[0030] For example, after the block data of the current batch is parsed, according to the parsing time (f n (X)) Calculate the parsing time adjustment coefficient (c). For the nth batch of parsing, c satisfies:

[0031]

[0032] In the process of continuously reading and calculating block batch data, for any block parsing time f n (X)∈(T min ,T max ),always Make |f n (X)-f n-1 (X)|≤ε, where T max >0,T min >0. Among them, ε is the smallest time interval of any limit. The above belongs to the definition of mathematical limit. To clearly explain the analytical time f n (X) This sequence prediction value is differentiable on the continuous X. That is, in the calculation process of any batch, the total parsing time consumed by the batch block (f n(X)) is always limited to a fixed constant range. The analysis time adjustment coefficient (c) can be calculated by the following method based on various theoretical calculation methods and practical process supplementation:

[0033] (1) A fixed value is obtained by statistically calculating the historical parsed data corresponding to the parsed data of the same type of blocks; calculating the value of c according to method (1) will make the entire adaptive calculation process relatively stable, and its testing and actual performance have verified its superiority. According to the changes in the fixed block generation cycle (or time cycle), the fixed value of c is calculated and refreshed to ensure that it can meet the performance of adaptive response to the latest block; and it can be dynamically tuned by speeding up the update calculation frequency of the constant value of c, thereby improving the immediate adaptability to block changes.

[0034] (2) Dynamically calculate the parsing time adjustment coefficient (c) based on the real-time parsing time sequence f(X).

[0035] Parsing time sequence f(X) = (f n-m (X),f n-m+1 (X)…f n-1 (X)), the parsing time adjustment parameter corresponding to the current batch (c n ) The parsing time sequence f(X) consisting of the previous m batches and c corresponding to the previous batch n-1 Joint decision.

[0036] c n =softmax(c n-1 +pf(X))+k

[0037] Among them, the m value can select different fixed integer values ​​according to the different blockchains to be parsed, usually an integer value within 10. If the value of m is too large, it will affect the actual calculation effect. For example, the ETH chain can select 5 batches for dynamic calculation, which can effectively increase the adaptability to changes in block output; and p is a series of constant parameters, that is, p = {p0, p1, p2, p3...}. Usually for all p, p∈(0,1], the number of parameters p and the parsing time in the parsing time sequence are one-to-one corresponding, that is, each parsing time will have a constant parameter p corresponding to it, which is used to adjust the impact of each parsing time on the final calculation result. The size of parameter p can be directly used to adjust the size of the impact of the parsing time on the result. Usually, the longer the batch is from the current batch, the smaller the value of p, for example, p = {0.1, 0.2, 0.3, 0.4...}. k is a constant value, k∈(0,1], and the existence of k can avoid excessive bias in time series prediction to a certain extent.

[0038] Step 104, determining a concurrent parsing block quantity adjustment coefficient corresponding to the next batch according to the parsing time adjustment coefficient and a concurrent parsing block quantity adjustment coefficient corresponding to the current batch;

[0039] For example, according to the current batch of concurrent parsing block number adjustment coefficient (K n ) and the analysis time adjustment coefficient (c) corresponding to the current batch jointly determine the concurrent analysis block number adjustment coefficient (K) corresponding to the next batch n+1 ). In the embodiment of the present application, the concurrent parsing block quantity adjustment coefficient (K) corresponding to the next batch n+1 ) can be calculated according to the following formula:

[0040] K n+1 =(1+c)*K n , n∈N +

[0041] K n+1 As a coefficient for adjusting the block batch size in the sequence change, the value of the current state will change with the calculation result of the previous time state.

[0042] Step 105 , determining the number of concurrent parsing blocks corresponding to the next batch according to the concurrent parsing block number adjustment coefficient corresponding to the next batch and the number of concurrent parsing blocks corresponding to the current batch.

[0043] For example, according to the number of concurrent parsing blocks corresponding to the current batch (X n ) and the adjustment coefficient of the number of concurrent parsed blocks corresponding to the next batch (K n+1 ) together calculate the number of concurrent parsing blocks corresponding to the next batch (X n+1 ). In the embodiment of the present application, the number of concurrent parsing blocks corresponding to the next batch (X n+1 ) can be calculated according to the following formula:

[0044] X n+1 =K n+1 ·X n

[0045] X n+1 The parameters used for concurrent parsing of the current batch are sent to the parsing program for block data parsing.

[0046] According to the calculated number of concurrent parsed blocks X corresponding to the next batch n+1 , obtain the corresponding number of next batches of blocks from the blockchain to be parsed and parse them. When a batch fails to be parsed because the amount of data exceeds the hardware resource limit, follow f n (X)>T max Situation handling, using the newly calculated X n+1Re-read and parse the n+1th batch of data.

[0047] The blockchain data parsing method provided by the present invention flexibly adjusts and determines the number of concurrent parsed blocks corresponding to the next batch by determining the parsing time of the blocks of the current batch in combination with the parsing time adjustment parameter and the concurrent parsing block number adjustment coefficient, thereby avoiding the situation where the parsing fails due to too many blocks read in any batch, and ensuring the parsing efficiency of the block data of the blockchain to be parsed.

[0048] As an optional implementation of the present invention, the method further includes: repeating the steps of obtaining the blocks of the number of concurrently parsed blocks corresponding to the current batch from the blockchain to be parsed and responding to the block parsing operation of the current batch to the step of determining the number of concurrently parsed blocks corresponding to the next batch according to the concurrently parsed block number adjustment coefficient corresponding to the next batch and the number of concurrently parsed blocks corresponding to the current batch, until all block data in the blockchain to be parsed are parsed.

[0049] As an optional implementation of the present invention, step 101 includes: performing a parsing operation on the blocks of the current batch and responding to a storage operation on the block data parsed from the current batch.

[0050] As a specific implementation of the present invention, the solution recorded in the embodiment of the present application is described by taking Ethereum as the parsing object:

[0051] First, the parsing parameters corresponding to the initial batch are determined based on the performance data of the server and the attribute data of the blockchain to be parsed on Ethereum, including: the expected shortest parsing time (T min ) is 60s, and the expected maximum parsing time (T max ) is 180s, the number of concurrent parsed blocks corresponding to the initial batch (X1) is 100, and the adjustment coefficient of the number of concurrent parsed blocks corresponding to the initial batch (K1) is 1.

[0052] Secondly, the blockchain node program is connected through the pre-integrated blockchain data parsing program on the server to read and parse the first batch of blocks and store the parsed block data in the blockchain node database. After the parsing is completed, the parsing time f1(X) is recorded, for example, f1(X) is 30s.

[0053] The resolution time adjustment coefficient c is calculated according to f1(X), where c is obtained by a fixed value method. In the present embodiment, c is taken as 0.1 as an example:

[0054]

[0055] From the above formula, we can get: f1(X)<60s, and c=0.1.

[0056] Next, the concurrent parsing block quantity adjustment coefficient (K2) corresponding to the next batch is calculated based on c and the concurrent parsing block quantity adjustment coefficient (K1), and K2 = (1 + c) * K1 = 1.1 is obtained.

[0057] Again, the number of concurrent parsing blocks corresponding to the next batch (X2) is calculated based on K2 and the number of concurrent parsing blocks corresponding to the initial batch (X1), and X2=K2*X1=110 is obtained.

[0058] Finally, when the next batch of parsing is performed, 110 blocks are obtained from the blockchain to be parsed as concurrent blocks and respond to the next batch of parsing operations. Repeat the above steps until all block data in the blockchain to be parsed are parsed.

[0059] The embodiment of the present invention further discloses a blockchain data parsing device, which is applied to a blockchain data parsing device, wherein the blockchain data parsing device is associated with a blockchain to be parsed, and is used to obtain a block to be parsed from the blockchain to be parsed; Figure 2 As shown, the device comprises:

[0060] The first parsing module 201 is used to obtain the number of concurrent parsed blocks corresponding to the current batch from the blockchain to be parsed and respond to the block parsing operation of the current batch when block data parsing of the blockchain to be parsed is required;

[0061] The first acquisition module 202 is used to acquire the parsing time consumed when performing a parsing operation on the blocks of the current batch;

[0062] A first determination module 203 is used to determine a parsing time adjustment coefficient according to the parsing time and an expected minimum parsing time and an expected maximum parsing time corresponding to data parsing of the blockchain to be parsed;

[0063] A second determination module 204 is used to determine the concurrent parsing block quantity adjustment coefficient corresponding to the next batch according to the parsing time adjustment coefficient and the concurrent parsing block quantity adjustment coefficient corresponding to the current batch;

[0064] The third determination module 205 is used to determine the number of concurrent parsed blocks corresponding to the next batch according to the concurrent parsed block number adjustment coefficient corresponding to the next batch and the number of concurrent parsed blocks corresponding to the current batch.

[0065] The blockchain data parsing device provided by the present invention flexibly adjusts and determines the number of concurrent parsed blocks corresponding to the next batch by determining the parsing time of the blocks of the current batch in combination with the parsing time adjustment parameter and the concurrent parsing block number adjustment coefficient, thereby avoiding the situation where the parsing fails due to too many blocks read in any batch, and ensuring the parsing efficiency of the block data of the blockchain to be parsed.

[0066] As an optional embodiment of the present invention, the device also includes: a second acquisition module, which is used to obtain the performance data of the blockchain data parsing device and the attribute data of the blockchain to be parsed if the current batch is an initial batch; a fourth determination module, which is used to determine the parsing parameters corresponding to the initial batch according to the performance data of the blockchain data parsing device and the attribute data of the blockchain to be parsed, and the parsing parameters include: the expected shortest parsing time, the expected longest parsing time, the number of concurrent parsing blocks corresponding to the initial batch, and the concurrent parsing block number adjustment coefficient corresponding to the initial batch.

[0067] As an optional embodiment of the present invention, the device also includes: a second parsing module, which is used to repeat the steps of obtaining the blocks of the number of concurrent parsed blocks corresponding to the current batch from the blockchain to be parsed and responding to the block parsing operation of the current batch to the step of determining the number of concurrent parsed blocks corresponding to the next batch according to the concurrent parsed block number adjustment coefficient corresponding to the next batch and the number of concurrent parsed blocks corresponding to the current batch, until all the block data in the blockchain to be parsed are parsed.

[0068] As an optional implementation manner of the present invention, the first parsing module is further configured to perform a parsing operation on the blocks of the current batch and respond to a storage operation on the block data parsed from the current batch.

[0069] The embodiment of the present invention further provides an electronic device, such as Figure 3 As shown, the electronic device may include a processor 401 and a memory 402, wherein the processor 401 and the memory 402 may be connected via a bus or other means. Figure 3 The example of connecting through bus is taken in the following.

[0070] The processor 401 may be a central processing unit (CPU). The processor 401 may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or a combination of the above chips.

[0071] The memory 402 is a non-transient computer-readable storage medium that can be used to store non-transient software programs, non-transient computer executable programs and modules, such as program instructions / modules corresponding to the blockchain data parsing method in the embodiment of the present invention. The processor 401 executes various functional applications and data processing of the processor by running the non-transient software programs, instructions and modules stored in the memory 402, that is, the blockchain data parsing method in the above method embodiment is implemented.

[0072] The memory 402 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required by at least one function; the data storage area may store data created by the processor 401, etc. In addition, the memory 402 may include a high-speed random access memory, and may also include a non-transitory memory, such as at least one disk storage device, a flash memory device, or other non-transitory solid-state storage device. In some embodiments, the memory 402 may optionally include a memory remotely arranged relative to the processor 401, and these remote memories may be connected to the processor 401 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0073] The one or more modules are stored in the memory 402, and when executed by the processor 401, the following is performed: Figure 1 The blockchain data parsing method in the illustrated embodiment.

[0074] For details of the above electronic equipment, please refer to Figure 1 The corresponding related descriptions and effects in the illustrated embodiments can be understood and will not be repeated here.

[0075] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the storage medium can be a disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD), etc.; the storage medium can also include a combination of the above-mentioned types of memory.

[0076] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.

Claims

1. A blockchain data parsing method, applied to a blockchain data parsing device, wherein the blockchain data parsing device is associated with a blockchain to be parsed, and is used to obtain a block to be parsed from the blockchain to be parsed; characterized in that: include: When it is necessary to parse block data of the blockchain to be parsed, obtain blocks of the number of concurrent parsed blocks corresponding to the current batch from the blockchain to be parsed and respond to the block parsing operation of the current batch; Get the parsing time consumed when parsing the current batch of blocks; Determine a parsing time adjustment coefficient according to the parsing time and the expected minimum parsing time and the expected maximum parsing time corresponding to data parsing of the blockchain to be parsed, wherein the expected minimum parsing time and the expected maximum parsing time are determined after comparing the performance data of the blockchain data parsing device and the attribute data of the blockchain to be parsed with the historical data; Determine the concurrent parsing block quantity adjustment coefficient corresponding to the next batch according to the parsing time adjustment coefficient and the concurrent parsing block quantity adjustment coefficient corresponding to the current batch; The number of concurrent parsing blocks corresponding to the next batch is determined according to the concurrent parsing block number adjustment coefficient corresponding to the next batch and the concurrent parsing block number corresponding to the current batch.

2. The method according to claim 1, characterized in that The method further comprises: If the current batch is an initial batch, obtaining performance data of the blockchain data parsing device and attribute data of the blockchain to be parsed; The parsing parameters corresponding to the initial batch are determined according to the performance data of the blockchain data parsing device and the attribute data of the blockchain to be parsed, and the parsing parameters include: the expected shortest parsing time, the expected maximum parsing time, the number of concurrent parsed blocks corresponding to the initial batch, and the concurrent parsed block number adjustment coefficient corresponding to the initial batch.

3. The method according to claim 1, characterized in that: The method further comprises: Repeat the steps of obtaining the block corresponding to the number of concurrently parsed blocks of the current batch from the blockchain to be parsed and responding to the block parsing operation of the current batch to the step of determining the number of concurrently parsed blocks corresponding to the next batch according to the adjustment coefficient of the number of concurrently parsed blocks corresponding to the next batch and the number of concurrently parsed blocks corresponding to the current batch, until all the block data in the blockchain to be parsed are parsed.

4. The method according to any one of claims 1 to 3, characterized in that The obtaining of blocks corresponding to the number of concurrently parsed blocks of the current batch from the blockchain to be parsed and responding to the parsing operation of the blocks of the current batch includes: performing a parsing operation on the blocks of the current batch and responding to a storage operation on the block data parsed from the current batch.

5. A blockchain data parsing device, applied to a blockchain data parsing device, wherein the blockchain data parsing device is associated with a blockchain to be parsed, and is used to obtain a block to be parsed from the blockchain to be parsed; characterized in that: include: A first parsing module is used for obtaining blocks of the number of concurrent parsed blocks corresponding to the current batch from the blockchain to be parsed when block data parsing of the blockchain to be parsed is required, and responding to the block parsing operation of the current batch; The first acquisition module is used to acquire the parsing time consumed when performing a parsing operation on the blocks of the current batch; A first determination module is used to determine a parsing time adjustment coefficient according to the parsing time and an expected minimum parsing time and an expected maximum parsing time corresponding to data parsing of the blockchain to be parsed, wherein the expected minimum parsing time and the expected maximum parsing time are determined after comparing the performance data of the blockchain data parsing device and the attribute data of the blockchain to be parsed with historical data; A second determination module is used to determine the concurrent parsing block quantity adjustment coefficient corresponding to the next batch according to the parsing time adjustment coefficient and the concurrent parsing block quantity adjustment coefficient corresponding to the current batch; The third determination module is used to determine the number of concurrent parsed blocks corresponding to the next batch according to the concurrent parsed block number adjustment coefficient corresponding to the next batch and the number of concurrent parsed blocks corresponding to the current batch.

6. The device according to claim 5, characterized in that The device also includes: A second acquisition module is used to acquire performance data of the blockchain data parsing device and attribute data of the blockchain to be parsed if the current batch is an initial batch; The fourth determination module is used to determine the parsing parameters corresponding to the initial batch according to the performance data of the blockchain data parsing device and the attribute data of the blockchain to be parsed, and the parsing parameters include: the expected shortest parsing time, the expected maximum parsing time, the number of concurrent parsing blocks corresponding to the initial batch, and the concurrent parsing block number adjustment coefficient corresponding to the initial batch.

7. The device according to claim 5, characterized in that The device also includes: The second parsing module is used to repeat the steps of obtaining the block corresponding to the number of concurrently parsed blocks of the current batch from the blockchain to be parsed and responding to the block parsing operation of the current batch to the step of determining the number of concurrently parsed blocks corresponding to the next batch according to the adjustment coefficient of the number of concurrently parsed blocks corresponding to the next batch and the number of concurrently parsed blocks corresponding to the current batch, until all the block data in the blockchain to be parsed are parsed.

8. The device according to any one of claims 5 to 7, characterized in that: The first parsing module is further configured to perform a parsing operation on the blocks of the current batch and respond to a storage operation on the block data parsed in the current batch.

9. An electronic device, characterized in that: include: at least one processor; And a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor performs the steps of the blockchain data parsing method as described in any one of claims 1 to 4.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the blockchain data parsing method as described in any one of claims 1 to 4 are implemented.