# DDTMS: Dirichlet-Distribution-Based Trust Management Scheme in Internet of Things
## 3 Dirichlet-Distribution-Based Trust Management Scheme (DDTMS)
### Third-Party Recommended Trust Value Calculation  
The trust value of neighbor nodes can directly be observed and calculate through direct interaction, meanwhile, the trust values from third-party recommendations can increase the trustworthiness of a node based on this. The hierarchical routing protocols usually organize wireless sensor networks in a cluster structure, as key nodes for data transmission and data compression, the cluster head should also provide the recommended the trust values of their neighbor nodes for other nodes within the cluster. Assuming that the sensor network has suffered from any internal attacks at the beginning of the first round, the cluster head selected in the first round can be acting as the proxy node of the third-party trust recommendation in this round of clusters.As the interaction between nodes progresses, such as the successful interaction between normal nodes, the failed interactions imposed by malicious nodes, as well as the occurrence of uncertain interaction events with certain probability, the corresponding trust values are first obtained by distributed computing between nodes. Meanwhile, the trust value is summarized to the cluster head node together with the detected data. The centralized calculation is performed by the cluster head node. The trust value table is sent to each node, and the corresponding trust value table is updated. After a round, the cluster head node is re-elected as a third-party agent by considering the election scheme of multiple factors, as well as trust value, so that the relatively secure cluster head node can be selected by this scheme, to ensure the entire cluster structure stable. The calculation scheme of the third-party recommended value \(RT_{j}\) for the common node \(j\) in a cluster is  
\[RT_{j}=\frac{1}{M}\sum\limits_{k=1,k\
eq i,k\
eq j}^{M}DT_{kj} \tag{10}\]  
where \(M\) represents the number of nodes that can communicate with node \(j\) in addition to node \(j\) and the proxy node, then the recommended trust value can be centrally calculated by the direct trust value obtained with the nodes in the cluster. Therefore, the calculation steps for the third-party recommended trust value are as follows:  
(1) According to the assumption, the sensor network is initialized, in the first round, of the cluster head is randomly elected as a proxy node for the third party's recommended trust value. (2)After the cluster head selection, according to the communication requirements, each node in the sensor network establishes contact with the cluster head in a self-organizing manner, and finally constructs the cluster structure of the current round process. (3)Nodes in the cluster begin to detect the corresponding and neighbor nodes in the sensing area, and calculate the trust value. (4) After the information collection of current round, the trust value information of neighbor node is sent to the cluster head node together with the data, and the cluster head node performs centralized calculation to obtain the trust value of each node in the cluster. Furthermore, the abnormal situation is processed, and delivered to the cluster member nodes. (5) After the start of the new round, each node elects the trustful cluster head node of the current round according to its own situation and the trust value, and then repeats the steps 2 to 5. C. Trust Value Synthesis  
\[ \begin{split}& T_{ij}=\alpha\times DT_{ij}+\beta\times RT_{j}= \alpha\times\frac{(w_{s}s_{ij}+1)\cdot\left(1-\mu_{history}\right)}{w_{s}s_{ ij}+w_{f}f_{ij}+w_{u}u_{ij}+3}+\beta\times\frac{1}{M}\sum\limits_{k=1,k\
eq i,k \
eq j}^{M}DT_{kj}\\ &=\frac{\alpha\cdot(w_{s}s_{ij}+1)\cdot\left(1-\mu_{history} \right)}{w_{s}s_{ij}+w_{f}f_{ij}+w_{u}u_{ij}+3}+\frac{\beta}{M}\sum\limits_{k =1,k\
eq i,k\
eq j}^{M}DT_{kj}\end{split}  \tag{11}\]  
where, \(\alpha\) and \(\beta\) are weights of direct observation and indirect observation respectively, and they satisfy \(\alpha+\beta=1\). In this section, we design the Dirichlet-Distribution-based Trust Management Scheme (DDTMS).