# Reputation-Driven Dynamic Node Consensus and Reliability Sharding Model in IoT Blockchain
## 3 System Model
#### 3.1.1 Reputation Introduction of RE-PBFT  
The PBFT is a consensus agreement between nodes through multiple broadcast voting results. For the consensus process, under the condition of client security, the purpose of the normal working node is to verify and pass the transaction and then store it on the blockchain. However, in addition to the normal working node, there are also dishonest nodes and down nodes, which are respectively called Byzantine nodes and crash nodes. From a macro point of view, the three types of nodes in the consensus network will bring two different results: normal nodes are conducive to transaction verification and successful block generation; Byzantine nodes and crash nodes are the opposite. By analyzing the behaviors of the above three types of nodes in the consensus process, the following three behaviors can be obtained: normal consensus behavior, dishonest behavior, and node failure. dishonesty is detrimental to the consensus network, which includes both the malicious behaviors determined by Byzantine nodes themselves and the malicious behaviors caused by attacks on normal working nodes (such as man-in-the-middle attack). Node downtime may be due to the problem of the node itself (device performance problems or being attacked and unable to respond to requests), or it could also be that the Byzantine node acted against the consensus process. It is not easy to judge whether the node is dishonest from the behavior of the node. To solve the above problems, this paper proposes a reputation evaluation scheme to quantify node behavior. The basic idea of quantification is as follows: in the normal PBFT consensus algorithm, the number of normal working nodes is greater than the number of abnormal nodes, and the system can only be effective if this requirement is met. Therefore, the nodes with most behaviors are defined as normal working nodes, and the nodes with few behaviors are defined as abnormal nodes. The normal working nodes are rewarded with reputation, and the abnormal nodes are punished. Section 3.1.3 introduces the judgment basis of abnormal nodes based on reputation. Reputation is the credibility of a node. The higher the reputation, the higher the possibility that the node is a normal working node, and the higher the possibility that the node is a normal working node in the consensus process (the stronger the ability to resist  
Figure 1: RDSCM applied in IoT network. attacks and system collapse), and for the smaller, the opposite is true. The reputation is obtained by quantifying the behavior of nodes. The quantification standard is based on the influence of the behavior of nodes in the consensus network. If the influence is large, the change of reputation will be correspondingly larger. Based on the above ideas, the following reputation replacement scheme is proposed:  
For normal nodes:  
\[r_{t}=\left\{ \begin{array}{c}r_{t-1}+1+v_{i},\textit{node normal}\\ r_{t-1}-p^{n-1}-\left(total-1\right)^{2}-v_{i},\textit{node abnormal}\end{array} \right. \tag{1}\]  
For main nodes:  
\[r_{t}=\left\{ \begin{array}{c}r_{t-1}+1+v_{i},\textit{node normal}\\ r_{t-1}/2-p^{n-1}-\left(total-1\right)^{2}-v_{i},\textit{node abnormal}\end{array} \right. \tag{2}\]  
where \(r\) is the reputation value of the node; \(t\) is the number of consensus, \(n\) is the number of successive abnormal behaviors of this node; \(p\) is the continuous abnormal punishment factor, generally take the natural constant e; total is the cumulative number of abnormal; \(v_{i}=1-\left(i-1\right)/N\) represents the reward/penalty value of the ith node that completes the consensus, where \(N\) is the number of nodes participating in the consensus in the same shard, \(v_{i}\) is the additional reward in the case of normal working nodes, otherwise, it is extra punishment. Nodes with downtime behavior will be punished with a random value in (0, 1). The normal operation of nodes is the obligation of all nodes, so the reputation will increase the baseline value after the normal operation of nodes.