## 3 Proposed Scheme
### Trusted Data Identifications  
Infiltration of malicious nodes in IoT networks degrades the performance of the network. Malicious nodes being network members seriously degrade the network's performance as they are not easily identified. This section outlines a method to identify the trustworthy data. \(TMPAD\) assists fog nodes in differentiating the malicious and legitimate nodes by evaluating the probability of trusted and malicious nodes within a WPAN. The trust level of a node is established through the assessment of its interactions with neighboring nodes during packet exchanges. More precisely, it is determined by the accurate reception of requested data packets in response to the generated requests. For example, if a node \(X\) transmits \(A\) requests to its neighboring node \(Y\) and receives \(B\) response files from node \(Y\), with \(A_{corr}\) denoting the corrupted files received, the trust probability of node \(X\) for node \(Y\) (\(T_{Y}^{X}\)) is calculated as follows:  
\[T_{Y}^{X}=\frac{(B-A_{corr})^{2}\times SNR_{max}}{SNR_{XY}\times A\times B} \tag{6}\]  
where the channel capacity (CC) between two links is calculated by using Shannon capacity [27] as follows:  
\[CC=B\times log_{2}(1+SNR) \tag{7}\]  
where \(SNR\) is the signal-to-noise ratio, and \(B\) represents the bandwidth. The higher the trust value, the higher the trust level of the neighboring node. Each node computes the trust value for every directly connected neighboring node. In the case where there are \(m\) nodes situated close to a trust-finding node \(A^{tf}\), and the trust value for each neighboring node is established using Equation (6), the collective trust value of \(A^{tf}\) is then calculated as follows:  
\[A^{tf}=\frac{\sum_{i=1}^{m}T_{i}^{tf}}{m} \tag{8}\]  
The potential threat arises from a malicious node capable of transmitting a deceitful trust value, whereas a genuine node would accurately relay the true trust value of its neighboring nodes. Consequently, depending solely on this parameter is insufficient for determining the trustworthiness of a node. To authenticate the trust value provided by a node, it becomes essential to collect input from other nodes within the clustering network. All nodes directly linked to the trust-finding nodes are required to transmit their trust values concerning the trust-finding node to the PAN coordinator, as shown in Figure 4. This procedural step aids in the assessment of the trust value associated with each neighboring node. The trust value of a node by all its available \(N\) neighbors \(T_{N}^{tf}\) is calculated as  
\[T_{N}^{tf}=\frac{\sum_{i=1}^{N}T_{i}^{tf}}{N} \tag{9}\]  
To calculate the trust probability of all nodes in a cluster, a weighted metric is assigned to the trust values calculated in Equations (8) and (9) as below. 1. A high weight is assigned to the neighboring trust value, as calculated in Equation (9). 2. A low weight is assigned to the self-calculated trust value, as determined in Equation (8). A sigmoid function is defined to determine the trust probability for each network node in a WPAN and is calculated as follows:  
\[\sigma S_{i}=\frac{1}{1+e^{-[a(A_{i}^{tf})+T_{u}^{tf}(T_{i}^{tf})]}} \tag{10}\]  
A higher probability of trust value means that nodes are legitimate and their GTS requests needs to be preferred over the nodes with reduced probability. However, if thetrust probability is less than a critical value then its GTS request will not be entertained. Algorithm 1 represents the complete procedure.