# Blockchain-Assisted Adaptive Reconfiguration Method for Trusted UAV Network
## 4 Recommended Scheme
### Trusted Network Reconfiguration
#### 4.3.1 Node Global Trustworthiness Assessment  
By data consensus, the asynchronous generic subset ACS of all nodes is obtained, which contains the local state data of the node's trustworthiness score of all its neighboring nodes, \(StateData_{i}=\{ID_{i},\left[ID\right]_{i},\left[ID_{i}^{j}:CurScore_{i-j}^{bc -height}\right]\), \(cdots\}\). The local state assessment \(LSA\) of a node is obtained by counting the asynchronous generic subset ACS, i.e., the trustworthiness assessment of a node by all neighboring nodes, as \(LSA_{i}=\{ID_{i},\left[ID\right]_{i},\left[ID_{j}^{j}:CurScore_{j-i}^{bc-height }\right]\),...\(\}\). The global trustworthiness discount of nodes can be calculated based on LSA, but the UAV network in the mission is a distributed Byzantine systemand collusive or selfish behavior is not accurately determined in the above computational method. The global statistical computational method is used to identify colluding nodes, selfish nodes, and to correct for the global trustworthiness discount. The global trust discount of a UAV node \(ID_{x}\) is the expected value of the local discount of all its neighboring nodes \(GDiscount^{x}\) with a variance of \(\sigma^{x}\), as shown in the following two equations. \[GDiscount^{x}=(\sum_{i=0}^{n}CurScore_{x-i}^{bcheight})/n \tag{3}\]  
\[\sigma^{x}=\sqrt{\sum_{i}^{n}\left(CurScore_{x-i}^{bcheight}-{GDiscount^{x}} \right)^{2}/n} \tag{4}\]  
where \(i\) is one of all n neighbors of node \(x\). The rules for the system to set the global trust degree discount are shown in Table 3.  
According to the rule, Equation (5) corrects the global trust discount of node \(x\). Equation (6) calculates the current global trustworthiness. \[GDiscount^{x}=GDiscount^{x}+Discount_{\sigma}^{x}+Discount_{error}^{x} \tag{5}\]  
\[{GRputation_{x}^{bcheight}={GRputation_{x}^{bcheight-1}+GDiscount^{x}}} \tag{6}\]  
when \({GRputation_{x}^{bcheight}}\) is less than or equal to 0, it means that the node is also untrustworthy and its node ID and its authentication information are accumulated to the wrong node subvector commitment and isolated from the network. Refer to pseudo-code Algorithm 3 for details. \begin{table}
\begin{tabular}{c c} \hline \hline
**Reasons for Trust Discount** & **Global Discount** \\ \hline \(Discount_{\sigma}^{x}(|CurScore_{x|i}^{bcheight}|<5\sigma^{x})\) & 0 \\ \hline \(Discount_{\sigma}^{x}(|CurScore_{x|i}^{bcheight}|\geq 5\sigma^{x})\) & \(-\)0.5 \\ \hline Selfish node \(Discount_{error}^{x}\) & \(-\)1 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: The rules for global reputation discounts. ```
1:\(GlobalTrustAssess(\{LSD\},ID_{x})\)
2:let\(LSA[N][]\leftarrow\{\}\)
3:/*Running in a Delegated Agent UAV\(ID_{x}\)*/
4:\(\#\{StateData\}_{x}\)already contains local state transactions for 2/3 of the total number of nodes in the current network. 5:if\(Nodesof\,ReceivedLocalStateTrans(\{StateData\}_{x})\geq 2/3\)then
6: #Extracts the corresponding decentralized transaction message blocks from the local transaction set. 7:\(DRBC_{x}\gets BuildMyRBCPacket()\)
8:\(\#\)Multicast its own \(DRBC_{x}\) to the delegate agent nodes. 9: Multi\(\_\)cast(\(RBC_{x}\{ID_{A}\}\)
10:while1 do
11:\(DRBC_{other}\gets ReceivedDBCformOtherAgents()\)
12:\(\#\)Translides \(DRBC_{other}\) to the delegate agent nodes. 13:\(Multi\_cast(DRBC_{other}\{ID_{A}\}\)
14:\(\#\)If 2/3 DRBCs are acknowledged, consensus is reached. 15:\(ACS\gets BuildACSFromStateData(LSD)\)
16:\(\#\) Quit from Loop. 17:endwhile
18:endif
19:\(\#\)Statistical local assessment of all nodes
21:\(\#\{ACS\}_{i}\): contains the trustworthiness scores of node \(ID_{i}\) for all neighboring nodes. 22:\(\#\{LSA\}_{i}\): contains the trustworthiness scores of all neighboring nodes for \(ID_{i}\) itself. 23:\(\{LSA\}\gets StatisticLSA(ACS)\)
24:\(\#\)Computing the assessment of \(ID_{x}\) by all neighboring nodes from \(\{LSA\}\).