Batch processing parameter adaptive control method and system in block chain consensus mechanism

By dynamically adjusted the batch processing parameters in the blockchain consensus mechanism, the problem of difficulty adapting to load changes was solved, the best optimization of system performance was achieved, reducing the delay time, and improving throughput and resource utilization efficiency.

CN119363313APending Publication Date: 2025-01-24INST OF SOFTWARE - CHINESE ACAD OF SCI +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411360940.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-27
Publication Date
2025-01-24

AI Technical Summary

Technical Problem

In the existing blockchain consensus mechanism, fixed batch parameters are difficult to adapt to changing load conditions, resulting in poor performance of the system under different loads, and difficult to effectively adjust throughput and confirmation delay time.

Method used

By testing the performance of the consensus mechanism under different batch processing parameter combinations under the target deployment environment and target number of nodes of the blockchain, a performance constraint function is established. The adaptive batch processing parameters are calculated in real time based on the instantaneous load of the consensus node, and the upper limit B of the number of transactions in each batch and the maximum time interval T between each batch are dynamically adjusted to optimize system performance.

Benefits of technology

The best performance of the blockchain consensus mechanism under different loads, significantly reduced the delay time of transaction confirmation, improved transaction throughput, optimized resource utilization, and enhanced the adaptability and stability of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119363313A_ABST
    Figure CN119363313A_ABST
Patent Text Reader

Abstract

The invention discloses a batch processing parameter adaptive control method and system in a block chain consensus mechanism, and belongs to the technical field of computers. According to the method, under the target deployment environment and the target node number of the block chain, the actual average throughput theta and average confirmation delay time tau of a consensus mechanism under different combinations of T and B are tested, T is the maximum time interval between every two packaged batches, B is the upper limit of the transaction number contained in each batch, and a performance constraint function is obtained; when the consensus mechanism runs, according to the instantaneous load of the consensus node, finding a group of input points which confirm that the delay is minimum on the performance constraint function, and taking the input points as initial batch processing parameters to be substituted into a batch processing packaging process; and setting an optimization objective function, searching a group which enables the value of the optimization objective function to be maximum from an initial point, and taking the group as a new batch processing parameter to be substituted into a batch processing packaging process. According to the method, the problem that fixed batch processing parameters are difficult to adapt to continuously changing load conditions in an existing block chain consensus mechanism technology can be solved, and the efficiency of a consensus mechanism during operation is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method and system for adaptively controlling batch processing parameters of input transactions of a blockchain consensus mechanism. Technical Background

[0002] The consensus mechanism is the key and core of blockchain technology. In order to reduce the communication overhead of confirming a single transaction and improve the system throughput, the existing consensus mechanism usually adopts the transaction batching method, which packages multiple transactions into a batch and then inputs them into the consensus mechanism for processing as the smallest unit. In the process of packaging transactions into batches, several batch processing parameters are required, such as the upper limit B of the number of transactions contained in each batch and the maximum time interval T between each two batches. These batch processing parameters have a key impact on the performance of the consensus mechanism. For example, a too small B will affect the throughput of the consensus mechanism when the load is large, and a too large B will cause the confirmation of the consensus mechanism to be too slow when the system load is small. A too small T will cause each batch to contain only a few transactions and damage the throughput. A too large T will cause the waiting time for packaging to be too long under low load, resulting in slow confirmation. Therefore, a new batch processing parameter adaptive control method and system are needed to adaptively improve the efficiency of the consensus mechanism during operation. Summary of the invention

[0003] In order to solve the problem that fixed batch processing parameters in the existing blockchain consensus mechanism technology are difficult to adapt to the changing load conditions, the present invention provides a batch processing parameter adaptive control method and system.

[0004] The technical solutions specifically adopted in the present invention are as follows:

[0005] A method for adaptively controlling batch processing parameters in a blockchain consensus mechanism comprises the following steps:

[0006] 1) Under the target deployment environment and target number of nodes of the blockchain, test the actual average throughput θ and average confirmation delay time τ of the consensus mechanism under different combinations of T and B, where T is the maximum time interval between each two batches, and B is the upper limit of the number of transactions contained in each batch, and obtain the dependence of θ, τ on T, B, that is, the performance constraint function F(T,B);

[0007] 2) When the consensus mechanism is running, based on the instantaneous load β of the consensus node, all input points that make θ greater than β are calculated on the performance constraint function F(T,B), and a set of input points with the smallest confirmation delay (T min ,B min ) and is taken into the batch packaging process as the initial batch processing parameter;

[0008] 3) Set the optimization objective function, (T min ,Bmin ) is taken as the initial point, and a set (T, B) is found that maximizes the value of the optimization objective function, and is brought into the batch packaging process as a new batch processing parameter.

[0009] Furthermore, in step 2), all input points that make θ greater than β are calculated on the performance constraint function F(T,B) by using a difference algorithm.

[0010] Furthermore, in step 2), β<θ<1.1β.

[0011] Furthermore, in step 3), a function that satisfies the conditions of being a decreasing function for τ and an increasing function for θ is set as the optimization objective function.

[0012] Furthermore, in step 3), at the initial point (T min ,B min ) and use the gradient descent algorithm to find a set (T, B) that maximizes the optimization objective function value.

[0013] Furthermore, the batch packaging process in steps 2) and 3) includes the following steps:

[0014] Start a timer that expires after T time, and wait to receive more transactions to be packaged;

[0015] If the number of transactions to be packaged is equal to or exceeds B before the timer expires, the timer is cleared and B transactions are packaged in batches;

[0016] If the number of pending transactions is still less than B after the timer expires and is cleared, all pending transactions are batched;

[0017] When the current batch of transactions is packaged, restart a timer that expires after T time, and repeat the above steps until the new batch of transactions is packaged.

[0018] A batch processing parameter adaptive control system in a blockchain consensus mechanism, comprising:

[0019] The pending transaction register is used to collect transactions to be uploaded to the chain;

[0020] The batch processing parameter controller is used to test the actual average throughput θ and average confirmation delay time τ of the consensus mechanism under different combinations of T and B under the target deployment environment and target number of nodes of the blockchain, where T is the maximum time interval between each packaged batch, and B is the upper limit of the number of transactions contained in each batch, and the dependence of θ, τ on T, B is obtained, that is, the performance constraint function F(T, B); when the consensus mechanism is running, according to the instantaneous load β of the consensus node, all input points that make θ greater than β are calculated on the performance constraint function F(T, B), and a set of input points with the smallest confirmation delay are found from all the input points (Tmin ,B min ) and used as the initial batch processing parameters; set the optimization objective function to (T min ,B min ) as the initial point, find a set (T, B) that maximizes the value of the optimization objective function and use it as the new batch processing parameters;

[0021] The transaction batch packager is used to perform batch packaging according to the initial batch processing parameters or new batch processing parameters;

[0022] The transaction batch register is used to temporarily store the transaction batches after batch processing.

[0023] Furthermore, the steps of batch packaging by the transaction batch packager include:

[0024] Start a timer that expires after T time, and wait to receive more transactions to be packaged;

[0025] If the number of transactions to be packaged is equal to or exceeds B before the timer expires, the timer is cleared and B transactions are packaged in batches;

[0026] If the number of pending transactions is still less than B after the timer expires and is cleared, all pending transactions are batched;

[0027] When the current batch of transactions is packaged, restart a timer that expires after T time, and repeat the above steps until the new batch of transactions is packaged.

[0028] The present invention has the advantages that:

[0029] 1. Dynamic adjustment capability: The present invention can monitor the instantaneous load of the blockchain system in real time, and dynamically adjust the batch processing parameters (the upper limit B of the number of transactions and the maximum time interval T between each two batches) according to the load conditions to ensure the optimal performance of the system under different loads.

[0030] 2. Reduce confirmation delay: Through adaptive optimization and adjustment of batch processing parameters, the confirmation delay of transactions can be significantly reduced, the user experience can be improved, and the demand for fast transaction confirmation can be met.

[0031] 3. Improve transaction throughput: The optimized batch processing parameters enable the consensus mechanism to process more transactions per unit time, significantly improving the average throughput and enabling the system to better cope with high-concurrency transaction scenarios.

[0032] 4. Optimize resource utilization: Reduce resource waste by intelligently adjusting parameters and ensure that system resources (such as computing power and storage) are used more efficiently, thereby improving the performance of the overall system.

[0033] 5. Enhance system adaptability: It can adapt to the ever-changing transaction patterns and network conditions, improve the flexibility of the blockchain system, enable it to maintain stable and efficient operation in a variety of environments, and improve the efficiency of the consensus mechanism during operation.

[0034] 6. Easy to implement and integrate: This method is highly feasible and can be seamlessly integrated with the existing blockchain consensus mechanism, improving the performance of the existing system without major architectural changes.

[0035] 7. Improved security: By reducing latency and increasing throughput, security risks caused by network congestion are reduced, such as the risk of transactions being delayed or lost.

[0036] 8. Continuous optimization: As the system operation time increases, the batch parameter controller can continuously perform adaptive optimization to ensure that the system always runs in the best state. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] Figure 1 It is a schematic diagram of a batch processing parameter adaptive control system in a blockchain consensus mechanism in an embodiment. Specific implementation methods

[0039] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of them. Based on the embodiments in the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the embodiments of the present invention.

[0040] The embodiment of the present invention provides a method for adaptively controlling batch processing parameters in a blockchain consensus mechanism. The main technical concept is: when the consensus mechanism is running, by adaptively adjusting online parameters such as the upper limit B of the number of transactions included in each batch and the maximum time interval T between each two batches, the confirmation delay time of the consensus mechanism is reduced and the transaction throughput of the consensus mechanism is improved.

[0041] 1. Performance constraint relationship test before operation:

[0042] For the consensus mechanism deployed on all nodes of the blockchain, under the target deployment environment and the target number of nodes, the actual average throughput θ and average confirmation delay τ of the consensus mechanism under different combinations of T and B are tested, where the average throughput θ refers to the average number of transactions confirmed per unit time, in units of transactions per second; the average confirmation delay τ refers to the average value of the confirmation delay time of each transaction, in units of seconds. After the test, the dependence relationship of θ and τ on T and B is obtained (the specific dependence relationship can be determined according to the specific example, the present invention does not make specific limitations, and those skilled in the art should be able to understand), which is recorded as the performance constraint function (θ, τ) = F(T, B).

[0043] 2. Find the initial point of batch processing parameters during runtime:

[0044] When the consensus mechanism is deployed, the consensus node calculates all input points (T1, B1), (T2, B2), … (T1, B1), (T2, B2), … (T2, B2) on the performance constraint function F that can make the average throughput θ slightly greater than β (such as β<θ<1.1β) based on its instantaneous load β (referring to the number of pending transactions received per unit time) through the difference algorithm. k ,B k ), and find a set of solutions with the smallest confirmation delay (T min ,B min ), (T min ,B min ) as the initial batch processing parameters and brought into the batch packaging process.

[0045] 3. Adaptive optimization of batch parameters at runtime:

[0046] Set a function that satisfies the decreasing function of delay τ and the increasing function of throughput θ as the optimization objective function (the specific optimization objective function can be determined according to the specific example, the present invention does not make a specific limitation, and those skilled in the art should understand it), use the (T min ,B min ) as the initial point, use the gradient descent algorithm around the initial point to find a set of (T, B) that maximizes the optimization objective function value, and use the optimized (T, B) as the new batch processing parameters and bring it into the batch packaging process.

[0047] 4. Batch packaging process of consensus nodes in the consensus mechanism:

[0048] 1) Start a timer that expires after T time, and wait to receive more transactions to be packaged;

[0049] 2) If the number of transactions to be packaged is equal to or exceeds B before the timer expires, the timer is immediately cleared and B transactions are packaged in batches;

[0050] 3) If the number of pending transactions is still less than B after the timer expires and is cleared, all pending transactions are batched;

[0051] 4) When the current batch of transactions is packaged, restart a timer that expires after T time, and repeat the above steps until the new batch of transactions is packaged.

[0052] The embodiment of the present invention also proposes a batch processing parameter adaptive control system in the blockchain consensus mechanism, which can efficiently implement the batch processing parameter adaptive control method in the blockchain consensus mechanism. The composition of this system is as follows Figure 1 As shown, it includes a pending transaction register, a transaction batch packager, a batch processing parameter controller and a transaction batch register. The processing process is as follows:

[0053] First, the pending transaction register collects transactions to be uploaded to the chain;

[0054] Then, the batch parameter controller selects the initial batch parameters (T min ,B min ) into the transaction batch packager (see steps 1-2 above);

[0055] Then, the transaction batch packager packages the transaction batch according to the initial batch processing parameters and the above step 4, and sends it to the transaction batch temporary storage;

[0056] Finally, during the operation of the system, the batch processing parameter controller will perform adaptive optimization through the above step 3 to obtain the optimization result (T, B). The transaction batch packager packages the transaction batch according to the above step 4 based on the optimization result and sends it to the transaction batch temporary register.

[0057] It should be understood that the "system" and "device" used in this specification are a method for distinguishing different components, elements, parts, parts or assemblies at different levels. However, if other words can achieve the same purpose, the words can be replaced by other expressions.

[0058] As shown in this specification and claims, unless the context clearly indicates an exception, the words "a", "an", "an" and / or "the" do not refer to the singular and may also include the plural. Generally speaking, the terms "comprise" and "include" only indicate the inclusion of the steps and elements that have been clearly identified, and these steps and elements do not constitute an exclusive list. The method or device may also include other steps or elements.

[0059] Flowcharts are used in this specification to illustrate the operations performed by the system according to the embodiments of this specification. It should be understood that the preceding or following operations are not necessarily performed precisely in order. Instead, the steps may be processed in reverse order or simultaneously. At the same time, other operations may also be added to these processes, or one or more operations may be removed from these processes.

[0060] The basic concepts have been described above. Obviously, for those skilled in the art, the above detailed disclosure is only for example and does not constitute a limitation of this specification. Although not explicitly stated here, those skilled in the art may make various modifications, improvements and corrections to this specification. Such modifications, improvements and corrections are suggested in this specification, so such modifications, improvements and corrections still belong to the spirit and scope of the exemplary embodiments of this specification.

[0061] At the same time, this specification uses specific words to describe the embodiments of this specification. For example, "one embodiment", "an embodiment", and / or "some embodiments" refer to a certain feature, structure or characteristic related to at least one embodiment of this specification. Therefore, it should be emphasized and noted that "one embodiment" or "an embodiment" or "an alternative embodiment" mentioned twice or more in different positions in this specification does not necessarily refer to the same embodiment. In addition, certain features, structures or characteristics in one or more embodiments of this specification can be appropriately combined.

[0062] In addition, it will be understood by those skilled in the art that various aspects of this specification may be illustrated and described by a number of patentable categories or situations, including any new and useful process, machine, product or combination of substances, or any new and useful improvements thereto. Accordingly, various aspects of this specification may be performed entirely by hardware, entirely by software (including firmware, resident software, microcode, etc.), or by a combination of hardware and software. The above hardware or software may be referred to as "data blocks", "modules", "engines", "units", "components" or "systems". In addition, various aspects of this specification may be represented as a computer product located in one or more computer-readable media, which includes computer-readable program code.

[0063] A computer storage medium may include a propagated data signal containing computer program code, for example, in baseband or as part of a carrier wave. The propagated signal may be in a variety of forms, including electromagnetic, optical, etc., or a suitable combination. A computer storage medium may be any computer-readable medium other than a computer-readable storage medium, which can be connected to an instruction execution system, device or apparatus to communicate, propagate or transmit the program for use. The program code on the computer storage medium may be transmitted via any suitable medium, including radio, cable, fiber optic cable, RF, or similar media, or any combination of the above media.

[0064] The computer program code required for the operation of each part of this specification can be written in any one or more programming languages, including object-oriented programming languages ​​such as Java, Scala, Smalltalk, Eiffel, JADE, Emerald, C++, C#, VB.NET, Python, etc., conventional procedural programming languages ​​such as C language, Visual Basic, Fortran2003, Perl, COBOL2002, PHP, ABAP, dynamic programming languages ​​such as Python, Ruby and Groovy, or other programming languages, etc. The program code can be run entirely on the user's computer, or run on the user's computer as an independent software package, or run partially on the user's computer and partially on a remote computer, or run entirely on a remote computer or processing device. In the latter case, the remote computer can be connected to the user's computer through any network form, such as a local area network (LAN) or a wide area network (WAN), or connected to an external computer (e.g., via the Internet), or in a cloud computing environment, or used as a service such as software as a service (SaaS).

[0065] In addition, unless explicitly stated in the claims, the order of the processing elements and sequences described in this specification, the use of alphanumeric characters, or the use of other names are not intended to limit the order of the processes and methods of this specification. Although the above disclosure discusses some invention embodiments that are currently considered useful through various examples, it should be understood that such details are only for illustrative purposes, and the attached claims are not limited to the disclosed embodiments. On the contrary, the claims are intended to cover all modifications and equivalent combinations that are consistent with the essence and scope of the embodiments of this specification. For example, although the system components described above can be implemented by hardware devices, they can also be implemented only by software solutions, such as installing the described system on an existing processing device or mobile device.

[0066] Similarly, it should be noted that in order to simplify the description disclosed in this specification and thus help understand one or more embodiments of the invention, in the above description of the embodiments of this specification, multiple features are sometimes combined into one embodiment, figure or description thereof. However, this disclosure method does not mean that the features required by the subject matter of this specification are more than the features mentioned in the claims. In fact, the features of the embodiments are less than all the features of the single embodiment disclosed above.

[0067] In some embodiments, numbers describing the number of components and attributes are used. It should be understood that such numbers used in the description of the embodiments are modified by the modifiers "about", "approximately" or "substantially" in some examples. Unless otherwise specified, "about", "approximately" or "substantially" indicate that the numbers are allowed to vary by ±20%. Accordingly, in some embodiments, the numerical parameters used in the specification and claims are approximate values, which may change according to the required features of individual embodiments. In some embodiments, the numerical parameters should take into account the specified significant digits and adopt the general method of retaining digits. Although the numerical domains and parameters used to confirm the breadth of their range in some embodiments of this specification are approximate values, in specific embodiments, the setting of such numerical values ​​is as accurate as possible within the feasible range.

[0068] Each patent, patent application, patent application publication, and other materials, such as articles, books, specifications, publications, documents, etc., cited in this specification are hereby incorporated by reference in their entirety. Except for application history documents that are inconsistent with or conflicting with the contents of this specification, documents that limit the broadest scope of the claims of this specification (currently or later attached to this specification) are also excluded. It should be noted that if the descriptions, definitions, and / or use of terms in the materials attached to this specification are inconsistent or conflicting with the contents described in this specification, the descriptions, definitions, and / or use of terms in this specification shall prevail.

[0069] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.

[0070] Finally, it should be understood that the embodiments described in this specification are only used to illustrate the principles of the embodiments of this specification. Other variations may also fall within the scope of this specification. Therefore, as an example and not a limitation, alternative configurations of the embodiments of this specification may be considered consistent with the teachings of this specification. Accordingly, the embodiments of this specification are not limited to the implementations explicitly introduced and described in this specification.

Claims

1. A method for adaptively controlling batch processing parameters in a blockchain consensus mechanism, comprising the following steps: 1) Under the target deployment environment and target number of nodes of the blockchain, test the actual average throughput θ and average confirmation delay time τ of the consensus mechanism under different combinations of T and B, where T is the maximum time interval between each two batches, and B is the upper limit of the number of transactions contained in each batch, and obtain the dependence of θ, τ on T, B, that is, the performance constraint function F(T,B); 2) When the consensus mechanism is running, based on the instantaneous load β of the consensus node, all input points that make θ greater than β are calculated on the performance constraint function F(T,B), and a set of input points with the smallest confirmation delay (T min ,B min ) and is taken into the batch packaging process as the initial batch processing parameter; 3) Set the optimization objective function, (T min ,B min ) is taken as the initial point, and a set (T, B) is found that maximizes the value of the optimization objective function, and is brought into the batch packaging process as a new batch processing parameter.

2. The method according to claim 1, characterized in that In step 2), all input points that make θ greater than β are calculated on the performance constraint function F(T,B) by using the difference algorithm.

3. The method according to claim 1 or 2, characterized in that In step 2), β<θ<1.1β.

4. The method according to claim 1, characterized in that In step 3), a function that satisfies the conditions of being a decreasing function for τ and an increasing function for θ is set as the optimization objective function.

5. The method according to claim 1 or 4, characterized in that In step 3), at the initial point (T min ,B min ) and use the gradient descent algorithm to find a set (T, B) that maximizes the optimization objective function value.

6. The method according to claim 1, characterized in that The batch packaging process in steps 2) and 3) includes the following steps: Start a timer that expires after T time, and wait to receive more transactions to be packaged; If the number of transactions to be packaged is equal to or exceeds B before the timer expires, the timer is cleared and B transactions are packaged in batches; If the number of pending transactions is still less than B after the timer expires and is cleared, all pending transactions are batched; When the current batch of transactions is packaged, restart a timer that expires after T time, and repeat the above steps until the new batch of transactions is packaged.

7. A batch processing parameter adaptive control system in a blockchain consensus mechanism, comprising: The pending transaction register is used to collect transactions to be uploaded to the chain; The batch processing parameter controller is used to test the actual average throughput θ and average confirmation delay time τ of the consensus mechanism under different combinations of T and B under the target deployment environment and target number of nodes of the blockchain, where T is the maximum time interval between each packaged batch, and B is the upper limit of the number of transactions contained in each batch, and the dependence of θ, τ on T, b is obtained, that is, the performance constraint function F(T, B); when the consensus mechanism is running, according to the instantaneous load β of the consensus node, all input points that make θ greater than β are calculated on the performance constraint function F(T, B), and a set of input points with the smallest confirmation delay are found from all the input points (T min ,B min ) and used as the initial batch processing parameters; Set the optimization objective function to (T min ,B min ) as the initial point, find a set (T, B) that maximizes the value of the optimization objective function and use it as the new batch processing parameters; The transaction batch packager is used to perform batch packaging according to the initial batch processing parameters or new batch processing parameters; The transaction batch register is used to temporarily store the transaction batches after batch processing.

8. The system according to claim 7, characterized in that All input points that make β<θ<1.1β are calculated on the performance constraint function F(T,B) through the difference algorithm.

9. The system according to claim 7, characterized in that Set the function that satisfies the decreasing function for τ and the increasing function for θ as the optimization objective function; at the initial point (T min ,B min ) and use the gradient descent algorithm to find a set (T, B) that maximizes the optimization objective function value.

10. The system according to claim 7, characterized in that The steps of batch packaging by the transaction batch packager include: Start a timer that expires after T time, and wait to receive more transactions to be packaged; If the number of transactions to be packaged is equal to or exceeds B before the timer expires, the timer is cleared and B transactions are packaged in batches; If the number of pending transactions is still less than B after the timer expires and is cleared, all pending transactions are batched; When the current batch of transactions is packaged, restart a timer that expires after T time, and repeat the above steps until the new batch of transactions is packaged.