Block chain consensus layer parameter adaptive method and system based on reinforcement learning

Through the blockchain consensus layer parameter adaptation method based on reinforcement learning, deep reinforcement learning algorithms, state managers, and performance probes are used to dynamically adjust the blockchain consensus layer parameters, solving the problems of high concurrency and malicious intent in traditional blockchain systems. Security threats and performance bottlenecks under attacks improve the robustness and data flow efficiency of the blockchain system.

CN118784657APending Publication Date: 2024-10-15BEIHANG UNIV
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411005023.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-25
Publication Date
2024-10-15

AI Technical Summary

Technical Problem

When faced with a surge in transaction volume, poor network conditions, and malicious attacks, traditional static blockchain systems are unable to adjust consensus layer parameters in a timely manner, resulting in security threats and performance bottlenecks, affecting the efficiency and reliability of the blockchain system.

Method used

The blockchain consensus layer parameter adaptation method based on reinforcement learning is adopted. By building a consensus node status manager and performance probe, the deep reinforcement learning algorithm is trained, the consensus layer parameters are dynamically adjusted, and real-time optimization and online modification of parameters are achieved.

Benefits of technology

It improves the robustness and performance of the blockchain system, enhances security and data flow efficiency in complex heterogeneous environments, and solves security threats and performance bottlenecks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118784657A_ABST
    Figure CN118784657A_ABST
Patent Text Reader

Abstract

The invention discloses a block chain consensus layer parameter self-adaption method and system based on reinforcement learning, and belongs to the field of block chains, and the method comprises the steps: constructing a consensus node state manager, and carrying out the perception and maintenance of the health state and security information of each consensus node of a current block chain network; constructing a performance probe, and measuring, calculating and recording performance data of each consensus node of the current block chain network; constructing and training a deep reinforcement learning algorithm, and selecting an optimal parameter combination of a block chain consensus layer; and constructing a block chain parameter modification framework, and combining the selected optimal parameters of the block chain consensus layer on the block chain for instant application. According to the block chain consensus layer parameter adaptive method and system based on reinforcement learning, security threats and performance bottlenecks confronted by a current block chain consensus protocol are solved, and the robustness, performance and sustainable optimization capability of a block chain system are further improved; and technical support is provided for efficient and secure data circulation of the block chain technology in a complex heterogeneous environment.
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 consensus layer parameter self-adaptation method and system based on reinforcement learning. Background Art

[0002] With the rapid development of the information technology industry, blockchain technology, as a decentralized, secure and reliable distributed ledger technology, is increasingly gaining widespread attention, and its application scenarios have gradually expanded to multiple fields such as finance, medical care, the Internet of Things, and the metaverse. The development of blockchain technology not only provides a reliable foundation for the circulation and interaction of digital assets, but also effectively promotes the process of digitalization and decentralization in various industries. Nowadays, accelerating the promotion of new decentralized business forms based on blockchain has become an inevitable trend for future industrial development. Compared with traditional centralized applications, the integration of blockchain technology makes data circulation more secure and reliable, and can effectively reduce costs and increase efficiency, and improve market returns and data circulation efficiency.

[0003] In the blockchain architecture, the consensus layer plays a vital role. It ensures that the nodes in the network reach a consensus on transaction records and status, and further maintains the consistency and security of the entire system. Due to the characteristics of blockchain with dispersed nodes, diverse scenarios, and frequent transactions, when the traditional static blockchain system encounters problems such as a surge in transaction volume, poor network conditions, and malicious attacks, the relevant parameter settings of the consensus layer can only be executed according to the preset values. It is impossible to make timely corrections to the parameter settings according to the current network environment, and it is even more impossible to achieve a balance between security and performance according to the current network environment, which is easy to cause systemic risks such as double-spending attacks and network congestion. However, there are still many deficiencies and challenges in achieving adaptive optimization in dynamic network environments and heterogeneous application scenarios. For example, the blockchain network has poor performance in large-scale application scenarios with multiple nodes and high concurrency, and also faces serious data security threats. If this defect cannot be effectively solved, the large-scale commercial application of blockchain technology will not be able to make breakthrough progress.

[0004] Therefore, there is an urgent need for a dynamic adaptive method and system that integrates the two functions of dynamic parameter optimization and online parameter modification at runtime to solve the security threats and performance bottlenecks faced by the current blockchain consensus protocol and ensure the high efficiency, reliability and smooth operation of the blockchain. Summary of the invention

[0005] The purpose of the present invention is to provide a blockchain consensus layer parameter adaptation method and system based on reinforcement learning to solve the problems mentioned in the above background technology.

[0006] To achieve the above object, the present invention provides a blockchain consensus layer parameter adaptive method based on reinforcement learning, comprising the following steps:

[0007] S1. Build a consensus node status manager to perceive and maintain the health status and security information of each consensus node in the current blockchain network;

[0008] S2. Build a performance probe to measure and record the performance data of each consensus node in the current blockchain network;

[0009] S3. Build and train a deep reinforcement learning algorithm to select the optimal parameter combination for the blockchain consensus layer based on the security and performance status information perceived and measured by the consensus node state manager and performance probe in S1 and S2;

[0010] S4: Build a blockchain parameter modification framework to instantly apply the optimal parameter combination of the blockchain consensus layer selected by the deep reinforcement learning algorithm of S3 on the blockchain.

[0011] Preferably, S1 uses a heartbeat detection mechanism to perceive and maintain the health status and security information of each consensus node in the current blockchain network. The heartbeat detection mechanism specifically includes:

[0012] a1. The consensus node responsible for verifying transaction validity, participating in the consensus process and generating new blocks sends a heartbeat signal containing node health status and security information to the consensus node state manager at a fixed time interval;

[0013] a2. The consensus node status manager receives the heartbeat signal, records the consensus node status information, and feeds back a confirmation message to the consensus node.

[0014] Preferably, S2 specifically includes:

[0015] S21. Actively measure and record the number of transactions contained in each block, the packaging time of the block, the confirmation time of the block, and the time consumed in the four consensus stages of Proposal, Prevote, Precommit, and Commit during the operation of the blockchain;

[0016] S22. Calculate the two performance indicators of blockchain consensus process transaction throughput and block latency based on the parameter values ​​measured in S21.

[0017] Preferably, S3 specifically includes:

[0018] S31, status acquisition, obtain the current number of active consensus nodes NumNodes, block delay BlockDelay, transaction throughput TPS, and network delay Network Latency of the blockchain for model training;

[0019] S32, parameter recommendation, providing consensus layer recommended parameter settings for the timeout time of each consensus stage and the number of consecutive blocks produced by each node based on the current status information of the blockchain, which is used to formulate a real-time optimization plan for blockchain security and performance;

[0020] S33, benefit evaluation, using the preset reward function and real-time status information to evaluate the security and performance benefits of the current blockchain consensus layer parameter settings relative to historical rounds for calculating rewards;

[0021] S34, reward feedback, with the goal of maximizing long-term safety and performance benefits, to calculate reward feedback to guide subsequent model training;

[0022] Benefit evaluation and reward feedback, including:

[0023] Let C be the current reward function value, I be the initial reward function value, and L be the reward function value of the previous round. Then evaluate the relative benefits of the current round, the initial situation, and the previous round respectively:

[0024]

[0025] Assuming η is the adjustment coefficient, the reward feedback value r can be calculated T :

[0026]

[0027] The above formula shows that if the current reward parameter is improved compared to the previous one (ΔT 1 >0), the reward is positive. If the current reward parameter has not increased or decreased compared to the previous one, the reward is negative. The size of the reward also depends on the change in the current reward parameter relative to the initial value (ΔT 0 ), and the adjustment coefficient η.

[0028] Preferably, the specific contents of S4 include:

[0029] S41. Construct a configuration extraction function at the corresponding position according to the configuration and effective position of module parameters in different consensus mechanisms;

[0030] S42. Use C / S architecture to establish a connection with the blockchain, send a parameter modification request through the client, and the server parses the request and determines the parameter modification location and scope;

[0031] S43. Combined with the consensus workflow, the configuration extraction function is called to read and apply the parameter modification value to the blockchain, thus realizing the online modification function of the consensus parameters during runtime;

[0032] S44. After the parameter modification is completed, a test is performed to ensure that the parameter modification is effective by outputting the parameter value in the log file.

[0033] A blockchain consensus layer parameter adaptive system based on reinforcement learning, including the following modules:

[0034] The state perception module is used to regularly monitor and maintain the health status of each consensus node in the blockchain network through the heartbeat detection mechanism to ensure the security and stability of the blockchain network;

[0035] The performance measurement module is used to actively measure and calculate the two performance indicators of consensus node throughput and block latency through performance probes, so as to measure and record the performance status information of each consensus node in the current blockchain network;

[0036] A model training module is used to evaluate the relative benefits of the consensus layer parameter settings relative to the initial situation and the previous round based on the security and performance status information monitored and recorded by the perception module and the measurement module, and use this as a reward function to train the deep reinforcement learning model, and make decisions based on the network environment status information of each node of the current blockchain, so as to provide the optimal consensus layer parameter settings according to the current blockchain status;

[0037] The parameter modification module is used to select the parameters of the mainstream blockchain consensus protocol module and determine the adjustable range of the parameters. It uses and expands the SDK provided by the blockchain system to design a blockchain parameter modification framework to achieve runtime adjustment of blockchain parameters, verify whether the parameter modification is successful, and ensure that the parameter modification takes effect from the next block.

[0038] Preferably, the state perception module includes:

[0039] The heartbeat detection unit is used to receive the heartbeat signal and feedback the confirmation message to the consensus node unit;

[0040] The state management unit is used to record the health status and security information of the consensus node.

[0041] Preferably, the performance measurement module includes a performance probe unit for measuring blockchain runtime parameters and calculating transaction throughput and block latency during the blockchain consensus process.

[0042] Preferably, the model training module includes:

[0043] The status acquisition unit is used to obtain the four status information of the current number of active consensus nodes in the blockchain, NumNodes, block delay BlockDelay, transaction throughput TPS, and network delay Network Latency;

[0044] The parameter recommendation unit is used to provide recommended settings for four consensus layer parameters, namely, the timeout period of the three consensus stages Propose, Prevote, and Precommit and the number of consecutive blocks produced by each node, based on the current status information of the blockchain;

[0045] The benefit evaluation unit is used to evaluate the security and performance benefits of the current blockchain consensus layer parameter settings relative to historical rounds through a preset reward function and real-time status information;

[0046] A reward feedback unit, which is used to calculate reward feedback with the goal of maximizing long-term safety and performance gains;

[0047] The calculation principles of the revenue evaluation unit and the reward feedback unit include:

[0048] Let C be the current reward function value, I be the initial reward function value, and L be the reward function value of the previous round. Then we can evaluate the relative benefits of the current round, the initial situation, and the previous round respectively:

[0049]

[0050] Assuming η is the adjustment coefficient, the reward feedback value r can be calculated T :

[0051]

[0052] The above formula shows that if the current reward parameter is improved compared to the previous one (ΔT 1 >0), the reward is positive. If the current reward parameter has not increased or decreased compared to the previous one, the reward is negative. The size of the reward also depends on the change in the current reward parameter relative to the initial value (ΔT 0 ), and the adjustment coefficient η.

[0053] Preferably, the parameter modification module includes:

[0054] b1. Construct configuration extraction functions at corresponding locations for the configuration and effective locations of module parameters in different consensus mechanisms;

[0055] b2. Use C / S architecture to establish a connection with the blockchain, send a parameter modification request through the client, and the server parses the request and determines the parameter modification location and scope;

[0056] b3. Combined with the consensus workflow, the configuration extraction function is called to read and apply the parameter modification value to the blockchain, thus realizing the online modification function of the consensus parameters during runtime;

[0057] b4. After the parameter modification is completed, test it and ensure that the parameter modification is effective by outputting the parameter value in the log file.

[0058] Therefore, the present invention adopts the above-mentioned blockchain consensus layer parameter adaptive method and system based on reinforcement learning, which has the following beneficial effects:

[0059] (1) By integrating deep reinforcement learning technology with the parameter modification framework, it is possible to dynamically optimize and modify the consensus layer parameters based on the real-time security and performance status data of the blockchain;

[0060] (2) Solve the security threats and performance bottlenecks faced by current blockchain consensus protocols, further improve the robustness, performance, and sustainable optimization capabilities of blockchain systems, and provide technical support for the efficient and secure data flow of blockchain technology in complex heterogeneous environments.

[0061] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0062] Figure 1 is a schematic flow chart of a method according to an embodiment of the present invention;

[0063] Figure 2 The following is a flowchart of the heartbeat detection mechanism according to an embodiment of the present invention;

[0064] Figure 3 The following is a flowchart of the performance probe technology (performance measurement module) of an embodiment of the present invention;

[0065] Figure 4 This is a workflow diagram of a reinforcement learning model (model training module) according to an embodiment of the present invention;

[0066] Figure 5 It is a working flow diagram of the parameter modification framework (parameter modification module) of an embodiment of the present invention;

[0067] Figure 6 A module diagram of a system according to an embodiment of the present invention;

[0068] Figure 7 It is a schematic diagram of performance scoring verification according to an embodiment of the present invention. DETAILED DESCRIPTION

[0069] Example

[0070] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on 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 present invention.

[0071] Reference Figure 1-Figure 7 The present invention discloses a blockchain consensus layer parameter adaptive method based on reinforcement learning, comprising the following steps:

[0072] S1. Build a consensus node status manager to perceive and maintain the health status and security information of each consensus node in the current blockchain network;

[0073] The heartbeat detection mechanism is used to perceive and maintain the health status and security information of each consensus node in the current blockchain network. The heartbeat detection mechanism specifically includes:

[0074] a1. The consensus node responsible for verifying transaction validity, participating in the consensus process and generating new blocks sends a heartbeat signal containing node health status and security information to the consensus node state manager at a fixed time interval;

[0075] a2. The consensus node status manager receives the heartbeat signal, records the consensus node status information, and feeds back a confirmation message to the consensus node.

[0076] S2. Build a performance probe to measure and record the performance data of each consensus node in the current blockchain network;

[0077] S21. Actively measure and record the number of transactions contained in each block, the packaging time of the block, the confirmation time of the block, and the time consumed in the four consensus stages of Proposal, Prevote, Precommit, and Commit during the operation of the blockchain;

[0078] S22. Calculate the two performance indicators of blockchain consensus process transaction throughput and block latency based on the parameter values ​​measured in S21.

[0079] S3. Build and train a deep reinforcement learning algorithm to select the optimal parameter combination for the blockchain consensus layer based on the security and performance status information perceived and measured by the consensus node state manager and performance probe in S1 and S2;

[0080] Preferably, S3 specifically includes:

[0081] S31, status acquisition, obtain the current number of active consensus nodes NumNodes, block delay BlockDelay, transaction throughput TPS, and network delay Network Latency of the blockchain for model training;

[0082] S32, parameter recommendation, providing consensus layer recommended parameter settings for the timeout time of each consensus stage and the number of consecutive blocks produced by each node based on the current status information of the blockchain, which is used to formulate a real-time optimization plan for blockchain security and performance;

[0083] S33, benefit evaluation, using the preset reward function and real-time status information to evaluate the security and performance benefits of the current blockchain consensus layer parameter settings relative to historical rounds for calculating rewards;

[0084] S34, reward feedback, with the goal of maximizing long-term safety and performance benefits, to calculate reward feedback to guide subsequent model training;

[0085] Benefit evaluation and reward feedback, including:

[0086] Let C be the current reward function value, I be the initial reward function value, and L be the reward function value of the previous round. Then evaluate the relative benefits of the current round, the initial situation, and the previous round respectively:

[0087]

[0088] Assuming η is the adjustment coefficient, the reward feedback value r can be calculated T :

[0089]

[0090] The above formula shows that if the current reward parameter is improved compared to the previous one (ΔT 1 >0), the reward is positive. If the current reward parameter has not increased or decreased compared to the previous one, the reward is negative. The size of the reward also depends on the change in the current reward parameter relative to the initial value (ΔT 0 ), and the adjustment coefficient η.

[0091] S4: Build a blockchain parameter modification framework to instantly apply the optimal parameter combination of the blockchain consensus layer selected by the deep reinforcement learning algorithm of S3 on the blockchain.

[0092] S41. Construct a configuration extraction function at the corresponding position according to the configuration and effective position of module parameters in different consensus mechanisms;

[0093] S42. Use C / S architecture to establish a connection with the blockchain, send a parameter modification request through the client, and the server parses the request and determines the parameter modification location and scope;

[0094] S43. Combined with the consensus workflow, the configuration extraction function is called to read and apply the parameter modification value to the blockchain, thus realizing the online modification function of the consensus parameters during runtime;

[0095] S44. After the parameter modification is completed, a test is performed to ensure that the parameter modification is effective by outputting the parameter value in the log file.

[0096] A blockchain consensus layer parameter adaptive system based on reinforcement learning, including the following modules:

[0097] The state perception module is used to regularly monitor and maintain the health status of each consensus node in the blockchain network through the heartbeat detection mechanism to ensure the security and stability of the blockchain network.

[0098] The heartbeat detection unit is used to receive the heartbeat signal and feedback the confirmation message to the consensus node unit;

[0099] The state management unit is used to record the health status and security information of the consensus node.

[0100] The performance measurement module is used to actively measure and calculate the two performance indicators of consensus node throughput and block latency through performance probes, so as to measure and record the performance status information of each consensus node in the current blockchain network.

[0101] The performance measurement module includes a performance probe unit, which is used to measure blockchain runtime parameters and calculate the transaction throughput and block latency of the blockchain consensus process.

[0102] The model training module is used to evaluate the relative benefits of the consensus layer parameter settings relative to the initial situation and the previous round based on the security and performance status information monitored and recorded by the perception module and the measurement module, and use this as a reward function to train the deep reinforcement learning model, and make decisions based on the current network environment status information of each node in the blockchain, so as to provide the optimal consensus layer parameter settings according to the current blockchain status.

[0103] The model training module includes:

[0104] The status acquisition unit is used to obtain the four status information of the current number of active consensus nodes in the blockchain, NumNodes, block delay BlockDelay, transaction throughput TPS, and network delay Network Latency;

[0105] The parameter recommendation unit is used to provide recommended settings for four consensus layer parameters, namely, the timeout period of the three consensus stages Propose, Prevote, and Precommit and the number of consecutive blocks produced by each node, based on the current status information of the blockchain;

[0106] The benefit evaluation unit is used to evaluate the security and performance benefits of the current blockchain consensus layer parameter settings relative to historical rounds through a preset reward function and real-time status information;

[0107] A reward feedback unit, which is used to calculate reward feedback with the goal of maximizing long-term safety and performance gains;

[0108] The calculation principles of the revenue evaluation unit and the reward feedback unit include:

[0109] Let C be the current reward function value, I be the initial reward function value, and L be the reward function value of the previous round. Then we can evaluate the relative benefits of the current round, the initial situation, and the previous round respectively:

[0110]

[0111] Assuming η is the adjustment coefficient, the reward feedback value r can be calculated T :

[0112]

[0113] The above formula shows that if the current reward parameter is improved compared to the previous one (ΔT 1 >0), the reward is positive. If the current reward parameter has not increased or decreased compared to the previous one, the reward is negative. The size of the reward also depends on the change in the current reward parameter relative to the initial value (ΔT 0 ), and the adjustment coefficient η.

[0114] The parameter modification module is used to select the parameters of the mainstream blockchain consensus protocol module and determine the adjustable range of the parameters. It uses and expands the SDK provided by the blockchain system to design a blockchain parameter modification framework to achieve runtime adjustment of blockchain parameters, verify whether the parameter modification is successful, and ensure that the parameter modification takes effect from the next block.

[0115] b1. Construct configuration extraction functions at corresponding locations for the configuration and effective locations of module parameters in different consensus mechanisms;

[0116] b2. Use C / S architecture to establish a connection with the blockchain, send a parameter modification request through the client, and the server parses the request and determines the parameter modification location and scope;

[0117] b3. Combined with the consensus workflow, the configuration extraction function is called to read and apply the parameter modification value to the blockchain, thus realizing the online modification function of the consensus parameters during runtime;

[0118] b4. After the parameter modification is completed, test it and ensure that the parameter modification is effective by outputting the parameter value in the log file.

[0119] like Figure 7 As shown, the effectiveness of the method of this embodiment is verified based on the performance score, and the performance score Score is calculated as follows:

[0120] Score=(0.7×norm(TPS)+0.15×(1-norm(CPU))+0.15×(1-

[0121] norm(Mem)))×100;

[0122] The norm() function is used to standardize the original resource utilization and transaction throughput to the range of 0 to 1. CPU refers to CPU utilization, Mem refers to memory utilization, and TPS refers to transaction throughput.

[0123] Therefore, the present invention adopts the above-mentioned blockchain consensus layer parameter adaptation method and system based on reinforcement learning, aiming to solve the security threats and performance bottlenecks faced by the current blockchain consensus protocol, further improve the robustness, performance and sustainable optimization capabilities of the blockchain system, and provide technical support for the efficient and secure data flow of blockchain technology in complex heterogeneous environments.

[0124] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that they can still modify or replace the technical solution of the present invention with equivalents, and these modifications or equivalent replacements cannot cause the modified technical solution to deviate from the spirit and scope of the technical solution of the present invention.

Claims

1. A blockchain consensus layer parameter adaptive method based on reinforcement learning, characterized in that: The following steps are involved: S1. Build a consensus node status manager to perceive and maintain the health status and security information of each consensus node in the current blockchain network; S2. Build a performance probe to measure and record the performance data of each consensus node in the current blockchain network; S3. Build and train a deep reinforcement learning algorithm to select the optimal parameter combination for the blockchain consensus layer based on the security and performance status information perceived and measured by the consensus node state manager and performance probe in S1 and S2; S4: Build a blockchain parameter modification framework to instantly apply the optimal parameter combination of the blockchain consensus layer selected by the deep reinforcement learning algorithm of S3 on the blockchain.

2. According to claim 1, a blockchain consensus layer parameter adaptive method based on reinforcement learning is characterized in that: S1 uses a heartbeat detection mechanism to perceive and maintain the health status and security information of each consensus node in the current blockchain network. The heartbeat detection mechanism specifically includes: a1. The consensus node responsible for verifying transaction validity, participating in the consensus process and generating new blocks sends a heartbeat signal containing node health status and security information to the consensus node state manager at a fixed time interval; a2. The consensus node status manager receives the heartbeat signal, records the consensus node status information, and feeds back a confirmation message to the consensus node.

3. According to a blockchain consensus layer parameter adaptive method based on reinforcement learning according to claim 1, it is characterized in that: S2 specifically includes: S21. Actively measure and record the number of transactions contained in each block, the packaging time of the block, the confirmation time of the block, and the time consumed in the four consensus stages of Proposal, Prevote, Precommit, and Commit during the operation of the blockchain; S22. Calculate the two performance indicators of blockchain consensus process transaction throughput and block latency based on the parameter values ​​measured in S21.

4. According to a method for adaptively adjusting parameters of blockchain consensus layer based on reinforcement learning according to claim 1, it is characterized in that: S3 specifically includes: S31, status acquisition, obtain the current number of active consensus nodes NumNodes, block delay BlockDelay, transaction throughput TPS, and network delay Network Latency of the blockchain for model training; S32, parameter recommendation, providing consensus layer recommended parameter settings for the timeout time of each consensus stage and the number of consecutive blocks produced by each node based on the current status information of the blockchain, which is used to formulate a real-time optimization plan for blockchain security and performance; S33, benefit evaluation, using the preset reward function and real-time status information to evaluate the security and performance benefits of the current blockchain consensus layer parameter settings relative to historical rounds for calculating rewards; S34, reward feedback, with the goal of maximizing long-term safety and performance benefits, to calculate reward feedback to guide subsequent model training; The benefits evaluation and reward feedback include: Let C be the current reward function value, I be the initial reward function value, and L be the reward function value of the previous round. Then evaluate the relative benefits of the current round, the initial situation, and the previous round respectively: Assuming η is the adjustment coefficient, the reward feedback value r can be calculated T : The above formula shows that if the current reward parameter is improved compared with the last time, ΔT1>0, the reward is positive; if the current reward parameter is not improved or decreased compared with the last time, the reward is negative.

5. According to a method for adaptively adjusting parameters of blockchain consensus layer based on reinforcement learning according to claim 4, it is characterized in that: S4 specific content includes: S41. Construct a configuration extraction function at the corresponding position according to the configuration and effective position of module parameters in different consensus mechanisms; S42. Use C / S architecture to establish a connection with the blockchain, send a parameter modification request through the client, and the server parses the request and determines the parameter modification location and scope; S43. Combined with the consensus workflow, the configuration extraction function is called to read and apply the parameter modification value to the blockchain, thus realizing the online modification function of the consensus parameters during runtime; S44. Perform a test after the parameter modification is completed.

6. A system for applying the blockchain consensus layer parameter adaptive method based on reinforcement learning as described in any one of claims 1 to 5, characterized in that: Includes the following modules: The state perception module is used to regularly monitor and maintain the health status of each consensus node in the blockchain network through the heartbeat detection mechanism to ensure the security and stability of the blockchain network; The performance measurement module is used to actively measure and calculate the two performance indicators of consensus node throughput and block latency through performance probes, so as to measure and record the performance status information of each consensus node in the current blockchain network; A model training module is used to evaluate the relative benefits of the consensus layer parameter settings relative to the initial situation and the previous round based on the security and performance status information monitored and recorded by the perception module and the measurement module, and use this as a reward function to train the deep reinforcement learning model, and make decisions based on the network environment status information of each node of the current blockchain, so as to provide the optimal consensus layer parameter settings according to the current blockchain status; The parameter modification module is used to select the parameters of the mainstream blockchain consensus protocol module and determine the adjustable range of the parameters. It uses and expands the SDK provided by the blockchain system to design a blockchain parameter modification framework to achieve runtime adjustment of blockchain parameters, verify whether the parameter modification is successful, and ensure that the parameter modification takes effect from the next block.

7. According to claim 6, a system for a blockchain consensus layer parameter adaptive method based on reinforcement learning is characterized in that: The state awareness module includes: The heartbeat detection unit is used to receive the heartbeat signal and feedback the confirmation message to the consensus node unit; The state management unit is used to record the health status and security information of the consensus node.

8. According to claim 6, a system for a blockchain consensus layer parameter adaptive method based on reinforcement learning is characterized in that: The performance measurement modules include: The performance probe unit is used to measure blockchain runtime parameters and calculate the transaction throughput and block latency of the blockchain consensus process.

9. The system of a blockchain consensus layer parameter adaptive method based on reinforcement learning according to claim 6 is characterized in that: The model training module includes: The status acquisition unit is used to obtain the four status information of the current number of active consensus nodes in the blockchain, NumNodes, block delay BlockDelay, transaction throughput TPS, and network delay Network Latency; The parameter recommendation unit is used to provide recommended settings for four consensus layer parameters, namely, the timeout period of the three consensus stages Propose, Prevote, and Precommit and the number of consecutive blocks produced by each node, based on the current status information of the blockchain; The benefit evaluation unit is used to evaluate the security and performance benefits of the current blockchain consensus layer parameter settings relative to historical rounds through a preset reward function and real-time status information; A reward feedback unit, which is used to calculate reward feedback with the goal of maximizing long-term safety and performance gains; The calculation principles of the revenue evaluation unit and the reward feedback unit include: Let C be the current reward function value, I be the initial reward function value, and L be the reward function value of the previous round. Then evaluate the relative benefits of the current round, the initial situation, and the previous round respectively: Let η be the adjustment coefficient, then the reward feedback value r is calculated T : The above formula shows that if the current reward parameter is improved compared with the last time (ΔT1>0), the reward is a positive value. If the current reward parameter is not improved or decreased compared with the last time, the reward is a negative value.

10. According to claim 6, a system for a blockchain consensus layer parameter adaptive method based on reinforcement learning is characterized in that: The parameter modification module includes: b1. Construct configuration extraction functions at corresponding locations for the configuration and effective locations of module parameters in different consensus mechanisms; b2. Use C / S architecture to establish a connection with the blockchain, send a parameter modification request through the client, and the server parses the request and determines the parameter modification location and scope; b3. Combined with the consensus workflow, the configuration extraction function is called to read and apply the parameter modification value to the blockchain, thus realizing the online modification function of the consensus parameters during runtime; b4. After the parameter modification is completed, test it and ensure that the parameter modification is effective by outputting the parameter value in the log file.

Citation Information

Cited By

  • Block chain topology-consensus co-evolution method and system based on reinforcement learning

    CN121418296A

  • Blockchain topology-consensus collaborative evolution method and system based on reinforcement learning

    CN121418296B