# Reputation-Driven Dynamic Node Consensus and Reliability Sharding Model in IoT Blockchain
## 3 System Model
#### 3.1.3 Node Eliminate of RE-PBFT  
Nodes in distributed networks are peer to peer, and there is no authoritative central department to verify the reliability of nodes. Although the behavior information of a node can be obtained through the reputation of a node, there is a lack of clear criteria for judging whether it is an abnormal node. To try to remove a node, it is necessary to judge whether the node is abnormal first. In RE-PBFT, the local outlier factor algorithm (LOF) in anomaly detection is used to test the abnormal node. In reference [41], the LOF introduces a local outlier value to each object in the data set to represent its outlier degree. This is the first concept of outliers, which quantifies how outlier an object is. Outlier factors are local, only one restricted neighborhood of each object is considered, and the method is related to the sample density in the neighborhood of the object. The sample density is determined by the range of the neighborhood and the number of samples in the neighborhood. There is a parameter K in LOF to determine the size of the neighborhood of the object, K is the number of samples around the object, and the circle with the radius from the object to the kth far sample is the kth field of the object. The selection of the K value determines the judgment accuracy of outliers, the K value is set to \(2/3\) in this model because it has been known in the PBFT consensus algorithm that the proportion of maximum malicious nodes is \(1/3\) and that of normal working nodes is \(2/3\). It cannot directly contribute to the reputation as an LOF of input, one dimensional feature is too simple to obtain good results, so the two-dimensional data is composed of the reputation of the end of the previous round of consensus and the reputation of the end of the current round of consensus, expressed as \(R_{i}=\left(t_{i}^{t-1},r_{i}^{t}\right)\), The above formulas respectively represent the reputation of node i after the \(t-1\)st consensus and the reputation of node i after the \(t\)th consensus, R represents the input data of node i in LOF. Based on LOF, the threshold value of the outlier factor is designed, which is the average value of the outlier factor of all nodes. The threshold value is adopted because the outlier factor will change greatly after one abnormal behavior exists in the node. However, as described in Section 3.1.1, the abnormal nodes are judged under the accumulation of abnormal behaviors, so the threshold value of the outlier factor is compared with the outlier factor value of each node to determine whether any node is removed. The specific implementation process is shown in Figure 3, and the implementation method is as follows:Step 1: After the consensus is completed, the node reputation is updated by Equations (1) and (2) according to the behavior of the node;  
Step 2: The node checks and calculates the local maintenance reputation table. If it finds any node that meets the condition of being removed, it will pack the discovery as _<<Broadcast>_, _message, timestamp, sign_> and rebroadcast to all remaining nodes (_<broadcast>_ represents the sending stage, where the message is the message body, the _timestamp_ is the sending timestamp, and _sign_ is the signature of the sending node);  
Step 3: Node receives node eliminate broadcast from other different nodes _<<Broadcast>_, _message, timestamp_, _i>_, if the messages are the same, the _timestamp_ order shall be taken as the standard, and the first broadcast node shall be the discovery node eliminated this time. If different, it will be processed in the order of _timestamp_;  
Step 4: Verify by comparing the message in _<Broadcast>_ with the locally maintained reputation table.