# Towards Tamper-Proof Trust Evaluation of Internet of Things Nodes Leveraging IOTA Ledger
## 4 Proposed Methodology
### Trustworthiness Evaluation  
The process of trustworthiness evaluation is shown in Algorithm 1. The algorithm contains functions to evaluate each metric for a node \(i\). It shows the process performed by each node \(j\) within the communication range of a node \(i\) to determine local trust scores for node \(i\). For \(n\) number of nodes within node \(i\)'s communication range, there are \(n\) trust scores. In the final phase of our trustworthiness assessment framework for IoT nodes, we employ the exponential weighting approach to calculate the overall trust score. This approach is designed to amplify the impact of each node's performance across the metrics calculated above. This ensures that higher scores are rewarded, while lower scores are more significantly penalized. In this way, the proposed scheme provides a nuanced and sensitive analysis of each node's overall contribution to the network's reliability and efficiency. The consensus algorithm is designed to operate with as few as two local trust scores, i.e., a node and one neighbor. While more scores improve robustness, the algorithm does not mandate a hard minimum beyond this. If three or more trust scores are available,the algorithm uses both the mean-median comparison to detect and smooth out outliers. If only two scores are available, the average of both is used as the agreed trust score. If a node has no neighbors in a temporarily disconnected scenario, the trust score is marked as undefined and is excluded from trust-based operations until more data are available. ```
0:Message\({}_{i}\),IOTA_transactions
0: Node trust value
1:for Each node \(i\)do
2:\(Reliability_{i}\gets computeReliability(T_{i},bit\ errors,bits\ transferred)\)
3:\(QoS_{i}\gets computeQoS(T_{i},T_{i,j},data\ transmitted)\)
4:\(Centrality_{i}\gets computeCentrality(i,Graph)\)
5:\(IOTA\_trust_{i}\gets computeIOTArust(i,IOTA\_transactions)\)
6:if\(Reliability_{i}\geq 0.5\) AND \(QoS_{i}\geq 0.5\)then
7:for Each node \(j\) within range do
8: Send \(Message_{i}\) to \(j\)
9:\(trust_{i}\gets computeTrust(Reliability_{i},QoS_{i},Centrality_{i},IOTA\_trust_{i})\)
10:endfor
11:else
12:\(trust_{i}\gets 0\)\(\triangleright\) Untrusted node
13:endif
14:endfor
```  
**Algorithm 1** Optimized Trustworthiness Evaluation  
The local trust score for each node is computed using an exponential function applied to the key metrics: reliability, QoS, and harmonic centrality. The formula is as follows:  
\[\text{local\_trust}=\sum_{i=1}^{n}w_{i}\times e^{(s_{i})} \tag{14}\]  
where:  
* \(s_{i}\) represents the normalized score of each metric. * \(w_{i}\) denotes the weight assigned to each metric, reflecting its importance in the overall assessment of trustworthiness. * The exponential function \(e^{(s_{i})}\) is applied to each score, enhancing the distinction between varying performance levels. The ITS score is then combined with the trust evaluation model to compute the Final Trust Score (FTS):  
\[FTS=(\lambda)ITS+(1-\lambda)local\_trust \tag{15}\]  
where \(\lambda\) controls the contribution of IOTA-based metrics versus traditional trust factors such as reliability, QoS, and centrality. To compute node \(i^{\prime}\)s trust score, a consensus mechanism is given in Algorithm 2. In the algorithm, the trust score computed by node \(j\) for node \(i\) is denoted as \(local\_trust_{j}\). Each node \(i\) initializes an empty list to store trust scores from all nodes \(j\) within its communication range. Each node \(j\) computes its local trust value for node \(i\) using the \(compute\_TrustValue\) function and appends it to the list of trust scores for node \(i\). The \(consensusAlgorithm\) function sorts the collected trust scores. It then calculates the median and mean of these scores. If the difference between the mean and median is below the consensus threshold, the mean is considered as the agreed trust score. Otherwise, the median is used. The agreed trust score for node \(i\) is broadcasted to all nodes within its communication range.