A practical DPoS consensus improvement method based on isolation forest algorithm

By introducing the isolation forest algorithm into the DPoS consensus algorithm for node behavior recording and anomaly detection, the problems of low decentralization and insufficient supervision of malicious nodes in the DPoS consensus algorithm are solved, and the fairness and security of the consensus mechanism are improved.

CN118611857BActive Publication Date: 2024-10-22BEIHANG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411083946.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-08
Publication Date
2024-10-22
Estimated Expiration
2044-08-08

AI Technical Summary

Technical Problem

The DPoS consensus algorithm has problems such as low decentralization, inactive nodes and lack of supervision of malicious nodes, which affects the fairness and efficiency of the consensus and increases security risks.

Method used

A practical DPoS consensus improvement method based on the isolated forest algorithm is adopted to optimize the process of electing agent nodes through node behavior recording and anomaly detection and elimination, and improve the fairness and security of the consensus mechanism.

Benefits of technology

It effectively eliminates abnormal nodes, promotes node voting enthusiasm and consensus verification timeliness, inhibits malicious behavior, and improves the fairness, efficiency and security of the consensus mechanism.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118611857B_ABST
    Figure CN118611857B_ABST
Patent Text Reader

Abstract

The present invention discloses a practical DPoS consensus improvement method based on an isolation forest algorithm, which belongs to the field of blockchain technology and includes the following steps: S1, based on historical behavior information, detecting and eliminating abnormal nodes for common nodes that did not participate in the previous round of consensus and proxy nodes that participated in the previous round of consensus, and outputting a candidate set that can participate in the proxy node election; S2, taking the intersection of the candidate set that can participate in the proxy node election and the node set that participates in the election to obtain a candidate set, and each node freely votes for the nodes in the above candidate set, and finally obtains a set of the number of votes corresponding to the candidate; S3, proxy node selection; S4, consensus; S5, reward settlement; S6, node behavior information update. The present invention adopts the above-mentioned practical DPoS consensus improvement method based on an isolation forest algorithm, introduces node behavior records and abnormal node detection and elimination to optimize the DPoS algorithm, and improves the practicality of the DPoS consensus mechanism.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of blockchain technology, and in particular to a practical DPoS consensus improvement method based on an isolation forest algorithm. Background Art

[0002] Delegated Proof of Stake (DPoS) evolved from the Proof of Stake (PoS) consensus algorithm and was first proposed and applied by Dan Larimer, the chief developer of Bitshares, in April 2014. In DPoS, users obtain voting rights by staking tokens, and the system elects block nodes through voting. Only some block nodes complete consensus verification, thereby improving consensus efficiency. The existing DPoS consensus algorithm process mainly includes: node voting, vote counting, proxy node election, proxy node block generation, and block reward settlement. By executing block generation and consensus verification by some entrusted nodes, DPoS solves the problem of excessive resource waste caused by the concentration of computing power in the Proof of Work (PoW) consensus mechanism. The voting mechanism solves the Matthew effect caused by the Proof of Stake consensus algorithm determining the accounting right only based on the age of the coin.

[0003] Compared with the existing mainstream consensus algorithms, DPoS can achieve a trade-off effect in terms of performance and decentralization, but it still faces problems such as low decentralization, inactive nodes, and lack of supervision of malicious nodes: First, relying solely on equity to elect agents may lead to a lack of changes in agent nodes, so that the right to produce blocks may still be concentrated in the hands of a few large nodes, thus affecting the degree of decentralization of the entire network. Secondly, in the case where only the agent's block-producing behavior can be rewarded, the remaining ordinary nodes may show an inactive voting attitude. In addition, in the election process of the election of proxy nodes, the lack of evaluation of the candidate's network status may lead to the election of agents with poor network communication conditions, thereby affecting the block verification process. Finally, there is a lack of supervision of malicious behaviors of nodes (such as submitting invalid transactions, producing invalid blocks, and other malicious behaviors). If these malicious nodes become proxy nodes, it may have a negative impact on the performance of the entire consensus process.

[0004] Through the above analysis, we can find that DPoS still has problems such as low decentralization, inactive nodes and lack of supervision of malicious behavior. These problems affect the fairness and efficiency of its consensus and increase security risks. Summary of the invention

[0005] The purpose of this invention is to provide a practical DPoS consensus improvement method based on the isolation forest algorithm, which introduces node behavior records and abnormal node detection and elimination to optimize the DPoS algorithm, thereby improving the practicality of the DPoS consensus mechanism.

[0006] To achieve the above objectives, the present invention provides a practical DPoS consensus improvement method based on the isolation forest algorithm, comprising the following steps:

[0007] S1. Based on historical behavior information and , for ordinary nodes that did not participate in the previous round of consensus and the proxy nodes that participated in the previous round of consensus Detect and remove abnormal nodes, and output a set of candidates that can participate in proxy node elections ;

[0008] S2. Set the candidates who can participate in the proxy node election Take the intersection with the set of nodes participating in the election to get the set of candidates , through ordinary nodes that do not participate in the consensus in this round Assembly of candidates The nodes in the Nodes vote freely and finally get the set of votes corresponding to the candidates. ;

[0009] S3. Set the number of votes Sort in descending order, output first Candidates as a set of proxy nodes ;

[0010] S4. Collect the proxy nodes The proxy nodes in the block are disrupted, and they take turns to generate blocks and verify the blocks. K After the block generation operation, this round of consensus ends ( express Candidates, K express K block operation, the two have the same value but different meaning);

[0011] In each round of consensus, this K Behavior information of nodes in the secondary consensus ;

[0012] S5. Based on the behavior information of the node For the proxy nodes that participated in the previous round of consensus Provide token rewards;

[0013] S6. Input the behavior information of the nodes in this round of consensus As well as historical node behavior, update behavior information .

[0014] Preferably, in step S1:

[0015] Ordinary nodes that did not participate in the previous round of consensus ,in, Indicates A normal node, Indicates the total number of common nodes;

[0016] Proxy nodes participating in the previous round of consensus ,in, Indicates the number of Agent nodes, k Represents the number of proxy nodes;

[0017] Ordinary nodes that did not participate in the previous round of consensus Corresponding historical behavior information; A proxy node that participated in the previous round of consensus Corresponding historical behavior information;

[0018] ,in, Indicates Characteristics of a common node;

[0019] ;

[0020] in, Indicates the transaction activity of the node; Indicates the number of invalid transactions sent; Indicates the number of votes participated in; Indicates the number of times the node is offline; Indicates the offline time of the node; Indicates the time it takes for a node to enter the network;

[0021] ,in, Indicates the last round Characteristics of the proxy nodes;

[0022] ;

[0023] in, Indicates the number of invalid blocks produced; Indicates consensus delay; Indicates the number of times the consensus was participated in.

[0024] Preferably, in step S1, the set of candidates that can participate in the proxy node election is , Indicates the legal candidates, Indicates the total number of legal candidates screened.

[0025] Preferably, in step S1, ordinary nodes that did not participate in the previous round of consensus and the proxy nodes that participated in the previous round of consensus Detect and remove abnormal nodes, and output a set of candidates that can participate in proxy node elections , including the following steps:

[0026] S11. For ordinary nodes that did not participate in the previous round of consensus and the proxy nodes that participated in the previous round of consensus Determine the number of sampling groups , the number of samples in each sample group And the maximum height of the tree ;

[0027] S12, putting the samples in each sample group into the root node of a tree, at this time, the current node is the root node;

[0028] S13, for the current node, randomly select a behavior feature and a cutoff value of the behavior feature to classify the sample;

[0029] Samples smaller than the cutoff value are placed in the left child of the current node, and samples larger than the cutoff value are placed in the right child of the node, forming a sub-branch of the current node. At this point, the task of the current node is completed, and the next step is to enter the division of its child nodes;

[0030] S14, taking the left child and the right child in step S13 as the new current node respectively, repeating recursive step S13, when there is only one sample in the sample set corresponding to the new current node, the node becomes a leaf node, and can no longer generate the next layer of child nodes, and reaches the recursive boundary of the sub-branch of the current node, jumps out of the operation of the sub-branch of the current node, and operates the remaining unoperated nodes and their sub-branches;

[0031] When the height of the entire tree reaches the maximum height When , the generation of the tree is completed;

[0032] S15, executing steps S12 to S14 in each sample group to form a forest;

[0033] S16. Define the height of the sample as the height of the last leaf node where it is located. After the training is completed, set a safe height value for each tree. , ;

[0034] For each sample, the height is less than the safe height value The samples are considered as abnormal data;

[0035] S17, Integration The learning results of the tree, when a sample in When all the trees of the number of nodes are abnormal, they are judged as abnormal, and the corresponding nodes are removed, and are not allowed to participate in the election of the proxy node in this round as candidates. .

[0036] Preferably, in step S11, for ordinary nodes that did not participate in the previous round of consensus , set the maximum height of the tree ;

[0037] For the proxy nodes that participated in the previous round of consensus , set the maximum height of the tree ;

[0038] The total sample size is In the case of Determine the number of samples within the group and the number of sampling groups , and is a parameter for adjusting training speed and accuracy, where 0< , .

[0039] Preferably, in step S4, to satisfy the behavior information The traceability requirement is that after multiple rounds of consensus, when the accumulated behavior information reaches the size of a transaction, the historical behavior information record enters the transaction pool as a transaction information and is put on the chain in the next round of consensus.

[0040] Therefore, the present invention adopts the above-mentioned practical DPoS consensus improvement method based on the isolation forest algorithm, and its technical effects are as follows:

[0041] (1) Regarding the elimination of election nodes, since most nodes in the network have similar network communication capabilities and tend to show high enthusiasm and non-malicious behavior, under the screening of the anomaly detection algorithm, "normal" and "most" consensus nodes will be screened out. These nodes will be eligible for election, and combined with the node's own willingness to participate in the election, they will form the set of elected proxy nodes for the next round.

[0042] (2) By introducing the node behavior record and node removal stage, the present invention promotes the node's voting enthusiasm, consensus verification timeliness, and consensus participation enthusiasm, and at the same time, suppresses the production of invalid transactions, production of invalid blocks, and possible malicious behaviors of new nodes. These optimization measures help solve the problems of low decentralization, low node participation, and lack of supervision and suppression of malicious behaviors of some nodes in the original DPoS, effectively resist malicious events such as takeover by the proxy committee, and improve the fairness, efficiency, and security of the consensus mechanism.

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

[0044] Figure 1 This is a flowchart of a practical DPoS consensus improvement method based on the isolation forest algorithm of the present invention;

[0045] Figure 2 The process of obtaining anomaly detection results by ensemble learning and then eliminating them;

[0046] Figure 3 Anomaly detection is the process of identifying anomalous samples for a set of samples represented by a tree. DETAILED DESCRIPTION

[0047] The technical solution of the present invention is further described below through the accompanying drawings and embodiments.

[0048] Unless otherwise defined, technical or scientific terms used in the present invention shall have the common meanings understood by one having ordinary skills in the field to which the present invention belongs.

[0049] Embodiment 1

[0050] like Figure 1 The figure is a flowchart of a practical DPoS consensus improvement method based on the isolation forest algorithm. The present invention introduces node behavior records and abnormal node detection and elimination in the entire consensus process. Before the current round of proxy node election, the historical behavior record information is first used to The historical behavior characteristics of each node saved in the network are used to detect anomalies on all nodes through the isolation forest algorithm (iForest), and the abnormal nodes are removed. The removed nodes do not participate in the election of proxy nodes this time. After the node removal operation, the general operations of the DPoS consensus mechanism such as election voting, determination of proxy nodes, block consensus, and reward distribution are carried out. At the same time, the behavior characteristics of the nodes in this round of consensus will be recorded during the voting process and the block generation process. After the consensus round is over, the node behavior information will be combined with historical information. Update. Node behavior information The chain operation will also be carried out after a certain number of rounds to ensure the traceability of regulatory information.

[0051] The specific steps of the present invention are as follows:

[0052] S1. Based on historical behavior information and , for ordinary nodes that did not participate in the previous round of consensus and the proxy nodes that participated in the previous round of consensus Detect and remove abnormal nodes, and output a set of candidates that can participate in proxy node elections ;

[0053] Before the first round of consensus begins, since there is no historical information to refer to, the node removal operation starts from the second round of consensus of the entire system.

[0054] Ordinary nodes that did not participate in the previous round of consensus ,in, Indicates A normal node, Indicates the total number of common nodes;

[0055] Proxy nodes participating in the previous round of consensus ,in, Indicates the number of Agent nodes, k Represents the number of proxy nodes;

[0056] Ordinary nodes that did not participate in the previous round of consensus Corresponding historical behavior information; A proxy node that participated in the previous round of consensus Corresponding historical behavior information;

[0057] ,in, Indicates Characteristics of a common node;

[0058] ;

[0059] in, Indicates the transaction activity of the node; Indicates the number of invalid transactions sent; Indicates the number of votes participated in; Indicates the number of times the node is offline; Indicates the offline time of the node; Indicates the time it takes for a node to enter the network;

[0060] ,in, Indicates the last round Characteristics of the proxy nodes;

[0061] ;

[0062] in, Indicates the number of invalid blocks produced; Indicates consensus delay; Indicates the number of times the consensus was participated in.

[0063] The set of candidates that can participate in proxy node election , Indicates the legal candidates, Indicates the total number of legal candidates screened.

[0064] The detection and removal of abnormal nodes adopts the idea of ​​ensemble learning, that is, firstly, abnormal samples are identified in different sample groups, and then the results of multiple groups are combined to determine the final abnormal samples and remove them. Figure 2 The process of obtaining anomaly detection results by means of ensemble learning and then eliminating them represents the process of sample grouping, ensemble learning, anomaly identification and elimination. Figure 3 The process of identifying abnormal samples for a set of samples represented by a tree. Figure 2 and Figure 3 The detection and elimination of abnormal nodes are explained in detail.

[0065] Step S1 includes the following sub-steps:

[0066] S11. For ordinary nodes that did not participate in the previous round of consensus and the proxy nodes that participated in the previous round of consensus Determine the number of sampling groups , the number of samples in each sample group And the maximum height of the tree ;

[0067] For ordinary nodes that did not participate in the previous round of consensus , set the maximum height of the tree ;

[0068] For the proxy nodes that participated in the previous round of consensus , set the maximum height of the tree ;

[0069] The total sample size is In the case of Determine the number of samples within the group and the number of groups (number of sampling groups) , and is a parameter for adjusting training speed and accuracy, where 0< , .

[0070] S12, placing the samples in each sample group into the root node of a tree. At this time, the current node is the root node, and then dividing the samples from the root node to form the remaining nodes to form the entire tree;

[0071] S13, for the current node, randomly select a behavior feature and a cutoff value of the behavior feature to classify the sample;

[0072] Samples smaller than the cutoff value are placed in the left child of the current node, and samples larger than the cutoff value are placed in the right child of the node, forming a sub-branch of the current node. At this point, the task of the current node is completed, and the next step is to enter the division of its child nodes;

[0073] S14, taking the left child and the right child in step S13 as the new current node respectively, repeating recursive step S13, when there is only one sample in the sample set corresponding to the new current node, the node becomes a leaf node, and can no longer generate the next layer of child nodes, and reaches the recursive boundary of the sub-branch of the current node, jumps out of the operation of the sub-branch of the current node, and operates the remaining unoperated nodes and their sub-branches;

[0074] When the height of the entire tree reaches the maximum height When , the generation of the tree is completed;

[0075] S15, executing steps S12 to S14 in each sample group to form a forest;

[0076] S16. Define the height of the sample as the height of the last leaf node where it is located. After the training is completed, set a safe height value for each tree. , ;

[0077] For each sample, the height is less than the safe height value The samples are considered as abnormal data;

[0078] S17, Integration The learning results of the tree, when a sample in When all the trees of the number of nodes are abnormal, they are judged as abnormal, and the corresponding nodes are removed, and are not allowed to participate in the election of the proxy node in this round as candidates. .

[0079] By dynamically adjusting To control the intensity of screening out abnormal nodes, the larger the value, the higher the screening intensity.

[0080] S2. Set the candidates who can participate in the proxy node election Take the intersection with the set of nodes participating in the election to get the set of candidates , through ordinary nodes that do not participate in the consensus in this round Assembly of candidates The nodes in the Nodes vote freely and finally get the set of votes corresponding to the candidates. ;

[0081] S3. Set the number of votes Sort in descending order, output first Candidates as a set of proxy nodes ;

[0082] S4. Collect the proxy nodes The proxy nodes in the block are disrupted, and they take turns to generate blocks and verify the blocks. K Block generation operation ( K After the consensus is reached, this round of consensus ends; express Candidates, K express K block operation, the two have the same value but different meanings).

[0083] In each round of consensus, this K Behavior information of nodes in the secondary consensus ;

[0084] The cumulative time span of behavior records is Round consensus , It is an integer value that can be adjusted dynamically. Its adjustment is mainly based on two considerations: the network communication situation will not change significantly within a period of time, so the time length of the behavior based on the election elimination process should be longer. However, taking into account the variability of the environment and in order to promote some negative nodes and malicious nodes to transform into positive behaviors, the cumulative span of the behavior based on this stage should not be too large. The consensus accumulation can be modified more adaptively according to the frequency of network changes and the degree of change in node behavior: when the initial network environment changes and the node behavior is diverse, the span is set to 2 to 4 rounds of consensus span to improve node enthusiasm and promote system adjustment; when the network environment is stable and the node behavior in the system tends to be stable and positive, the time span can be appropriately enlarged to maintain system stability.

[0085] To meet behavioral information The requirement of traceability is that after multiple rounds of consensus, when the accumulated behavior information reaches the size of a transaction, the historical behavior information record enters the transaction pool as a transaction information and is put on the chain in the next round of consensus. This operation has two advantages. First, it ensures the authenticity of the behavior information through the confirmation of most nodes. Second, it enables the historical behavior of the node to be traced and verified. In this way, the transparency and credibility of the node behavior information are improved.

[0086] S5. Based on the behavior information of the node For the proxy nodes that participated in the previous round of consensus Provide token rewards;

[0087] S6. Input the behavior information of the nodes in this round of consensus As well as historical node behavior, update behavior information .

[0088] Therefore, the present invention adopts the above-mentioned practical DPoS consensus improvement method based on the isolation forest algorithm, introduces node behavior records and abnormal node detection and elimination to optimize the DPoS algorithm, and improves the practicality of the DPoS consensus mechanism.

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

Claims

1. A practical DPoS consensus improvement method based on the isolation forest algorithm, characterized in that: The following steps are involved: S1. Based on historical behavior information and , for ordinary nodes that did not participate in the previous round of consensus and the proxy nodes that participated in the previous round of consensus Detect and remove abnormal nodes, and output a set of candidates that can participate in proxy node elections ; S2. Set the candidates who can participate in the proxy node election Take the intersection with the set of nodes participating in the election to get the set of candidates , through ordinary nodes that do not participate in the consensus in this round Assembly of candidates The nodes in the Nodes vote freely and finally get the set of votes corresponding to the candidates. ; S3. Set the number of votes Sort in descending order, output first Candidates as a set of proxy nodes ; S4. Collect the proxy nodes The proxy nodes in the block are disrupted, and they take turns to generate blocks and verify the blocks. K After the block generation operation, this round of consensus ends; In each round of consensus, this K Behavior information of nodes in the secondary consensus; S5. Based on the behavior information of the node For the proxy nodes that participated in the previous round of consensus Provide token rewards; S6. Input the behavior information of the nodes in this round of consensus As well as historical node behavior, update behavior information ; In step S1, ordinary nodes that did not participate in the previous round of consensus ,in, Indicates A normal node, Indicates the total number of common nodes; Proxy nodes participating in the previous round of consensus ,in, Indicates the number of Agent nodes, k Represents the number of proxy nodes; Ordinary nodes that did not participate in the previous round of consensus Corresponding historical behavior information; A proxy node that participated in the previous round of consensus Corresponding historical behavior information; ,in, Indicates Characteristics of a common node; in, Indicates the transaction activity of the node; Indicates the number of invalid transactions sent; Indicates the number of votes participated in; Indicates the number of times the node is offline; Indicates the offline time of the node; Indicates the time it takes for a node to enter the network; ,in, Indicates the last round Characteristics of the proxy nodes; in, Indicates the number of invalid blocks produced; Indicates consensus delay; Indicates the number of times the consensus was participated in; In step S1, the set of candidates that can participate in the proxy node election , Indicates the legal candidates, Indicates the total number of legal candidates screened; In step S1, for ordinary nodes that did not participate in the previous round of consensus and the proxy nodes that participated in the previous round of consensus Detect and remove abnormal nodes, and output a set of candidates that can participate in proxy node elections , including the following steps: S11. For ordinary nodes that did not participate in the previous round of consensus and the proxy nodes that participated in the previous round of consensus Determine the number of sampling groups , the number of samples in each sample group And the maximum height of the tree ; S12, putting the samples in each sample group into the root node of a tree, at this time, the current node is the root node; S13, for the current node, randomly select a behavior feature and a cutoff value of the behavior feature to classify the sample; Samples smaller than the cutoff value are placed in the left child of the current node, and samples larger than the cutoff value are placed in the right child of the node, forming a sub-branch of the current node. At this point, the task of the current node is completed, and the next step is to enter the division of its child nodes; S14, taking the left child and the right child in step S13 as the new current node respectively, repeating recursive step S13, when there is only one sample in the sample set corresponding to the new current node, the node becomes a leaf node, and can no longer generate the next layer of child nodes, and reaches the recursive boundary of the sub-branch of the current node, jumps out of the operation of the sub-branch of the current node, and operates the remaining unoperated nodes and their sub-branches; When the height of the entire tree reaches the maximum height When , the generation of the tree is completed; S15, executing steps S12 to S14 in each sample group to form a forest; S16. Define the height of the sample as the height of the last leaf node where it is located. After the training is completed, set a safe height value for each tree. , ; For each sample, the height is less than the safe height value The samples are considered as abnormal data; S17, Integration The learning results of the tree, when a sample in When all the trees of the number of nodes are abnormal, they are judged as abnormal, and the corresponding nodes are removed, and are not allowed to participate in the election of the proxy node in this round as candidates. .

2. According to claim 1, a practical DPoS consensus improvement method based on the isolation forest algorithm is characterized in that: In step S11, for ordinary nodes that did not participate in the previous round of consensus , set the maximum height of the tree ; For the proxy nodes that participated in the previous round of consensus , set the maximum height of the tree ; The total sample size is In the case of Determine the number of samples within the group and the number of sampling groups , and is a parameter for adjusting training speed and accuracy, where 0< , .

3. According to claim 2, a practical DPoS consensus improvement method based on the isolation forest algorithm is characterized in that: In step S4, to satisfy the behavior information The traceability requirement is that after multiple rounds of consensus, when the accumulated behavior information reaches the size of a transaction, the historical behavior information record enters the transaction pool as a transaction information and is put on the chain in the next round of consensus.