# Blockchain-Assisted Adaptive Reconfiguration Method for Trusted UAV Network
## 4 Recommended Scheme
### Node Local State Transactions Generation  
After system initialization is complete, the Genesis block stores the configuration information of the initial pre-defined upper layer network with a trust value of 10 for each registered node. a neighbor node forwarding behavior monitoring function is added to the intra-zone routing protocol (IARP), where IARP generates a neighbor table using the neighbor information collected by the neighbor node detection protocol (NDP) at the MAC layer, and periodically broadcasts outward the update packets of information such as neighbor table and zone radius at the same time, a forwarding behavior timer is started to record the forwarding behavior of neighboring nodes. The cycle of sending routing  
Figure 2: Mission-Oriented UAV Network Blockchain Workflow.  
message packets is to monitor the forwarding behavior of neighboring nodes, the behavior is divided into four categories.  
1. Normal forwarding, the return packet is received within the threshold time and the data is not tampered with.
2. Delayed forwarding, received outside the threshold time but the data is not tampered with.
3. Data discarded, no return packet is received within a cycle.
4. Forwarding malicious, the data is tampered with.  
The definition of the behavior given by the scheme and the criteria for the trust discount are shown in Table 2.  
The pseudo-code 1 of the algorithm indicates the detection of the node's forwarding behavior to neighboring nodes and the scoring of a given trust discount, as described in lines 14-35, and the output is the cumulative score of the trust discount for one data forwarding behavior of all neighboring nodes of the node.  
Each node averages the neighbor trust discount records before the consensus mechanism is initiated and evaluates the local trust of its neighbor nodes based on the stage monitoring record set. Equation (1) indicates the local trust discount, where \(nCount\) is the number of forwarding actions. \(Discount_{i-j}^{k}\) is the discount value of node \(ID_{i}\)'s behavior to its neighbor \(ID_{j}\) for the \(k\_th\) time in this phase, and \(CurScore_{i-j}^{\textit{bcheight}}\) is the average value of the discount in this phase.  
\[CurScore_{i-j}^{\textit{bcheight}}=\frac{\sum_{k}^{nCount}\textit{Discount}_{ i-j}^{k}}{nCount} \tag{1}\]  
The final local state transactions are generated with a transaction data structure consisting of node \(ID_{i}\), a list of neighboring node IDs, and a list of discounted averages of the current phase trust of neighboring nodes. The final local state record takes the form of Formula (2).  
\[StateData_{i}=\{ID_{i},[ID]_{i},[ID_{i}^{j}:CurScore_{i-j}^{\textit{bc-height }}],\ldots\} \tag{2}\]  
where \(ID_{i}^{x}\) is a neighbor node of node \(ID_{i}\), \([ID]_{i}\) is the current list of neighbor nodes of node \(ID_{i}\). When the period ends or the trigger event occurs, node \(ID_{i}\) sends the record to the upper network \(\{ID\}_{A}^{j},j\in[M]\) and the consensus process starts. Algorithm 2 then gives the behavior of all nodes during the consensus cycle, with the nodes accumulating local trust loss and can be obtained by comparing the current neighbor table with the list of neighbors at the beginning of this cycle when the structure changes significantly, as shown in lines 20-25, and directly requesting consensus.  
\begin{table}
\begin{tabular}{c c} \hline \hline
**Data Forwarding Behavior** & **Reputation Discount** \\ \hline Normal forwarding & \(0\) \\ Delayed forwarding & \(-1\) \\ not forwarding data & \(-2\) \\ Forwarding of incorrect data & \(-3\) \\ \hline \hline \end{tabular}
\end{table}
Table 2: Classification of data forwarding behavior and penalty rules.