Dynamic block chain fragmentation method for large-scale unmanned aerial vehicle network
By employing a time-varying graph model and an improved K-means algorithm in large-scale UAV networks, combined with verifiable random functions and a slot-epoch dynamic coupling architecture, the dynamic adaptability problem of the sharding mechanism in UAV networks is solved, thereby improving the scalability and consensus efficiency of the system.
Patent Information
- Application Number
- CN202511111727.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-08
- Publication Date
- 2025-11-21
AI Technical Summary
In large-scale drone networks, existing sharding mechanisms cannot adapt to the dynamic nature of drones, leading to communication interruptions, unstable transaction processing, and impacting the scalability and latency of the blockchain system.
By employing a time-varying graph model and an improved K-means algorithm, combined with a verifiable random function and a time-slot-epoch dynamic coupling architecture, the sharding process is dynamically adjusted to ensure stable communication and balanced node distribution in the UAV network.
It improves the throughput and performance of drone networks, ensures reliable and efficient consensus operations in dynamic drone networks, and adapts to topology changes and node dynamics.
Smart Images

Figure CN121001104A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of unmanned aerial vehicle network blockchain sharding technology, and particularly relates to a dynamic blockchain sharding method for large-scale unmanned aerial vehicle networks. BACKGROUND
[0002] The unmanned aerial vehicle ad hoc network technology field is the formation and maintenance of unmanned aerial vehicle self-organizing networks in a fixed infrastructure environment, covering network topology dynamic construction, adaptive routing protocol, node positioning and tracking, data transmission optimization, and network coverage range expansion. The blockchain technology is a distributed ledger technology that uses encryption algorithms, consensus mechanisms, and other means to ensure data security and credibility.
[0003] The blockchain technology provides a promising approach to the reliability and credibility of Internet of Things (IoT) systems. However, IoT devices often lack the ability to directly participate in blockchain consensus, and unmanned aerial vehicle platforms provide a viable alternative. Unmanned aerial vehicles have the advantage of dynamic coverage and reduced dependence on fixed infrastructure, such as centralized servers, and embedding a blockchain consensus mechanism in an unmanned aerial vehicle network can greatly improve adaptability, flexibility, and resource utilization efficiency. The spatial mobility of unmanned aerial vehicles enables their networks to dynamically address communication coverage gaps, ensuring the continuous availability of consensus even in the event of device failure or adverse environments. In addition, unmanned aerial vehicles support the on-demand, elastic expansion of consensus nodes, minimizing dependence on fixed ground infrastructure.
[0004] When applying blockchain consensus in large-scale unmanned aerial vehicle networks, the blockchain scalability problem arises due to the surge in transaction numbers, i.e., how limited-resource unmanned aerial vehicles can maintain the efficiency of transaction achievement. Sharding mechanisms are commonly used to address blockchain scalability issues, but existing sharding mechanisms are not suitable for unmanned aerial vehicle network environments, as they typically assume static nodes and ignore the dynamic nature of unmanned aerial vehicles. Unmanned aerial vehicles in sharding may require joining, exiting, and topology changes due to task requirements. These situations can cause communication disruptions or unstable boundary definitions in unmanned aerial vehicle sharding networks, thereby jeopardizing the atomicity and consistency of cross-shard transaction processing. To address these challenges, we propose a dynamic sharding scheme based on a time-varying graph model, suitable for large-scale unmanned aerial vehicle blockchain networks.
[0005] Sharding technology is one of the core solutions to the scalability problem in the field of blockchain, and its core idea is to divide the entire network into multiple parallel processing subsets, improving overall performance through division of labor. Sharding technology greatly improves the throughput and scalability of the system while maintaining decentralization and security. ELASTIC is one of the earliest sharding protocols, which has pioneered a method to improve consensus efficiency and inspired a series of subsequent sharding solutions.
[0006] While some research explores sharding algorithms in IoT environments, most existing methods still rely on centralized servers to connect IoT devices, increasing deployment costs and security risks. For IoT environments, utilizing UAV networks to perform consensus operations can significantly improve adaptability, resource utilization, and fault recovery capabilities. However, few studies address the specific challenges of implementing sharding in large-scale UAV networks. In UAV networks, communication reliability is crucial, as effective blockchain consensus is based on stable communication links.
[0007] To address this issue, a UAV network is modeled as a time-varying graph to capture the temporal dynamics of network connectivity. Based on this model, an improved clustering algorithm is needed to perform sharding formation, and a time-slot-epoch dynamic coupling architecture is designed. This ensures both stable intra-shard communication and balanced distribution of nodes, supporting reliable and efficient consensus operations in dynamic UAV networks. SUMMARY
[0008] To this end, the present application provides a dynamic blockchain sharding method for large-scale UAV networks to overcome the problem that in the prior art, transaction processing and message propagation between a large number of IoT devices and UAV-based consensus nodes can seriously affect the scalability and latency of the blockchain system operated by the UAV network, resulting in poor performance and low throughput of the UAV network.
[0009] To achieve the above object, the present application provides a dynamic blockchain sharding method for large-scale UAV networks, comprising:
[0010] Step S1, determining each UAV in the target UAV network to obtain the dynamic attributes of each UAV node, wherein the dynamic attributes of a single UAV include the state parameters of the UAV obtained in time sequence and the connection state between any two UAVs, and the UAV state parameters include three-dimensional position, moving speed, communication radius and remaining energy;
[0011] Step S2, constructing a time-varying graph model of the UAV network based on the dynamic attributes of each UAV node;
[0012] Step S3, determining a set of UAV network nodes participating in the sharding process based on a verifiable random function;
[0013] Step S4, performing blockchain sharding on the set of UAV network nodes based on an improved K-means algorithm and the corresponding edge set of the UAV network, wherein the selection of the initial center point of the improved K-means algorithm is determined based on a probability distribution proportional to the square of the shortest distance between each UAV and the corresponding nearest IoT region center;
[0014] Step S5, determining whether to trigger the blockchain sharding of the set of UAV network nodes based on the extracted dynamic changes of each of the UAVs and a preset epoch change mechanism, wherein the dynamic changes include a number change of each UAV in the target UAV network and a connection state change between any two UAVs.
[0015] Further, the process of determining the set of UAV network nodes participating in the sharding process based on the verifiable random function includes,
[0016] Step S31, calculating a pseudo-random output of a corresponding shared seed of a single UAV and a verifiable proof based on a corresponding public-private key of the single UAV node in the UAV network and the obtained shared seed sent by the cloud platform;
[0017] Step S32, submitting the random number and the verifiable proof of the single UAV to the server side;
[0018] Step S33, verifying the validity of the corresponding random number and the verifiable proof based on the public-private key of the single UAV node by the server side;
[0019] Step S34, determining the set of UAV network nodes participating in the sharding process based on the ascending order arrangement of the random number values corresponding to the set of UAV nodes whose verification is successful by the server side, and based on the sorting result and a preset number of non-participating sharding.
[0020] Further, the process of sharding the set of UAV network nodes based on the improved K-means algorithm and the corresponding UAV network edge set includes,
[0021] Step S41, completing algorithm initialization preparation based on a set maximum number of iterations, a set of UAVs participating in sharding, and a number of initially set empty shards;
[0022] Step S42, selecting a number of UAVs as initial center points and assigning them to corresponding shard sets based on the distance of each UAV to the nearest Internet of Things regional center and a preset distance-probability correspondence principle;
[0023] Step S43, assigning a UAV to the shard with the maximum sum of composite similarities between the UAV and the existing nodes in any shard based on the sum of composite similarities;
[0024] Step S44, determining whether to update the center points based on the sum of composite similarities of each UAV in a single shard with other UAVs, and completing one round of iteration optimization;
[0025] Step S45, determining to terminate iteration or to re-shard using the updated center points based on a first determination condition;
[0026] Step S46, the blockchain is fragmented by assigning the set of unmanned aerial vehicle network nodes participating in the fragmentation process to each fragment set.
[0027] Further, the preset epoch change mechanism comprises,
[0028] The number of newly added unmanned aerial vehicles reaches the total number of fragments;
[0029] The number of single fragment active unmanned aerial vehicles exiting is greater than or equal to a preset maximum unmanned aerial vehicle exit number threshold, or the total number of unmanned aerial vehicles exiting the entire network is greater than or equal to a preset maximum unmanned aerial vehicle exit number threshold of the entire network;
[0030] The structural change amount of the network topology connection matrix exceeds a set threshold value.
[0031] Further, the process of calculating the composite similarity between the to-be-allocated unmanned aerial vehicle and the existing nodes of each fragment comprises,
[0032] Calculating the ratio of the intersection and the union of the neighbor nodes of the two unmanned aerial vehicles;
[0033] Based on the ratio of the intersection and the union and the judgment value of whether the two unmanned aerial vehicles are in the same cluster, the similarity is determined.
[0034] Further, the process of judging whether to update the center point based on the sum of the composite similarity between each unmanned aerial vehicle and other unmanned aerial vehicles in a single fragment comprises,
[0035] Step S441, based on the sum of the composite similarity between each unmanned aerial vehicle and other unmanned aerial vehicles in a single fragment, the maximum sum of the composite similarity is extracted;
[0036] Step S442, if the maximum sum of the composite similarity is greater than the sum of the composite similarity of the current center point, it is determined that the center point needs to be updated;
[0037] Step S443, the unmanned aerial vehicle position corresponding to the maximum sum of the composite similarity is obtained, and the updated center point is determined.
[0038] Further, the first determination condition comprises,
[0039] If it is determined to update the center point and the preset maximum iteration number is not reached, it is determined to use the updated center point to re-perform fragmentation;
[0040] If it is determined not to update the center point or the preset maximum iteration number is reached, it is determined to terminate iteration.
[0041] Further, the process of constructing a time-varying graph model of the unmanned aerial vehicle network based on the dynamic attributes of each unmanned aerial vehicle node comprises,
[0042] Step S21, constructing a node set of the UAV network based on the three-dimensional positions, moving speeds, communication radii and residual energies of the respective UAVs;
[0043] Step S22, determining the communication connection state of the respective UAVs based on the Euclidean distance between any two UAVs to construct an edge set of the UAV network;
[0044] Step S23, dividing the preset total duration into preset uniform time intervals based on the preset total duration to construct a time sequence set of the UAV network;
[0045] Step S24, constructing a time-varying graph model of the UAV network based on the node set of the UAV network, the edge set of the UAV network and the time sequence set of the UAV network.
[0046] Further, if the number of single-shard active UAVs that exit is greater than or equal to a preset maximum UAV exit number threshold, re-sharding is triggered, wherein the maximum UAV exit number threshold is determined based on the practical Byzantine fault tolerance protocol.
[0047] Further, the structure change amount of the network topology connection matrix is based on the Frobenius norm of the change amount of the network topology connection matrix within a unit time, and if the result value of the Frobenius norm is greater than a preset threshold, re-sharding is triggered.
[0048] Compared with the prior art, the beneficial effects of the present application are that the present application can solve the problem of the scalability and delay of the unmanned aerial vehicle network running the blockchain system caused by the transaction processing and message propagation between a large number of Internet of Things devices and consensus nodes based on unmanned aerial vehicles, and significantly improve the throughput and performance of the unmanned aerial vehicle network. The present application models the unmanned aerial vehicle network as a time-varying graph to capture the time dynamics of network connections. On the basis of this model, the present application designs an improved clustering algorithm to perform sharding formation, and designs a time slot-epoch dynamic coupling architecture. This can not only ensure stable internal communication of the shards, but also ensure balanced distribution of nodes, thereby supporting reliable and efficient consensus operations in dynamic unmanned aerial vehicle networks.
[0049] In particular, the time-varying graph constructed by the present application is a mathematical framework for simulating dynamic network topology, which simultaneously obtains the time evolution of node attributes and the constantly changing edge connections, thereby accurately reflecting the behavior of real-world mobile networks. Unlike traditional static graph models, the time-varying graph model incorporates time dynamics into spatial structure, and is therefore particularly suitable for representing the communication state of mobile unmanned aerial vehicle networks.
[0050] In particular, the application carries out the process of blockchain sharding on the set of unmanned aerial vehicle network nodes through three stages of circulation. In the first stage, the application uses a verifiable random function to select a set of unmanned aerial vehicles that do not participate in sharding in order to ensure that the number of unmanned aerial vehicles in each shard is the same, and then determines the set of unmanned aerial vehicles that participate in the sharding process; in the second stage, the application uses an improved K-Means algorithm to perform blockchain sharding on the unmanned aerial vehicle network, and combines the network communication conditions of the time-varying graph modeling to ensure stable communication and improve the consensus efficiency within the shard; in the third stage, the application observes the dynamic changes of the unmanned aerial vehicle network according to the time-varying graph model, and designs a responsive mechanism to handle the joining, exiting and drastic changes of the unmanned aerial vehicle topology, and when the epoch change is triggered, it will re-enter stage one.
[0051] In particular, the application determines whether to trigger the blockchain sharding on the set of unmanned aerial vehicle network nodes by extracting the dynamic changes of each unmanned aerial vehicle and the preset epoch change mechanism. In the unmanned aerial vehicle blockchain network, due to the limitations of task scheduling and physical environment, the unmanned aerial vehicle may need to be charged during operation, thus having to temporarily exit the consensus process. Under such dynamic conditions, a rigid consensus schedule based on epochs will affect normal operation. In traditional sharding consensus protocols, the running time is usually divided into multiple epochs of fixed duration, and each epoch is further divided into several time slots. Each time slot corresponds to a complete consensus execution cycle. However, most existing methods use static epoch configuration, which cannot adapt to the inherent topology dynamic changes of the unmanned aerial vehicle network, such as changes in communication links caused by node movement. These dynamic changes often lead to a local decrease in consensus efficiency, because fixed-length epochs cannot adapt to fluctuations in network state. In particular, sudden changes in node density or communication channel quality can cause a surge in communication overhead in certain periods. To address this limitation, the application takes advantage of time-varying graph modeling to propose a time slot-epoch dynamic coupling framework. This method can adaptively adjust the length of the time interval: in the topology stable period, the time interval is extended to minimize the reorganization overhead, and in the network rapid change period, the time interval is shortened to speed up consensus convergence. BRIEF DESCRIPTION OF DRAWINGS
[0052] Figure 1 Flowchart of the steps of the dynamic blockchain sharding method for large-scale unmanned aerial vehicle networks of the embodiments of the application;
[0053] Figure 2 Flowchart of the steps of the method for determining the set of unmanned aerial vehicle network nodes participating in the sharding process based on a verifiable random function according to the embodiments of the application;
[0054] Figure 3 Flowchart of the algorithm based on the improved K-means algorithm according to the embodiments of the application;
[0055] Figure 4 A schematic diagram of a UAV blockchain network sharding for an IoT scenario according to an embodiment of the present application. DETAILED DESCRIPTION
[0056] In order to make the objects and advantages of the present application clearer, the present application will be further described below in conjunction with embodiments. It should be understood that the specific embodiments described herein merely serve the purpose of explaining the present application and are not intended to limit the present application.
[0057] The preferred embodiments of the present application will be described below with reference to the accompanying drawings. It should be understood by those skilled in the art that the embodiments are merely used to explain the technical principles of the present application and are not intended to limit the protection scope of the present application.
[0058] It should be noted that, in the description of the present application, the terms "upper", "lower", "left", "right", "inner", "outer" and the like indicating the direction or positional relationship are based on the direction or positional relationship shown in the drawings, which is merely for the convenience of description and does not indicate or imply that the device or element must have a particular orientation, be constructed and operated in a particular orientation, and therefore cannot be understood as a limitation on the present application.
[0059] In addition, it should also be noted that, in the description of the present application, unless otherwise explicitly specified and limited, the terms "mounting", "connecting", "connection" should be understood in a broad sense, for example, it can be fixed connection, or detachable connection, or integrally connected; it can be mechanical connection, or electrical connection; it can be directly connected, or indirectly connected through an intermediate medium, or the internal communication of two elements. Those skilled in the art can understand the specific meaning of the above terms in the present application according to the specific circumstances.
[0060] Please refer to Figure 1 , Figure 4 as shown, Figure 1 A flowchart of a dynamic blockchain sharding method for a large-scale UAV network according to an embodiment of the present application; Figure 4 A schematic diagram of a UAV blockchain network sharding for an IoT scenario according to an embodiment of the present application. The process of the dynamic blockchain sharding method for a large-scale UAV network according to the present application includes:
[0061] Step S1, determining each UAV in the target UAV network to obtain the dynamic attributes of each UAV node, wherein the dynamic attributes of a single UAV include the UAV single machine state parameters obtained in time sequence and the connection state between any two UAVs, and the UAV single machine state parameters include three-dimensional position, moving speed, communication radius and residual energy;
[0062] Step S2, constructing a time-varying graph model of the UAV network based on the dynamic attributes of each UAV node;
[0063] Step S3, determining a set of unmanned aerial vehicle network nodes participating in the sharding process based on a verifiable random function;
[0064] Step S4, performing blockchain sharding on the set of unmanned aerial vehicle network nodes based on an improved K-means algorithm and a corresponding edge set of the unmanned aerial vehicle network, wherein the selection of initial center points of the improved K-means algorithm is determined based on a probability distribution proportional to the square of the shortest distance between each unmanned aerial vehicle and the corresponding nearest IoT area center;
[0065] Step S5, determining whether to trigger the blockchain sharding on the set of unmanned aerial vehicle network nodes based on the extracted dynamic changes of each unmanned aerial vehicle and a preset epoch change mechanism, wherein the dynamic changes include the number changes of each unmanned aerial vehicle in the target unmanned aerial vehicle network and the connection state changes between any two unmanned aerial vehicles.
[0066] In the embodiment, the blockchain network sharding of unmanned aerial vehicles in the Internet of Things scenario is used to solve the problem that the transaction processing and message propagation between a large number of Internet of Things devices and consensus nodes based on unmanned aerial vehicles will cause the scalability and delay of the unmanned aerial vehicle network running the blockchain system, and improve the efficiency of the unmanned aerial vehicle network running the blockchain system. By modeling the unmanned aerial vehicle network as a time-varying graph, the time dynamics of network connections are captured. On the basis of this model, an improved clustering algorithm is designed to perform sharding formation, and a time slot-epoch dynamic coupling architecture is designed. This can not only ensure stable internal communication of the shards, but also ensure balanced distribution of nodes, thereby supporting reliable and efficient consensus operations in dynamic unmanned aerial vehicle networks.
[0067] Specifically, the process of constructing the time-varying graph model of the unmanned aerial vehicle network based on the dynamic attributes of each unmanned aerial vehicle node includes,
[0068] Step S21, constructing a node set of the unmanned aerial vehicle network based on the corresponding three-dimensional position, moving speed, communication radius and remaining energy of each unmanned aerial vehicle;
[0069] Step S22, determining the corresponding unmanned aerial vehicle communication connection state based on the Euclidean distance between any two unmanned aerial vehicles to construct an edge set of the unmanned aerial vehicle network;
[0070] Step S23, dividing a preset uniform time interval based on a preset total duration to construct a time sequence set of the unmanned aerial vehicle network;
[0071] Step S24, constructing a time-varying graph model of the unmanned aerial vehicle network based on the node set of the unmanned aerial vehicle network, the edge set of the unmanned aerial vehicle network and the time sequence set of the unmanned aerial vehicle network.
[0072] In this embodiment, by acquiring the dynamic attributes of the drones, the topology of the drone blockchain network can be abstracted as the time-varying graph model, denoted as G = {D, ε, T}. The node set of the drone network is denoted as D, including all drones in the network, defined as D = {D1, D2, ..., D}. M Let M be the total number of drones. The node of the i-th drone is denoted as D. i The state at time t is determined by its three-dimensional spatial position p. i (t), velocity v i (t), Dynamic communication radius R i (t) and residual energy E i (t) is represented by the expression D. i =(p i (t),v i (t),R i (t),E i (t)). The edge set of the UAV network is denoted as ε, which is used to represent the dynamic connection between UAV nodes.
[0073] In this embodiment, to more effectively describe the communication state of the drone network, the edge set of the drone network is defined as follows:
[0074]
[0075] Among them, e i,j (t) represents the time t of the drone D i and D j The connection state between them is defined as follows:
[0076]
[0077] Among them, e i,j (t) = 1 indicates that the D corresponding to the i-th drone is i D corresponding to the j-th UAV j The Euclidean distance between the two drones is within the communication radius of the two drones, which means that there is a communication link between the two drones.
[0078] In this embodiment, the time series set of the UAV network is constructed using a discrete-time model of the UAV network, where the total duration T is divided into a series of uniform time intervals, denoted as T = {t0, t1, t2, ..., t...}. n Furthermore, it is assumed that the network state remains constant within each time interval, including the set of nodes in the drone network and the communication links between the corresponding drones.
[0079] Please see Figure 2As shown, it is the step flow chart of the embodiment of the application for determining the set of UAV network nodes participating in the sharding process based on the verifiable random function, and the process of the embodiment of the application for determining the set of UAV network nodes participating in the sharding process based on the verifiable random function includes,
[0080] In step S31, based on the corresponding public and private keys of the single UAV node in the UAV network and the shared seed sent by the cloud platform, the pseudo-random output of the corresponding shared seed of the single UAV is calculated and the verifiable proof is obtained.
[0081] In step S32, the random number and the verifiable proof of the single UAV are submitted to the server side.
[0082] In step S33, the server side verifies the validity of the corresponding random number and the verifiable proof based on the public and private keys of the single UAV node.
[0083] In step S34, the server side arranges the random number values of the set of UAV nodes verified successfully in ascending order, and determines the set of UAV network nodes participating in the sharding process based on the sorting result and the preset number of non-participating sharding.
[0084] In this embodiment, the set of UAVs that do not participate in the sharding is selected by using the verifiable random function VRF, and the set of UAVs participating in the sharding process is determined.
[0085] In this embodiment, in a UAV network consisting of a total of M UAVs, the network is divided into k shards, where the number k is preset according to requirements. Since the number M cannot be divided by k, the sharding may not guarantee that the number of UAVs in each shard is equal, which brings challenges to maintaining the security and balance between shards. In order to solve the case of M mod k ≠ 0, this embodiment uses VRF to randomly select z = M mod k UAVs that do not participate in the blockchain sharding and consensus process, where z is the preset number of non-participating shards, to ensure that the number of UAVs in each shard is equal and the security and balance of UAVs between shards are guaranteed.
[0086] It can be understood that VRF is a technology that combines cryptography and randomness generation, which can support the safe and efficient operation of distributed systems while ensuring randomness, uniqueness and verifiability.
[0087] In this embodiment, the process of selecting the set of UAV network nodes participating in the sharding process includes three parts:
[0088] 1) Local VRF calculation
[0089] After joining the network, the D i Each of the i UAV nodes will be assigned a public and private key (pk i , ski Using a shared seed distributed through a cloud platform, the i-th drone calculates its VRF output as follows: Where, π i It is a verifiable proof, y i ∈[0,2 256 ) is the pseudo-random output used for selection, and seed is the random number seed provided by the server.
[0090] 2) Random number submission and verification
[0091] Each drone submits its calculated tuple (π) to the server. i y i The server uses the corresponding public key pki to verify the validity of each tuple: VRFVerify(pki). i , seed, π i y i =True.
[0092] 3) Global sorting and selection
[0093] After successful verification, the server will determine the corresponding y values for all drones. i Sort the values in ascending order to get an ordered list. The first z drones are selected to form set S and do not participate in sharding. Therefore, the number of drones participating in the consensus process in each shard is N = (Mz) / k, and the set of drones participating in the sharding is represented as Q = DS.
[0094] Please see Figure 3 The diagram shows the flowchart of the improved K-means algorithm according to an embodiment of the present invention. The process of blockchain sharding of the UAV network node set based on the improved K-means algorithm and the corresponding UAV network edge set includes:
[0095] Step S41: Based on the set maximum number of iterations, the set of drones participating in the partitioning, and several initial empty partitions, complete the algorithm initialization preparation;
[0096] Step S42: Based on the distance of each drone to the nearest IoT area center and the preset distance-probability correspondence principle, select several drones as initial center points and assign them to the corresponding fragment sets.
[0097] Step S43: Calculate the sum of composite similarities between the drone to be assigned and existing nodes in any segment, and assign the drone to the segment with the largest sum of composite similarities.
[0098] Step S44, judging whether to update the center point based on the sum of the complex similarity of each UAV to other UAVs within a single shard, completing a round of iteration optimization;
[0099] Step S45, determining to terminate iteration or re-perform sharding using the updated center point based on the first determination condition;
[0100] Step S46, completing blockchain sharding by allocating the set of UAV network nodes participating in the sharding process to each shard set.
[0101] In this embodiment, the improved K-means algorithm is used to shard the UAVs in the blockchain network. The K-means algorithm solves the inherent initialization sensitivity problem of the traditional K-means algorithm by introducing a probability mechanism for center point selection, thereby significantly improving the clustering stability. After initialization, the algorithm will continue to perform the traditional assignment-update iteration process until convergence. However, the standard K-means is mainly suitable for clustering in numerical vector space, and lacks compatibility with graph structure data such as dynamic UAV networks. In addition, traditional K-means type algorithms cannot guarantee balanced cluster size, which is a basic requirement for maintaining consistent security and performance among blockchain shards. To address these limitations, this embodiment proposes an improved K-means sharding algorithm designed for UAV blockchain networks.
[0102] In this embodiment, the number of initially empty shards is denoted as k, it can be understood that for a large IoT area, it can be divided into k (sub) areas as needed, and each area is taken over by a shard for consensus. The number of K is usually preset according to demand and considered as a known item.
[0103] In this embodiment, the first improvement is in the initialization of the center point in the IoT area context. Specifically, this embodiment modifies the center point selection strategy and adds region-aware distance weighting. The selection of the initial k center points is based on a probability distribution proportional to the square of the shortest distance of each UAV to the center of its nearest IoT region. The calculation process includes calculating the distance of the i-th UAV coordinate D i to the center of the i-th IoT region, i
[0104] d i =‖D i -C i ‖ 2
[0105] Calculate the weight of each unselected point,
[0106]
[0107] where ε is set to 0.01, according to the weight w i The larger the weight, the greater the probability of being selected. The probability calculation formula is,
[0108]
[0109] This method can ensure that the initial center points are fully dispersed in different IoT areas, thereby reducing local optimal traps and improving global sharding performance.
[0110] Next, this embodiment redefines the similarity metric between nodes and the center point update mechanism to conform to the time-varying characteristics of the UAV network. To capture the similarity between UAVs based on structure and communication, this embodiment introduces a composite similarity metric that combines the Jaccard similarity coefficient with the cluster membership relationship. When updating the center point, this embodiment does not use the average coordinate method, but instead designates the new center point as the node with the highest overall similarity to other nodes in the same shard. Finally, the total similarity sum of each UAV to each shard set is calculated, and each UAV is allocated to a shard based on a greedy strategy.
[0111] Specifically, the process of calculating the composite similarity between the UAV to be allocated and the existing nodes in each shard includes,
[0112] Calculating the ratio of the intersection and union of the neighbor nodes of the two UAVs;
[0113] Based on the ratio of the intersection and union and the judgment value of whether the two UAVs belong to the same cluster, the similarity is determined.
[0114] In this embodiment, the similarity between the ith and jth UAVs is defined as, i and D j
[0115]
[0116] where s(i) and s(j) represent the neighbor sets of the ith and jth UAVs D i and D j respectively. The first term represents the Jaccard similarity, capturing the topological similarity in the TVG. Compared with the Euclidean distance, this index can better reflect the structure and communication affinity of the dynamic UAV network. If the ith and jth UAVs belong to the same communication cluster, the function CS(D i , D j ) returns 1, otherwise it returns 0. This expression is conducive to grouping UAVs with strong local connectivity into the same shard, thereby improving communication efficiency within the shard.
[0117] where CS(Di , D j ) is a function of judging whether two UAVs belong to the same communication cluster, and its content is:
[0118] If D i and D j belong to the same UAV cluster then:
[0119] return 1;
[0120] Else
[0121] return 0.
[0122] Specifically, the process of judging whether to update the center point based on the sum of the complex similarity of each UAV in a single shard to other UAVs includes,
[0123] Step S441, based on the sum of the complex similarity of each UAV in a single shard to other UAVs, extracting the maximum sum of the complex similarity value;
[0124] Step S442, if the maximum sum of the complex similarity value is greater than the sum of the complex similarity value of the current center point, it is determined that the center point needs to be updated;
[0125] Step S443, obtaining the UAV position corresponding to the maximum sum of the complex similarity value, and determining the updated center point.
[0126] In this embodiment, the updated center point of the i-th shard is given by the following formula:
[0127]
[0128] Where the update function is essentially to find the UAV with the maximum similarity value in V i . The calculation formula is Where D p belongs to V i , D g is all UAVs in V p except D i , that is, the sum of the similarity of one UAV in the shard to all other UAVs; and the argmax function is a general function that returns the UAV with the maximum similarity value, which is denoted as D p here.
[0129] Where V i represents the set of UAV nodes in the i-th shard, corresponding to the i-th IoT area. V = {V1, V2, …, V k} represents the complete shard set, μ = {μ1, μ2, …, μk} denotes the corresponding center point.
[0130] This strategy ensures that the center point has the maximum connectivity within its shard, thereby improving the communication stability of the UAV network shards.
[0131] For each shard V i , we repeatedly select the UAV with the highest accumulated similarity score with the existing nodes in V i from the remaining unassigned UAVs in Q i and add it to V k and remove it from Q to avoid being selected repeatedly.
[0132] The improved K-Means++ shard is shown in Algorithm 1.
[0133] Algorithm 1:
[0134] Input: time-varying graph G, number of shards k, set of UAVs participating in consensus Q
[0135] Output: shard result V = {V1, V2, …, V k}
[0136]
[0137]
[0138] Specifically, the first determination condition includes,
[0139] If it is determined to update the center point, and the preset maximum iteration number is not reached, it is determined to use the updated center point to re-shard.
[0140] If it is determined not to update the center point, or the preset maximum iteration number is reached, it is determined to terminate iteration.
[0141] Specifically, the preset epoch change mechanism includes,
[0142] The number of newly added UAVs reaches the total number of shards;
[0143] The number of active UAVs exiting a single shard is greater than or equal to a preset maximum UAV exit number threshold, or the total number of UAVs exiting the entire network is greater than or equal to a preset maximum UAV exit number threshold for the entire network;
[0144] The structural change of the network topology connection matrix exceeds a set threshold value.
[0145] Specifically, if the number of active UAVs exiting a single shard is greater than or equal to a preset maximum UAV exit number threshold, a re-sharding is triggered, wherein the maximum UAV exit number threshold is determined based on a practical Byzantine fault tolerance protocol.
[0146] It can be understood that the practical Byzantine fault tolerance protocol is abbreviated as PBFT, which is an algorithm that allows a distributed system to reach consensus normally even in the presence of malicious nodes, that is, there are at most f malicious nodes, and the total number of nodes N of the system satisfies N = 3f + 1. According to the above protocol, in the embodiment, N is the number of drones in each shard, and the value of f is the ceiling of the calculated value. Preferably, considering the stability of consensus operation, the preset maximum drone exit quantity threshold is set to f / 2 (ceiling).
[0147] If the total number of drones that exit the network reaches k, global resharding and network reconstruction will also be started. That is, the preset maximum drone exit quantity threshold of the whole network is k.
[0148] Specifically, the structural change amount of the network topology connection matrix is based on the Frobenius norm of the change amount of the network topology connection matrix in unit time, and if the result value of the Frobenius norm is greater than a preset threshold, resharding is triggered. The preset threshold is set according to the running situation, and if it is desired to reduce the frequency of resharding, a higher value is set. In the embodiment, the preferred threshold is set to N, that is, the number of drones in each shard.
[0149] In the embodiment, according to the nature of the activity of the drone, epoch adjustment can be divided into the following three cases.
[0150] 1) New drone joins the network
[0151] In the shard management process, VRF will randomly select z drones to exclude them from participating in intra-shard consensus. When a new drone joins the network, it will be added to the non-shard set S, and z will be incremented by one. Once z = k, that is, the number of non-consensus drones equals the number of shards, since the number of non-consensus drones can be evenly distributed among the shards, it will not cause uneven distribution, at this time, the global resharding process will be triggered, and the new non-consensus set will be selected by VRF.
[0152] 2) Drone exits the blockchain network
[0153] If the drone participating in consensus in shard i exits, it will be removed from V i after completing the ongoing round of consensus. For the N drones actively participating in consensus within the shard, to ensure effective maintenance of intra-shard consensus, no more than f / 2 drones are tolerated to exit, otherwise the resharding process is triggered. In addition, if the total number of drones that exit the network reaches k, global resharding and network reconstruction will also be started.
[0154] 3) Topology change
[0155] In addition to the dynamic changes of nodes, the changes of UAV network topology caused by mobility or communication fluctuation also affect the sharding consensus. We solve this problem by analyzing the edge set connectivity within TVG. Suppose the network is initially sharded at time t0, with edge matrix ε(t0). At subsequent time t i , we measure its structural change F = |ε(t i )-ε(t0)| F , F represents the Frobenius norm. If F > N, indicating that the topology deviation is large, then the re-sharding procedure is performed to ensure the consensus reliability at the current time.
[0156] So far, the technical solutions of the present application have been described in combination with the preferred embodiments shown in the drawings, but it is easy for those skilled in the art to understand that the protection scope of the present application is obviously not limited to these specific embodiments. Those skilled in the art can make equivalent changes or replacements to the related technical features without departing from the principles of the present application, and the technical solutions after these changes or replacements will fall within the protection scope of the present application.
Claims
1. A dynamic blockchain sharding method for large-scale UAV networks, characterized in that, The method comprises the following steps: determining each unmanned aerial vehicle in the target unmanned aerial vehicle network to obtain dynamic attributes of each unmanned aerial vehicle node, wherein the dynamic attributes of a single unmanned aerial vehicle include state parameters of the unmanned aerial vehicle obtained in time sequence and connection states between any two unmanned aerial vehicles, and the state parameters of the unmanned aerial vehicle include three-dimensional position, moving speed, communication radius and residual energy; constructing a time-varying graph model of the unmanned aerial vehicle network based on the dynamic attributes of each unmanned aerial vehicle node; determining a set of unmanned aerial vehicle network nodes participating in the sharding process based on a verifiable random function; performing blockchain sharding on the set of unmanned aerial vehicle network nodes based on an improved K-means algorithm and corresponding edge sets of the unmanned aerial vehicle network, and the selection of initial center points of the improved K-means algorithm is determined based on a probability distribution proportional to the square of the shortest distance between each unmanned aerial vehicle and the corresponding nearest IoT region center; judging whether to trigger the blockchain sharding on the set of unmanned aerial vehicle network nodes based on the extracted dynamic changes of each unmanned aerial vehicle and a preset epoch change mechanism, wherein the dynamic changes include the number change of each unmanned aerial vehicle in the target unmanned aerial vehicle network and the connection state change between any two unmanned aerial vehicles.
2. The method of claim 1, wherein, The process of determining the set of unmanned aerial vehicle network nodes participating in the sharding process based on the verifiable random function comprises: calculating the pseudo-random output of the corresponding shared seed of a single unmanned aerial vehicle and the verifiable proof based on the corresponding public and private keys of the single unmanned aerial vehicle node and the shared seed sent by the obtained cloud platform; submitting the random number and the verifiable proof of the single unmanned aerial vehicle to the server side; verifying the validity of the corresponding random number and the verifiable proof based on the public and private keys of the single unmanned aerial vehicle node by the server side; determining the set of unmanned aerial vehicle network nodes participating in the sharding process based on the ascending order arrangement of the random number values of the set of unmanned aerial vehicle nodes with successful verification and the preset number of nodes not participating in the sharding.
3. The method of claim 1, wherein, The process of performing blockchain sharding on the set of unmanned aerial vehicle network nodes based on the improved K-means algorithm and the corresponding edge sets of the unmanned aerial vehicle network comprises: completing algorithm initialization preparation based on the set maximum number of iterations, the set of unmanned aerial vehicles participating in the sharding and a plurality of initially set empty shards; selecting a plurality of unmanned aerial vehicles as initial center points and distributing them to the corresponding shard set based on the distance from each unmanned aerial vehicle to the nearest IoT region center and the preset distance-probability correspondence principle; distributing the unmanned aerial vehicle to the shard with the maximum total composite similarity between the unmanned aerial vehicle and the existing nodes in any shard based on the total composite similarity calculated between the unmanned aerial vehicle to be distributed and any node in the shard; judging whether to update the center point based on the total composite similarity of each unmanned aerial vehicle in a single shard and other unmanned aerial vehicles to complete one round of iteration optimization; determining to terminate iteration or to use the updated center point to perform sharding again based on the first determination condition; allocating the set of unmanned aerial vehicle network nodes participating in the sharding process to each shard set to complete the blockchain sharding.
4. The method of claim 1, wherein, The preset epoch change mechanism comprises: the number of newly added unmanned aerial vehicles reaches the total number of shards; The number of active UAVs in a single shard that exit is greater than or equal to a preset maximum UAV exit number threshold, or the total number of UAVs that exit in the entire network is greater than or equal to a preset maximum UAV exit number threshold in the entire network; The structural change amount of the network topology connection matrix exceeds a set threshold value.
5. The method of claim 3, wherein, The process of calculating the composite similarity between the to-be-assigned UAV and each existing node in the shard includes Calculating the ratio of the intersection and the union of the neighbor nodes of the two UAVs; Based on the ratio of the intersection and the union and the judgment value of whether the two UAVs are in the same cluster, the similarity is determined.
6. The method of claim 5, wherein, The process of determining whether to update the center point based on the sum of the composite similarity of each UAV in a single shard and other UAVs includes Based on the sum of the composite similarity of each UAV in a single shard and other UAVs, the maximum sum of the composite similarity is extracted; If the maximum sum of the composite similarity is greater than the sum of the composite similarity of the current center point, it is determined that the center point needs to be updated; The UAV position corresponding to the maximum sum of the composite similarity is obtained, and the updated center point is determined.
7. The method of claim 6, wherein, The first determination condition includes If it is determined to update the center point and the preset maximum iteration number is not reached, it is determined to use the updated center point to re-perform the shard; If it is determined not to update the center point or the preset maximum iteration number is reached, it is determined to terminate the iteration.
8. The method of claim 1, wherein, The process of constructing a time-varying graph model of the UAV network based on the dynamic attributes of each UAV node includes Based on the three-dimensional position, moving speed, communication radius and remaining energy corresponding to each UAV, a node set of the UAV network is constructed; Based on the Euclidean distance between any two UAVs, the corresponding UAV communication connection state is determined to construct an edge set of the UAV network; Based on the preset total duration, a preset uniform time interval is divided to construct a time sequence set of the UAV network; Based on the node set of the UAV network, the edge set of the UAV network and the time sequence set of the UAV network, a time-varying graph model of the UAV network is constructed.
9. The method of claim 4, wherein, If the number of active UAVs in a single shard that exit is greater than or equal to a preset maximum UAV exit number threshold, re-performing the shard is triggered, wherein the maximum UAV exit number threshold is determined based on the practical Byzantine fault tolerance protocol.
10. The method of claim 4, wherein, The structural change amount of the network topology connection matrix is based on the Frobenius norm of the change amount of the network topology connection matrix per unit time, and if the result value of the Frobenius norm is greater than a preset threshold, re-performing the shard is triggered.