CN115037813A - Block chain data analysis method and device and electronic equipment - Google Patents
Block chain data analysis method and device and electronic equipment Download PDFInfo
- Publication number
- CN115037813A CN115037813A CN202210649617.0A CN202210649617A CN115037813A CN 115037813 A CN115037813 A CN 115037813A CN 202210649617 A CN202210649617 A CN 202210649617A CN 115037813 A CN115037813 A CN 115037813A
- Authority
- CN
- China
- Prior art keywords
- analysis
- block chain
- analyzed
- batch
- concurrent
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000007405 data analysis Methods 0.000 title claims abstract description 64
- 238000000034 method Methods 0.000 title claims abstract description 52
- 238000004458 analytical method Methods 0.000 claims abstract description 256
- 230000015654 memory Effects 0.000 claims description 20
- 238000004590 computer program Methods 0.000 claims description 4
- 238000004364 calculation method Methods 0.000 description 12
- 230000008569 process Effects 0.000 description 10
- 238000013461 design Methods 0.000 description 5
- 238000012545 processing Methods 0.000 description 4
- 230000008859 change Effects 0.000 description 3
- RTZKZFJDLAIYFH-UHFFFAOYSA-N Diethyl ether Chemical compound CCOCC RTZKZFJDLAIYFH-UHFFFAOYSA-N 0.000 description 2
- 238000010586 diagram Methods 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 239000007787 solid Substances 0.000 description 2
- 230000001360 synchronised effect Effects 0.000 description 2
- 230000003044 adaptive effect Effects 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 238000004422 calculation algorithm Methods 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 238000010295 mobile communication Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000010223 real-time analysis Methods 0.000 description 1
- 238000012360 testing method Methods 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/22—Parsing or analysis of headers
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/24—Negotiation of communication capabilities
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Security & Cryptography (AREA)
- Debugging And Monitoring (AREA)
Abstract
The invention discloses a block chain data analysis method, a block chain data analysis device and electronic equipment, wherein the method comprises the following steps: when the block data analysis needs to be carried out on the block chain to be analyzed, acquiring blocks of the number of concurrent analysis blocks corresponding to the current batch from the block chain to be analyzed and responding to the block analysis operation of the current batch; acquiring analysis duration consumed when analyzing the blocks of the current batch; determining an analysis duration adjustment coefficient according to the analysis duration and the expected shortest analysis duration and the expected longest analysis duration corresponding to the data analysis of the block chain to be analyzed; determining a number adjustment coefficient of the concurrent analysis blocks corresponding to the next batch according to the analysis duration adjustment coefficient and the number adjustment coefficient of the concurrent analysis blocks corresponding to the current batch; and determining the number of the concurrent analysis blocks corresponding to the next batch according to the adjustment coefficient of the number of the concurrent analysis blocks corresponding to the next batch and the number of the concurrent analysis blocks corresponding to the current batch.
Description
Technical Field
The invention relates to the technical field of block chains, in particular to a block chain data analysis method, a block chain data analysis device and electronic equipment.
Background
The block chain is a distributed ledger database which is safely shared, and data is recorded in the distributed ledger database by taking a block as a unit. When analyzing block data, it is a common practice to read block information one by one in a batch according to a block height sequence, read a plurality of block data information in each batch, and then concurrently process and analyze the data. The number of the read blocks in each batch determines the subsequent processing speed, and the more the read blocks in each batch, the higher the throughput of the program is, and the higher the processing speed is; however, when the number of read blocks per batch reaches a threshold, the program analysis will fail due to the memory constraint. Therefore, it is desirable to provide a method for analyzing block chain data to determine the number of concurrently analyzed blocks in each batch, so as to avoid the influence on the analysis efficiency.
Disclosure of Invention
Therefore, the invention provides a method, a device and an electronic device for analyzing block chain data to determine the number of concurrent analysis blocks in each batch.
According to a first aspect, an embodiment of the present invention discloses a method for analyzing block chain data, which is applied to a block chain data analysis device, where the block chain data analysis device is associated with a block chain to be analyzed, and is configured to obtain a block to be analyzed from the block chain to be analyzed; the method comprises the following steps: when the block data analysis needs to be carried out on the block chain to be analyzed, acquiring blocks of the number of concurrent analysis blocks corresponding to the current batch from the block chain to be analyzed and responding to the block analysis operation of the current batch; acquiring analysis duration consumed when analyzing the blocks of the current batch; determining an analysis duration adjustment coefficient according to the analysis duration and the expected shortest analysis duration and the expected longest analysis duration corresponding to the data analysis of the block chain to be analyzed; determining a number adjustment coefficient of the concurrent analysis blocks corresponding to the next batch according to the analysis duration adjustment coefficient and the number adjustment coefficient of the concurrent analysis blocks corresponding to the current batch; and determining the number of the concurrent analysis blocks corresponding to the next batch according to the adjustment coefficient of the number of the concurrent analysis blocks corresponding to the next batch and the number of the concurrent analysis blocks corresponding to the current batch.
Optionally, the method further comprises: if the current batch is an initial batch, acquiring performance data of the block chain data analysis equipment and attribute data of the block chain to be analyzed; determining analysis parameters corresponding to the initial batch according to the performance data of the block chain data analysis equipment and the attribute data of the block chain to be analyzed, wherein the analysis parameters comprise: adjusting coefficients for the expected shortest analysis duration, the expected longest analysis duration, the number of concurrent analysis blocks corresponding to the initial batch, and the number of concurrent analysis blocks corresponding to the initial batch.
Optionally, the method further comprises: and repeating the step of obtaining the blocks with the number of the concurrent analysis blocks corresponding to the current batch from the block chain to be analyzed and responding to the block analysis operation of the current batch to the step of determining the number of the concurrent analysis blocks corresponding to the next batch according to the adjustment coefficient of the number of the concurrent analysis blocks corresponding to the next batch and the number of the concurrent analysis blocks corresponding to the current batch until all the block data in the block chain to be analyzed are analyzed.
Optionally, the obtaining blocks with the quantity of concurrent analysis blocks corresponding to the current batch from the block chain to be analyzed and responding to the block analysis operation on the current batch includes: and responding to the storage operation of the block data analyzed by the current batch while performing the analysis operation on the blocks of the current batch.
According to a second aspect, the embodiment of the present invention further discloses a block chain data analysis device, which is applied to a block chain data analysis device, where the block chain data analysis device is associated with a block chain to be analyzed, and is configured to obtain a block to be analyzed from the block chain to be analyzed; the method comprises the following steps: the first analysis module is used for acquiring blocks with the number of concurrent analysis blocks corresponding to the current batch from the block chain to be analyzed and responding to the block analysis operation of the current batch when the block data analysis needs to be carried out on the block chain to be analyzed; the first acquisition module is used for acquiring analysis duration consumed when the analysis operation is performed on the blocks of the current batch; the first determining module is used for determining an analysis duration adjustment coefficient according to the analysis duration and the expected shortest analysis duration and the expected longest analysis duration corresponding to the data analysis of the block chain to be analyzed; the second determining module is used for determining the number adjusting coefficient of the concurrent analysis blocks corresponding to the next batch according to the analysis duration adjusting coefficient and the number adjusting coefficient of the concurrent analysis blocks corresponding to the current batch; and a third determining module, configured to determine the number of the concurrent analysis blocks corresponding to the next batch according to the adjustment coefficient of the number of the concurrent analysis blocks corresponding to the next batch and the number of the concurrent analysis blocks corresponding to the current batch.
Optionally, the apparatus further comprises: a second obtaining module, configured to obtain performance data of the block chain data analysis device and attribute data of the block chain to be analyzed if the current batch is an initial batch; a fourth determining module, configured to determine, according to the performance data of the blockchain data analysis device and the attribute data of the blockchain to be analyzed, an analysis parameter corresponding to the initial batch, where the analysis parameter includes: adjusting coefficients for the expected shortest analysis duration, the expected longest analysis duration, the number of concurrent analysis blocks corresponding to the initial batch, and the number of concurrent analysis blocks corresponding to the initial batch.
Optionally, the apparatus further comprises: and the second analysis module is used for repeating the step of obtaining the blocks with the quantity of the concurrent analysis blocks corresponding to the current batch from the block chain to be analyzed and responding to the block analysis operation of the current batch to the step of determining the quantity of the concurrent analysis blocks corresponding to the next batch according to the quantity adjustment coefficient of the concurrent analysis blocks corresponding to the next batch and the quantity of the concurrent analysis blocks corresponding to the current batch until all the block data in the block chain to be analyzed are analyzed.
Optionally, the first parsing module is further configured to perform a parsing operation on a block of a current batch and respond to a storage operation of block data parsed from the current batch.
According to a third aspect, an embodiment of the present invention further discloses an electronic device, including: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to cause the at least one processor to perform the steps of the method for block chain data parsing according to the first aspect or any optional implementation manner of the first aspect.
According to a fourth aspect, the embodiments of the present invention further disclose a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps of the block chain data parsing method according to the first aspect or any optional embodiment of the first aspect.
The technical scheme of the invention has the following advantages:
the block chain data analysis method/device provided by the invention is applied to block chain data analysis equipment, wherein the block chain data analysis equipment is associated with a block chain to be analyzed and is used for acquiring a block to be analyzed from the block chain to be analyzed; when the block data analysis needs to be performed on the block chain to be analyzed, acquiring blocks with the number of concurrent analysis blocks corresponding to the current batch from the block chain to be analyzed, responding to the block analysis operation on the current batch, acquiring the analysis duration consumed when the analysis operation is performed on the blocks of the current batch, determining an analysis time length adjustment coefficient according to the analysis time length and the expected shortest analysis time length and the expected longest analysis time length corresponding to the data analysis of the block chain to be analyzed, determining a number adjustment coefficient of the concurrent analysis blocks corresponding to the next batch according to the analysis duration adjustment coefficient and the number adjustment coefficient of the concurrent analysis blocks corresponding to the current batch, and determining the number of the concurrent analysis blocks corresponding to the next batch according to the adjustment coefficient of the number of the concurrent analysis blocks corresponding to the next batch and the number of the concurrent analysis blocks corresponding to the current batch. The analysis duration of the blocks of the current batch is determined, and the analysis duration adjustment parameter and the number of the concurrent analysis blocks are combined to flexibly adjust and determine the number of the concurrent analysis blocks corresponding to the next batch, so that the condition that the analysis fails due to too many blocks read from any batch is avoided, and the analysis efficiency of the block data of the block chain to be analyzed is ensured.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
Fig. 1 is a flowchart of an exemplary method for analyzing blockchain data according to an embodiment of the present invention;
fig. 2 is a schematic block diagram of an exemplary block chain data analysis apparatus according to an embodiment of the present invention;
fig. 3 is a diagram of a specific example of an electronic device in an embodiment of the invention.
Detailed Description
The technical solutions of the present invention will be described clearly and completely with reference to the accompanying drawings, and it should be understood that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance.
In addition, the technical features involved in the different embodiments of the present invention described below may be combined with each other as long as they do not conflict with each other.
The embodiment of the invention discloses a block chain data analysis method, which is applied to block chain data analysis equipment, wherein the block chain data analysis equipment is associated with a block chain to be analyzed and is used for acquiring a block to be analyzed from the block chain to be analyzed, and the block chain data analysis equipment can be a node in the block chain to be analyzed or can be connected with any node in the block chain to be analyzed so as to acquire the block to be analyzed from the block chain to be analyzed. In this embodiment, the device for analyzing blockchain data may be a server, a program for analyzing blockchain data is pre-configured on the server, and the server is connected to a database for storing blockchain data. As shown in fig. 1, the method comprises the steps of:
As an optional embodiment of the present invention, the method further comprises: if the current batch is an initial batch, acquiring performance data of the block chain data analysis equipment and attribute data of the block chain to be analyzed; illustratively, performance data of the blockchain data parsing device includes, but is not limited to, CPU computing power, memory size, etc. of the device; the attribute data of the blockchain to be analyzed includes, but is not limited to, complexity of a blockchain data structure of the blockchain to be analyzed, a size of a block, throughput of data nodes in the blockchain, network connection speed of the blockchain network, and the like. Different block chains adopt different data structure designs according to different source codes and system structures, the data structure design scheme can include but is limited to a data nesting level, an updating logic, a uniqueness generation method, an encryption method and the like, and the complexity of a block structure can be determined according to the complexity of the data nesting level, the complexity of the updating logic, the complexity of an adopted encryption algorithm and the like in the data structure design scheme. These can also result in additional computational effort going from synchronized data to plaintext data, from serialized data to structured data. After open source data of nodes on a chain are synchronized, targeted data analysis needs to be performed according to the characteristics and design of the chain, and all block chain analysis problems cannot be covered by adopting a general identification method. In addition, the unique design of part of the tile chain, such as the rollback mechanism of the ETH chain, requires additional attention to whether the tile is immediately confirmed and the transaction amount is changed when parsing the tile, which also causes additional burden in the calculation process.
Determining analysis parameters corresponding to the initial batch according to the performance data of the block chain data analysis equipment and the attribute data of the block chain to be analyzed, wherein the analysis parameters comprise: adjusting coefficients for the expected shortest analysis duration, the expected longest analysis duration, the number of concurrent analysis blocks corresponding to the initial batch, and the number of concurrent analysis blocks corresponding to the initial batch.
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 resolution time (T) max ) The number of concurrent analysis blocks (X) corresponding to the initial batch 0 ) Adjusting coefficient (K) of the number of concurrent analysis blocks corresponding to the initial batch 0 )。
The expected shortest resolution duration (T) in the embodiment of the application min ) The expected longest resolving duration (T) max ) The number of concurrent analysis blocks (X) corresponding to the initial batch 0 ) Comparing performance data of the block chain data analysis equipment and attribute data of the block chain to be analyzed with historical data to determine; if the analysis duration is determined according to the analysis duration consumed under the condition that program analysis fails when the same analysis equipment is configured to perform data analysis on the block chains in which the same type of data is stored, the expected longest analysis duration is less than the analysis duration consumed under the condition that the program analysis fails; the same can be based on historical dataThe analysis parameters are determined according to the difference of the analysis equipment with different performances or the block chains to be analyzed with different data attributes, and the adjustment coefficient of the number of concurrent analysis blocks corresponding to the initial batch can be set to be 1, so that the number of corresponding batches can be adjusted in time in the subsequent analysis process.
102, acquiring analysis duration consumed when analyzing the blocks of the current batch; illustratively, the timing operation is responded when the analysis operation is performed on the blocks of the current batch, and the analysis duration (f) consumed in the analysis operation process of the current batch is obtained according to the timing operation result n (X))。
103, determining an analysis duration adjustment coefficient according to the analysis duration and the expected shortest analysis duration and the expected longest analysis duration corresponding to the data analysis of the block chain to be analyzed;
exemplarily, after the block data of the current batch is analyzed, the analysis duration (f) is determined according to n (X)) calculating an analysis duration adjustment coefficient (c) satisfying, for the nth batch analysis:
in the process of continuously reading and calculating the block batch data, the time length f is analyzed for any block n (X)∈(T min ,T max ) Always isSo that | f n (X)-f n-1 (X) is less than or equal to epsilon, wherein T max >0,T min >0. Wherein epsilon is a time interval with small arbitrary limit, and the above description belongs to the definition expression of mathematical limit, and is to clearly illustrate the analysis time length f n (X) the sequence prediction value is differentiable between successive xs. I.e. the total analysis time (f) consumed by the batch block in the calculation process of any batch n (X)) is always confined to a fixed constant interval. Wherein the analysis duration adjustment coefficient (c) is complemented according to various theoretical calculation modes and practical processesThe calculation can be carried out by the following method:
(1) carrying out statistical calculation according to historical analysis data corresponding to the block data of the same type to obtain a fixed value; calculating the value of c according to method (1) makes the whole adaptive calculation process relatively smooth, and the test and actual performance of the method both prove the superiority of the method. According to the change of the generation period (or time period) of the fixed block, the fixed value of c is calculated and refreshed to ensure that the fixed value can meet the self-adaptive performance of the latest block; and the method can dynamically adjust the c constant value by accelerating the updating calculation frequency of the c constant value and the like, thereby improving the instant adaptability to the block change.
(2) And dynamically calculating the analysis time length adjustment coefficient (c) according to the real-time analysis time length sequence f (X).
Analysis time length sequence f (x) ═ f n-m (X),f n-m+1 (X)…f n-1 (X)), adjusting parameter (c) for analysis time length corresponding to current batch n ) The sequence f (X) of the analysis time length formed by the previous m batches and c corresponding to the previous batch n-1 And (4) jointly determining.
c n =softmax(c n-1 +pf(X))+k
The value of m may be different fixed integer values, usually an integer value within 10, according to different block chains to be analyzed, and an excessive value of m may affect an actual calculation effect, for example, an ETH chain may select 5 batches for dynamic calculation, which may effectively increase a fitness for block output variation; and p is a series of constant parameters, i.e. p ═ p 0 ,p 1 ,p 2 ,p 3 …, and typically for all p, p ∈ (0, 1)]The number of the parameters p corresponds to the analysis duration in the analysis duration sequence, that is, each analysis duration corresponds to a constant parameter p, and is used for adjusting the influence of each analysis duration on the final calculation result, the size of the parameter p can be directly used for adjusting the degree of the influence of the analysis duration on the result, and the value of p is smaller when the time of the batch is longer than the current batch time, for example, p is {0.1, 0.2, 0.3, 0.4. }. k is a constant value, k ∈ (0, 1)]The presence of k may avoid to some extent an excessive bias of the time series prediction.
104, determining a number adjustment coefficient of the concurrent analysis blocks corresponding to the next batch according to the analysis duration adjustment coefficient and the number adjustment coefficient of the concurrent analysis blocks corresponding to the current batch;
illustratively, the coefficient (K) is adjusted according to the number of concurrent parsing blocks of the current batch n ) Determining the adjustment coefficient (K) of the number of concurrent analysis blocks corresponding to the next batch together with the adjustment coefficient (c) of the analysis duration corresponding to the current batch n+1 ). In the embodiment of the present application, the adjustment coefficient (K) of the number of concurrent parsing blocks corresponding to the next batch n+1 ) Can be calculated according to the following formula:
K n+1 =(1+c)*K n ,n∈N +
K n+1 as a coefficient for adjusting the block batch size in the sequence change, the value of the current state changes with the calculation result of the previous time state.
And 105, determining the number of the concurrent analysis blocks corresponding to the next batch according to the adjustment coefficient of the number of the concurrent analysis blocks corresponding to the next batch and the number of the concurrent analysis blocks corresponding to the current batch.
Illustratively, the number (X) of concurrent parsing blocks corresponding to the current batch n ) Adjusting coefficient (K) of the number of concurrent parsing blocks corresponding to the next batch n+1 ) The number (X) of the concurrent analysis blocks corresponding to the next batch is calculated together n+1 ). In the embodiment of the present application, the number (X) of concurrent parsing blocks corresponding to the next batch n+1 ) Can be calculated according to the following formula:
X n+1 =K n+1 ·X n
X n+1 and sending the parameters which are used as the concurrent analysis of the current batch to an analysis program for analyzing the block data.
According to the number X of the concurrent analysis blocks corresponding to the next batch obtained by calculation n+1 And acquiring the blocks of the next batch with the corresponding number from the block chain to be analyzed and analyzing the blocks. When a certain batch fails to be analyzed due to the fact that the data volume exceeds the hardware resource limit, according to f n (X)>T max Situation handling, with newCalculated X n+1 And reading and analyzing the n +1 th batch of data again.
According to the block chain data analysis method provided by the invention, the number of the concurrent analysis blocks corresponding to the next batch is flexibly adjusted and determined by combining the analysis duration of the determined blocks of the current batch with the analysis duration adjustment parameter and the adjustment coefficient of the number of the concurrent analysis blocks, so that the condition that the analysis fails due to too many blocks read from any batch is avoided, and the analysis efficiency of the block data of the block chain to be analyzed is ensured.
As an optional embodiment of the present invention, the method further comprises: and repeating the step of obtaining the blocks with the number of the concurrent analysis blocks corresponding to the current batch from the block chain to be analyzed and responding to the block analysis operation of the current batch to the step of determining the number of the concurrent analysis blocks corresponding to the next batch according to the adjustment coefficient of the number of the concurrent analysis blocks corresponding to the next batch and the number of the concurrent analysis blocks corresponding to the current batch until all the block data in the block chain to be analyzed are analyzed.
As an alternative embodiment of the present invention, step 101 includes: and responding to the storage operation of the block data analyzed from the current batch while analyzing the blocks of the current batch.
As a specific embodiment of the present invention, a description will be given of a scheme described in an example of the present application, with ether house as an analysis target:
firstly, determining analysis parameters corresponding to an initial batch according to performance data of a server and attribute data of a block chain to be analyzed on an Etherhouse, wherein the analysis parameters comprise: expectation of shortest parsing time (T) min ) 60s, the longest resolution duration (T) is expected max ) 180s, the number of concurrent parsing blocks (X) corresponding to the initial batch 1 ) 100, the adjustment coefficient (K) of the number of concurrent parsing blocks corresponding to the initial batch 1 ) Is 1.
Secondly, connecting a block chain node program through a block chain data analysis program pre-integrated on the server, reading and analyzing the blocks of the first batch, and storing the analyzed block data into the number of block link pointsA database. Recording the analysis duration f after the analysis is finished 1 (X), e.g. as f 1 (X) is 30s for example.
According to f 1 (X) calculating an analysis duration adjustment coefficient c, wherein c is obtained by adopting a fixed value method, and in the embodiment of the application, c is 0.1:
the formula can be obtained: f. of 1 (X) < 60s, yielding c ═ 0.1.
Thirdly, adjusting the coefficient (K) according to c and the number of the concurrent analysis blocks 1 ) Calculating the adjustment coefficient (K) of the number of the concurrent analysis blocks corresponding to the next batch 2 ) To obtain K 2 =(1+c)*K 1 =1.1。
Thirdly, according to K 2 And the number of concurrent parsing blocks (X) corresponding to the initial batch 1 ) Calculating the number (X) of the concurrent analysis blocks corresponding to the next batch 2 ) Obtaining X 2 =K 2 *X 1 =110。
And finally, when the next batch of analysis is carried out, acquiring 110 blocks from the block chain to be analyzed as concurrent blocks and responding to the next batch of analysis operation. And repeating the steps until all the block data in the block chain to be analyzed are analyzed.
The embodiment of the invention also discloses a block chain data analysis device which is applied to block chain data analysis equipment, wherein the block chain data analysis equipment is associated with the block chain to be analyzed and is used for acquiring the block to be analyzed from the block chain to be analyzed; as shown in fig. 2, the apparatus includes:
a first analysis module 201, configured to, when block data analysis needs to be performed on the to-be-analyzed block chain, obtain blocks of a number of concurrent analysis blocks corresponding to a current batch from the to-be-analyzed block chain and respond to a block analysis operation on the current batch;
a first obtaining module 202, configured to obtain a parsing duration consumed when parsing the blocks of the current batch;
a first determining module 203, configured to determine an analysis duration adjustment coefficient according to the analysis duration and an expected shortest analysis duration and an expected longest analysis duration corresponding to data analysis performed on the to-be-analyzed block chain;
a second determining module 204, configured to determine a number of concurrent analysis blocks adjustment coefficient corresponding to a next batch according to the analysis duration adjustment coefficient and the number of concurrent analysis blocks adjustment coefficient corresponding to the current batch;
a third determining module 205, configured to determine the number of the concurrent analysis blocks corresponding to the next batch according to the adjustment coefficient of the number of the concurrent analysis blocks corresponding to the next batch and the number of the concurrent analysis blocks corresponding to the current batch.
According to the block chain data analysis device provided by the invention, the number of the concurrent analysis blocks corresponding to the next batch is flexibly adjusted and determined by combining the analysis duration of the determined blocks of the current batch with the analysis duration adjustment parameter and the adjustment coefficient of the number of the concurrent analysis blocks, so that the condition that the analysis fails due to too many blocks read from any batch is avoided, and the analysis efficiency of the block data of the block chain to be analyzed is ensured.
As an optional embodiment of the present invention, the apparatus further comprises: a second obtaining module, configured to obtain performance data of the block chain data analysis device and attribute data of the block chain to be analyzed if the current batch is an initial batch; a fourth determining module, configured to determine, according to the performance data of the block chain data analysis device and the attribute data of the block chain to be analyzed, an analysis parameter corresponding to the initial batch, where the analysis parameter includes: adjusting coefficients for the expected shortest analysis duration, the expected longest analysis duration, the number of concurrent analysis blocks corresponding to the initial batch, and the number of concurrent analysis blocks corresponding to the initial batch.
As an optional embodiment of the present invention, the apparatus further comprises: and the second analysis module is used for repeating the step of obtaining the blocks with the quantity of the concurrent analysis blocks corresponding to the current batch from the block chain to be analyzed and responding to the block analysis operation of the current batch to the step of determining the quantity of the concurrent analysis blocks corresponding to the next batch according to the quantity adjustment coefficient of the concurrent analysis blocks corresponding to the next batch and the quantity of the concurrent analysis blocks corresponding to the current batch until all the block data in the block chain to be analyzed are analyzed.
As an optional embodiment of the present invention, the first parsing module is further configured to perform a parsing operation on a block of a current batch, and respond to a storage operation of block data parsed from the current batch.
An embodiment of the present invention further provides an electronic device, as shown in fig. 3, the electronic device may include a processor 401 and a memory 402, where the processor 401 and the memory 402 may be connected by a bus or in another manner, and fig. 3 takes the connection by the bus as an example.
The memory 402 is a non-transitory computer readable storage medium, and can be used to store non-transitory software programs, non-transitory computer executable programs, and modules, such as program instructions/modules corresponding to the method for parsing blockchain data in the embodiment of the present invention. The processor 401 executes various functional applications and data processing of the processor by running non-transitory software programs, instructions and modules stored in the memory 402, that is, implements the block chain data parsing method in the above method embodiment.
The memory 402 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created by the processor 401, and the like. Further, the memory 402 may include high speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid state storage device. In some embodiments, memory 402 may optionally include memory located remotely from processor 401, which may be connected to processor 401 via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The one or more modules are stored in the memory 402 and when executed by the processor 401, perform a method of block chain data parsing as in the embodiment shown in fig. 1.
The details of the electronic device may be understood with reference to the corresponding related description and effects in the embodiment shown in fig. 1, and are not described herein again.
Those skilled in the art will appreciate that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium and can include the processes of the embodiments of the methods described above when executed. The storage medium may be a magnetic Disk, an optical Disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a Flash Memory (Flash Memory), a Hard Disk (Hard Disk Drive, abbreviated as HDD) or a Solid State Drive (SSD), etc.; the storage medium may also comprise a combination of memories of the kind described above.
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 invention, and such modifications and variations fall within the scope defined by the appended claims.
Claims (10)
1. A block chain data analysis method is applied to block chain data analysis equipment, wherein the block chain data analysis equipment is associated with a block chain to be analyzed and is used for acquiring a block to be analyzed from the block chain to be analyzed; it is characterized by comprising the following steps:
when the block data analysis needs to be carried out on the block chain to be analyzed, acquiring blocks of the number of concurrent analysis blocks corresponding to the current batch from the block chain to be analyzed and responding to the block analysis operation of the current batch;
acquiring analysis duration consumed when analyzing the blocks of the current batch;
determining an analysis duration adjustment coefficient according to the analysis duration and the expected shortest analysis duration and the expected longest analysis duration corresponding to the data analysis of the block chain to be analyzed;
determining a number adjustment coefficient of the concurrent analysis blocks corresponding to the next batch according to the analysis duration adjustment coefficient and the number adjustment coefficient of the concurrent analysis blocks corresponding to the current batch;
and determining the number of the concurrent analysis blocks corresponding to the next batch according to the adjustment coefficient of the number of the concurrent analysis blocks corresponding to the next batch and the number of the concurrent analysis blocks corresponding to the current batch.
2. The method of claim 1, further comprising:
if the current batch is an initial batch, acquiring performance data of the block chain data analysis equipment and attribute data of the block chain to be analyzed;
determining analysis parameters corresponding to the initial batch according to the performance data of the block chain data analysis equipment and the attribute data of the block chain to be analyzed, wherein the analysis parameters comprise: adjusting coefficients for the expected shortest analysis duration, the expected longest analysis duration, the number of concurrent analysis blocks corresponding to the initial batch, and the number of concurrent analysis blocks corresponding to the initial batch.
3. The method of claim 1, further comprising:
and repeating the step of obtaining the blocks with the number of the concurrent analysis blocks corresponding to the current batch from the block chain to be analyzed and responding to the block analysis operation of the current batch to the step of determining the number of the concurrent analysis blocks corresponding to the next batch according to the adjustment coefficient of the number of the concurrent analysis blocks corresponding to the next batch and the number of the concurrent analysis blocks corresponding to the current batch until all the block data in the block chain to be analyzed are analyzed.
4. The method according to any one of claims 1 to 3, wherein the obtaining blocks of the number of concurrently analyzed blocks corresponding to the current batch from the block chain to be analyzed and responding to the block analysis operation for the current batch comprises: and responding to the storage operation of the block data analyzed from the current batch while analyzing the blocks of the current batch.
5. A block chain data analysis device is applied to block chain data analysis equipment, wherein the block chain data analysis equipment is associated with a block chain to be analyzed and is used for acquiring a block to be analyzed from the block chain to be analyzed; it is characterized by comprising the following steps:
the first analysis module is used for acquiring blocks with the number of concurrent analysis blocks corresponding to the current batch from the block chain to be analyzed and responding to the block analysis operation of the current batch when the block data analysis needs to be carried out on the block chain to be analyzed;
the first acquisition module is used for acquiring analysis duration consumed when the analysis operation is performed on the blocks of the current batch;
a first determining module, configured to determine an analysis duration adjustment coefficient according to the analysis duration and an expected shortest analysis duration and an expected longest analysis duration that correspond to when data analysis is performed on the to-be-analyzed block chain;
the second determining module is used for determining the number adjusting coefficient of the concurrent analysis blocks corresponding to the next batch according to the analysis duration adjusting coefficient and the number adjusting coefficient of the concurrent analysis blocks corresponding to the current batch;
and a third determining module, configured to determine the number of the concurrent analysis blocks corresponding to the next batch according to the adjustment coefficient of the number of the concurrent analysis blocks corresponding to the next batch and the number of the concurrent analysis blocks corresponding to the current batch.
6. The apparatus of claim 5, further comprising:
a second obtaining module, configured to obtain performance data of the blockchain data analysis device and attribute data of the blockchain to be analyzed if the current batch is an initial batch;
a fourth determining module, configured to determine, according to the performance data of the block chain data analysis device and the attribute data of the block chain to be analyzed, an analysis parameter corresponding to the initial batch, where the analysis parameter includes: adjusting coefficients for the expected shortest analysis duration, the expected longest analysis duration, the number of concurrent analysis blocks corresponding to the initial batch, and the number of concurrent analysis blocks corresponding to the initial batch.
7. The apparatus of claim 5, further comprising:
and the second analysis module is used for repeating the step of obtaining the blocks with the number of the concurrent analysis blocks corresponding to the current batch from the block chain to be analyzed and responding to the block analysis operation of the current batch to the step of determining the number of the concurrent analysis blocks corresponding to the next batch according to the adjustment coefficient of the number of the concurrent analysis blocks corresponding to the next batch and the number of the concurrent analysis blocks corresponding to the current batch until all the block data in the block chain to be analyzed are analyzed.
8. The apparatus according to any of claims 5-7, wherein the first parsing module is further configured to perform a parsing operation on the chunks of the current batch while responding to a storage operation on the chunk data parsed from the current batch.
9. An electronic device, comprising: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to cause the at least one processor to perform the steps of the method of block chain data parsing of any one of claims 1-4.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method for block chain data parsing according to any one of claims 1-4.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210649617.0A CN115037813A (en) | 2022-06-08 | 2022-06-08 | Block chain data analysis method and device and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210649617.0A CN115037813A (en) | 2022-06-08 | 2022-06-08 | Block chain data analysis method and device and electronic equipment |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115037813A true CN115037813A (en) | 2022-09-09 |
Family
ID=83123302
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210649617.0A Pending CN115037813A (en) | 2022-06-08 | 2022-06-08 | Block chain data analysis method and device and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115037813A (en) |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108228659A (en) * | 2016-12-22 | 2018-06-29 | 经贸联网科技股份有限公司 | Dynamic update finance data and/or dynamic adjust the method and system of power configuration |
CN108776897A (en) * | 2018-06-05 | 2018-11-09 | 腾讯科技(深圳)有限公司 | Data processing method, device, server and computer readable storage medium |
CN109461079A (en) * | 2018-10-29 | 2019-03-12 | 众安信息技术服务有限公司 | Transaction processing method and device based on block chain |
CN109951482A (en) * | 2019-03-19 | 2019-06-28 | 全链通有限公司 | User terminal and its block chain domain name analytic method |
CN111339181A (en) * | 2020-02-10 | 2020-06-26 | 腾讯科技(深圳)有限公司 | Block storage method, block storage device, node equipment and storage medium |
CN112948501A (en) * | 2021-05-13 | 2021-06-11 | 支付宝(杭州)信息技术有限公司 | Data analysis method, device and system |
CN113419823A (en) * | 2021-06-22 | 2021-09-21 | 东北大学 | Alliance chain system suitable for high-concurrency affairs and design method thereof |
CN113706146A (en) * | 2021-08-04 | 2021-11-26 | 杭州溪塔科技有限公司 | Processing method, device and system for executing batch transaction based on block chain |
-
2022
- 2022-06-08 CN CN202210649617.0A patent/CN115037813A/en active Pending
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108228659A (en) * | 2016-12-22 | 2018-06-29 | 经贸联网科技股份有限公司 | Dynamic update finance data and/or dynamic adjust the method and system of power configuration |
CN108776897A (en) * | 2018-06-05 | 2018-11-09 | 腾讯科技(深圳)有限公司 | Data processing method, device, server and computer readable storage medium |
CN109461079A (en) * | 2018-10-29 | 2019-03-12 | 众安信息技术服务有限公司 | Transaction processing method and device based on block chain |
CN109951482A (en) * | 2019-03-19 | 2019-06-28 | 全链通有限公司 | User terminal and its block chain domain name analytic method |
CN111339181A (en) * | 2020-02-10 | 2020-06-26 | 腾讯科技(深圳)有限公司 | Block storage method, block storage device, node equipment and storage medium |
CN112948501A (en) * | 2021-05-13 | 2021-06-11 | 支付宝(杭州)信息技术有限公司 | Data analysis method, device and system |
CN113419823A (en) * | 2021-06-22 | 2021-09-21 | 东北大学 | Alliance chain system suitable for high-concurrency affairs and design method thereof |
CN113706146A (en) * | 2021-08-04 | 2021-11-26 | 杭州溪塔科技有限公司 | Processing method, device and system for executing batch transaction based on block chain |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10938961B1 (en) | Systems and methods for data deduplication by generating similarity metrics using sketch computation | |
WO2019223443A1 (en) | Method and apparatus for processing database configuration parameter, and computer device and storage medium | |
CN113254472B (en) | Parameter configuration method, device, equipment and readable storage medium | |
US11249987B2 (en) | Data storage in blockchain-type ledger | |
CN112732738B (en) | Adaptive network data acquisition method based on multi-objective optimization and related equipment | |
CN109308309B (en) | Data service quality assessment method and terminal | |
CN111914285B (en) | Geographic distributed graph calculation method and system based on differential privacy | |
CN111122222B (en) | Sample point position determining method and system | |
US20230125308A1 (en) | Data compression based on co-clustering of multiple parameters for ai training | |
CN111291083A (en) | Webpage source code data processing method and device and computer equipment | |
CN117081996B (en) | Flow control method based on server-side real-time feedback and soft threshold and related equipment | |
CN110874314A (en) | Pressure measurement method, apparatus, device and medium | |
CN115037813A (en) | Block chain data analysis method and device and electronic equipment | |
CN112711739B (en) | Data processing method and device, server and storage medium | |
CN110543509B (en) | Monitoring system, method and device for user access data and electronic equipment | |
CN111258968A (en) | Enterprise redundant data cleaning method and device and big data platform | |
US11372832B1 (en) | Efficient hashing of data objects | |
CN109344049B (en) | Method and apparatus for testing a data processing system | |
CN115794806A (en) | Gridding processing system, method and device for financial data and computing equipment | |
Karthik et al. | Performance Skew prediction in HPCC systems | |
CN113468179B (en) | Base number estimation method, base number estimation device, base number estimation equipment and storage medium | |
CN113485805B (en) | Distributed computing adjustment method, device and equipment based on heterogeneous acceleration platform | |
CN112435000B (en) | Pending order notification method and device, computer equipment and storage medium | |
CN112306691B (en) | User grade determining method, system, computer device and storage medium | |
CN115982240A (en) | Time series data processing method, electronic equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |