# Blockchain-Based UAV-Assisted Mobile Edge Computing for Dual Game Resource Allocation
## 1 Introduction
To overcome these problems, this paper proposes a two-stage optimization algorithm (DSO) based on blockchain smart contracts, which combines Stackelberg games and auction algorithms to optimize resource allocation among servers, drones, and users, and improve the computational efficiency and reliability of the system. In practical applications, blockchain-based UAV-assisted mobile edge computing (UAV-MEC) faces many challenges. The first is network latency and performance bottlenecks. Because blockchain relies on consensus mechanisms such as PoW or PoS, the process requires a lot of time for transaction verification and data synchronization, which may affect the efficiency of UAVs in performing real-time computing tasks. Especially in a high-concurrency environment, system throughput and response speed will be severely constrained. The next challenge is the limitation of computing and storage resources. Due to their small size and hardware limitations, drones cannot store the blockchain ledger and verify transactions for a long time, especially as the blockchain scales, the problem of resource consumption becomes more and more prominent. In addition, energy efficiency is also a major challenge. Blockchain operations and computing tasks require a lot of energy, and drones rely on battery power. The increase in computing and communication loads will significantly shorten the drone's battery life and affect the stability and continuity of its tasks. In terms of system scalability, as the number of drones and user requests increases, the blockchain network needs to have efficient scalability to ensure that transactions can still be processed in a timely manner and data consistency can be maintained in a multi-node environment. However, existing blockchain technologies face problems such as insufficient throughput and synchronization delays in large-scale scenarios. In order to reduce the impact of these problems on the experimental results, the experimental parameters in this paper are applicable to scenarios with large-scale user needs. The following text also verifies the rationality of the blockchain in this system through designed experiments. Specifically, first, a resource allocation mechanism between the server (leader) and the drone (follower) is constructed based on the Stackelberg game model. The resource allocation strategy is optimized based on a comprehensive consideration of factors such as the computing power, energy consumption, and task processing time of the drone to maximize the overall system efficiency. Second, this paper introduces an auction algorithm to optimize resource pricing between drones and users, making resource allocation more efficient and fairer. Finally, blockchain smart contract technology is used to automate task assignment, result verification, and reward management, enhancing the security, reliability, and transparency of the system. The main contributions of this paper are as follows:  
(1) We propose a two-stage DSO game algorithm to optimize resource allocation and improve resource utilization. In the first stage, we express the trading interactions between servers and drones as a Stackelberg game, where ECSs are leaders and drones are followers. ECSs control the unit price of edge computing resources to maximize the profit earned by drones. Drones control the amount of edge computing resources needed to maximize their goals. For the game between drones and users, we use an auction algorithm to optimize the resource allocation between the two. (2) We propose a blockchain-based secure resource trading framework in the proposed network. ECS acts as an edge computing resource provider and a mining task publisher in the blockchain-based network, where the drone is an edge computing resource requester. Transaction information about edge computing resource transactions, including resource request and resource price, is recorded in the blockchain.