Block chain node state detection method and device, electronic equipment and storage medium

By selecting nodes with characteristic parameters to characterize the performance stability of nodes in the blockchain network as state detection nodes, detecting the status of consensus nodes and performing alarm processing, the problem of cumbersome detection operations in the existing technology is solved, and real-time detection and stability guarantee of consensus node status in the blockchain network is realized.

CN120017485APending Publication Date: 2025-05-16TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202311517495.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-11-13
Publication Date
2025-05-16

AI Technical Summary

Technical Problem

In the prior art, the availability of consensus nodes in the blockchain network is detected through external tools, and the operation is complicated and requires manual configuration of nodes and addresses.

Method used

By selecting nodes with characteristic parameters to characterize the performance stability of nodes in the blockchain network as state detection nodes, sending detection information to consensus nodes, recording response information, determining the status abnormal nodes and performing alarm processing.

Benefits of technology

Real-time detection of consensus node status in blockchain network is realized, the detection process is simplified, the tedious operation of manual configuration is avoided, and network stability is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120017485A_ABST
    Figure CN120017485A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a block chain node state detection method and device, equipment and a storage medium. The method comprises the steps that at least one block chain node is selected as a state detection node according to feature parameters of all block chain nodes in a block chain network, and the feature parameters are used for representing performance stability of the block chain nodes; sending detection information to each consensus node in the block chain network through the state detection node, and recording response information of the consensus nodes for the detection information; and determining a state abnormal node in the block chain network according to the response information, and performing alarm processing on the state abnormal node. According to the embodiment of the invention, external connection of a detection device and manual configuration of node information can be avoided, real-time detection of the state of each node participating in consensus in the block chain network is realized, and the operation stability of the block chain network is guaranteed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of blockchain technology, and specifically to a blockchain node status detection method and device, an electronic device, and a computer-readable storage medium. Background Art

[0002] A blockchain node is a computer or device running in a blockchain network, where each node has a complete blockchain ledger that contains all transaction records and the history of the blockchain. These nodes maintain the blockchain by communicating with each other.

[0003] In the related art, in order to ensure the stability of the blockchain network, it is necessary to connect external tools to regularly detect the availability of each consensus node. However, when using external tools to detect, it is necessary to manually configure all consensus nodes and node addresses participating in the consensus in the detection file, which is a cumbersome and complicated operation. Therefore, how to propose a simple and convenient blockchain status detection solution is an urgent problem that technicians in this field need to solve. Summary of the invention

[0004] To solve the above technical problems, the embodiments of the present application provide a method and device for detecting the status of a blockchain node, an electronic device, and a computer-readable storage medium.

[0005] According to one aspect of an embodiment of the present application, a state detection method for a blockchain node is provided, comprising: selecting at least one blockchain node as a state detection node according to characteristic parameters of each blockchain node in the blockchain network, wherein the characteristic parameters are used to characterize the performance stability of the blockchain node; sending detection information to each consensus node in the blockchain network through the state detection node, and recording response information of the consensus node to the detection information; determining a state-abnormal node in the blockchain network according to the response information, and performing alarm processing on the state-abnormal node.

[0006] According to one aspect of an embodiment of the present application, a state detection device for a blockchain node is provided, comprising: a selection module, used to select at least one blockchain node as a state detection node according to characteristic parameters of each blockchain node in the blockchain network, wherein the characteristic parameters are used to characterize the performance stability of the blockchain node; a detection module, used to send detection information to each consensus node in the blockchain network through the state detection node, and record response information of the consensus node to the detection information; an alarm module, used to determine the state abnormal node in the blockchain network according to the response information, and perform alarm processing on the state abnormal node.

[0007] In one embodiment of the present application, the status detection device of the blockchain node also includes: a slave node acquisition module, which is used to select at least one blockchain node as a status detection slave node from other blockchain nodes except the status detection node according to the characteristic parameters of each blockchain node; a backup module, which is used to back up the response information in the status detection slave node; and a switching module, which is used to switch the status detection slave node to send detection information to the consensus node and record corresponding response information when the status detection node fails.

[0008] In one embodiment of the present application, the state detection device of the blockchain node also includes: a detection module, which is used to detect the number of state detection nodes and the number of state detection slave nodes in the blockchain network; a state detection node selection module, which is used to select state detection nodes that meet the state detection node number threshold from the blockchain network if the number of state detection nodes is less than the state detection node number threshold; a state detection slave node selection module, which is used to select state detection slave nodes that meet the state detection slave node number threshold from the blockchain network if the number of state detection slave nodes is less than the state detection slave node number threshold.

[0009] In one embodiment of the present application, the status detection node selection module is specifically configured as follows: if the number of the status detection nodes is less than a first number threshold, the status detection slave node is switched to a new status detection node; and a new status detection slave node is reselected from the blockchain network.

[0010] In one embodiment of the present application, the selection module is specifically configured as follows: performing weighted sum calculation on the characteristic parameters of each blockchain node respectively to obtain the stability value of each blockchain node; and determining the state detection node according to the stability value of each blockchain node.

[0011] In one embodiment of the present application, the selection module is specifically configured as follows: obtaining characteristic parameters corresponding to each blockchain node in the blockchain network, wherein the characteristic parameters include at least one of a block production speed, a number of disconnection times, and a latest block production time; performing weighted sum calculations on the characteristic parameters of each blockchain node respectively to obtain a stability value of each blockchain node.

[0012] In one embodiment of the present application, the alarm module is specifically configured as follows: determining an alarm level based on at least one of the location and number of the abnormal status nodes, the alarm level including a warning level and an alarm level, and the alarm level is higher than the alarm level; triggering the warning system to send an alarm notification message based on the alarm level.

[0013] In one embodiment of the present application, the alarm mold body is configured to: obtain the consensus type corresponding to the abnormal status node; determine, based on the consensus type, a limit value for at least one of the location and number of abnormal status nodes allowed to appear in the blockchain network; compare at least one of the location and number of abnormal status nodes in the blockchain network with the limit value, and determine the alarm level based on the comparison result obtained.

[0014] In one embodiment of the present application, the detection module is specifically configured as follows: if the response information returned by the consensus node is received within a preset time range, the response information is directly recorded; if the response information returned by the consensus node is not received within the preset time range, response information is generated for the consensus node and the generated response information is recorded.

[0015] According to one aspect of an embodiment of the present application, an electronic device is provided, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the electronic device implements the status detection method of the blockchain node as described above.

[0016] According to one aspect of an embodiment of the present application, a computer-readable storage medium is provided, on which computer-readable instructions are stored. When the computer-readable instructions are executed by a processor of a computer, the computer executes the status detection method of the blockchain node as described above.

[0017] In the technical solution provided in the embodiments of the present application, the status detection of the consensus nodes in the blockchain network is specifically performed by the blockchain nodes in the blockchain network. Since each blockchain node is pre-configured with information of other blockchain nodes, compared to realizing blockchain status detection through external tools, the present application does not require additional configuration of the consensus nodes, and thus can realize simpler and more convenient blockchain status detection.

[0018] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present application, and together with the specification, are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work. In the drawings:

[0020] Figure 1is a schematic diagram of an implementation environment shown in an exemplary embodiment of the present application;

[0021] Figure 2 is a flow chart of a method for detecting the status of a blockchain node shown in an exemplary embodiment of the present application;

[0022] Figure 3 is a flowchart of state detection of a blockchain node shown in another exemplary embodiment of the present application;

[0023] Figure 4 It is a schematic diagram of the relationship between the blockchain state node and the blockchain state detection slave node in the blockchain;

[0024] Figure 5 is a flowchart of a method for detecting the status of a blockchain node shown in another exemplary embodiment of the present application;

[0025] Figure 6 is a flowchart of a method for detecting the status of a blockchain node shown in another exemplary embodiment of the present application;

[0026] Figure 7 It is a schematic diagram of the direct switching relationship between the state detection node and the state detection slave node in the blockchain;

[0027] Figure 8 is a flowchart of a method for detecting the status of a blockchain node shown in another exemplary embodiment of the present application;

[0028] Fig. 9 is a flowchart of a method for detecting the status of a blockchain node shown in another exemplary embodiment of the present application;

[0029] Fig.10 is a flowchart of a method for detecting the status of a blockchain node shown in another exemplary embodiment of the present application;

[0030] Fig.11 is a flowchart of a method for detecting the status of a blockchain node shown in another exemplary embodiment of the present application;

[0031] Fig.12 is a flowchart of a method for detecting the status of a blockchain node shown in another exemplary embodiment of the present application;

[0032] Fig.13 This is a schematic diagram of the state detection node in the blockchain sending detection information to the consensus node;

[0033] Fig.14 It is a brief flow chart of the status detection of blockchain nodes in an exemplary application scenario;

[0034] Fig.15is a block diagram of a state detection device for a blockchain node shown in an exemplary embodiment of the present application;

[0035] Fig.16 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present application is shown. DETAILED DESCRIPTION

[0036] Here, exemplary embodiments will be described in detail, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are only examples of devices and methods consistent with some aspects of the present application as detailed in the attached claims.

[0037] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program with a predetermined function, and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.

[0038] 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.

[0039] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.

[0040] The term "multiple" as used in this application refers to two or more than two. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the related objects are in an "or" relationship.

[0041] First of all, it should be noted that the technical solution of the embodiment of this application involves the field of blockchain technology. Before introducing the technical solution of the embodiment of this application, a brief introduction to blockchain technology is given. Blockchain technology is a decentralized, distributed, and tamper-proof data storage and transmission technology based on a chain data structure, which ensures the security of data transmission and access through cryptographic algorithms.

[0042] Among them, blockchain nodes refer to computers or devices running in the blockchain network. Each node has a complete copy, including all transaction records and the history of the blockchain. These nodes maintain the integrity and security of the blockchain by communicating with each other. Nodes can be miners, full nodes or light nodes, and they have different roles and functions. Miners are responsible for verifying transactions and creating new blocks, full nodes store a copy of the entire blockchain and verify transactions, and light nodes only store block headers and a small amount of transaction information, and need to obtain complete blockchain data from other nodes. The more blockchain nodes there are, the more decentralized the network is, and the more difficult it is to attack and tamper with.

[0043] In related technologies, in order to ensure the stability of the blockchain network, it is necessary to connect external tools to regularly detect the availability of each consensus node. However, when using external tools to detect, it is necessary to manually configure all consensus nodes and node addresses participating in the consensus in the detection file, which is a cumbersome and complicated operation.

[0044] Based on this, the embodiments of the present application provide a blockchain node status detection method and device, electronic device, storage medium, and program product, which realize real-time detection of the status of nodes participating in consensus in the blockchain network and ensure the stable operation of the blockchain network.

[0045] See also Figure 1 , Figure 1 It is a schematic diagram of an implementation environment involved in this application, which includes a server end 110 and a blockchain network composed of multiple blockchain nodes 120, wherein the blockchain node 120 can be (any form of computing device connected to the blockchain network, such as a server, a user terminal, etc.), and a peer-to-peer network is formed between the nodes. The peer-to-peer protocol is an application layer protocol running on the Transmission Control Protocol (TCP). In the blockchain network, any machine such as a server or a terminal can join and become a node, and the node includes a hardware layer, an intermediate layer, an operating system layer, and an application layer.

[0046] See also Figure 1 The functions of each node in the blockchain network shown include:

[0047] 1) Routing: a basic function of a node, used to support communication between nodes.

[0048] In addition to the routing function, the node can also have the following functions:

[0049] 2) Applications are deployed in the blockchain to implement specific businesses based on actual business needs, record data related to the implementation of functions to form record data, carry digital signatures in the record data to indicate the source of the task data, and send the record data to other nodes in the blockchain system for other nodes to add the record data to a temporary block when they successfully verify the source and integrity of the record data.

[0050] For example, the services implemented by the application include:

[0051] 2.1) Shared ledger, used to provide functions such as storage, query and modification of account data, and send the record data of the operation on the account data to other nodes in the blockchain system. After other nodes verify the validity, as a response to acknowledge the validity of the account data, the record data will be stored in a temporary block, and a confirmation can also be sent to the node that initiated the operation.

[0052] 2.2) Smart contracts are computerized protocols that can execute the terms of a smart contract. They are implemented by deploying code on a shared ledger that is executed when certain conditions are met. The code is used to complete automated transactions based on actual business needs, such as querying the logistics status of the goods purchased by the buyer and transferring the buyer's electronic currency to the merchant's address after the buyer signs for the goods. Of course, smart contracts are not limited to executing smart contracts for transactions, but can also execute smart contracts that process received information.

[0053] 3) Blockchain, including a series of blocks that are connected to each other in the order of their generation. Once a new block is added to the blockchain, it will not be removed. The block records the record data submitted by the nodes in the blockchain system.

[0054] In some achievable embodiments, the server 110 can select at least one blockchain node 120 from the blockchain network as a state detection node 130 according to the characteristic parameters of each blockchain node 120 in the blockchain network, so as to send detection information to each blockchain node 120 participating in the consensus in the blockchain network through the state detection node 130, and record the response information of each blockchain node 120 participating in the consensus to the detection information through the state detection node, wherein the state detection node 130 can record the blockchain node 120 that feedbacks the response information to the detection information as a normal node, and record the blockchain node 120 that does not feedback the response information to the detection information as an abnormal node; then, the server 110 state detection node 130 determines the abnormal state node in the blockchain network according to the response information of each blockchain node 120 in the blockchain network, and performs alarm processing on the abnormal state node. Compared with the related technology, while realizing the detection of the node state in the blockchain network, the network level is used to maintain the information of the nodes in the blockchain network, which reduces the information and configuration collection on the blockchain and ensures the stable operation of the blockchain network.

[0055] It should be noted that this application involves user-related data such as accounts and transaction objects. When the methods of this application are applied to specific products or technologies, the user's permission or consent must be obtained, and the extraction, use and processing of relevant data must comply with local security standards and local laws and regulations.

[0056] See also Figure 2 , Figure 2 This is a flowchart of a method for detecting the status of a blockchain node shown in an exemplary embodiment of the present application. This method can be applied to Figure 1 The implementation environment shown, which can be Figure 1 The server 110 in the illustrated implementation environment executes.

[0057] like Figure 2 As shown, in an exemplary embodiment, the state detection method of a blockchain node may include steps S210 to S230, which are described in detail as follows:

[0058] Step S210: Select at least one blockchain node as a status detection node based on characteristic parameters of each blockchain node in the blockchain network, wherein the characteristic parameters are used to characterize the performance stability of the blockchain node.

[0059] It should be noted that the characteristics of blockchain nodes are mainly reflected in the following aspects: the storage capacity of blockchain nodes, among which blockchain nodes can store corresponding block data in TF cards, U disks, mobile hard disks and computers, etc.; the network connection stability of blockchain nodes, that is, the offline network rate of blockchain nodes, which characterizes the stability of network connections between other nodes in the blockchain network; and the participation of blockchain nodes in the current blockchain network, that is, the transactions conducted by blockchain nodes in the current blockchain network through visual terminals, etc.

[0060] At least one blockchain node can be selected from the current blockchain nodes as a status detection node based on characteristic parameters used to characterize the performance stability of the blockchain nodes. The status detection node can be used as the execution subject of the small heartbeat data packet sent to the blockchain network, thereby avoiding the need to implant a blockchain node status detection device in the blockchain to detect the status of each node in the blockchain network.

[0061] Optionally, a blockchain node can be selected from the current blockchain network as a status detection node based on the characteristic parameters of the blockchain node, wherein the selected blockchain node serves as the execution subject for executing the status detection of the blockchain node, and the status detection information is sent to the nodes in the blockchain network through the status detection node, thereby avoiding implanting other node status detection devices in the blockchain network to occupy the bandwidth of the current network, thereby ensuring the operation stability of the blockchain node.

[0062] Among them, the performance stability of blockchain nodes refers to the ability of nodes to maintain stability, reliability, and efficiency during operation. Blockchain nodes need to store a large amount of data and process a large number of transaction requests, so the hardware configuration and network bandwidth of the nodes need to be powerful enough to ensure that the nodes can run efficiently. In addition, blockchain nodes also need to follow certain specifications and protocols to ensure that the interaction and verification between nodes can be carried out correctly and effectively. If the node has vulnerabilities or is attacked, it may affect the stability and security of the entire blockchain network. Therefore, the performance stability of blockchain nodes is very important, and the nodes need to have sufficient hardware resources and network bandwidth to support them, and the nodes need to follow certain specifications and protocols to ensure security and stability.

[0063] Optionally, multiple blockchain nodes can be selected from the current blockchain network as status detection nodes according to the characteristic parameters of the blockchain nodes. When there are multiple status detection nodes, the nodes participating in the consensus in the blockchain network can be evenly divided into multiple status detection nodes; the nodes participating in the consensus in the blockchain network can also be divided into their respective corresponding status detection nodes based on the location information of the nodes participating in the consensus in the blockchain network. Of course, the nodes participating in the consensus in the blockchain network can also be divided into their respective corresponding status detection nodes based on the amount of tasks corresponding to the nodes participating in the consensus in the blockchain network.

[0064] Step S220, sending detection information to each consensus node in the blockchain network through the status detection node, and recording the response information of the consensus node to the detection information.

[0065] After determining the status detection node in the current blockchain network, the detection node sends detection information to each consensus node in the blockchain network. The detection information can be a heartbeat packet to test whether the node is offline, and the heartbeat packet may not contain any actual data, but only serve as a detection link. The response information of each node participating in the consensus in the current blockchain to the detection information is recorded.

[0066] Optionally, if no response information is received from a consensus node in the blockchain network within a preset time range, the identity identifier and location information corresponding to the consensus node that did not return a response information are recorded, and the identity identifiers and location information corresponding to all consensus nodes on the blockchain network that did not return a response information within the preset time range are summarized.

[0067] Optionally, if no response information is received from the consensus node in the blockchain network within a preset time range, the consensus node that has not returned the response information will be marked with a corresponding offline mark; if a response information is received from the consensus node in the blockchain network within a preset time range, the consensus node that returns the response information will be marked with a corresponding online mark.

[0068] Step S230, determine the abnormal status nodes in the blockchain network according to the response information, and perform alarm processing on the abnormal status nodes.

[0069] After obtaining the response information of the consensus node in the current blockchain network to the detection information, the abnormal status node in the blockchain can be determined according to the response information of each consensus node in the blockchain recorded in the response information, wherein the abnormal status node can refer to the consensus node that does not return the response information within the preset time in response to the detection information sent by the status consensus node.

[0070] Among them, following the above-mentioned embodiment, all consensus nodes on the blockchain network that have not returned response information within a preset time range summarized in the response information can be regarded as status-abnormal nodes, and alarm processing can be performed on the status-abnormal nodes, and the location information of the status-abnormal nodes can be carried in the alarm information to facilitate maintenance personnel to directly locate the status-abnormal nodes according to the location information of the status-abnormal nodes.

[0071] Optionally, following the above-mentioned embodiment, the consensus node carrying the offline flag in the response information can be obtained, and the consensus node carrying the offline flag can be used as a state-abnormal node, and then alarm processing is performed on the state-abnormal node, and the location information of the state-abnormal node can be carried in the alarm information to facilitate maintenance personnel to directly locate the state-abnormal node according to the location information of the state-abnormal node.

[0072] exist Figure 2 In the illustrated embodiment, at least one blockchain node is first selected as a status detection node based on characteristic parameters of each blockchain node in the blockchain network that are used to characterize the stability of the blockchain node, and detection information is sent to each consensus node in the blockchain network through the status detection node, thereby avoiding the need to connect other status detection devices externally in the blockchain network and avoiding manual configuration of the corresponding consensus node information. By recording the response information of the consensus node to the detection information, the abnormal status nodes in the blockchain network are determined based on the response information of the consensus nodes on the blockchain, and then alarm processing is performed on the abnormal status nodes, thereby realizing real-time detection of the status of the consensus nodes participating in the blockchain network and ensuring the operational stability of the blockchain network.

[0073] In an exemplary embodiment, see Figure 3 , Figure 3 is a flowchart of a method for detecting the state of a blockchain node shown in another exemplary embodiment of the present application. The method can be applied to Figure 1 The implementation environment shown, which can be Figure 1 The illustrated implementation environment is executed by server 110 .

[0074] like Figure 3 As shown, the method includes steps S310 to S330, and steps S210 to S230, wherein steps S310 to S330 are described in detail as follows:

[0075] Step S310: According to the characteristic parameters of each blockchain node, at least one blockchain node is selected from other blockchain nodes except the status detection node as a status detection slave node.

[0076] After selecting at least one blockchain node from each node of the current blockchain network as a state detection node, you can continue to select at least one blockchain node from other blockchain nodes in the remaining blockchain network except the state detection node as a state detection slave node.

[0077] Among them, Figure 4 As shown, regarding the selection of the state detection slave node, at least one blockchain node can be selected as the state detection slave node from each node of the blockchain network except the state detection node based on the characteristic parameters that characterize the stability of the blockchain node, wherein the number of the state detection slave nodes can be the same as the number of the state detection nodes.

[0078] Of course, in some achievable embodiments, the number of state detection slave nodes may be different from the number of state detection nodes. For example, if multiple state detection nodes are selected in the current blockchain network, and the multiple state detection nodes are for different consensus nodes to be detected, at this time, at least one blockchain node may be selected from each node of the blockchain network other than the blockchain state detection node as a state detection slave node, wherein the number of state detection slave nodes may be different from the number of state detection nodes.

[0079] Step S320: back up the response information in the status detection slave node.

[0080] If the number of state detection slave nodes is the same as the number of state detection nodes, the response information on the state detection node can be backed up by the corresponding state detection slave node, that is, the state detection slave node can run simultaneously with the state detection node and back up the response information of the consensus node in the blockchain network from the state detection node.

[0081] If the number of state detection slave nodes is different from the number of state detection nodes, the state detection slave node and the state detection node run simultaneously, and back up the response information of the consensus node in the blockchain network on at least one state detection node. Optionally, the state detection slave node can back up the response information of the consensus node in the blockchain network recorded on all state nodes. Exemplarily, if the number of state detection slave nodes is less than the number of state detection nodes, the state detection slave node corresponding to each state detection node is determined according to the relative position information between the state detection node and the state detection slave node, and then the state detection slave nodes back up the response information recorded on the state detection nodes corresponding to each state detection node.

[0082] In some feasible embodiments, the status detection slave node and the status detection node run simultaneously, and the status detection slave node regularly backs up the response information on the status detection node to ensure that the response information recorded on the status detection slave node is consistent with the response information recorded on the status detection node.

[0083] Step S330: When a state detection node fails, the state detection slave node is switched to send detection information to the consensus node, and the corresponding response information is recorded.

[0084] When a failure of the status detection node is detected, the status detection slave node can be switched to send detection information to the consensus node in the blockchain network and record the response information of the consensus node on the corresponding blockchain.

[0085] Among them, the reasons for the failure of the status detection node may include: unreliable network communication, such as different transaction processing capabilities of nodes, different throughput of network node data, or arbitrary delays and content failures; node processing may be wrong, and the node itself may crash at any time; updates to the internal protocols of the blockchain system, such as software upgrades, weak consensus cannot require all nodes in the entire system to be updated at the same time, which may cause hard forks or soft forks; cheating nodes may appear, such as interfering with the operation of other nodes, etc.

[0086] Optionally, when a state detection node in the blockchain network fails, the state detection slave node is switched to send detection information to the nodes participating in the consensus in the blockchain network. Moreover, since the state detection slave node has a backup of the response information of the consensus nodes in the blockchain network, the state detection slave node can directly take over the work of the state detection node and continue to process the sending of detection information to the consensus nodes in the blockchain network and the receipt of response information returned by the consensus nodes.

[0087] exist Figure 3 In the illustrated embodiment, at least one blockchain node is selected as a status detection slave node from other blockchain nodes except the status detection node according to the characteristic parameters of the blockchain node, and the response information is backed up in the status detection slave node to ensure that the status detection slave node and the response information on the status detection node remain synchronized, so that when a failure occurs in the status detection node, the status detection slave node is switched to send detection information to the consensus node in the blockchain network, and the response information is recorded, thereby ensuring the stable operation of node status detection in the blockchain network through the master-slave node method.

[0088] In an exemplary embodiment, see Figure 5 , Figure 5 is a flowchart of a method for detecting the state of a blockchain node shown in another exemplary embodiment of the present application. The method can be applied to Figure 1 The implementation environment shown, which can be Figure 1 The illustrated implementation environment is executed by server 110 .

[0089] like Figure 5As shown, the blockchain node status detection method proposed in this embodiment also includes steps S510 to S530, which are described in detail as follows:

[0090] Step S510, detecting the number of status detection nodes and the number of status detection slave nodes in the blockchain network.

[0091] Considering that detection information is sent to consensus nodes in the blockchain network through the state detection nodes in the blockchain network, and the response information recorded on the state detection nodes is backed up by the state detection slave nodes, therefore, to ensure that the state detection nodes and the state detection slave nodes can operate stably in the blockchain network, it is necessary to detect the number of state detection nodes or the number of state detection slave nodes in the blockchain network to determine whether the state detection nodes and the state detection nodes in the blockchain network are operating stably.

[0092] Optionally, if the blockchain network includes a state detection node and a corresponding state detection slave node, the state detection node and the state detection slave node can maintain the detection work of the consensus node in the blockchain network. If the number of state detection nodes or state detection slave nodes is less than one, the detection work of the consensus node in the blockchain network cannot be maintained. Therefore, it is necessary to detect the number of state detection nodes or the number of state detection slave nodes in the blockchain network.

[0093] Optionally, if the blockchain network includes multiple state detection nodes and multiple state detection slave nodes, and the multiple state detection nodes all perform detection on the corresponding consensus nodes in the blockchain network, and the multiple state detection slave nodes all run simultaneously with the multiple state detection nodes to back up the response information on the state detection slave nodes corresponding to each other. Therefore, when either the state detection node or the state detection slave node is missing, it will affect the stability of the detection of the nodes participating in the consensus in the blockchain network. Therefore, it is necessary to detect the number of state detection nodes or the number of state detection slave nodes in the blockchain network.

[0094] Step S520: If the number of status detection nodes is less than the threshold number of status detection nodes, select status detection nodes that meet the threshold number of status detection nodes from the blockchain network;

[0095] Step S530: If the number of status detection slave nodes is less than the threshold number of status detection slave nodes, a status detection slave node that meets the threshold number of status detection slave nodes is selected from the blockchain network.

[0096] If the number of detected state detection nodes is less than the preset state detection node number threshold, it indicates that the state detection node in the blockchain network is unstable and will affect the accuracy of the heartbeat detection of the consensus node in the blockchain network. It is necessary to reselect state detection nodes that meet the corresponding threshold from the blockchain network. For example, if it is determined based on the test results that the state detection node has been disconnected in the blockchain network, it is necessary to reselect state detection nodes that meet the number threshold from the blockchain network.

[0097] If the number of state detection slave nodes detected is less than the preset state detection slave node number threshold, it indicates that the state detection slave node in the blockchain network is unstable, which will indirectly affect the accuracy of the heartbeat detection of the consensus node in the blockchain network. It is necessary to reselect state detection slave nodes that meet the corresponding number threshold from the blockchain network. For example, if it is determined according to the test results that the state detection slave node has been disconnected in the blockchain network, it is necessary to reselect state detection slave nodes that meet the number threshold from the blockchain network.

[0098] exist Figure 5 In the illustrated embodiment, by detecting the number of state detection nodes or the number of state detection slave nodes in the blockchain network, and when the number of state detection nodes or the number of state detection slave nodes in the blockchain network is less than a preset number threshold, a reselection mechanism is executed in each node of the blockchain network, thereby ensuring the stability of the number of state detection nodes and state detection slave nodes in the blockchain network, and further ensuring the stability and accuracy of consensus node state detection in the blockchain network.

[0099] In one embodiment of the present application, see Figure 6 In one of the exemplary embodiments provided in the present application, if the number of state detection nodes is less than the state detection node number threshold, the specific implementation process of selecting the state detection nodes that meet the state detection node number threshold from the blockchain network may also include step S610 and step S620, which are described in detail as follows:

[0100] Step S610: If the number of state detection nodes is less than the state detection node number threshold, the state detection slave node is switched to a new state detection node.

[0101] If it is detected that the number of status detection slave nodes is less than the corresponding status slave node data threshold, for example, it is detected that the number of status detection slave nodes in the blockchain network is less than the preset number, it cannot be guaranteed that the response information on the status detection node can be successfully backed up to the status detection slave node in a stable manner. Therefore, it is necessary to directly select a new status detection slave node from the blockchain network, and use the re-selected status detection slave node to back up the response information recorded on the status detection node.

[0102] Step S620, reselect a new status detection slave node from the blockchain network.

[0103] If the number of detected state detection nodes is less than the corresponding state detection node number threshold, for example, if the number of detected state detection nodes in the blockchain network is less than the required state detection node number threshold in the blockchain network, the stable operation of the state detection of the consensus node in the blockchain network cannot be guaranteed. Therefore, it is necessary to directly switch the state detection slave node to a new state detection node. Since the state detection slave node backs up the response information of the nodes participating in the consensus on the blockchain, the switched state detection slave node can directly send detection information to the consensus node in the blockchain network. A new state detection slave node is reselected from the blockchain network, and the reselected state detection slave node is used to back up the response information recorded on the state detection node.

[0104] Optionally, when there are multiple state detection slave nodes in the blockchain network, if the number of detected state detection nodes is less than the corresponding state detection node number threshold, the faulty state detection node is determined, and the state detection slave node corresponding to the faulty state detection node is switched to a new state detection node, and the other state detection nodes that have not failed remain unchanged. A new state detection slave node is reselected from the blockchain network, and the reselected state detection slave node is used to back up the response information recorded on the state detection node.

[0105] It should be noted that the process of reselecting slave nodes from the blockchain network can refer to the specific implementation process of step S310 above.

[0106] Optional, such as Figure 7As shown, in some feasible embodiments, if it is detected that the number of state detection slave nodes in the blockchain network is less than the threshold number of state detection slave nodes preset in the blockchain network, then the state detection slave nodes that meet the threshold number of state detection slave nodes can be re-selected from the current blockchain network; if it is detected that the number of state detection nodes in the blockchain network is less than the threshold number of state detection nodes preset in the blockchain, then the corresponding state detection slave node can be directly switched to a new state detection node, and the state detection slave node sends detection information to the nodes participating in the consensus in the blockchain network, and records the corresponding response information, and then, a new state detection slave node is re-selected from the blockchain network, and the re-selected state detection slave node is used to back up the response information recorded on the state detection node.

[0107] exist Figure 6 In the illustrated embodiment, if it is detected that the number of state detection slave nodes in the blockchain network is less than the corresponding number threshold, a new state detection slave node is directly selected from the blockchain network. If it is ensured that the state detection node has a corresponding state detection slave node, the synchronization of the master and standby nodes is ensured, and when the number of state detection nodes is less than the corresponding number threshold, the state detection slave node is directly switched to a new state detection node, which ensures the stability of the state detection of the consensus node in the blockchain network, and a new state detection slave node is reselected from the blockchain network, which ensures that the state detection node has a corresponding state detection slave node, which ensures the synchronization of the master and standby nodes.

[0108] In an embodiment of this application, see Figure 8 , Figure 8 is a flowchart of a method for detecting the state of a blockchain node shown in another exemplary embodiment of the present application. The method can be applied to Figure 1 The implementation environment shown, which can be Figure 1 The illustrated implementation environment is executed by server 110 .

[0109] like Figure 8 As shown, the specific implementation process of selecting at least one blockchain node as a status detection node according to the characteristic parameters of each blockchain node in the blockchain network includes at least step S810 and step S820, which are described in detail as follows:

[0110] Step S810, performing weighted sum calculation on the characteristic parameters of each blockchain node to obtain the stability value of each blockchain node;

[0111] Step S820, determining the status detection node according to the stability value of each blockchain node.

[0112] Specifically, the characteristic parameters of each blockchain node in the blockchain network are weighted and summed to obtain the stability value of each blockchain node, wherein the characteristic parameters of the blockchain node may be the characteristics of the blockchain node used to characterize the performance stability of the blockchain node, such as the storage capacity, network connection capacity, and production capacity of the blockchain node. According to the actual situation of the blockchain network, the characteristic parameters of each node in the blockchain are weighted and summed to obtain the stability value of the blockchain node of each node, and then the blockchain status detection node can be determined according to the stability value of each blockchain node in the blockchain network.

[0113] Optionally, in some feasible embodiments, if multiple blockchain status detection nodes need to be selected according to the actual needs of the current blockchain network, the blockchain nodes in the blockchain network whose stability values ​​reach above the preset stability values ​​can be used as status detection nodes.

[0114] Optionally, in some feasible embodiments, if a blockchain node needs to be selected as a status detection node of the blockchain network according to the actual needs of the current blockchain network, the blockchain node with the largest stability value in the blockchain network can be used as the status detection node.

[0115] In addition, the selection of the state detection slave node can also refer to the above-mentioned state detection node selection method. For example, if according to the actual needs of the current blockchain network, the blockchain node with a stability value greater than the preset stability value in the current blockchain network is used as the target blockchain node, and the corresponding state detection node and state detection slave node in the blockchain network are selected from the target blockchain node. It is also possible to select the node with the largest stability value from the current blockchain network as the state detection node, and select the state detection slave node from the remaining blockchain nodes except the state detection node according to the stability value.

[0116] exist Figure 8 In the illustrated embodiment, the stability value of each blockchain node is obtained by performing weighted sum calculation on the characteristic parameters of each blockchain node in the blockchain network, so that the corresponding state detection node can be determined according to the stability value of each blockchain node, thereby ensuring the stability of the ability of the state detection node for detecting the node state.

[0117] In one embodiment of the present application, see Fig. 9 , Fig. 9 is a flowchart of a method for detecting the state of a blockchain node shown in another exemplary embodiment of the present application. The method can be applied to Figure 1 The implementation environment shown, which can be Figure 1 The illustrated implementation environment is executed by server 110 .

[0118] like Fig. 9 As shown, the characteristic parameters include at least one of the block production speed of the node, the number of times the node is offline, and the latest block production time of the node. The specific implementation process of performing weighted sum calculation on the characteristic parameters of each blockchain node to obtain the stability value of each blockchain node may also include the following steps S910 and S920, which are described in detail as follows:

[0119] Step S910, obtaining characteristic parameters corresponding to each blockchain node in the blockchain network, the characteristic parameters including at least one of a block production speed, a number of disconnection times, and a latest block production time;

[0120] Step S920, performing weighted sum calculation on the characteristic parameters of each blockchain node to obtain the stability value of each blockchain node.

[0121] In some achievable embodiments, the performance stability of blockchain nodes in a blockchain network is mainly reflected in at least one of the production speed, the number of disconnections, and the latest production time. For example, the production speed of a blockchain node refers to the speed at which a new block is generated based on the blockchain node and added to the blockchain. In general, the block production speed of a blockchain depends on multiple factors such as the number, distribution, function, and workload of nodes in the network.

[0122] At least one of the production speed, number of disconnections, and latest production time corresponding to each blockchain node on the blockchain can be obtained respectively, and according to the actual operation requirements of the blockchain network, the production speed, number of disconnections, and latest production time of each blockchain are weighted and summed to obtain the stability value of each blockchain node, as shown in the following formula:

[0123] Node=MAX{MAX(commit_block)*percentN1%,MIN(disconnect)

[0124] *percentN2%,last_commit_block*percentN3%}

[0125] In the formula, commit_block represents the block production speed, disconnect represents the number of disconnections, and last_commit_block represents the latest block production time; N1, N2, and N3 are the weighted coefficients corresponding to the block production speed, the number of disconnections, and the latest block production time, respectively, and Node represents the stability value.

[0126] Optionally, in order to ensure the performance stability of the selected state detection node, the state detection node and the state detection slave node can be selected according to the Node value of each blockchain node in the blockchain network.

[0127] It should be noted that blockchain block generation refers to the process in which nodes in the blockchain network generate new blocks and add them to the blockchain within a specific time. For example, when a node successfully mines a new block, it broadcasts the block to other nodes in the network so that other nodes can verify and add it to their local blockchain copies. This process is an important part of the blockchain network, which helps ensure the security and reliability of the blockchain; blockchain disconnection is a network failure that causes the node to be unable to connect to the blockchain network or communicate with other nodes normally. If a node goes offline, it may affect the stability and security of the entire blockchain network. Therefore, it is very important to maintain the stability and reliability of the node. In some cases, node disconnection may be caused by network problems, hardware failures, or other reasons. If a node goes offline, the network administrator or blockchain developer can take appropriate measures to solve the problem, such as checking the network connection, updating the software, or replacing the hardware. In addition, blockchain networks usually have fault-tolerant mechanisms to ensure that the stability and security of the network are not affected when nodes go offline. For example, some blockchain networks use consensus algorithms to ensure that nodes reach a consensus on new blocks, and even if some nodes go offline, it will not affect the operation of the entire network.

[0128] Optionally, in order to improve the stability of the operation of the blockchain network, the corresponding state detection node and state detection slave node can be selected from the blockchain network according to the stability value of each node in the blockchain network, and the detection information is sent to the consensus node in the blockchain through the state detection node, and the response information fed back by the consensus node to the detection information is recorded. At the same time, the state detection slave node also runs simultaneously with the state detection node, and backs up the response information on the state detection node, so that when the state detection node fails, the state detection slave node can be directly switched to a new state detection node, and the detection information is sent to the consensus node in the blockchain through the new state detection node.

[0129] exist Fig. 9 In the illustrated embodiment, the stability value of each blockchain node is calculated by at least one of the block production speed, the number of disconnections, and the latest block production time corresponding to each blockchain node in the blockchain, and then the stability value of the blockchain node is determined from three aspects: the block production speed, the number of disconnections, and the latest block production time, thereby ensuring the stability of the ability of the status detection node used to detect the node status.

[0130] In an exemplary embodiment, see Fig.10 , Fig.10 is a flowchart of the state detection of a blockchain node shown in an exemplary embodiment of the present application. The method can be applied to Figure 1 The implementation environment shown, which can be Figure 1The server 110 in the illustrated implementation environment executes.

[0131] like Fig.10 As shown, the method includes steps S210 to S230 and steps S1010 and S1020, wherein the detailed description of steps S1010 and S1020 is as follows:

[0132] Step S1010, determining an alarm level according to at least one of the location and the number of nodes with abnormal status, the alarm level including the early warning level and the alarm level, and the alarm level is higher than the alarm level;

[0133] Step S1020: triggering the early warning system to send an alarm notification message based on the alarm level.

[0134] In the current blockchain network, the state detection node sends detection information to the consensus node in the blockchain network, and records the response information of the consensus node to the detection information, and records the consensus node that feeds back the response information, and then compares it with the consensus node information to which the state detection node sends the detection information, to determine the consensus node with abnormal state that does not send the detection information to the state node, thereby determining the abnormal nodes in the current blockchain network.

[0135] In one embodiment, in the current blockchain network, detection information is sent to the consensus node in the blockchain network through the state detection node, and the response information fed back by the consensus node to the detection information is recorded, wherein the response information carries the identity or address information of the corresponding consensus node, thereby generating a corresponding node response information table on the state detection node, as shown in Table 1 below:

[0136] node Identity Response Information Node-1 192.168.255.255 1 Node-2 192.168.10.11 0 Node-3 192.168.10.16 1 Node-4 192.168.11.14 1 … node-n 192.168.10.08 1

[0137] Table 1

[0138] In the above table, "1" in the response information column indicates that the status detection node has received the response information returned by the consensus node for the detection information; "0" indicates that the status detection node has not received the response information returned by the consensus node for the detection information. From the above table, we can see that "Node-2" has not returned a response information for the detection information, which indicates that "Node-2" is a disconnected node.

[0139] Optionally, the address information of the offline node "Node-2" on the current blockchain network can be further calculated, where the blockchain node address is a public key hash value or script hash value used to store digital assets. Each blockchain address is unique and irreversible. In addition, the blockchain address is usually derived from the public key or script through an encryption algorithm to ensure the security of the user's identity and transaction information.

[0140] Specifically, the number, identity and address information of the abnormal state nodes in the current blockchain network can be determined based on the response information of the consensus nodes in the blockchain network recorded on the state detection node to the detection information feedback, and then the number, identity and address information of the abnormal state nodes determine the state alarm level of the blockchain node, wherein the alarm level includes the early warning level and the alarm level, and the alarm level is higher than the alarm level, and then the early warning system in the blockchain network is triggered to send an alarm notification information, and the identity information of the abnormal state node can be carried in the alarm notification information. For example, in the alarm notification information issued for the abnormal state node "node-2" mentioned above, the identity "192.168.10.11" of "node-2" can be carried to facilitate direct positioning of the abnormal state node.

[0141] Optionally, if the location information of the abnormal status node meets the preset alarm location information, the alarm level of the current blockchain network is determined to be the alarm level, and the early warning system corresponding to the blockchain network is triggered to send an alarm notification information, and the identity information and location information of the abnormal status node are carried in the alarm notification information.

[0142] Optionally, if the number of nodes with abnormal status reaches a preset threshold value of the number of nodes with abnormal status, the alarm level of the current blockchain network is determined to be the alarm level, and the early warning system corresponding to the blockchain network is triggered to send an alarm notification message, and the identity information and location information of the node with abnormal status are carried in the alarm notification message.

[0143] Optionally, if the number of nodes with abnormal status reaches a preset threshold of the number of nodes with abnormal status and the location information of the nodes with abnormal status meets the preset alarm location information, the alarm level of the current blockchain network is determined to be the alarm level, and the early warning system corresponding to the blockchain network is triggered to send an alarm notification information, and the identity information and location information of the nodes with abnormal status are carried in the alarm notification information.

[0144] When the number of nodes with abnormal status does not reach the preset threshold of the number of nodes with abnormal status and the location information of the nodes with abnormal status does not meet the preset alarm location information, the alarm level of the current blockchain network is determined to be the warning level, and the warning system corresponding to the blockchain network is triggered to send a warning notification information, which may also carry the identity information and location information of the nodes with abnormal status.

[0145] exist Fig.10 In the illustrated embodiment, the alarm level is determined according to the location and / or number of nodes with abnormal status in the blockchain network, so as to trigger the early warning system to send alarm notification information according to the alarm level, thereby not only realizing the detection of the status of each consensus node in the blockchain network, but also sending alarm notification information according to different alarm levels, thereby improving the accuracy of alarms for blockchain network nodes.

[0146] In the embodiment of the present application, a blockchain node status detection method is also provided, which can be applied to Figure 1 In the implementation environment shown, the method can be executed by the server 110. In the embodiment of the present application, the method is described by taking the execution of the server 110 as an example.

[0147] like Fig.11 As shown, the blockchain node status detection processing method is Fig.10 Based on the above, step S1010 is expanded to S1110 to S1130. Steps S1110 to S1130 are described in detail as follows:

[0148] Step S1110, obtaining the consensus type corresponding to the abnormal state node;

[0149] Step S1120, determining a limit value of at least one of the position and number of consensus nodes that are allowed to have abnormal status in the blockchain network based on the consensus type;

[0150] Step S1130, comparing at least one of the location and number of abnormal status nodes in the blockchain network with the limit value, and determining the alarm level based on the comparison result.

[0151] In an embodiment of the present application, the consensus type corresponding to the abnormal state node in the current blockchain network is obtained, which also includes obtaining the consensus algorithm corresponding to the abnormal state node in the current blockchain network, so as to determine the limit of the number and location of the abnormal state of the consensus nodes allowed in the current blockchain network according to the consensus type participated by the abnormal state node in the current blockchain network and the corresponding consensus algorithm.

[0152] Among them, consensus in the blockchain network refers to the unanimous recognition of data by all participating nodes. In the blockchain network, since the participating nodes are distributed all over the world, communication may be delayed, so it is impossible for all participating nodes to operate at the same time. In order to ensure the consistency of data, participants need to reach a consensus. At present, common consensus mechanisms in blockchain networks include Proof of Work (PoW), Proof of Stake (PoS), Proof of Authority (PoA), etc.

[0153] It should be noted that common consensus algorithms include: Raft, Paxos, PBFT, DPos, BFT, etc. Among them, Raft and Paxos are more common consensus algorithms, and the Raft algorithm is easier to understand than the Paxos algorithm. In the Raft algorithm, there are three roles for nodes in the system: leader, follower, and candidate. In normal operation, there is one node in the cluster as the leader and the other nodes as followers. If the leader fails, the other nodes will elect a new leader; if the leader is elected and the current term number is found to be less than the stored term number, the leader will update its term number to the stored term number and become the new leader; if the leader is elected and the current term number is equal to the stored term number, the leader will update its term number to the stored term number and become the new leader.

[0154] Optionally, after determining a limit on at least one of the location and number of abnormal status nodes allowed to occur in the blockchain network based on the consensus type corresponding to the abnormal status nodes in the current blockchain network and the consensus algorithm, at least one of the location and number of abnormal status nodes determined in the blockchain network is compared with the limit, and then determining the corresponding alarm level based on the comparison result.

[0155] Optionally, if at least one of the positions and numbers of status-abnormal nodes in the blockchain is consistent with the limit value of at least one of the positions and numbers of status-abnormal nodes allowed in the blockchain network, the alarm level of the blockchain network is determined to be alarm, and the early warning system is triggered to generate an alarm message; if at least one of the positions and numbers of status-abnormal nodes in the blockchain is inconsistent with the limit value of at least one of the positions and numbers of status-abnormal nodes allowed in the blockchain network, and does not exceed the limit value, the alarm level of the blockchain network is determined to be warning, and the early warning system is triggered to generate a warning message.

[0156] If, based on the consensus type in the current blockchain network, it is determined that any node status abnormality cannot be tolerated on the running nodes on the current blockchain network, if it is detected that there is a node with an abnormal status in the current blockchain network, the early warning system will be directly triggered to send an alarm message, and the location information of the node with the abnormal status will be carried in the alarm message.

[0157] For example, if the consensus algorithm of the blockchain network is a BFT consensus algorithm, since the BFT algorithm is a consistency algorithm based on message passing, in a weakly synchronized network, the algorithm can reach a consensus after three stages. In general, the fault tolerance rate of the BFT algorithm is 1 / 3, that is, assuming that one-third of the nodes in the network are abnormal state nodes, and the remaining two-thirds of the nodes are non-abnormal state nodes. Therefore, according to the requirements of the normal operation of the block network, the number limit of abnormal state nodes of the BFT consensus is set to:

[0158] BFT consensus: (on-chain nodes - abnormal status nodes) - 1 ≤ on-chain nodes * 2 / 3

[0159] That is, if the nodes on the blockchain network are BFT consensus, the number of nodes with abnormal status participating in the consensus nodes in the blockchain network cannot exceed one-third of the total number of nodes on the blockchain. When the number of nodes with abnormal status on the blockchain does not reach one-third of the number of nodes on the blockchain, the blockchain early warning system is triggered to send an early warning notification message, and the number of nodes with abnormal status and the location of the abnormal nodes can be included in the early warning notification message; when the number of nodes with abnormal status on the blockchain reaches one-third of the number of nodes on the blockchain, the blockchain early warning system is triggered to send an alarm notification message, and the number of nodes with abnormal status and the location of the abnormal nodes can be included in the alarm notification message.

[0160] For example, if the consensus algorithm in the blockchain network is the Raft algorithm, since the fault tolerance of the Raft algorithm is (n-1) / 2, assuming that the total number of nodes in the cluster is n and the number of faulty nodes is f, according to the principle of minority obeys majority, the normal node needs to be one more than the faulty node to reach a consensus, that is, f+1, so the total number of nodes is 2f+1. Therefore, according to the requirements of the normal operation of the blockchain network, the limit value of the number of abnormal nodes in the state of the Raft consensus is set to:

[0161] Raft consensus: (on-chain nodes - failed nodes) - 1 ≤ on-chain nodes * 1 / 2

[0162] That is, if the nodes on the blockchain network are Raft-type consensus, the number of abnormal state nodes participating in the consensus nodes in the blockchain network cannot exceed one-half of the total number of nodes on the blockchain. When it is detected that the number of abnormal state nodes on the blockchain does not reach one-half of the number of nodes on the blockchain, the blockchain early warning system is triggered to send an early warning notification message, and the number of abnormal state nodes and the location of the abnormal state nodes may be included in the early warning notification message; when the number of abnormal state nodes on the blockchain reaches one-third of the number of nodes on the blockchain, the blockchain early warning system is triggered to send an alarm notification message, and the number of abnormal state nodes and the location of the abnormal state nodes may be included in the alarm notification message.

[0163] exist Fig.11 In the illustrated embodiment, by obtaining the consensus type corresponding to the node with abnormal status, and determining the limit of any one of the position and number of abnormal consensus nodes running in the current blockchain network according to the consensus type, and also determining the limit of any one of the position and number of abnormal status allowed for consensus nodes according to different consensus types, the accuracy of the alarm for the blockchain network nodes is improved, and the flexible application of different analysis and judgment rules to blockchains running different consensuses is realized, thereby ensuring the stability of the operation of the blockchain network.

[0164] In the embodiment of the present application, a blockchain node status detection method is also provided, which can be applied to Figure 1 In the implementation environment shown in the present application embodiment, the method is described by taking the execution of the state detection node 130 in the blockchain network as an example.

[0165] like Fig.12 As shown, the blockchain node status detection processing method is Figure 2 Based on the above, step S220 is expanded to S1210 to S1220. Steps S1210 to S1220 are described in detail as follows:

[0166] Step S1210: If the response information returned by the consensus node is received within the preset time range, the response information is directly recorded;

[0167] Step S1220: If no response information returned by the consensus node is received within a preset time range, response information is generated for the consensus node and the generated response information is recorded.

[0168] After determining the status detection node in the current blockchain network, detection information is sent to each consensus node in the blockchain network through the status detection node, wherein the detection information may be a heartbeat packet for testing whether the node is offline, and the heartbeat packet may not contain any actual data, but only serve as a detection link, and receive the response information returned by the consensus node in the blockchain. Since the nodes in the blockchain network may be distributed all over the world, communication may be delayed. Therefore, if the response information returned by the node participating in the consensus in the blockchain is received within the preset time range, the received response information is directly recorded. If the response information returned by the node participating in the consensus in the blockchain is not received within the preset time range, then the corresponding response information is generated for the node that did not return the response information, and the generated response information is also recorded. The response information of the node that returns the response information is different from the generated response information of the node that does not return the response information, so that the abnormal status nodes and the normal status nodes in the current blockchain network can be directly distinguished.

[0169] Exemplarily, the state detection node sends detection information to the consensus node in the blockchain network, and records the response information returned by each consensus node in the blockchain network, wherein, if the response information "xxxx" returned by the consensus node to the detection information sent by the state detection node is received within the preset time, then the direct response information "xxxx" is recorded behind the identity identifier corresponding to the consensus node; if the response information returned by the consensus node to the detection information sent by the state detection node is not received within the preset time range, then the response information "0" of the consensus node is generated, wherein "0" is used to indicate that the consensus node did not return the response information within the preset time range, indicating that the consensus node is a consensus node with an abnormal state.

[0170] like Fig.13 As shown, the state detection node in the blockchain network sends detection information to the consensus nodes participating in the consensus in the blockchain, and receives the response information returned by the consensus nodes in the blockchain within a preset time range, and directly records the status information returned by the consensus nodes. If no response information is received from the consensus nodes in the blockchain within the preset time range, a response information indicating that the consensus node state is abnormal is generated, and a response information table of each consensus node in the blockchain network is generated in the state detection node, as shown in Table 2 below:

[0171] Consensus Node Response Information Node-1 xxx1 Node-2 0 Node-3 xxx3 … … node-n 0

[0172] Table 2

[0173] And the state detection slave node corresponding to the state detection node in the blockchain network backs up the response information of the consensus node recorded on the state detection node in real time, so that when the state detection node sends a fault, it directly switches to the state detection slave node, so as to send detection information to the nodes participating in the consensus in the blockchain network through the state detection slave node, and record the response information returned by the consensus node for the detection information.

[0174] In addition, in some feasible embodiments, if the status detection node in the blockchain network receives the response information returned by all consensus nodes in the blockchain network in response to the detection information within a preset time range, it indicates that the current blockchain network is operating normally and there are no nodes with abnormal status. Then, the status detection node continues to send detection information to all consensus nodes in the blockchain network at a preset frequency, and records the response information of all consensus nodes in the blockchain network in response to the detection information until the blockchain's early warning system is triggered to send an alarm notification message.

[0175] In some feasible embodiments, after the early warning system in the blockchain network is triggered to send early warning information, the status detection node in the blockchain network sends detection information to all nodes participating in the consensus in the blockchain network at a preset frequency, and records the response information of all consensus nodes in the blockchain network to the detection information until the early warning system of the blockchain is triggered to send an alarm notification information.

[0176] exist Fig.13 In the illustrated embodiment, different response information is recorded according to whether the response information returned by the consensus node is received within a preset time range, and then the abnormal status nodes in the blockchain network can be directly distinguished, thereby realizing the convenience and intelligence of blockchain node status detection.

[0177] Fig.14 This is a brief flow chart of the status detection of blockchain nodes in an exemplary application scenario. Fig.14 In the application scenario shown,

[0178] According to the characteristic parameters of each blockchain node in the blockchain network, at least one blockchain node is selected as a state detection node, wherein the characteristic parameters of the blockchain node are used to characterize the performance stability of the blockchain node. The state detection node sends detection information to each consensus node in the blockchain network, and the response information of the consensus node to the detection information is recorded. In addition, after the state detection node in the blockchain is selected, at least one blockchain node is selected from other blockchain memories except the state detection node as a state detection slave node, and the response information is backed up in the state detection slave node, so that when the state detection node fails to send, the state detection slave node is switched to send the detection information to the consensus nodes participating in the consensus in the blockchain network. If the response information returned by the consensus node is received within a preset time range, the response information is directly recorded; if the response information returned by the consensus node is not received within the preset time range, response information is generated for the consensus node, and the generated response information is recorded. Afterwards, the abnormal state nodes in the blockchain network can be determined according to the response information of each consensus node on the blockchain recorded in the state detection node, and the alarm level can be determined according to the consensus type corresponding to the abnormal state node, and at least one of the position and number of the abnormal state nodes; if at least one of the position and number of the abnormal state nodes in the blockchain is consistent with the limit of the number and / or position of the consensus node allowed to have abnormal state in the blockchain network, the alarm level of the blockchain network is determined to be alarm, and the early warning system is triggered to generate alarm information; if the position and / or number of the abnormal state nodes in the blockchain are inconsistent with the limit of the number and / or position of the consensus node allowed to have abnormal state in the blockchain network, and do not exceed the limit, the alarm level of the blockchain network is determined to be warning, and the early warning system is triggered to generate warning information, and then, the state detection node continues to send detection information to all consensus nodes in the blockchain network at a preset frequency, and records the response information of all consensus nodes in the blockchain network to the detection information until the early warning system of the blockchain is triggered to send an alarm notification information. For the detailed implementation process, please refer to the records in the aforementioned embodiments, and this will not be repeated here.

[0179] Fig.15 is a block diagram of a state detection device for a blockchain node shown in an exemplary embodiment of the present application. The device can be applied to Figure 1 The implementation environment shown in the figure is specifically configured in the server 110. The device can also be applied to other exemplary implementation environments and specifically configured in other devices. This embodiment does not limit the implementation environment to which the device is applied.

[0180] like Fig.15 As shown, the exemplary blockchain node status detection device includes:

[0181] A selection module 1510 is used to select at least one blockchain node as a state detection node according to characteristic parameters of each blockchain node in the blockchain network, wherein the characteristic parameters are used to characterize the performance stability of the blockchain node;

[0182] The detection module 1520 is used to send detection information to each consensus node in the blockchain network through the state detection node, and record the response information of the consensus node to the detection information;

[0183] The alarm module 1530 is used to determine the abnormal status nodes in the blockchain network according to the response information, and perform alarm processing on the abnormal status nodes.

[0184] In an exemplary embodiment, based on the above solution, the device further includes:

[0185] A slave node acquisition module is used to select at least one blockchain node as a state detection slave node from other blockchain nodes except the state detection node according to the characteristic parameters of each blockchain node;

[0186] A backup module, used to back up response information in the status detection slave node;

[0187] The switching module is used to switch the state detection slave node to send detection information to the consensus node and record the corresponding response information when a state detection node fails.

[0188] In an exemplary embodiment, based on the aforementioned scheme, the device also includes: a detection module, which is used to detect the number of state detection nodes or the number of state detection slave nodes in the blockchain network; and a reselection module, which is used to reselect state detection nodes or state detection slave nodes that meet the corresponding number thresholds from the blockchain network if the number of state detection nodes or the number of state detection slave nodes is less than their respective corresponding number thresholds.

[0189] In an exemplary embodiment, based on the aforementioned scheme, the reselection module is specifically configured as follows: if it is detected that the number of status detection slave nodes is less than the corresponding number threshold, a new status detection slave node is directly selected from the blockchain network; if it is detected that the number of status detection nodes is less than the corresponding number threshold, the status detection slave node is switched to a new status detection node; and a new status detection slave node is reselected from the blockchain network.

[0190] In an exemplary embodiment, based on the aforementioned scheme, the selection module 1510 is specifically configured as follows: performing weighted sum calculations on the characteristic parameters of each blockchain node respectively to obtain the stability value of each blockchain node; and determining the status detection node according to the stability value of each blockchain node.

[0191] In an exemplary embodiment, based on the aforementioned scheme, the selection module 1510 is specifically configured as follows: obtaining characteristic parameters corresponding to each blockchain node in the blockchain network, the characteristic parameters including at least one of block production speed, number of disconnections, and latest block production time; performing weighted sum calculation on the characteristic parameters of each blockchain node respectively to obtain a stability value of each blockchain node.

[0192] In an exemplary embodiment, based on the aforementioned scheme, the alarm module 1530 is specifically configured as follows: determining the alarm level according to the location and / or number of nodes with abnormal status, the alarm level includes a warning level and an alarm level, and the alarm level is higher than the alarm level; triggering the warning system to send an alarm notification message based on the alarm level.

[0193] In an exemplary embodiment, based on the aforementioned scheme, the alarm module 1530 is specifically configured as follows: obtaining the consensus type corresponding to the abnormal status node; determining the limit value of the number and / or position of the abnormal status nodes allowed in the blockchain network based on the consensus type; comparing the position and / or number of the abnormal status nodes in the blockchain network with the limit value, and determining the alarm level based on the comparison result.

[0194] In an exemplary embodiment, based on the aforementioned scheme, the detection module 1520 is specifically configured as follows: if the response information returned by the consensus node is received within a preset time range, the response information is directly recorded; if the response information returned by the consensus node is not received within the preset time range, response information is generated for the consensus node, and the generated response information is recorded.

[0195] It should be noted that the state detection device of the blockchain node provided in the above embodiment and the road condition refresh method provided in the above embodiment belong to the same concept, wherein the specific manner in which each module and unit performs the operation has been described in detail in the method embodiment, and will not be repeated here. In actual applications, the state detection device of the blockchain node provided in the above embodiment can allocate the above functions to different functional modules as needed, that is, divide the internal structure of the device into different functional modules to complete all or part of the functions described above, and this is not limited here.

[0196] An embodiment of the present application also provides an electronic device, comprising: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by one or more processors, the electronic device implements the road condition refresh method provided in the above-mentioned embodiments.

[0197] Fig.16 The structure diagram of the computer system suitable for implementing the electronic device of the embodiment of the present application is shown. It should be noted that: Fig.16The computer system 1600 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0198] like Fig.16 As shown, the computer system 1600 includes a central processing unit (CPU) 1601, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 1602 or the program loaded from the storage part 1608 to the random access memory (RAM) 1603, such as executing the method in the above embodiment. In RAM 1603, various programs and data required for system operation are also stored. CPU 1601, ROM 1602 and RAM 1603 are connected to each other through bus 1604. Input / output (I / O) interface 1605 is also connected to bus 1604.

[0199] The following components are connected to the I / O interface 1605: an input section 1606 including a keyboard, a mouse, etc.; an output section 1607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1608 including a hard disk, etc.; and a communication section 1609 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 1609 performs communication processing via a network such as the Internet. A drive 1610 is also connected to the I / O interface 1605 as needed. A removable medium 1611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1610 as needed so that a computer program read therefrom is installed into the storage section 1608 as needed.

[0200] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication section 1609, and / or installed from a removable medium 1611. When the computer program is executed by a central processing unit (CPU) 1601, various functions defined in the system of the present application are executed.

[0201] It should be noted that the computer-readable medium shown in the embodiment of the present application can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium can be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, wherein a computer-readable computer program is carried. This propagated data signal can take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. A computer program contained on a computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.

[0202] The flowchart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present application. Wherein, each box in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0203] The units involved in the embodiments described in this application may be implemented by software or hardware, and the units described may also be set in a processor. The names of these units do not, in some cases, constitute limitations on the units themselves.

[0204] Another aspect of the present application also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the road condition refreshing method as described above is implemented. The computer-readable storage medium may be included in the electronic device described in the above embodiment, or may exist independently without being assembled into the electronic device.

[0205] Another aspect of the present application also provides a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. A processor of a computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the road condition refreshing method provided in each of the above embodiments.

[0206] The above content is only a preferred exemplary embodiment of the present application and is not intended to limit the implementation scheme of the present application. A person skilled in the art can easily make corresponding changes or modifications based on the main concept and spirit of the present application. Therefore, the scope of protection of the present application shall be based on the scope of protection required by the claims.

Claims

1. A method for detecting the status of a blockchain node, characterized in that: include: According to characteristic parameters of each blockchain node in the blockchain network, at least one blockchain node is selected as a state detection node, wherein the characteristic parameters are used to characterize the performance stability of the blockchain node; Sending detection information to each consensus node in the blockchain network through the status detection node, and recording the response information of the consensus node to the detection information; The abnormal status nodes in the blockchain network are determined according to the response information, and alarm processing is performed on the abnormal status nodes.

2. The method according to claim 1, characterized in that The method further comprises: According to the characteristic parameters of each blockchain node, at least one blockchain node is selected from other blockchain nodes except the state detection node as a state detection slave node; Backing up the response information in the status detection slave node; When the status detection node fails, the status detection slave node is switched to send detection information to the consensus node, and the corresponding response information is recorded.

3. The method according to claim 2, characterized in that The method further comprises: Detecting the number of state detection nodes and the number of state detection slave nodes in the blockchain network; If the number of the state detection nodes is less than the state detection node number threshold, selecting a state detection node that meets the state detection node number threshold from the blockchain network; If the number of the status detection slave nodes is less than the status detection slave node number threshold, a status detection slave node that meets the status detection slave node number threshold is selected from the blockchain network.

4. The method according to claim 3, characterized in that If the number of the state detection nodes is less than the state detection node number threshold, selecting a state detection node that meets the state detection node number threshold from the blockchain network includes: If the number of the state detection nodes is less than the state detection node number threshold, switching the state detection slave node to a new state detection node; A new status detection slave node is reselected from the blockchain network.

5. The method according to claim 1, characterized in that The selecting at least one blockchain node as a status detection node according to the characteristic parameters of each blockchain node in the blockchain network includes: Perform weighted sum calculation on the characteristic parameters of each blockchain node to obtain the stability value of each blockchain node; The status detection node is determined according to the stability values ​​of the respective blockchain nodes.

6. The method according to claim 5, characterized in that The weighted sum calculation is performed on the characteristic parameters of each blockchain node to obtain the stability value of each blockchain node, including: Acquire characteristic parameters corresponding to each blockchain node in the blockchain network, wherein the characteristic parameters include at least one of a block generation speed, a number of disconnection times, and a latest block generation time; The characteristic parameters of each blockchain node are weighted and summed to obtain the stability value of each blockchain node.

7. The method according to claim 1, characterized in that The performing alarm processing on the abnormal state node includes: Determine an alarm level according to at least one of the location and the number of the abnormal state nodes, the alarm level includes a warning level and an alarm level, and the alarm level is higher than the alarm level; The alarm system is triggered to send an alarm notification message based on the alarm level.

8. The method according to claim 7, characterized in that The determining of the alarm level according to at least one of the location and the number of the abnormal state nodes includes: Obtain the consensus type corresponding to the abnormal state node; Determine, based on the consensus type, a limit value of at least one of a location and a number of consensus nodes in the blockchain network that are allowed to have abnormal states; At least one of the location and the number of nodes with abnormal status in the blockchain network is compared with the limit value, and the alarm level is determined based on the comparison result.

9. The method according to claim 1, characterized in that The recording of the response information of the nodes participating in the consensus to the detection information includes: If the response information returned by the consensus node is received within the preset time range, the response information is directly recorded; If no response information returned by the consensus node is received within the preset time range, response information is generated for the consensus node and the generated response information is recorded.

10. A state detection device for a blockchain node, characterized in that: The device comprises: A selection module, used to select at least one blockchain node as a state detection node according to characteristic parameters of each blockchain node in the blockchain network, wherein the characteristic parameters are used to characterize the performance stability of the blockchain node; A detection module, used to send detection information to each consensus node in the blockchain network through the status detection node, and record the response information of the consensus node to the detection information; An alarm module is used to determine the abnormal status nodes in the blockchain network according to the response information, and perform alarm processing on the abnormal status nodes.

11. An electronic device, characterized in that: include: one or more processors; A storage device for storing one or more programs, which, when executed by the one or more processors, enables the electronic device to implement the state detection method of the blockchain node as described in any one of claims 1 to 9.

12. A computer-readable storage medium, characterized in that: Computer-readable instructions are stored thereon, and when the computer-readable instructions are executed by a processor of a computer, the computer executes the state detection method of a blockchain node according to any one of claims 1 to 9.

Citation Information

Cited By

  • Block chain network node monitoring method and device based on Web3.0, equipment and medium

    CN121262007A