A Blockchain-Based Multi-Unmanned Aerial Vehicle Task Processing System for Situation Awareness and Real-Time Decision

: With the rapid advancement of Unmanned Aerial Vehicle (UAV) technology, UAV swarms are being extensively applied in various ﬁelds, such as intelligent transportation, search and rescue, logistics delivery, and aerial mapping. However, the utilization of UAV swarms in sustainable transportation also presents some challenges, such as inefﬁcient task allocation and data transmission security issues, highlighting the importance of privacy protection in this context. To address these issues, this study applies blockchain technology to multi-UAV tasks and proposes a blockchain-based multi-UAV task processing system for situation awareness and real-time decisions. The primary objective of this system is to enhance the efﬁciency of UAV swarm task scheduling, bolster data transmission security, and address privacy protection concerns. Utilizing the highly secure features of blockchain technology, the system constructs a distributed task processing network. System tasks are stored in the blockchain through smart contracts, ensuring the immutability and veriﬁability of task information. Smart contracts have an automatic execution capability, whereby the system can efﬁciently coordinate tasks and maintain the consistency of task execution information through consensus mechanisms. Additionally, adopting the Pointer Network structure for intelligent path planning based on task allocation results leads to the attainment of the shortest service routes, consequently expanding the service coverage of sustainable transportation systems while reducing energy consumption. This further advances the realization of urban sustainable transportation. Through experimental results, we verify that the proposed system enables real-time task scheduling and collaborative processing for multiple UAVs, signiﬁcantly enhancing the efﬁciency, security, and privacy protection level of UAV swarm task execution in the context of sustainable transportation. It makes a positive contribution to building more sustainable urban transportation systems.


Introduction
In recent years, the rapid development of Internet of Things (IoT) technology has driven the trend of the digital era [1].As an integral component of the IoT, UAVs have progressively found applications in various domains of human life, including intelligent transportation, agriculture, logistics, and more [2][3][4].This has garnered significant attention from both academia and industry [5].Simultaneously, with the advancement of communication technology, an increasing number of mobile devices have integrated into edge networks, resulting in a substantial surge in the generation of real-time service requests [6].This, in turn, poses security threats to a considerable amount of data distributed across the network [7].In the context of multi-UAV missions, the encompassed data extends beyond mere positional and environmental information to encompass task directives, image data, and other pertinent sources.The real-time precision and accuracy of these data play a pivotal role in the system's overall performance.Nevertheless, the imperative collaboration among geographically dispersed UAVs necessitates data sharing to facilitate precise environmental perception and swift decision-making.This engenders concerns over data privacy and security, especially within a distributed setting where data may become vulnerable to unauthorized access and tampering.Furthermore, conventional centralized data management methodologies may fall short in addressing the exigent real-time demands of multi-UAV missions, given their susceptibility to network congestion and single-point failures, among other challenges.
Building upon the aforementioned backdrop, we propose the design of a blockchainbased multi-UAV mission processing system for situational awareness and real-time decision-making.The objective of this system is to leverage blockchain technology to establish a secure and real-time platform for processing multi-UAV missions.By doing so, the system aims to enhance the efficacy of task allocation and flight path planning for UAVs, facilitate collaborative mission execution, mitigate concerns over data privacy and security, facilitate real-time data sharing, and offer efficient decision-making support.This innovative approach is poised to unlock substantial potential and promising applications within the realm of UAV technology, propelling it toward greater development and prospects.

Research Challenges
The inherent constraints posed by the dynamic wireless channel, limited battery capacity, and restricted computational resources of UAVs have highlighted the inefficiencies of conventional methods in the realm of UAV-connected Internet [8].In contrast to the confined sensing coverage and communication capabilities exhibited by solitary UAVs, the orchestrated efforts of multiple UAVs have paved the way for enhanced sensing and transmission services [9].With the burgeoning expansion of UAV systems, the realm of collaborative processing for numerous UAV tasks encounters a spectrum of challenges.The wireless and ever-shifting landscape of communication deployment exposes UAVs to an array of security vulnerabilities, including network attacks and physical breaches [10].The copious data amassed during UAV operations brings forth privacy apprehensions, and conventional centralized systems might be susceptible to perils such as data manipulation, unauthorized data access, or data leakage.In response to these formidable challenges, the fusion of blockchain technology emerges as a solution, ensuring data encryption, fortifying sensitive data security, averting data leakage, and upholding the security and privacy tenets of UAV systems.
The execution of UAV missions frequently necessitates stringent real-time and lowlatency prerequisites.Nonetheless, the consensus algorithm and the subsequent transaction verification procedure within a blockchain network could potentially introduce heightened latency.Consequently, the pursuit of expeditious task allocation and prompt decisionmaking within a blockchain framework, aimed at meeting the exigent low-latency prerequisites of UAV mission processing, poses a formidable challenge.Moreover, the deployment and operational expenditures linked with blockchain technology might be substantial, particularly within expansive multi-UAV mission processing frameworks.Addressing the research quandary of curtailing the expenses associated with blockchain systems, while concurrently harmonizing the interplay between costs and advantages, becomes imperative to attain the economic viability of multi-UAV mission processing systems.

Contributions
To address the aforementioned issues, we propose a blockchain-based multi-UAV task processing system for situation awareness and real-time decisions.The system is designed to ensure data security and privacy protection, enhance task responsiveness, and enable intelligent decision support.This will bring more opportunities and potential to the field of UAV applications while improving the efficiency and security of mission execution.The main contributions of this work are as follows: • By introducing blockchain technology, we achieve secure transmission and storage of data.The decentralized and encrypted nature of blockchain protects the integrity and confidentiality of task data, preventing unauthorized access and tampering, thereby enhancing the system's data security and privacy protection capabilities; • Our system has the capability to acquire and analyze network data in real-time, including sensor data and communication data.Based on these data, the system utilizes intelligent algorithms to determine task priorities and allocate optimal resources, enabling efficient task processing and optimized resource utilization.This enhances task allocation efficiency and improves overall task execution effectiveness; • We have established a decentralized collaboration platform that enables direct communication and information sharing among UAVs.Through the use of smart contracts and distributed consensus mechanisms, the system is capable of facilitating trustworthy task collaboration and resource allocation, thereby enhancing the collaborative processing capabilities of multi-UAV systems.
This paper is organized as follows: In Section 2, a review of related work is presented.Section 3 introduces the system design.The implementation of the system and its performance analysis are described in Section 4. Finally, Section 5 concludes the paper.For abbreviations of terminology in the article, refer to Table 1.

UAV
An aircraft operated without a human pilot on board, commonly known as a drone, used for various tasks.
UAV Swarm A group of UAVs that work together to achieve common goals through coordinated and allocated tasks.

Blockchain Technology
A decentralized and secure digital ledger technology used for data integrity, security, and sharing.

IoT
A network of interconnected devices that can exchange data and communicate over the internet.

Frontend
The user interface and presentation layer of the system.

Backend
The server-side logic and data processing layer of the system.
Vue.js A JavaScript framework for building user interfaces.

Spring Cloud
A framework for building distributed systems and microservices.

Spring Boot
A framework for building stand-alone, production-grade applications.

MyBatis
MyBatis is a Java-based persistence framework that simplifies database interactions.It provides an SQL mapping approach, allowing developers to define queries in XML or annotations, making it easier to manage and retrieve data from relational databases.

FastAPI
A modern Python-based web framework known for high performance.

MySQL
MySQL is an open-source RDBMS renowned for its speed, reliability, and SQL-based interaction.It is used for data storage, management, and retrieval, catering to various projects from personal to enterprise.

Redis
Redis is an open-source, high-performance, in-memory data store used for caching and messaging.It supports diverse data structures and is commonly employed for caching and real-time data management.TSP TSP is a classic optimization problem where the goal is to find the shortest possible route that visits a set of given cities and returns to the starting city.It is a common problem in the field of combinatorial optimization.

NP-hard
NP-hard refers to problems that are at least as hard as the hardest problems in the NP complexity class.These problems might not have efficient algorithms for finding solutions, making them challenging to solve for large inputs.

NP-Pointer Network
A reinforcement learning-based algorithm for solving optimization problems like the Traveling Salesman Problem.

Gurobi
A commercial mathematical optimization solver used for linear programming, integer programming, mixed-integer programming, and more.It excels at solving large-scale and complex problems.

2-opt
A local search optimization algorithm employed to solve the TSP.It enhances the current solution by reversing two edges in the path, aiming for a shorter path.

OR-Tools
An open-source optimization library developed by Google.It is designed to address operations research problems like scheduling, routing, packing, and others.

Nearest Neighbor
The Nearest Neighbor algorithm is used to solve the TSP.It starts from an initial point and, at each step, selects the unvisited point closest to the current one, until all points have been visited.

Collaborative Planning for Multi-UAV Missions
The advancement of computer and communication technologies has provided support for the scalability and intelligence of the IoT [11].IoT devices connect to the internet and transmit data to the cloud for processing [12].Intelligent sensors can be integrated with transportation infrastructure to achieve sustainable intelligent transportation systems [13].With the increasing number of mobile users, IoT systems are required to handle massive amounts of data and user requests, generating a significant volume of data every day [14].Efficient data transmission and processing capabilities are necessary.Cloud computing utilizes the internet and virtualization technologies to provide on-demand computing resources to users [15].Wireless-powered mobile edge computing technology enhances the computing capabilities of mobile devices, compensating for limited battery capacity [16].Partial computation offloading enables low-latency execution, benefiting latency-sensitive applications [17].Various devices in the IoT are interconnected, connecting physical objects and supporting intelligent decision-making, device automation, and new services and applications [18].The development of vehicular networks enables communication among vehicles, providing real-time traffic information and decision support to reduce road accidents and traffic congestion [19,20].The development of smart vehicles offers a comfortable and safe travel environment for drivers and passengers [21].Establishing a sustainable transportation system with zero emissions, energy efficiency, and diversified modes of transport will help reduce carbon emissions, save on fuel, and lower vehicle costs [22].
Renowned for their mobility and versatility, UAVs are widely utilized in various domains [23], providing essential computing, communication, and storage services to ground users [24].UAVs play a crucial role in improving the safety and reliability of intelligent transportation systems [25].However, UAV systems face challenges such as limited energy and flight restrictions [26], communication challenges, and large-scale data processing.Fog computing extends cloud computing infrastructure to the edge network [27,28], enhancing the collaborative capabilities of UAVs to handle complex environments and tasks, such as intelligent transportation [29], traffic prediction, and remote rescue operations.Network topology awareness identifies critical nodes, bottlenecks, and vulnerabilities, enhancing network robustness and performance.Shaikh et al. [30] proposed a topology structure and network monitoring algorithm based on Open Shortest Path First to improve network reliability, security, and performance.M. Laghate et al. [31] modeled the response mechanism of common communication protocols using Granger causality to infer directed data flows in group networks.Some researchers predict network objectives and behaviors by studying network evolution trends.H. Baek et al. [32] designed a Link-Situation Awareness and Control tactical data link for UAVs to ensure reliable UAV control and situational awareness.UAV mission processing involves predefining and coordinating the management of different numbers of UAVs, task types, and payloads to maintain a reasonable inter-UAV collaborative relationship.This processing covers multiple levels and aspects, including task allocation, trajectory planning, data link planning, and emergency response planning.Li et al. [33] addressed the problem of multi-UAV position optimization in Device-to-Device networks and proposes a low-complexity GNN-based method to achieve optimal solutions.Tian et al. [34] introduced a three-step experience buffer depth deterministic policy gradient algorithm to enable rapid path planning for UAVs in urban environments.Li et al. [35] focused on data collection and flight trajectory optimization for UAVs to shorten mission completion time.

Application of Blockchain in Data Security for Multi-UAV Missions
Blockchain technology [36][37][38] has garnered significant attention due to its decentralized, anonymous, and immutable characteristics.Multi-UAV missions involve often involve a substantial amount of sensitive data, thereby underscoring the paramount significance of data security.The introduction of blockchain technology offers novel opportunities and solutions for the collaborative processing of UAV tasks.By incorporating blockchain technology into UAV networks, secure storage and sharing of UAV mission data can be accomplished, ensuring the integrity and reliability of data.Concurrently, blockchain technology can facilitate functionalities such as smart contracts, enabling trust management and automated collaboration among UAVs.This enhancement will further fortify the stability and security of UAV networks, thereby facilitating the proficient execution of multifaceted UAV collaborative tasks.Alladi et al. [39] provided an overview of the research progress on blockchain applications in UAVs and their various applications in UAV networks.Miao et al. [40] proposed a secure data sharing mechanism called BP2P-FL, which is based on privacy-preserving data providers in peer-to-peer federated learning, facilitating high-quality data sharing.Ma et al. [41] focused on delay-sensitive blockchain applications, analyzing the delay bounds of practical Byzantine fault-tolerant and HotStuff consensus algorithms using deterministic network calculus.This analysis offers valuable insights for research utilizing low-latency blockchain technology.Seid et al. [42] proposed an integrated blockchain and multi-agent deep reinforcement learning framework for computation offloading with EH in a multi-UAV-supported IoT network, where IoTDs obtain computing and energy resources from UAVs.Campos et al. [43] proposed a blockchainbased multi-UAV surveillance framework that enables UAV coordination and financial exchange between system users.

System Design
This section provides a detailed design of the system, including system architecture design, system function module design and main algorithm design, which will be followed by the detailed design of each part of the system.

System Framework Design
We employ a browser/server architecture, a decision that explicitly separates frontend and backend development, thereby capitalizing on the architecture's advantages.The primary merit of this architecture lies in its ability to decouple frontend and backend, reducing system coupling and allowing independent development at each level.Consequently, this enhances the system's maintainability and scalability as a whole.In terms of frontend development, we have chosen the Vue.js framework as the primary development tool.Vue.js, with its elegant design and user-friendly features, enhances the efficiency and flexibility of frontend development.Utilizing Vue.js' component-based approach, we divide the frontend interface into discrete components, fostering reusability and modularity, promoting team collaboration and parallel development.Furthermore, Vue.js' responsive design ensures real-time updates of the frontend interface based on user interactions, elevating the user experience.For backend development, we have combined the Spring Cloud, Spring Boot, and FastAPI frameworks.Spring Cloud equips the system with a plethora of tools and libraries for constructing a distributed architecture.This encompasses functionalities such as service discovery, load balancing, and distributed configuration, facilitating efficient service communication and management within a distributed environment.Spring Boot, as a framework for building microservices, expedites the establishment of standalone, production-grade applications.Its streamlined configuration and automated functionalities curtail developers' workload, streamlining the development process.FastAPI, a modern Python-based web framework, is celebrated for its high performance and user-friendliness.Given the system's requirements for real-time perception and scheduling, FastAPI's rapid performance and asynchronous capabilities support real-time data processing and communication.The selection of these frameworks aims to address critical requirements such as high concurrency, availability, performance, reliability, and security within the system.Furthermore, the drone hardware scheduling layer employs MAVSDK for development, coupled with FastAPI to construct a remote communication ground station, facilitating real-time perception and scheduling of drones.Task scheduling and multi-drone route planning are integrated into the algorithmic module layer, divided into centralized and distributed task scheduling, along with route planning for drone mission services.In summary, the system architecture encompasses four principal components: frontend presentation and interaction layer, backend service layer, algorithmic scheduling layer, and data storage layer.Additionally, it encompasses dependency management and deployment strategies for development.The architecture is illustrated in Figure 1. (

1) Frontend Presentation and Interaction Layer
The frontend presentation and interaction stratum shoulders the responsibility of presenting the system's frontend interface and facilitating user engagement.Within its scope, it encompasses pivotal functionalities encompassing login, registration, user administration, UAV oversight, task supervision, sensor oversight, and system administration.It is through this stratum that users can seamlessly engage with the system.The provision of a visual interface empowers task managers with real-time insights into UAV status and task advancement.This, in turn, facilitates timely task scheduling and informed decision-making.By offering an intuitive platform, the stratum affords users the opportunity to interact with the system, fostering efficient communication and enhanced operational control.
(2) Backend Service Layer The backend service layer is primarily responsible for handling user requests, including functionalities such as user login, registration, user management, task management, data management, and device management.The system also includes sub-functionalities such as real-time situational awareness, task scheduling, route planning, and task execution to achieve the goal of handling multiple real-time tasks for UAVs.To implement these functionalities, the backend service will be designed in two parts: the main service component and the real-time situational awareness and scheduling module for UAV hardware.The main service component will be developed using technologies such as SpringCloud, SpringBoot, and MyBatis.The real-time situational awareness and scheduling module for UAV hardware will be developed using the FastAPI framework in Python combined with MAVSDK.
(3) Algorithm Module Layer The algorithm module layer is primarily responsible for system task scheduling and path planning.By combining various algorithms, it integrates the independent components of UAV task allocation and route planning into a unified whole, taking into account real-time tasks and UAV status to achieve optimal system scheduling.It consists of two main parts: a centralized and distributed hybrid UAV task allocation module and a path planning module based on reinforcement learning.During the task scheduling process, the system first uses a centralized algorithm to allocate tasks based on UAV resources and task information.If there are situations such as UAV disconnection or task abnormalities, the UAV will automatically use a distributed auction algorithm to reassign tasks, addressing the issue of centralized task allocation's inability to adapt to task changes.Once the task allocation is complete, the system will employ reinforcement learning methods to plan the paths for the UAVs, aiming to achieve the shortest service routes and minimize the energy consumption of the UAVs.
(4) Data Storage Layer During the operation of the system, a large amount of data are generated, and data storage and retrieval are essential components.This paper combines multiple technologies to achieve data storage and management.To accommodate different types of data storage and retrieval, MySQL, Redis, and FastDFS are used to store data and files.MySQL database is used to store user information, UAV information, task information, and other data.The Redis cache is used to store frequently accessed data, improving the query efficiency of the system.FastDFS is used to store large files such as perception images, providing high-performance and scalable file storage and management.It optimizes the performance of large file uploads and downloads, and ensures file backup and fault tolerance.

System Function Module Design
Building upon the system architecture design outlined in the previous section, this section will provide a detailed overview of each functional module within the system.

Hardware Situational Awareness and Scheduling Module Design
To ensure stability and adaptability in various environments, the hardware situational awareness and scheduling module has been designed.This module enhances the operational stability and safety of the UAV system by precisely controlling and providing real-time situational awareness.
The UAV control functionality is responsible for executing precise commands to the UAV, such as startup, flight, stop, and execution of specific tasks.The MAVSDK library is used to customize ground stations, enabling precise control of the UAV.This is particularly important in harsh environments, ensuring the stable operation of the UAV in complex conditions.
The situational awareness functionality is responsible for monitoring and early warnings.It collects and processes real-time flight data from the UAV, including information such as position, velocity, attitude, and environmental perception, to achieve real-time monitoring and early warnings in the UAV. Figure 2 illustrates the workflow of the module's perception and warning capabilities.By integrating perception and warning information, the module provides stability to the overall network situation, enabling timely UAV recalls to avoid accidents caused by UAV loss of control.

Task Allocation and Path Planning Module Design
The accomplishment of real-time scheduling and simultaneous processing of multiple UAV tasks necessitates meticulous algorithmic design, encompassing UAV task allocation algorithms and reinforcement-learning-based path-planning algorithms.The taxonomy of UAV task scheduling algorithms bifurcates into centralized and distributed paradigms.In the former, task allocation decisions are orchestrated by a central server, whereas the latter delegates task allocation autonomy to individual UAVs.To harness the merits of both paradigms, this study proposes a hybrid model amalgamating centralized and distributed task allocation mechanisms.Commencing with centralized task allocation, the system seamlessly transitions to distributed task reallocation whenever changes arise, thereby mitigating inter-UAV conflicts and augmenting system execution efficiency.Subsequent to curating task service enumerations for each UAV, path-planning algorithms facilitate meticulous route delineation.The comprehensive procedural delineation is visually represented in Figure 3.
(1) Design of Centralized Task Allocation Strategy In the design of the centralized task scheduling algorithm in this system, a greedy strategy is employed as the basic approach.The advantage of the greedy strategy is its simplicity and ease of implementation, which allows for quick task allocation results in a centralized system.
The solution to this problem is obtained using the greedy strategy, where the idea is to prioritize the scheduling of tasks with the highest service priority, while satisfying the energy requirements.The pseudocode for this approach is shown in Algorithm 1.
During the task execution process, the energy status of the UAV is a critical factor to consider.It is important to prioritize the energy status of UAVs to avoid task delays or the inability to complete tasks.The UAV collection is sorted in descending order of remaining energy, ensuring that UAVs with higher energy levels are selected first.Then, the task collection is sorted in descending order of priority, and the collection is iterated to find the UAV with the maximum remaining energy that meets or exceeds the energy requirements of the task.If a suitable UAV is found, it is assigned the task and its remaining energy is updated.If no suitable UAV is found, options such as increasing the number of UAVs or recharging should be considered.Finally, the task-to-UAV assignment plan is returned.(2) Design of Distributed Task Redistribution Strategy In order to enhance task scheduling efficiency, mitigate communication overhead, minimize processing delays, and augment system flexibility, an edge-deployed distributed task redistribution algorithm is implemented.This algorithm facilitates the dynamic reallocation of tasks among UAVs, leveraging their prevailing states.This proves especially beneficial in exigent scenarios, ultimately bolstering task completion efficiency.The edge-centric dynamic task redistribution algorithm takes several pivotal factors into meticulous consideration, encompassing device resource constraints, network bandwidth limitations, task attributes, and system dynamics.Fundamentally rooted in auction strategies, the algorithm treats the task assignment conundrum as an auction scenario, where UAVs function as bidders and tasks embody the auction items.UAVs vie for tasks contingent upon their respective statuses and task requisites, culminating in the assignment of a task to the UAV that proffers the most economical bidding cost.This auction-based algorithm confers noteworthy merits in the realm of decentralized decision-making and task allocation, thereby diminishing the dependence on central servers.During the operational lifecycle of the system, the redistribution of tasks is dynamically fine-tuned in consonance with real-time conditions, endowing the auction algorithm with the agility to seamlessly adapt to fluctuations in real-world scenarios.Central to the algorithm's efficacy is the judicious selection of the UAV presenting the most economical bidding proposition for task execution.This judicious curation ensures the seamless and robust redistribution of tasks, thereby optimizing the efficiency of task completion and the utilization of UAV resources.A formal representation of the pseudocode governing task redistribution, hinging on the auction strategy, is delineated in Algorithm 2. In the above pseudocode, the function calculate_cost() calculates the cost by considering the distance, energy, and priority between the UAV and the task.It combines the calculated distance cost, energy cost, and priority cost to obtain the total cost, forming a comprehensive cost calculation method.
(3) Design of Reinforcement Learning-based Path Planning Algorithm The aforementioned task scheduling algorithm has successfully achieved efficient task allocation.However, practical applications also necessitate the consideration of UAV flight path planning.During flights, UAVs must select suitable paths based on task requirements to ensure optimal task completion.This path planning conundrum can be conceptualized as the Traveling Salesman Problem (TSP).Given its NP-hard complexity, conventional solving techniques often demand substantial computational resources and struggle to address extensive-scale scenarios.Consequently, our system adopts a reinforcement-learning-based path-planning approach known as the Pointer Network.In contrast to conventional TSPsolving methods, the Pointer Network offers a novel solution that excels at addressing large-scale TSP challenges.This is attributed to its quicker computation speed and en-hanced accuracy.By leveraging the strengths of the Pointer Network algorithm, our system overcomes the limitations of traditional techniques and efficiently handles complex flight path-planning for UAVs.
The Pointer Network is mainly applied to Sequence-to-Sequence (Seq2Seq) learning problems, aiming to address the core issue in sequence generation: how to select elements from the input sequence to make the output sequence more accurate.Its core idea is to map each element of the input sequence to the corresponding position in the output sequence, resulting in the final output sequence.The Pointer Network consists of two main components: the Encoder and the Decoder, as shown in Figure 4.In the Encoder part, the input sequence is transformed into a high-dimensional representation in a mapping process.The Decoder part generates the output sequence step-by-step based on the information in this representation.Unlike traditional Seq2Seq models, the Pointer Network introduces a pointer mechanism in the Decoder, allowing the selection of elements from the input sequence in the output sequence.Specifically, the Decoder learns to generate a probability distribution for each position, corresponding to the elements of the input sequence.The Decoder then utilizes this probability distribution to determine which position's element to select in the output sequence.This pointer mechanism enables the model to directly "point" to the elements that need to be output from the input sequence, rather than only generating words from a fixed vocabulary to construct the output sequence.Through this approach, the Pointer Network can effectively solve optimization problems such as the TSP, which requires finding the shortest path to visit a set of locations.
where h i represents the encoding of the i-th element in the input sequence.Specifically, the BiRNN consists of two Recurrent Neural Networks (RNNs) that encode the input sequence from left to right and from right to left, respectively.The outputs from these two directions are then concatenated to obtain the final encoding result.
The Decoder part consists of an RNN that takes as input the previous output and the encoding matrix from the Encoder.At each timestep, the Decoder calculates an attention distribution, which indicates which parts of the input sequence should be attended to at the current position.This attention distribution is used to compute a weighted average, representing which element from the input sequence should be chosen as the next element in the output sequence.
In more detail, let y t denote the output at timestep t, s t denote the state vector at timestep t, c denote the context vector, and h t denote the input representation.The computation of the Decoder can be expressed as follows: In the computation, f and g represent Multi-Layer Perceptron models.The term P(y t = i|y 1 , • • • , y t−1 , c) represents the probability of selecting the i-th input, The variable h t represents the input representation, which can be obtained by using the last state vector of the Encoder, specifically h t = h L+1 .In this process, the Decoder takes as input the sequence y 1 , • • • , y t−1 , and the context vector c, and predicts the next output y t .This process continues until all input sequences have been predicted.
In the Pointer Network, a Pointer Mechanism is introduced to perform pointer operations on the input sequence, mapping the probability distribution outputted by the Decoder to the input sequence.Specifically, given the current state s t of the Decoder, the position of the pointer at timestep t is calculated as follows: where α ti represents the probability of input i corresponding to the output t.It can be expressed as: where e ti represents the correlation between input i and output t, and can be expressed as: where W h , W e , and v are weight matrices, and tanh represents the hyperbolic tangent function.
Through the Pointer Mechanism, the Decoder can predict the next output based on the previous output and the context vector, and can also perform pointer operations on the input sequence for improved performance.When applied to TSP problem solving, the pseudocode for this model is shown in Algorithm 3.
In the above design, the problem is solved through two stages: Encoder and Decoder.In the Encoder stage, the algorithm extracts features from the input set of points and feeds each point's feature vector into the Encoder, obtaining the Encoder's output and state.The purpose of this stage is to encode the feature information of the input points into the hidden state of the Encoder for subsequent path planning.
In the Decoder stage, the path is generated iteratively by looping.First, the Decoder's state is initialized as the last hidden state of the Encoder.Through the Pointer Mechanism, the Decoder's state, previous output, and the Encoder's output set are input into the model.The Pointer Mechanism calculates weight scores for each point based on the current state and the history of outputs, and normalizes the scores into a probability distribution.Then, the algorithm samples from the probability distribution to obtain the index of the next point to be visited and adds it to the path.The Decoder's state is then updated and the output is calculated.This loop iteration continues until the path length reaches the specified size of the point set.
Finally, the distance from the last point to the starting point is calculated and added to the path length, resulting in the final shortest path distance.The model returns the shortest path distance and the order of cities visited, which in this system corresponds to the order of service for the UAVs.

UAV Task Management Design
The UAV task management module serves as the frontend interface for task management, allowing operators to oversee and control tasks.It interfaces with both the task assignment and route planning modules to acquire algorithm-generated outcomes.Furthermore, it collaborates with the hardware situational awareness and scheduling module to allocate and schedule tasks.Additionally, it establishes communication with the backend management system to facilitate task monitoring and administration.The structural layout of this module is illustrated in Figure 5.The task allocation module is the core component of UAV task management.It displays all pending task information and provides task assignment and execution functionality.
Through this interface, administrators can select specific tasks and the system will use the centralized task allocation functionality of the Task Allocation and Route Planning module to assign the tasks.Once task allocation is complete, administrators can trigger task execution for the UAVs from this page, and the ground station will execute the task commands.
The task visualization feature provides a visual representation of the UAV task execution routes and task completion status.Through maps and route diagrams, the current position of each UAV, task execution routes, task distribution, and task completion status can be observed, enabling real-time monitoring of task execution for the operators.The Task List functionality displays all task information, including task execution time, assigned UAVs, and task status.Administrators can query all tasks from this page for statistical analysis and monitoring of task execution.It also supports task data management operations such as add, delete, modify, and search, as well as Excel data export, fulfilling the requirements for task data management.

UAV Perception Data Management Design
A large amount of data are generated during the operation of the system, and the Data Management module is responsible for collecting and managing these data.These data include various types of sensor data collected by the UAVs, such as environmental information and target detection data.The Data Management Module ensures that these data can be uploaded to the system in real time, and provides operators with the ability to query and manage the data.A schematic diagram of the Data Management Module is shown in Figure 6.

UAV Equipment Management Design
UAV equipment management is responsible for managing all the UAVs and sensors that are stored in the inventory.This includes operations such as adding, deleting, querying, and modifying UAV devices, as well as adding, deleting, querying, and modifying sensors.The structure diagram of the UAV equipment management module is shown in Figure 7, which enables centralized management for easy maintenance and administration of the devices, ensuring the efficient operation and accurate execution of the UAV system.The UAV management module assumes the critical responsibility of monitoring and scheduling all UAV devices registered in the system.Personnel have the authority to determine a device's participation in task execution by configuring its enablement status.This status holds paramount importance within the task scheduling module.Specifically, task assignment solely considers UAVs marked as enabled, while those lacking this status remain excluded from consideration.Similarly, the sensor management module handles the administration of all sensor devices within the system, establishing their association with corresponding UAV devices.Personnel-set enablement status once again governs the initiation of sensor operation.Enabled sensors have their data comprehensively recorded and managed by the data management module.In contrast, data from disabled sensors remains unrecorded and untouched.Through the interplay of these modules, the system effectively governs the UAVs and their associated sensors.This orchestrated synergy ensures operational coherence, allowing for efficient management of tasks and sensor data.

System Implementation and Performance Analysis
This section delves into the practical realization of the system's functionalities, building upon the foundation laid out by the functional design.The focal points encompass the hardware situational awareness and scheduling module, the task assignment and route planning module, data management, and user management functionalities.The subsequent sections provide a comprehensive explanation and demonstration of the implementation process for each of these pivotal functionalities.

Implementation of the Hardware Situational Awareness and Scheduling Module
The real-time hardware situational awareness and scheduling module perceive various data from the system's network situation.It integrates warning information and provides corresponding scheduling plans in case of adverse network situations.MAVSDK and FastAPI are used for development to achieve UAV scheduling control and real-time situational awareness, ensuring the timeliness and accuracy of system situational awareness.The UAV scheduling control functionality is implemented using MAVSDK.It provides a high-level encapsulation of the MAVLink protocol, allowing simple API calls to control UAV actions such as takeoff, flight, landing, and advanced operations like route cruising.In this system, a ground station control platform is developed using Python-based MAVSDK.
The hardware situational awareness module utilizes UAV sensors to collect environmental data and transmits these data in real-time to the ground control station.MAVSDK's data streaming service is used to transmit UAV sensor data to the ground control station, and FastAPI is utilized to develop the service invocation endpoint, which receives and processes these data to generate real-time situational information and warning messages for the UAVs.The situational awareness and warning information is displayed on the frontend page, which also integrates UAV scheduling and control functionalities.The page layout is depicted in Figure 8.The left section displays the onboard camera feed and UAV's attitude, altitude, speed, position, and other information.The middle section uses a map API to display real-time locations and task hotspots.The right section contains the control module and situational awareness warning information, enabling real-time maneuvering control of the UAVs.Situational awareness and warning information, such as collision risks between UAVs based on their real-time positions, stability status of communication links with the ground station, and remaining battery capacity, are displayed based on server-side processing.
By integrating network situational awareness and warning results, the module promptly provides warning information when multiple UAVs are in unfavorable conditions such as disconnection or poor communication links.This alerts the personnel to take timely actions, such as returning the UAVs or terminating ongoing tasks.An example warning is shown in Figure 9.

Implementation of UAV Mission Management
The implementation of the mission scheduling and management feature takes charge of efficiently scheduling and overseeing tasks uploaded by users or administrators.Its principal role revolves around dispatching precise task instructions to individual UAVs and guiding them in the seamless execution of their designated tasks.To achieve this, the module operates in close concert with the algorithm scheduling layer framework, which is realized using the Spring Cloud microservice architecture.The module's communication with the service is facilitated through well-defined interfaces, enabling the retrieval of scheduling outcomes.
When a user or administrator selects their desired tasks and triggers the 'One-click tasking' button, the module promptly engages in centralized scheduling by leveraging the outcomes derived from the algorithm scheduling layer.This orchestration process ensures optimized allocation of tasks.As depicted in Figure 10, the module subsequently displays a diverse array of task allocation statuses once the scheduling process concludes.Building upon these scheduling results, the module meticulously plans optimal routes for each UAV.This route planning takes into account the UAV's task load and geographic location, thereby guaranteeing that each UAV is equipped with the most efficient task execution path.With this groundwork laid, the 'Execute Task' button comes into play.By selecting this option, the module effectively dispatches tasks to individual UAVs in accordance with the allocation and route planning outcomes stipulated by the algorithm scheduling layer.The system provides a task list page where all tasks can be retrieved and viewed with detailed information.Additionally, the personnel can edit and delete tasks through this system.The user interface for this feature is depicted in Figure 11.

Implementation of UAV Perception Data Management
The perception data management microservice is built to communicate with the MAVSDK ground station using FastAPI.It facilitates real-time retrieval of UAV's current status, operational logs, and image files, which are then recorded accordingly.The perceived data can be categorized into two main types: log records and image file storage, with support for Excel data import and export.MySQL is used to record log-type data, capturing the UAV's operational status, detailed task execution records, and sensor data for comprehensive analysis and monitoring of the UAV's performance.Additionally, the sys-tem stores records of personnel's actions as part of the system's data.As an example, the implementation of flight data are shown in Figure 12.We harness the capabilities of the open-source FastDFS distributed file system to effectively store the collected image files.This strategic choice not only ensures efficient storage, but also bolsters reliability due to its inherently distributed architecture.By leveraging FastDFS's API interface, we seamlessly execute a spectrum of operations including uploading, downloading, and deletion of files.Additionally, this framework supports real-time previews of the files through their designated URLs, enhancing user accessibility to these resources.The implementation result is depicted in Figure 13.

User Management Implementation
The user management module in this system plays a pivotal role in administering user-related functions, encompassing tasks such as user login, logout, user information management, and role administration.The initial login process involves validating the provided username and password against the records stored in the MySQL database.Following a successful login, a token is generated and conveyed to the frontend for storage, concurrently being stored in Redis.Subsequent requests originating from the frontend are subject to validation, with the token being decoded through the gateway.Successful validation ensures that users are directed to the appropriate pages.After user login, different roles will have different permissions.For example, after an administrator logs in, they can access the user information management page as depicted in Figure 14.

Performance Analysis
Optimizing UAV flight trajectories is pivotal in maximizing the utilization of UAV power, thus significantly impacting system performance.The objective is to ensure that the UAV efficiently covers all areas while minimizing the route length.In this system, the optimization of UAV routes is accomplished using the Pointer Network.
For the performance comparison experiments, a deep learning platform built upon PyTorch 1.13.1 was employed, with Python as the programming language.The experiments were conducted on the Ubuntu 20.04 operating system, utilizing the Nvidia GeForce RTX 3090 Founders Edition GPU for model training.The model employed is a single-layer LSTM model comprising 512 hidden units.Training was conducted through stochastic gradient descent with a learning rate of 1.0 and a batch size of 128.Model weights were initialized via a uniform random distribution ranging from −0.08 to 0.08.For optimal TSP gap determination, the Gurobi solver was employed.This commercial mathematical programming solver is adept at delivering optimal solutions for TSP problems involving up to 100 nodes.Traditional solving tools and algorithms, including OR-Tools, 2-opt, and the Nearest Neighbor algorithm, were also incorporated for comparison.The experiments were executed on an Intel(R) Xeon(R) Silver 4210R CPU @ 2.40 GHz.
Three different datasets were used in the experiments: 20-TSP, 50-TSP, representing TSP problems with 20, 50, and 100 nodes, respectively.For all node experiments, the node coordinates were represented as (x i , y i ), randomly distributed within a square of [0,1] × [0,1].The same data distribution was used for both training and testing stages.Based on the above settings, the results of the various models after the experiments are shown in Table 2.The outcomes presented in Table 2 unequivocally demonstrate the remarkable benefits of the Pointer Network architecture employed in this study during the comparative experiments involving the TSP.Particularly noteworthy is the Pointer Network's performance when pitted against professional solvers like Gurobi and OR-Tools.For TSP instances featuring 20 nodes, the Pointer Network effectively approximates the optimal solution cost and gap, all while maintaining a notably shorter runtime.As the problem scale expands to 50 and 100 nodes, the Pointer Network remains on par with Gurobi in terms of performance, even showcasing swifter execution times.In direct comparison with traditional heuristic algorithms, such as 2-opt and Nearest Neighbor, the Pointer Network consistently outshines across all problem scales.It consistently generates outcomes that closely approach optimal solutions while concurrently achieving higher time efficiency.In summation, the Pointer Network demonstrates remarkable efficacy in addressing small-scale TSP problems.This attribute renders it particularly suitable for real-time task scheduling and path planning, thereby augmenting the efficiency and precision of UAV mission services.

System Testing
System testing is the final step after the completion of software development, where the entire software system is tested to verify its functionality, performance, reliability, security, and compliance with requirements.In system testing, testers follow a predefined test plan and test cases to simulate real user scenarios and comprehensively test the system to identify defects and vulnerabilities, ensuring the quality of the system.The test results will be used to evaluate whether the system is ready for release and deployment in the production environment and will serve as a basis for future maintenance and upgrades.
This study will conduct functional testing on each of the system's functional modules to validate their alignment with the specified requirements.These encompass various modules, such as the situational awareness and scheduling module, task scheduling management module, and perception data management module.The chosen approach for functional testing in this study is the black-box testing method.Black-box testing effectively simulates the behavior of authentic users or external systems, thereby closely emulating the real-world usage scenarios of end-users.This methodology ensures a comprehensive assessment of the system's performance during actual operation, gauging its ability to reliably and stably respond to diverse inputs as intended.Additionally, black-box testing eliminates the necessity of delving deep into the intricate specifics of the system's internal implementation.This attribute enhances the simulation of a regular user's experiential interaction while proficiently capturing potential issues that might arise at the functional layer of the system.Another rationale underlying the adoption of black-box testing is its capacity to underscore the system's external behavior.The emphasis lies in assessing the system's response to distinct inputs and the corresponding output outcomes.This becomes pivotal for verifying the fulfillment of requirements within each functional module.A spectrum of scenarios, including boundary cases and exceptional circumstances, can be meticulously simulated, thus enabling an exhaustive evaluation of the system's performance and stability across diverse scenarios.This methodological approach significantly aids in the identification of latent functional defects, thereby facilitating the early resolution of potential concerns and consequently ensuring the system's reliability.In the process of designing test cases, functional requirements and specification documents serve as the guiding principles.By inputting varied data and operating the system, these test cases ascertain whether the system generates accurate outputs in accordance with expectations.Test cases of situation awareness and scheduling module are shown in Table 3. Test cases of task allocation and route planning module are shown in Table 4. Test cases of task scheduling management module are shown in Table 5. Test cases of data and device management module are shown in Table 6.Displays a list of tasks that have been assigned to the UAV.Consistent with expected results. 4 Check the mission visualization module to see the UAV mission execution routes and mission completion.
Displays the route of the UAV's mission and mission completion completion of the mission.
Consistent with expected results. 5 Add new tasks and validate task data addition and query functions.
After adding a new task, you are able to query the added tasks and verify the accuracy of task information.
Consistent with expected results.
6 Modify existing tasks and validate tasks Data modification and query functions.
After modifying an existing task, you will be able to query the modified task information and verify the accuracy of the information.accuracy.
Consistent with expected results.
7 Delete existing tasks and validate tasks Data deletion and query functions.
After deleting an existing task, it is not possible to query the Deleted task information.
Consistent with expected results.Failure to add data/device, the system gives a corresponding error The system gives a corresponding error message.
Consistent with expected results.
By conducting tests on each functional module, the output results of the main functions in each module match the expected results.This confirms that all functional modules are operating correctly, and the system has passed the testing phase.

Conclusions
This article explores the rapid development and widespread application of UAV technology, emphasizing the challenges faced by UAV clusters in terms of task allocation efficiency and data transmission security.To address these issues, this study combines blockchain technology with multi-drone situational awareness and successfully designs and implements a blockchain-based multi-UAV task processing system for situation awareness and real-time decisions, which has a positive impact on sustainable transportation.Through experiments, it has been proven that our system has achieved improvements in task efficiency.Through real-time task scheduling and collaborative processing, we have successfully improved the efficiency of task allocation, overcoming traditional bottlenecks and providing vital support for the efficient operation of sustainable transportation.This intelligent resource allocation helps reduce energy wastage and environmental impacts.Secondly, we have reinforced data security.By storing task information in blockchain smart contracts, we ensure the immutability and verifiability of task data, enhancing transparency and reliability in task allocation.This critical safeguard provides assurance for data security and integrity in sustainable transportation, helping to prevent potential data breaches and risks.Additionally, our system introduces autonomous collaboration mechanisms.Through the automatic execution of smart contracts, the system autonomously coordinates task allocation and execution, enhancing processing efficiency and accuracy.This is of paramount importance for autonomous collaboration and resource optimization in sustainable transportation, contributing to improved transportation efficiency and reduced congestion.
However, despite these remarkable achievements, it is essential to acknowledge that there is still much work to be done.Future work includes further enhancing the stability and robustness of the system, especially in complex environments, to adapt to diverse environmental changes and emergency situations.Furthermore, continuous optimization of system performance is required to address performance bottlenecks and scalability limitations in handling large-scale tasks and multi-UAV collaborative operations.With the ongoing development in the field of sustainable transportation, we are committed to extending the outcomes of this research to broader application areas to meet the growing demands.

Figure 2 .
Figure 2. Network situation awareness and warning process diagram.

Figure 3 .
Figure 3. Task assignment and route planning process plowchart.

Figure 4 .
Figure 4. Pointer Network structure.The Encoder part employs a Bidirectional Recurrent Neural Network (BiRNN) to transform the input sequencex = (x 1 , x 2 , • • • , x n ) into an encoding matrix H = (h 1 , h 2 , • • • , h n ),where h i represents the encoding of the i-th element in the input sequence.Specifically, the BiRNN consists of two Recurrent Neural Networks (RNNs) that encode the input sequence from left to right and from right to left, respectively.The outputs from these two directions are then concatenated to obtain the final encoding result.The Decoder part consists of an RNN that takes as input the previous output and the encoding matrix from the Encoder.At each timestep, the Decoder calculates an attention distribution, which indicates which parts of the input sequence should be attended to at the current position.This attention distribution is used to compute a weighted average, representing which element from the input sequence should be chosen as the next element in the output sequence.

Figure 6 .
Figure 6.Data management module diagram.The Data Management module interacts with the Ground Control Station to provide data collection and storage services.It manages various types of data and utilizes MySQL for persistent storage of record-based data.For image-and file-based data, a distributed storage system like FastDFS is used.Additionally, the data management module also provides data querying and export functions, allowing operators to easily search and analyze the data.

Figure 8 .
Figure 8. Situation monitor and control.

Figure 13 .
Figure 13.Image data management page.

Algorithm 2
Task Allocation Process for UAVs based on Auction Algorithm input: Set of UAVS U, Set of tasks T; output: Solution for UAV task allocation; initialize: Initialize the task assignment collection unassigned_tasks ← T ; while unassigned_tasks = θ do Initialize the minimum cost: min _cost ← ∞ ; Initialize the UAV corresponding to the minimum cost min _U AV ← None; for U AV ∈ U do for task ∈ unassigned_tasks do if task.energy_requirement > U AV.battery do Continue with the next iteration; end if Calculate the cost: cos t ← calculate_ cos t(U AV.task); if cos t < min cos t then Update the minimum cost: min _cost ← cost; Update the UAV corresponding to the minimum cost: min _U AV ← U AV Update the task corresponding to the minimum cost: min _task ←

task end if end for end for if min
_U AV = None and min _task = None then min _U AV Complete the task min _task; Remove the task min _task from unassigned_tasks;

Algorithm 3
Pointer Network solves the TSP problem input: TSP problem input point set P with point set size n; output: Shortest path distance d,shortest path path; Feature extraction is performed on the point set P to obtain the feature vector f i , i = 1, . . ., n ; Initialize the Encoder's state h 0 ; ForEach i ← 1 to n Input the feature vector f i and the state h i−1 of the last Encoder into the Encoder; Compute the Encoder's output and state o i ,h i = Encoder( f i , h i−1 ); end Initialize the Decoder's state s = h; Initialize path length L=0 and path=s 0 ; while path <n do Input the Decoder's state s t−1 and last output y t−1 as well as the Encoder's output set O = o 1 , o 2 , . . ., o n , into the Pointer Mechanism; Calculate the weight score p i = score(s t−1 , o i ) for each point, where score is the scoring function; Normalizing the weight scores with the So f tmax function yields a probability distribution p − p 1 , p 2 , . . ., p n ; Sample from the probability distribution p to obtain the index t of the point to be visited next; Calculate the current path length L = L + d(s t−1 , s t ) and add point s t to the path Path = path U s t ; Update the Decoder's state s t and compute the output y t ; end while Calculate the distance from the last point to the starting point L = L + d(s n , s 0 ); return the shortest path distance d = L and the shortest path path.

Table 2 .
Performance comparison of various model.

Table 3 .
Test cases of situation awareness and scheduling module.

Table 4 .
Test cases of task allocation and route planning module.
Algorithms are able to process a large tasks in a reasonable amount of time and return correct results.Consistent with expected results.

Table 5 .
Test cases of task scheduling management module.

Table 6 .
Test cases of data and device management module.Ensure that the system is able to properly collect UAV data of all types and store it.