Integration of blockchain technology offers a robust solution for ensuring reliable data transmission within unmanned aerial vehicle (UAV) networks. Nevertheless, it is crucial to address challenges associated with UAV networks, including their dynamic nature, high latency, limited scalability, and algorithmic inefficiencies. Hence, our proposal involves integrating UAV networks with blockchain technology to enhance their performance by optimizing the consensus algorithm based on network efficiency. We first propose a comprehensive framework for optimizing network performance based on network tomography, incorporating a systematic analysis of network performance and fault avoidance strategies. To improve analysis of the core network’s real-time performance, we also propose a topology prediction method based on an effective probability matrix. Additionally, we establish a calculation method for optimally placing network monitoring points in the core network for enhanced efficiency. We then introduce an adjustable reputation-based Raft-Poa layered consensus protocol that improves consensus protocol scalability and efficiency. To tackle data and node security concerns, we further propose a trust management mechanism based on group signatures. This mechanism verifies the authenticity of node data and identifies malicious nodes. Finally, we validate the protocol’s effectiveness and compare the algorithm’s effectiveness with MMP, Raft, Poa, etc. The simulation results of this protocol show remarkable improvements in network communications and consensus process efficiency, and reductions in communication latency and node utilization rates.