## 4 Proposed Scheme
### Trust Model
#### 4.4.1 Direct Trust  
The direct trust proposed by the proposed scheme calculates three main trust metrics: energy trust, historical interaction records, and data trust. When selecting forwarding nodes, the energy of forwarding nodes is an important evaluation metric, and insufficient energy cannot guarantee that forwarding nodes can reliably transmit data packets to receiving nodes. Evaluating the historical interaction records between nodes can effectively identify malicious behavior within the network, judge the interaction behavior of nodes, and identify MNs. Computing data trust can check the consistency and fault tolerance of generated or forwarded data within the underwater nodes and then identify the MNs that tamper with the data or modify the data. Energy trust: In addition to being an important indicator to ensure reliable data transmission, energy trust can also be used as a monitoring indicator to identify MNs. For example, MNs will consume extra energy of the nodes when they perform man-in-the-middle attacks. Especially when they perform DOS attacks, MNs send a large number of redundant messages, which consume the energy of the other nodes in the UWSNs and occupy the channel. So, the computation of energy trust can identify MNs in the UW-sensors in time to detect DOS and other malicious node attacks [26]. The proposed scheme defines the energy trust as the ratio of the average energy of the next hop node to the neighboring nodes, as follows:  
\[T_{energy}=\frac{e_{res}^{i}}{e_{avg}^{j,nei}} \tag{7}\]  
where \(e_{res}^{i}\) is the residual energy of UW-sensor \(n_{i}\) and \(e_{avg}^{i,nei}\) is the average residual energy of neighboring nodes of node \(n_{i}\). Historical interaction trust: Underwater nodes obtain historical interaction records with neighboring nodes by accessing the locally maintained communication log table and determine the behavior of the node through these records to calculate the historical interaction trust. This can effectively identify the malicious behavior of MNs, such as gray hole attacks, which are switching attacks in which MNs maliciously drop packets through a certain time period or selectively, affecting the normal communication of the network and destroying the availability as well as the accuracy of the transmitted data. The proposed scenario defines the historical interaction trust as follows:  
\[T_{history}=\frac{N_{sr}^{j}}{N_{tr}^{jnei}}+\frac{N_{ss}^{j}}{N_{ts}^{jnei}}, \tag{8}\]  
where \(N_{sr}^{j}\) and \(N_{ss}^{j}\) are the number of packets received and sent by the next hop node \(n_{i}\) to the source node and \(N_{tr}^{jnei}\) and \(N_{ts}^{jnei}\) are the number of packets received and sent by node \(n_{i}\) to neighboring nodes. Data trust: The main task of UWSNs is to transmit data. To prevent MNs from tampering or fabricating false data, the proposed scheme evaluates the trustworthiness of data transmission, according to the research of previous scholars [27]. Theoretically, the data received by neighboring underwater sensor nodes for a certain thing are similar, showing certain spatiotemporal correlation, and these theoretical data obey normal distribution. However, there is a certain difference between the actual value and the theoretical value, so the proposed scheme can effectively solve this problem by appropriately expanding the error threshold. The data trust for CH is calculated based on a set of data received in the previous time window, and the data trust is updated in the clustering for this time window. The proposed scheme defines the data trust specifically, as shown in Equations (9) and (10):  
\[f(x)=\frac{1}{\sigma\sqrt{2\pi}}e^{(-\frac{(x-y)^{2}}{2\sigma^{2}})}, \tag{9}\]where \(x_{i}\) is the value of the data item of the monitored underwater node sensor and \(\mu\) and \(\sigma\) are the mean and variance of the data, respectively.