Block chain network node detection method, device, system and program product
By using preset routing tables and random key technologies of the boot nodes in the central control device, nodes in the blockchain network are detected, and the problem of high detection costs in the existing technology is solved, and low-cost node detection is achieved.
Patent Information
- Application Number
- CN202411751645.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-30
- Publication Date
- 2025-03-25
AI Technical Summary
In the prior art, the detection cost of blockchain network nodes is relatively high, and a large number of nodes are required to establish a large number of nodes to detect blockchain network nodes.
By using a preset routing table of the boot node in the central control device, the first node in the blockchain network is detected and a random key is generated to send it to the first node to feedback the second node that is in contact with the first node.
The detection cost of blockchain network nodes is reduced, and other nodes on the blockchain network are detected by simply setting up a small number of boot nodes.
Smart Images

Figure CN119697066A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of blockchain technology, and in particular, relates to a detection method, device, system and program product for blockchain network nodes. Background Art
[0002] During the operation of the blockchain network, it is necessary to detect the blockchain network nodes on the blockchain network so as to obtain more blockchain network information.
[0003] At present, a large number of blockchain network nodes are usually established. Since the information of these established blockchain network nodes can be obtained, after these blockchain network nodes are established, the p2p (Peer to Peer) connection of these blockchain network nodes can be used to detect other blockchain network nodes on the blockchain network, thereby realizing the detection of blockchain network nodes on the blockchain network.
[0004] However, since the above methods require the establishment of a large number of blockchain network nodes, the detection cost of blockchain network nodes is increased. Summary of the invention
[0005] In view of this, the embodiments of the present application provide a blockchain network node detection method, device, system and program product to solve the technical problem of high detection cost of existing blockchain network nodes.
[0006] In a first aspect, an embodiment of the present application provides a method for detecting a blockchain network node, which is applied to a central control device, and the method includes:
[0007] According to a preset routing table of the bootstrap node, detecting a first node in the blockchain network that is in contact with the bootstrap node;
[0008] A random key is generated and sent to the first node to instruct the first node to feed back a second node whose node number is closest to the random key among the nodes connected to the first node according to the random key.
[0009] Optionally, also include:
[0010] Obtaining initial information of the blockchain network provided by the bootstrap node;
[0011] Obtaining node information of the second node;
[0012] Determine current information of the blockchain network based on the initial information and the node information of the second node.
[0013] Optionally, the random key has a preset prefix and is used to map to a k-bucket of a routing table of the first node.
[0014] Optionally, also include:
[0015] Establishing a connection with the second node at a preset frequency;
[0016] If the connection with the second node is successfully established, the current state of the second node is recorded as an online state, and a session with the second node is started, and after each successful connection with the second node is established, the duration of the session with the second node is extended;
[0017] If the connection with the second node fails, the current state of the second node is recorded as an offline state.
[0018] Optionally, establishing a connection with the second node at a preset frequency includes:
[0019] Determine a duration during which the current state of the second node is an online state;
[0020] The preset frequency is changed according to the duration; wherein the preset frequency is negatively correlated with the duration.
[0021] In a second aspect, an embodiment of the present application provides a method for detecting a blockchain network node, which is applied to a first node, and the method includes:
[0022] After receiving the random key sent by the central control device, based on the random key, the second node whose node number is closest to the random key among the nodes connected to the first node is fed back to the central control device; wherein the random key is generated by the central control device after detecting the first node connected to the boot node in the blockchain network according to the preset routing table of the boot node, and sent to the first node.
[0023] In a third aspect, an embodiment of the present application provides a central control device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method for detecting a blockchain network node as described in any one of the first aspects is implemented.
[0024] In a fourth aspect, an embodiment of the present application provides a blockchain network node, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method for detecting a blockchain network node as described in any one of the second aspects is implemented.
[0025] In a fifth aspect, an embodiment of the present application provides a blockchain network node detection system, comprising a central control device as described in the third aspect and a blockchain network node as described in the fourth aspect.
[0026] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the method for detecting a blockchain network node as described in any one of the first and second aspects above are implemented.
[0027] In the seventh aspect, an embodiment of the present application provides a computer program product. When the computer program product is run on a terminal device, the terminal device executes each step in the blockchain network node detection method as described in any one of the first and second aspects above.
[0028] The blockchain network node detection method, device, system and program product provided by the embodiments of the present application have the following beneficial effects:
[0029] The blockchain network node detection method provided in the embodiment of the present application can be applied to the central control device, specifically including: according to the routing table of the preset boot node, detecting the first node in the blockchain network that is connected to the boot node; generating a random key, and sending the random key to the first node to instruct the first node to feedback the second node whose node number is closest to the random key among the nodes that are connected to the first node according to the random key. Through the blockchain network node detection method of the present application, only a small number of boot nodes need to be set up to detect other blockchain network nodes on the blockchain network. Compared with the existing technology that requires the establishment of a large number of blockchain network nodes to detect other blockchain network nodes on the blockchain network, the blockchain network node detection method of the present application reduces the detection cost of blockchain network nodes. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0031] Figure 1 A flowchart of a blockchain network node detection method provided in an embodiment of the present application;
[0032] Figure 2 A flowchart of a method for detecting a blockchain network node provided in another embodiment of the present application;
[0033] Figure 3 A schematic diagram of the structure of a central control device provided in an embodiment of the present application;
[0034] Figure 4A schematic diagram of the structure of a blockchain network node provided in an embodiment of the present application;
[0035] Figure 5 A schematic diagram of the structure of a central control device provided in another embodiment of the present application;
[0036] Figure 6 A schematic diagram of the structure of a blockchain network node provided in another embodiment of the present application. DETAILED DESCRIPTION
[0037] It should be noted that the terms used in the embodiments of the present application are only used to explain the specific embodiments of the present application, and are not intended to limit the present application. In the description of the embodiments of the present application, unless otherwise specified, "multiple" refers to two or more than two, and "at least one", "one or more" refers to one, two or more. The terms "first" and "second" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Thus, it is defined that the "first" and "second" features can explicitly or implicitly include one or more of the features.
[0038] References to "one embodiment" or "some embodiments" etc. described in this specification mean that a particular feature, structure or characteristic described in conjunction with the embodiment is included in one or more embodiments of the present application. Thus, the phrases "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear at different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0039] The blockchain network node detection method provided in the embodiment of the present application can be applied to the scenario of detecting blockchain network nodes in various types of blockchain networks. For example, the blockchain network can be Ethereum.
[0040] The execution subject of the blockchain network node detection method provided in the embodiment of the present application may include a central control device and a blockchain network node. Specifically, the central control device and the blockchain network node may include but are not limited to electronic devices such as mobile phones, tablet computers, laptops, and desktop computers.
[0041] When it is necessary to detect blockchain network nodes in a blockchain network, the various steps of the blockchain network node detection method provided in the embodiment of the present application can be executed through the central control device and the blockchain network nodes, so that the blockchain network nodes in the blockchain network can be detected without establishing a large number of blockchain network nodes, thereby reducing the detection cost of the blockchain network nodes.
[0042] See also Figure 1 , Figure 1 The present invention provides a flowchart of a method for detecting a blockchain network node according to an embodiment of the present invention. The method for detecting a blockchain network node according to an embodiment of the present invention can be applied to a central control device and may include steps S101 to S102, which are described in detail as follows:
[0043] In S101, according to a preset routing table of the boot node, the first node in the blockchain network that is connected to the boot node is detected.
[0044] In the embodiment of the present application, when it is necessary to detect the blockchain network nodes in the blockchain network, the central control device can first establish a connection with the preset bootstrap peers in the blockchain network. Among them, the number and specific types of these preset bootstrap nodes can be set according to actual needs. For example, the preset bootstrap nodes can be Ethereum bootstrap nodes. In addition, these preset bootstrap nodes can provide the initial information of the blockchain network to the central control device.
[0045] After establishing a connection with each preset boot node, the central control device can obtain the routing table of each boot node, and can detect the first node in the blockchain network that is connected to the boot node according to the routing table of the boot node. Specifically, the central control device can traverse the routing table of each boot node to find the first node in the blockchain network that is connected to one or more of the boot nodes, until the central control device cannot find other new first nodes from the routing table of each boot node.
[0046] Among them, the first node connected to the boot node can be any blockchain network node that can be detected according to the routing table of the boot node.
[0047] In S102, a random key is generated and sent to the first node to instruct the first node to feed back a second node whose node ID is closest to the random key among the nodes connected to the first node according to the random key.
[0048] In an embodiment of the present application, after detecting all first nodes in the blockchain network that are connected to the boot node, the central control device can generate a random key.
[0049] Among them, the random key generated by the central control device may have a preset prefix. Exemplarily, the preset prefix may be a preset number of preset characters. Further, the preset character may be "0". Based on this, the preset prefix may be a preset number of "0".
[0050] In addition, the random key generated by the central control device can be used to map to the k-buckets of the routing table of each first node, so that after the first node receives the random key, it can, based on the random key, feedback the second node whose node number is closest to the random key among the nodes connected to the first node.
[0051] After the random key is generated, the central control device may send the generated random key to the first node to instruct the first node to feed back the second node whose node number is closest to the random key among the nodes connected to the first node according to the random key.
[0052] It should be noted that the number of first nodes can be one or more, and the number of random keys can also be one or more. Based on this, the central control device can generate multiple random keys and send the generated random keys to each first node respectively, and each first node can receive one or more random keys generated by the central control device. Optionally, the central control device can send all the generated random keys to each first node respectively, so that the first node can receive all the random keys generated by the central control device.
[0053] For each first node, after receiving the random key, the first node can, based on each received random key, feedback the second node whose node number is closest to the random key among the nodes connected to the first node. Therefore, each first node receives a random key and will feedback a second node, so that the central control device can detect multiple second nodes.
[0054] In a possible implementation, the central control device can instruct each first node to perform the step of feeding back the second node in parallel, thereby improving the efficiency of detecting the second node. Specifically, after generating each random key, the central control device can send each random key in parallel to each first node, so that each first node can feed back the second node in parallel.
[0055] In one possible implementation, when instructing the first node to execute the step of feeding back the second node, the central control device can make parallel requests to all k-buckets numbered within a preset number range in the first node, so that the first node can simultaneously traverse the nodes in all k-buckets within the preset number range, thereby improving the efficiency of the first node feeding back the second node, and further improving the efficiency of detecting the second node.
[0056] In actual applications, the central control device can continuously generate different random keys and send the generated random keys to the first node, so that the first node can continuously feed back the second node, and finally the central control device can detect multiple second nodes in the blockchain network.
[0057] In actual applications, after each second node is detected, the central control device can determine whether the second node has been detected before the current moment. If it is determined that the second node has not been detected before the current moment, the second node is determined to be a new second node. The central control device can continuously generate random keys until the central control device does not detect a new second node within a preset time, wherein the specific value of the preset time can be set according to actual needs and is not limited here.
[0058] In a possible implementation, after detecting the second node, the central control device can also determine the current information of the blockchain network. Specifically, the central control device can first obtain the initial information of the blockchain network provided by each boot node, and after each detection of the second node, the central control device can obtain the node information of the second node, and then the central control device can determine the current information of the blockchain network based on the initial information of the blockchain network provided by each boot node and the node information of the detected second node.
[0059] Among them, the initial information of the blockchain network may include but is not limited to the initial online time of each blockchain network node, the initial node status of each blockchain network, the ability of each blockchain network node to process transactions, the ID of each blockchain network node, the protocol type of the blockchain network, the IP information of each blockchain network node, the geographic location of each blockchain network node, etc.
[0060] Among them, the current information of the blockchain network may include but is not limited to the current online time of each blockchain network node, the status change of each blockchain network node, the ability of each blockchain network node to process transactions, the ID of each blockchain network node, the protocol type of the blockchain network, the IP information of each blockchain network node, the geographic location of each blockchain network node, etc.
[0061] In addition to executing the steps of detecting the second node described above, the central control device can also execute the steps of monitoring the detected second node described below. In practical applications, the central control device may include a detection module and a monitoring module, wherein the detection module of the central control device can be used to execute the steps of detecting the second node described above, and the monitoring module of the central control device can be used to execute the steps of monitoring the detected second node described below.
[0062] In one possible implementation, after each new second node is detected, the central control device may attempt to establish a connection with the second node at a preset frequency. After each attempt to establish a connection with the second node, the central control device may determine whether the connection with the second node is successful or unsuccessful.
[0063] If it is determined that the connection with the second node is successfully established, the central control device can record the current status of the second node as online, and can start a session with the second node. After that, each time a connection is successfully established with the second node, the duration of the session with the second node will be extended.
[0064] If it is determined that the connection with the second node fails, the central control device may record the current state of the second node as an offline state. In addition, when it is determined that the connection with the second node fails, if the central control device has a session with the second node, the central control device may terminate the session with the second node. After terminating the session with the second node, the central control device may continue to try to establish a connection with the second node at a preset frequency. After successfully establishing a connection with the second node, the central control device may restart the session with the second node.
[0065] In addition, when it is determined that the connection with the second node fails, the central control device may also obtain the error type that caused the connection with the second node to fail, and may re-establish the connection with the second node according to the error type. Exemplarily, if it is determined that the error type that caused the connection with the second node to fail is that the resource limit is exceeded, the central control device may re-establish the connection with the second node after a preset reconnection time. The preset reconnection time may include a number of equally spaced times.
[0066] In a possible implementation manner, the central control device may also change a preset frequency of establishing a connection with the second node according to the duration of the current state of the second node.
[0067] Specifically, the central control device can first determine the current status of the second node. If the current status of the second node is an online state, the electronic device can determine the duration of the current status of the second node being an online state. After determining the duration of the current status of the second node being an online state, the electronic device can change the preset frequency of establishing a connection with the second node according to the duration of the current status of the second node being an online state.
[0068] Among them, when the current state of the second node is an online state, the preset frequency is negatively correlated with the duration, that is, if the central control device determines that the current state of the second node is an online state for a long time, the preset frequency of establishing a connection with the second node can be reduced. If the central control device determines that the current state of the second node is an online state for a short time, the preset frequency of establishing a connection with the second node can be increased.
[0069] This is because when the central control device determines that the current state of the second node is online for a long time, it can be considered that the second node has a greater possibility of continuing to remain online, so the preset frequency of establishing a connection with the second node can be appropriately reduced to save the resources of the central control device. In addition, when the central control device determines that the current state of the second node is online for a short time, it can be considered that the second node has a lower possibility of continuing to remain online, so the preset frequency of establishing a connection with the second node can be appropriately increased to improve the accuracy of determining the current state of the second node.
[0070] In one possible implementation, the central control device may pre-store a first correspondence between the duration of the online state and the preset frequency of establishing a connection, so that after the central control device determines that the current state of the second node is the duration of the online state, it can change the frequency of establishing a connection with the second node according to the first correspondence.
[0071] Similarly, if the central control device determines that the current state of the second node is offline, the electronic device can determine the duration of the current state of the second node being offline. After determining the duration of the current state of the second node being offline, the electronic device can change the preset frequency of establishing a connection with the second node according to the duration of the current state of the second node being offline.
[0072] Among them, when the current state of the second node is an offline state, the preset frequency is negatively correlated with the duration, that is, if the central control device determines that the current state of the second node is an offline state for a long time, the preset frequency of establishing a connection with the second node can be reduced; if the central control device determines that the current state of the second node is an offline state for a short time, the preset frequency of establishing a connection with the second node can be increased.
[0073] This is because when the central control device determines that the current state of the second node is offline for a long time, it can be considered that the second node is likely to remain offline, so the preset frequency of establishing a connection with the second node can be appropriately reduced to save the resources of the central control device. In addition, when the central control device determines that the current state of the second node is offline for a short time, it can be considered that the second node is less likely to remain offline, so the preset frequency of establishing a connection with the second node can be appropriately increased to improve the accuracy of determining the current state of the second node.
[0074] In one possible implementation, the central control device may pre-store a second correspondence between the duration of the offline state and the preset frequency of establishing a connection, so that after the central control device determines that the current state of the second node is the duration of the offline state, it can change the frequency of establishing a connection with the second node according to the second correspondence.
[0075] It can be seen from the above that the blockchain network node detection method provided by the embodiment of the present application can be applied to the central control device, specifically including: according to the routing table of the preset boot node, detecting the first node in the blockchain network that is connected to the boot node; generating a random key, and sending the random key to the first node to instruct the first node to feedback the second node whose node number is closest to the random key among the nodes that are connected to the first node according to the random key. Through the blockchain network node detection method of the present application, only a small number of boot nodes need to be set up to detect other blockchain network nodes on the blockchain network. Compared with the existing technology that requires the establishment of a large number of blockchain network nodes to detect other blockchain network nodes on the blockchain network, the blockchain network node detection method of the present application reduces the detection cost of blockchain network nodes.
[0076] See also Figure 2 , Figure 2 This is a flowchart of an implementation method of a blockchain network node detection method provided in another embodiment of the present application. The blockchain network node detection method provided in the embodiment of the present application can be applied to blockchain network nodes. Specifically, the blockchain network node detection method provided in the embodiment of the present application can be applied to the first node of the embodiment of the present application.
[0077] The blockchain network node detection method provided in the embodiment of the present application may include step S201, which is described in detail as follows:
[0078] In S201, after receiving the random key sent by the central control device, the second node whose node ID is closest to the random key among the nodes connected to the first node is fed back to the central control device according to the random key.
[0079] In an embodiment of the present application, the first node may be used to receive a random key sent by the central control device, wherein the random key is generated and sent to the first node by the central control device after detecting the first node in the blockchain network that is connected to the boot node according to the preset routing table of the boot node.
[0080] After receiving the random key sent by the central control device, the first node may feed back to the central control device, based on the random key, a second node whose node ID is closest to the random key among the nodes connected to the first node.
[0081] Specifically, the first node can calculate the distance between the node numbers of each node connected to the first node and the random key according to the random key and the alphabetical order of each node connected to the first node. Then, based on the distance between the node numbers of each node connected to the first node and the random key, the second node whose node number is closest to the random key among the nodes connected to the first node is determined, and the second node is fed back to the central control device.
[0082] It should be noted that the number of first nodes can be one or more, and the number of random keys can also be one or more. Based on this, the central control device can generate multiple random keys and send all generated random keys to each first node respectively, and each first node can receive multiple random keys generated by the central control device. Each first node can feedback a second node to the central control device based on each received random key.
[0083] Based on the blockchain network node detection method provided in the above embodiment, the embodiment of the present application further provides a central control device and a blockchain network node for implementing the above method embodiment.
[0084] See also Figure 3 , Figure 3 A schematic diagram of the structure of a central control device provided in an embodiment of the present application is shown in FIG. Figure 3 As shown, the central control device 30 may include a first detection unit 31 and a second detection unit 32, wherein:
[0085] The first detection unit 31 is used to detect the first node in the blockchain network that is connected to the boot node according to a preset routing table of the boot node.
[0086] The second detection unit 32 is used for generating a random key and sending the random key to the first node to instruct the first node to feed back a second node whose node number is closest to the random key among the nodes connected to the first node according to the random key.
[0087] Optionally, the central control device 30 may further include a network information determination unit.
[0088] The network information determination unit is specifically used for:
[0089] Get the initial information of the blockchain network provided by the bootstrap node;
[0090] Obtain node information of the second node;
[0091] According to the initial information and the node information of the second node, the current information of the blockchain network is determined.
[0092] Optionally, the random key has a preset prefix and is used to map to a k-bucket of a routing table of the first node.
[0093] Optionally, the central control device 30 may further include a monitoring unit.
[0094] The monitoring unit is specifically used for:
[0095] Establishing a connection with a second node at a preset frequency;
[0096] If the connection with the second node is successfully established, the current state of the second node is recorded as an online state, and a session with the second node is started. After each successful connection with the second node, the duration of the session with the second node is extended;
[0097] If the connection with the second node fails, the current state of the second node is recorded as offline.
[0098] The monitoring unit is also used for:
[0099] Determine a duration that the current state of the second node is an online state;
[0100] The preset frequency is changed according to the duration; wherein the preset frequency is negatively correlated with the duration.
[0101] See also Figure 4 , Figure 4 A schematic diagram of the structure of a blockchain network node provided in an embodiment of the present application is shown in FIG. Figure 4 As shown, the blockchain network node 40 may include a third detection unit 41, wherein:
[0102] The third detection unit 41 is used to, after receiving the random key sent by the central control device, feedback to the central control device the second node whose node number is closest to the random key among the nodes connected to the first node according to the random key; wherein the random key is generated by the central control device after detecting the first node connected to the boot node in the blockchain network according to the routing table of the preset boot node and sending it to the first node.
[0103] See also Figure 5 , Figure 5This is a schematic diagram of the structure of a central control device provided in another embodiment of the present application. Figure 5 As shown, the central control device 5 provided in this embodiment may include: a processor 50, a memory 51, and a computer program 52 stored in the memory 51 and executable on the processor 50. For example, a program corresponding to the detection method of a blockchain network node. When the processor 50 executes the computer program 52, the steps in the above-mentioned detection method embodiment applied to a blockchain network node are implemented, for example Figure 1 In S101 to S102 shown, when the processor 50 executes the computer program 52, the functions of each module / unit in the embodiment corresponding to the above-mentioned central control device 50 are realized, for example Figure 3 The functions of the units 31 to 32 are shown.
[0104] Exemplarily, the computer program 52 may be divided into one or more modules / units, one or more modules / units are stored in the memory 51, and are executed by the processor 50 to complete the present application. One or more modules / units may be a series of computer program instruction segments that can complete specific functions, and the instruction segments are used to describe the execution process of the computer program 52 in the central control device 5. For example, the computer program 52 may be divided into a first detection unit 31 and a second detection unit 32. For the specific functions of each unit, please refer to Figure 3 The relevant descriptions in the corresponding embodiments are not repeated here.
[0105] Those skilled in the art will understand that Figure 5 It is only an example of the central control device 5 and does not constitute a limitation on the central control device 5. It may include more or less components than shown in the figure, or a combination of certain components, or different components.
[0106] See also Figure 6 , Figure 6 A schematic diagram of the structure of a blockchain network node provided in another embodiment of the present application. Figure 6 As shown, the blockchain network node 6 provided in this embodiment may include: a processor 60, a memory 61, and a computer program 62 stored in the memory 61 and executable on the processor 60. For example, a program corresponding to the detection method of a blockchain network node. When the processor 60 executes the computer program 62, the steps in the above-mentioned detection method embodiment applied to the blockchain network node are implemented, for example Figure 2 In S201 shown, the processor 60 executes the computer program 62 to implement the functions of each module / unit in the embodiment corresponding to the above-mentioned blockchain network node 40, for example Figure 4 The functionality of the unit 41 is shown.
[0107] Exemplarily, the computer program 62 may be divided into one or more modules / units, one or more modules / units are stored in the memory 61 and executed by the processor 60 to complete the present application. One or more modules / units may be a series of computer program instruction segments that can complete specific functions, and the instruction segments are used to describe the execution process of the computer program 62 in the blockchain network node 6. For example, the computer program 62 may be divided into the third detection unit 41, and the specific functions of each unit may be referred to in Figure 4 The relevant descriptions in the corresponding embodiments are not repeated here.
[0108] Those skilled in the art will understand that Figure 6 This is only an example of the blockchain network node 6 and does not constitute a limitation on the blockchain network node 6. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components.
[0109] The processor 50 and the processor 60 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc.
[0110] The memory 51 and the memory 61 can be the internal storage unit of the central control device 5 and the blockchain network node 6, such as the hard disk or memory of the central control device 5 and the blockchain network node 6. The memory 51 and the memory 61 can also be the external storage device of the central control device 5 and the blockchain network node 6, such as the plug-in hard disk, smart media card (SMC), secure digital (SD) card or flash card (flash card) equipped on the central control device 5 and the blockchain network node 6. Further, the memory 51 and the memory 61 can also include both the internal storage unit of the central control device 5 and the blockchain network node 6 and the external storage device. The memory 51 and the memory 61 are used to store computer programs and other programs and data required by electronic devices. The memory 51 and the memory 61 can also be used to temporarily store data that has been output or is to be output.
[0111] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional units as needed, that is, the internal structure of the central control device and the blockchain network node can be divided into different functional units to complete all or part of the functions described above. The functional units in the embodiment can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0112] An embodiment of the present application also provides a blockchain transaction pre-confirmation verification system, which may include a central control device and a blockchain network node.
[0113] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.
[0114] An embodiment of the present application provides a computer program product. When the computer program product is executed on a terminal device, the terminal device implements the steps in the above-mentioned various method embodiments.
[0115] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0116] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0117] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A method for detecting a blockchain network node, characterized in that: Applied to a central control device, the method comprises: According to a preset routing table of the bootstrap node, detecting a first node in the blockchain network that is in contact with the bootstrap node; A random key is generated and sent to the first node to instruct the first node to feed back a second node whose node number is closest to the random key among the nodes connected to the first node according to the random key.
2. The method according to claim 1, characterized in that: Also includes: Obtaining initial information of the blockchain network provided by the bootstrap node; Obtaining node information of the second node; Determine current information of the blockchain network based on the initial information and the node information of the second node.
3. The method according to claim 2, characterized in that The random key has a preset prefix and is used to be mapped to a k-bucket of the routing table of the first node.
4. The method according to claim 1, characterized in that: Also includes: Establishing a connection with the second node at a preset frequency; If the connection with the second node is successfully established, the current state of the second node is recorded as an online state, and a session with the second node is started, and after each successful connection with the second node is established, the duration of the session with the second node is extended; If the connection with the second node fails, the current state of the second node is recorded as an offline state.
5. The method according to claim 4, characterized in that The establishing a connection with the second node at a preset frequency includes: Determine a duration during which the current state of the second node is an online state; The preset frequency is changed according to the duration; wherein the preset frequency is negatively correlated with the duration.
6. A method for detecting a blockchain network node, characterized in that: Applied to the first node, the method comprises: After receiving the random key sent by the central control device, based on the random key, the second node whose node number is closest to the random key among the nodes connected to the first node is fed back to the central control device; wherein, the random key is generated by the central control device after detecting the first node connected to the boot node in the blockchain network according to the preset boot node routing table and sending it to the first node.
7. A central control device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method for detecting a blockchain network node as described in any one of claims 1 to 5 is implemented.
8. A blockchain network node, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method for detecting a blockchain network node as described in claim 6 is implemented.
9. A blockchain network node detection system, characterized in that: It includes the central control device as described in claim 7 and the blockchain network node as described in claim 8.
10. A computer program product, when the computer program product is run on a computer device, enables the computer device to execute the blockchain network node detection method as described in any one of claims 1 to 5, or implement the blockchain network node detection method as described in claim 6.