Block chain trusted sensor anomaly detection method based on trust value improved K-medoids
Through the K-medoids clustering algorithm based on trust value improvement, the problem of noise impact in the abnormal detection of trusted sensors of blockchain is solved, and more accurate and stable abnormal node detection is achieved, which improves the detection rate.
Patent Information
- Application Number
- CN202310500793.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-06
- Publication Date
- 2024-11-08
- Estimated Expiration
- 2043-05-06
AI Technical Summary
Existing blockchain trusted sensor anomaly detection technology is susceptible to noise, edge points, and isolated points, and has insufficient prediction accuracy, making it difficult to effectively eliminate abnormal nodes.
Using the K-medoids clustering algorithm based on trust value improvement, the exception node is determined through trust value initialization, node trust value update, cluster grouping and proximity principle partitioning, and combining specific node trust value update formulas and cluster grouping steps to achieve Anomaly detection of trusted blockchain sensors.
It improves the robustness to noise, enhances the accuracy and stability of abnormal node detection, and can efficiently eliminate abnormal nodes in different environments, improving the detection rate.
Smart Images

Figure CN118921176A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of blockchain sensor anomaly detection, and in particular to a blockchain trusted sensor anomaly detection method based on trust value-improved K-medoids. Background Art
[0002] Blockchain Trusted Sensor (BTS): It is a trusted hardware composed of sensors and trusted modules with certain data processing capabilities. It uses cryptography, blockchain, fault diagnosis, privacy protection and other technologies to ensure the data credibility of the data collection end, so that the source data can be tampered with and reliably transmitted from the collection end to the service end, that is, to solve the problem of data consistency on and off the chain. Although the existing technology has improved the prediction accuracy to a certain extent, it is easily affected by noise, edge points and isolated points. Based on the innovations and limitations of related technical solutions, a BTS anomaly detection method based on trust value is proposed for specific application scenarios of Blockchain Trusted Sensor (BTS). Summary of the invention
[0003] The purpose of the present invention is to provide a blockchain trusted sensor anomaly detection method based on trust value improved K-medoids to solve the problems raised in the above background technology.
[0004] To achieve the above object, the present invention provides the following technical solutions:
[0005] A blockchain trusted sensor anomaly detection method based on trust value improved K-medoids includes the following steps:
[0006] S1. Set the initial trust value to 60 points, and after the consensus is completed, update the trust value of the BTS nodes participating in this consensus through the node trust value update formula;
[0007] S2. Cluster the n BTS nodes into k groups according to the trust value, and determine the optimal BTS node as the center point;
[0008] S3, partition the remaining BTS nodes according to the proximity principle;
[0009] S4. When a client provides a new transaction request and the BTS participating in the consensus needs to vote, the BTS layer regards the nodes whose votes in the same partition are different from those of other BTS nodes as the abnormal target set A based on the partition voting results, and the node set with a credit value lower than 60 points as B. The nodes in the intersection of A∩B are judged as abnormal nodes.
[0010] As a preferred solution of the present invention: the node trust value update formula in S1 is:
[0011]
[0012]
[0013] As a preferred solution of the present invention: in the node trust value update formula:
[0014] T(i) r Expressed as: the trust value of the i-th node in the r-th consensus round;
[0015] r represents: consensus round;
[0016] d u It is expressed as: whether the BTS node is offline in the u-th consensus round, where offline is recorded as 1 and online is recorded as 0;
[0017] ζ is expressed as: BTS node offline penalty coefficient;
[0018] ω u Expressed as: the number of invalid transactions submitted by the BTS node in the u-th consensus round;
[0019] ξ is expressed as: malicious transaction penalty coefficient;
[0020] c u It is expressed as: whether the consensus participated by the BTS node in the u-th consensus round is successful or not, success is recorded as 1, and failure is recorded as 0;
[0021] Expressed as: the weight coefficient of the reward points given after consensus is successful;
[0022] Expressed as: the trust value of node i;
[0023] Expressed as: historical trust value of node i;
[0024] l is expressed as: the weight coefficient of historical trust value.
[0025] As a preferred solution of the present invention: the trust value clustering grouping in S2 is specifically divided into the following steps:
[0026] S①, the current iteration number NI = 0, select the top k nodes with the highest trust value among n BTS nodes as the initial center point;
[0027] S②, calculate the distance from each non-center point to each center point through formula 1, and cluster the nodes according to the proximity principle, thus generating a cluster set {C 1 ,C2,…,C k};
[0028] S③, the non-central nodes in each cluster replace the central node in turn, and the total cost Cost after replacement is calculated by formula 2. When Cost < 0, the central point is replaced by the node, otherwise it remains unchanged;
[0029] S④, Update the cluster set generated by initialization to obtain the optimal cluster set consisting of k center points {C 1 ,C2,…,C k}After that, the remaining BTS nodes are partitioned according to the proximity principle.
[0030] As a preferred solution of the present invention: Formula 1 in S② is:
[0031] As a preferred solution of the present invention: Formula 2 in S② is:
[0032] As a preferred solution of the present invention: in Formula 2:
[0033] p is represented by: non-central point in the cluster;
[0034] q i Represented as: Cluster C i The center point of
[0035] E is expressed as: the sum of squared deviations of all nodes in the cluster.
[0036] Compared with the prior art, the present invention has the following beneficial effects:
[0037] 1. The center clustering algorithm based on K-medoids has good robustness to noise and effectively avoids the influence of noise on prediction accuracy;
[0038] 2. The improved K-medoids clustering algorithm is more in line with the actual application needs of BTS and can eliminate BTS abnormal nodes more accurately and efficiently;
[0039] 3. The improved K-medoids clustering results have strong stability and can maintain a high detection rate for abnormal BTS nodes in different environments. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 The figure is a flowchart of the method of the present invention. DETAILED DESCRIPTION
[0041] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0042] See also Figure 1 The present invention provides a technical solution: a blockchain trusted sensor anomaly detection method based on trust value improved K-medoids, characterized in that it includes the following steps:
[0043] S1. Set the initial trust value to 60 points, and after the consensus is completed, update the trust value of the BTS nodes participating in this consensus through the node trust value update formula;
[0044] S2. Cluster the n BTS nodes into k groups according to the trust value, and determine the optimal BTS node as the center point;
[0045] S3, partition the remaining BTS nodes according to the proximity principle;
[0046] S4. When a client provides a new transaction request and the BTS participating in the consensus needs to vote, the BTS layer regards the nodes whose votes in the same partition are different from those of other BTS nodes as the abnormal target set A based on the partition voting results, and the node set with a credit value lower than 60 points as B. The nodes in the intersection of A∩B are judged as abnormal nodes.
[0047] Further: the node trust value update formula in S1 is:
[0048]
[0049]
[0050] Further: In the node trust value update formula:
[0051] T(i) r Expressed as: the trust value of the i-th node in the r-th consensus round;
[0052] r represents: consensus round;
[0053] d u It is expressed as: whether the BTS node is offline in the u-th consensus round, where offline is recorded as 1 and online is recorded as 0;
[0054] ζ is expressed as: BTS node offline penalty coefficient;
[0055] ω uExpressed as: the number of invalid transactions submitted by the BTS node in the u-th consensus round;
[0056] ξ is expressed as: malicious transaction penalty coefficient;
[0057] c u It is expressed as: whether the consensus participated by the BTS node in the u-th consensus round is successful or not, success is recorded as 1, and failure is recorded as 0;
[0058] Expressed as: the weight coefficient of the reward points given after consensus is successful;
[0059] Expressed as: the trust value of node i;
[0060] Expressed as: historical trust value of node i;
[0061] l is expressed as: the weight coefficient of historical trust value.
[0062] Further: the trust value clustering grouping in S2 is specifically divided into the following steps:
[0063] S①, the current iteration number NI = 0, select the top k nodes with the highest trust value among n BTS nodes as the initial center point;
[0064] S②, calculate the distance from each non-center point to each center point through formula 1, and cluster the nodes according to the proximity principle, thus generating a cluster set {C 1 ,C2,…,C k};
[0065] S③, the non-central nodes in each cluster replace the central node in turn, and the total cost Cost after replacement is calculated by formula 2. When Cost < 0, the central point is replaced by the node, otherwise it remains unchanged;
[0066] S④, Update the cluster set generated by initialization to obtain the optimal cluster set consisting of k center points {C 1 ,C2,…,C k}After that, the remaining BTS nodes are partitioned according to the proximity principle.
[0067] Further: Formula 1 in S② is:
[0068] Further: Formula 2 in S② is:
[0069] Further: In the formula 2:
[0070] p is represented by: non-central point in the cluster;
[0071] qi Represented as: Cluster C i The center point of
[0072] E is expressed as: the sum of squared deviations of all nodes in the cluster.
[0073] Specifically, when using it, the trust value of the blockchain is initialized to 60 points, and the blockchain consensus operation is performed. After the consensus is completed, the node trust value is updated through the formula:
[0074]
[0075]
[0076] Update the trust value of the BTS nodes participating in this consensus to obtain the trust value T(i) of the node in the corresponding round. r and the historical trust value of the node Then, the BTS nodes in the blockchain are clustered into groups based on the trust value, and the optimal BTS node in the optimal group is determined as the center point. When a client provides a new transaction request and the BTS participating in the consensus needs to vote, the BTS layer regards the nodes with different votes from other BTS nodes in the same partition as the abnormal target set A based on the partition voting results, and the node set with a credit value lower than 60 points is recorded as B. The nodes in the intersection of A∩B are judged as abnormal nodes, realizing rapid anomaly detection of trusted sensors in the blockchain.
[0077] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A blockchain trusted sensor anomaly detection method based on trust value improved K-medoids, characterized in that: The following steps are involved: S1. Set the initial trust value to 60 points, and after the consensus is completed, update the trust value of the BTS nodes participating in this consensus through the node trust value update formula; S2. Cluster the n BTS nodes into k groups according to the trust value, and determine the optimal BTS node as the center point; S3, partition the remaining BTS nodes according to the proximity principle; S4. When a client provides a new transaction request and the BTS participating in the consensus needs to vote, the BTS layer regards the nodes whose votes in the same partition are different from those of other BTS nodes as the abnormal target set A based on the partition voting results, and the node set with a credit value lower than 60 points as B. The nodes in the intersection of A∩B are judged as abnormal nodes.
2. According to claim 1, a blockchain trusted sensor anomaly detection method based on trust value improved K-medoids is characterized by: The node trust value update formula in S1 is:
3. According to claim 2, a blockchain trusted sensor anomaly detection method based on trust value improved K-medoids is characterized by: In the node trust value update formula: T(i) r Expressed as: the trust value of the i-th node in the r-th consensus round; r represents: consensus round; d u It is expressed as: whether the BTS node is offline in the u-th consensus round, where offline is recorded as 1 and online is recorded as 0; ζ is expressed as: BTS node offline penalty coefficient; ω u Expressed as: the number of invalid transactions submitted by the BTS node in the u-th consensus round; ξ is expressed as: malicious transaction penalty coefficient; c u It is expressed as: whether the consensus participated by the BTS node in the u-th consensus round is successful or not, success is recorded as 1, and failure is recorded as 0; Expressed as: the weight coefficient of the reward points given after consensus is successful; Expressed as: the trust value of node i; Expressed as: historical trust value of node i; l is expressed as: the weight coefficient of historical trust value.
4. According to claim 1, a blockchain trusted sensor anomaly detection method based on trust value improved K-medoids is characterized by: The trust value clustering grouping in S2 is specifically divided into the following steps: S①, the current iteration number NI = 0, select the top k nodes with the highest trust value among n BTS nodes as the initial center point; S②, calculate the distance from each non-central point to each central point through formula 1, and cluster the nodes according to the proximity principle, thus generating a cluster set {C1, C2, ..., C k }; S③, the non-central nodes in each cluster replace the central node in turn, and the total cost Cost after replacement is calculated by formula 2. When Cost < 0, the central point is replaced by the node, otherwise it remains unchanged; S④, Update the cluster set generated by initialization to obtain the optimal cluster set consisting of k center points {C1, C2, …, C k }After that, the remaining BTS nodes are partitioned according to the proximity principle.
5. According to claim 4, a blockchain trusted sensor anomaly detection method based on trust value improved K-medoids is characterized by: Formula 1 in S② is:
6. According to claim 4, a blockchain trusted sensor anomaly detection method based on trust value improved K-medoids is characterized by: Formula 2 in S② is:
7. The blockchain trusted sensor anomaly detection method based on trust value improved K-medoids according to claim 6 is characterized by: In the formula 2: p is represented by: non-central point in the cluster; q i Represented as: Cluster C i The center point of E is expressed as: the sum of squared deviations of all nodes in the cluster.
Citation Information
Patent Citations
Block chain system consensus method and device based on improved clustering algorithm
CN110113388A
Wireless sensor network malicious node detection method based on NBDP clustering
CN112929879A
Internet of Vehicles node consistency consensus method based on malicious node attack detection
CN113301047A
Sensor node detection method and device based on block chain, equipment and medium
CN115835212A
Access authentication method supporting trusted communication
CN115913674A
