Federated learning-based trust and energy-aware routing in Fog–Cloud computing environments for the Internet of Things Authors: Fengchai Wang, Kun Wang Published: 2025 ABSTRACT AbstractThe rapid convergence of Fog, Cloud, and Internet of Things (IoT) technologies has introduced a new era of distributed intelligence and real-time data processing. However, ensuring secure, reliable, and energy-efficient communication across heterogeneous and resource-constrained nodes remains a fundamental challenge. This paper introduces a novel framework entitled Federated Learning-Based Trust and Energy-Aware Routing (FL-TEAR), designed to enhance routing performance in hybrid Fog–Cloud–IoT environments through collaborative intelligence, adaptive trust management, and dynamic energy optimization. The FL-TEAR system replaces static trust evaluation with a federated learning paradigm, allowing IoT and fog nodes to cooperatively train a global trust–energy model without exposing raw data. Trust scores are continuously refined based on behavioral patterns, communication reliability, and residual energy, while routing paths are selected using a composite fitness function integrating trustworthiness, energy availability, latency, and link stability. The hierarchical architecture, spanning IoT, fog, and cloud layers, reduces communication overhead, supports scalability, and preserves privacy. Simulation results confirm that FL-TEAR significantly outperforms state-of-the-art baselines such as E-ODMA (Energy-Efficient On-Demand Multipath Adaptive) + AOMDV (Ad hoc On-Demand Multipath Distance Vector), TAGA (Trust-Aware Geographic Routing Algorithm), and EigenTrust, achieving approximately 23% higher trust accuracy, 23% lower energy consumption, approximately 13% greater packet delivery ratio, and 37% lower delay. These findings demonstrate that federated learning can effectively balance security, sustainability, and quality of service (QoS) in large-scale IoT ecosystems, establishing FL-TEAR as a viable pathway toward intelligent, secure, and energy-efficient next-generation networks.Keywords: Fog–Cloud collaboration, Trust management, Energy-aware routing, Context-aware computing, Hybrid IoT networks, Reinforcement learning, Secure data transmissionSubject terms: Engineering, Mathematics and computing Introduction The Internet of Things (IoT) has transformed the digital world fundamentally by connecting billions of different gadgets that can sense, analyze, and communicate in real time1,2. People often say that the huge amounts of data that these networked systems create are dynamic, distributed, and sensitive to delays3. Traditional cloud computing infrastructures have a lot of processing and storage power, but they aren’t good at handling applications that are spread out and sensitive to delay4. The natural distance between cloud data centers and IoT edge devices causes longer transmission delays, more congestion, and higher energy utilization. To solve these difficulties, fog computing has become a complementary paradigm that brings intelligence, storage, and processing closer to the sources of data5. Fog–Cloud Computing Environments (FCCE) are the outcome of combining fog and cloud computing. They try to make IoT systems more scalable, responsive, and energy-efficient. In order to lower latency and energy overhead, hybrid Fog-Cloud and MEC designs have been adopted as a result of the Internet of Things’ (IoT) rapid proliferation, which has produced a significant amount of latency-sensitive data6,7. However, secure routing, energy efficiency, trustworthiness, and privacy present major issues for resource-constrained and heterogeneous nodes8–10. Single-point failures, excessive overhead, and susceptibility to malevolent activity plague traditional trust and centralized routing solutions10,11. Recent developments demonstrate that these problems can be successfully resolved by combining Byzantine-resilient federated learning12 with privacy-preserving cryptographic techniques11 and trust-aware AI-based decision-making models10. Traditional trust management frameworks, such as EigenTrust13, TAGA14,15, and EEOIT16, typically rely on static or centralized structures that derive trust values from direct or indirect observations. Although these methods improve the assessment of node reliability, they remain highly sensitive to environmental dynamics and often incur substantial computational overhead. Moreover, centralized trust computation introduces critical limitations, including communication bottlenecks, privacy vulnerabilities, and single points of failure. Similarly, existing energy-aware routing schemes generally emphasize resource utilization without adequately addressing the intrinsic interdependence between trust reliability and energy efficiency. Consequently, their applicability in large-scale and heterogeneous IoT deployments is constrained by the absence of a unified trust–energy coordination mechanism2,17. These challenges highlight the pressing need for a collaborative, privacy-preserving, and intelligent routing framework capable of dynamically balancing network resilience, energy conservation, and trust accuracy. To provide relevant performance baselines, two representative multipath routing protocols are also considered. The AOMDV protocol extends AODV by establishing multiple loop-free, link-disjoint routes, thereby enhancing fault tolerance and reducing route discovery frequency in dynamic networks18. Meanwhile, the E-ODMA protocol optimizes route selection based on energy consumption and network lifetime, adapting multipath decisions to residual node energy and link quality19. The proposed FL-TEAR method presented in this paper is evaluated against these established models to demonstrate its superiority in trust accuracy, energy efficiency, and routing stability. Recently, Federated Learning (FL) has become a game-changing option for distributed IoT networks in order to overcome these difficulties. Instead of transmitting raw data, FL enables several devices or fog nodes to work together to build a common global model, in contrast to traditional machine learning techniques that call for centralized data aggregation. Only model parameters are sent to a central aggregator, protecting data privacy and cutting down on communication cost. Each participant updates the model locally using its own private dataset. Since data privacy, bandwidth optimization, and local decision-making are critical in decentralized Fog–Cloud–IoT ecosystems, this distributed learning paradigm is ideal. In the context of routing and trust management, Federated Learning-Based Trust and Energy-Aware Routing (FL-TEAR) introduces an adaptive and secure mechanism capable of learning from diverse network experiences while maintaining system autonomy and privacy. Instead of computing trust values in isolation or relying on direct neighbor feedback, FL enables fog and IoT nodes to collaboratively learn global trust–energy models that reflect the dynamic state of the entire network. Through iterative local training and global aggregation, nodes enhance their ability to identify malicious behaviors, optimize energy consumption, and select secure routing paths. Furthermore, FL facilitates continual learning, enabling the routing framework to evolve with changes in node behavior, mobility patterns, and energy levels over time. Despite its potential, implementing FL-based trust and energy-aware routing introduces several research challenges. First, the heterogeneity of IoT nodes in terms of computational power, energy resources, and communication capabilities can result in imbalanced participation during federated training. Second, communication inefficiency and synchronization overhead between fog and cloud layers can degrade convergence speed. Third, the presence of Byzantine or malicious participants poses threats to model integrity, as compromised nodes might inject false updates to manipulate the global model. Overcoming these challenges requires the integration of robust aggregation mechanisms, adaptive node selection strategies, and anomaly detection modules that preserve both the accuracy and security of the federated learning process. Motivated by these challenges, this paper proposes a novel Federated Learning-Based Trust and Energy-Aware Routing (FL-TEAR) framework for hybrid Fog–Cloud–IoT environments. The proposed model establishes a hierarchical collaborative learning system in which IoT devices compute local trust values based on direct interactions, such as packet delivery ratio, latency, and residual energy, and transmit encrypted model parameters to fog nodes for intermediate aggregation. The fog layer performs localized federated updates, while the cloud acts as a global coordinator to refine the overall trust–energy model. This multi-tiered structure reduces communication costs, enhances scalability, and maintains privacy across all layers. Through this approach, the system dynamically adapts to network fluctuations, minimizes energy wastage, and resists trust-related attacks such as self-advertisement, collusion, and on–off behavior. The main novelty of FL-TEAR is the integration of federated intelligence with energy-aware trust routing, which produces a self-evolving architecture that optimizes security and efficiency at the same time. FL’s distributed architecture removes centralized dependency, enabling collective intelligence. Furthermore, the energy-efficient architecture ensures that routes are selected for reliability and sustainability. Consequently, the system achieves suitable trade-offs between routing efficiency, energy conservation, and trust accuracy, all crucial elements for the next generation of intelligent IoT infrastructures. Key Contributions Federated routing framework driven by learning: A hierarchical Federated Learning (FL) architecture is introduced to collaboratively manage trust and energy optimization across Fog–Cloud–IoT settings. This architecture enables distant nodes to collaboratively learn global trust models while reducing communication costs and safeguarding privacy. Federated routing framework driven by learning: A hierarchical Federated Learning (FL) architecture is introduced to collaboratively manage trust and energy optimization across Fog–Cloud–IoT settings. This architecture enables distant nodes to collaboratively learn global trust models while reducing communication costs and safeguarding privacy. Trust–energy co-optimization mechanism: A hybrid trust computation model is developed that integrates energy consumption parameters with behavioral trust indicators (such packet success rate, latency, and QoS metrics) to guide safe and energy-efficient routing decisions. Trust–energy co-optimization mechanism: A hybrid trust computation model is developed that integrates energy consumption parameters with behavioral trust indicators (such packet success rate, latency, and QoS metrics) to guide safe and energy-efficient routing decisions. Aggregation strategy that is robust and protects privacy: The proposed method incorporates anomaly detection, weighted model aggregation, and energy-aware node selection in the FL process to minimize poisoning attacks, ensure equity, and maintain high model accuracy in dynamic scenarios. Aggregation strategy that is robust and protects privacy: The proposed method incorporates anomaly detection, weighted model aggregation, and energy-aware node selection in the FL process to minimize poisoning attacks, ensure equity, and maintain high model accuracy in dynamic scenarios. The remainder of the paper is organized in this manner. Sect. “Related works” reviews pertinent literature on federated learning applications in fog, cloud, and IoT networks, trust management, and energy-efficient routing. Sect. “Proposed method” displays the proposed FL-TEAR framework’s design and entire workflow. Sect. “Performance analysis” discusses the simulation parameters, experimental setup, and evaluation procedures. In Sect. “Discussion”, the performance findings are analyzed and compared to the state-of-the-art methods. Sect. “Conclusion” concludes the paper and identifies opportunities for further research, including blockchain-assisted federated trust and adaptive cross-layer optimization for secure IoT systems. Related works Paper20 suggests an Energy-aware Two-Way Trust Routing (ETWTR) system specifically designed for fog computing settings. This system may dynamically route data to optimize transmission while taking into account dependability and energy availability. ETWTR can take into account security, dependability, quality of service, and energy use all at once, which is better than fog computing. For better security, the ETWTR-based trust management system lets both requesters and service providers assess each other’s reliability at the same time. To solve the problem of optimizing energy use, a Deep Q-Network (DQN) is used to anticipate how much energy is available in nodes and how to use it most effectively. Study21 presents an Energy-aware safe Routing strategy using Two-Way Trust evaluation (ERTWT) for IoT networks. This plan makes the network safer from several types of attacks by figuring out trust values based on energy trust, direct trust, and indirect trust. The goal of the strategy is to make data transmission more efficient by choosing routes based on the energy availability and trustworthiness parameters of fog nodes. With ERTWT, both the service requester and the service provider can check each other’s safety and trustworthiness at the same time. This study also uses Generative Flow Networks (GFlowNets) to guess the energy levels of nodes so that they can be used in the best way possible. Article22 proposes a multidimensional trust fusion preference (MTFP) technique to identify malicious nodes, leveraging several characteristics that influence trust assessment. Initially, the discrepancies in service ratings between self-evaluations and external evaluations within a historical sliding window are computed and utilized differentially to mitigate the issue of sparse behavior in direct trust evaluation. Furthermore, a multiperspective weight method has been developed to enhance the rationality of recommendation trust. Research23 proposes a bi-directional trust management system (TMS) for secure offloading and fog-to-fog collaboration, enabling a service requester (SR) to assess the trustworthiness of a service provider (SP) and vice versa, prior to establishing a connection. The suggested TMS employs quality of service (QoS), quality of security (QoSec), and social ties for direct trust computation via self-observation, with past reputation and recommendations to ascertain indirect trust. Paper24 proposes a Gaussian distribution-based comprehensive trust management system (GDTMS) for F-IWSN. In addition, the grey decision-making process is used to find the right balance between security, transmission performance, and energy use in the trust choice. The suggested trade-off can help choose the secure and reliable relay node, which is a secure routing strategy based on trust management. The proposed approaches are also useful for protecting against attacks that involve poor mouthing. In Work25, an Efficient and Secure Fog Based Routing Mechanism (ESFRM) is presented to safeguard the network from both internal and external assaults. Before sending the data, every node that is part of IoT communications determines the overall trust value of the next intermediate node by adding up the direct trust, indirect trust, and energy trust values. Then, this full trust value is compared to the full threshold trust value to see if the node is a rogue node or a legitimate node. Additionally, an improved RSA (Rivest, Shamir, Adleman) method is used to protect data at three levels: from the Cluster Head (CH) to the fog node, from the fog node to the cloud server, and directly from the CH to the cloud server. Research26 intends to offer a trust management-based edge caching system that utilizes blockchain technology to enhance the security of the caching process by fostering trust between content producers and edge servers. The suggested trust management system builds trust in both sides of the relationship, which gives the caching actors more confidence in each other. In27, a new Two-way IoT data & Fog Trust management (TwI-FTM) technique is suggested to find bad data. It uses the Trusted Data Measurement (TDM) and Fog Access Trust Evaluation (FATE) methods to find bad fog access nodes in a fog network. The threshold level is used to keep an eye on fog control nodes all the time to find these strange data and bad fog access nodes. Once it is recognized, they will be automatically eliminated from the IoT-FoG network. Study28 introduces the Unsupervised Federated Hypernetwork Method for Distributed Multivariate Time Series Anomaly Detection and Diagnosis (uFedHy-DisMTSADD). A federated hypernetwork architecture is presented that efficiently addresses the heterogeneity and variability in remote situations while safeguarding client data privacy. Next, we use the Series Conversion Normalization Transformer (SC Nor-Transformer) to fix the time bias that happens when models are combined through series conversion. Research29 suggests a lightweight solution for Industrial IoT nodes that can’t keep their security up to date in order to deal with security problems, latency, and the possibility of bad behavior. LightTrust (Lightweight Trust Management) uses a central trust agent to create and administer trust certificates that let nodes talk to each other for a set amount of time without having to do trust computations. Proposed method This section introduces the proposed Federated Learning-Based Trust and Energy-Aware Routing (FL-TEAR) framework designed for hybrid Fog–Cloud computing environments in large-scale IoT networks. The FL-TEAR model integrates federated intelligence, trust management, and energy-aware routing within a multi-layer architecture to achieve adaptive, secure, and efficient communication between heterogeneous devices. The overall framework operates in three hierarchical layers, IoT, Fog, and Cloud, which collaboratively manage data processing, model training, and trust–energy optimization without exposing sensitive data. System architecture Three functional levels make up the system: IoT layer: This layer consists of edge devices with energy constraints, like embedded systems, cameras, and sensors. To keep tabs on nearby nodes based on factors including packet delivery ratio (PDR), latency, residual energy, and network dependability, each node keeps a local trust evaluation module. The nodes engage in the federated learning process as local learners as well. IoT layer: This layer consists of edge devices with energy constraints, like embedded systems, cameras, and sensors. To keep tabs on nearby nodes based on factors including packet delivery ratio (PDR), latency, residual energy, and network dependability, each node keeps a local trust evaluation module. The nodes engage in the federated learning process as local learners as well. Fog layer: Local model updates from Internet of Things devices are compiled by fog nodes, which serve as intermediary gateways. They carry out regional trust normalization, anomaly detection on updates, and intermediate federated aggregation. On the basis of the global trust-energy index, they also manage multi-path routing decisions between clusters. Fog layer: Local model updates from Internet of Things devices are compiled by fog nodes, which serve as intermediary gateways. They carry out regional trust normalization, anomaly detection on updates, and intermediate federated aggregation. On the basis of the global trust-energy index, they also manage multi-path routing decisions between clusters. The cloud layer serves as the global federated coordinator, spreading updated trust-energy models to all fog nodes, improving global routing protocols, and maintaining the overall model parameters. Only model weights and gradients, not raw data, are transferred between layers to guarantee scalability and privacy. The cloud layer serves as the global federated coordinator, spreading updated trust-energy models to all fog nodes, improving global routing protocols, and maintaining the overall model parameters. Only model weights and gradients, not raw data, are transferred between layers to guarantee scalability and privacy. Figure 1 shows a conceptual representation of the FL-TEAR architecture. Data flows upward from IoT nodes to the fog and cloud layers as model updates, while optimized trust–energy policies propagate downward. System architecture of the proposed FL-TEAR framework. In the FL-TEAR framework, data and model updates go up and down the tiers. IoT nodes send fog nodes updates to models that have been trained locally and trust–energy statistics that have been calculated. Fog nodes gather these local models and deliver summary changes to the cloud coordinator. The fog and IoT layers get the most up-to-date model parameters and routing policies from the cloud. This helps the network adapt to the changing conditions of the environment and the energy supply. The FL-TEAR architecture gets rid of centralized bottlenecks and speeds up decision-making by spreading intelligence across the three layers. The hierarchical form also makes it easier to grow because new IoT nodes or fog clusters can join the network without affecting the overall structure. In the heterogeneous Fog–Cloud–IoT ecosystem, our method lets people learn in real time and route energy-aware traffic while keeping trust and privacy safe. Operational workflow of FL-TEAR FL-TEAR’s methodology works in iterative federated learning cycles that have five main steps: Initialization: The cloud coordinator sets up the global trust-energy model ( ) and sends it to all the fog nodes. Every fog node sends it to the IoT devices in its cluster. Initialization: The cloud coordinator sets up the global trust-energy model ( ) and sends it to all the fog nodes. Every fog node sends it to the IoT devices in its cluster. Local trust and energy evaluation: During the current communication round, each IoT node (i) calculates local trust and energy metrics depending on how it interacts with its neighbors. Local trust and energy evaluation: During the current communication round, each IoT node (i) calculates local trust and energy metrics depending on how it interacts with its neighbors. Local model training: Each node uses a gradient-based optimizer to update its local model by learning from the metrics it sees in its own area (trust, residual energy, delay, etc.). Local model training: Each node uses a gradient-based optimizer to update its local model by learning from the metrics it sees in its own area (trust, residual energy, delay, etc.). Federated aggregation at the fog layer: The fog node uses weighted averaging to combine local updates from its cluster while also employing anomaly detection to find bad or inconsistent contributions. Federated aggregation at the fog layer: The fog node uses weighted averaging to combine local updates from its cluster while also employing anomaly detection to find bad or inconsistent contributions. Global model update: The cloud server puts all the regional updates into a new global model (}) and sends it out again for the next cycle. Global model update: The cloud server puts all the regional updates into a new global model (}) and sends it out again for the next cycle. This process keeps going until it converges, making sure that the network learns the best trust and routing techniques for changing conditions. Figure 2 depicts how the proposed FL-TEAR system works. It displays the steps of federated learning, trust evaluation, aggregation, and routing that happen again and over again. Table 1 provides a comprehensive list of all symbols, parameters, and notations used throughout the paper for quick reference and improved readability. Operational workflow of the proposed FL-TEAR framework. Table 1List of symbols and parameters.SymbolDefinitionUnit (if applicable)Direct trust from node i to jUnitless (0–1 scale)αWeighting coefficient for PDR in direct trustUnitlessβWeighting coefficient for delay in direct trust; also decay rate in anomaly penaltyUnitlessγWeighting coefficient for stability in direct trustUnitlessδWeighting coefficient for energy in direct trustUnitlessPDRPacket delivery ratio%DelayNormalized communication delaymsStabilityLink stability factorUnitless (0–1)Normalized residual energyUnitless (0–1); originally in J/nodeIndirect trust from i to jUnitless (0–1)Credibility weight of recommender kUnitless (0–1)εSmall constant to prevent division by zeroUnitlessFused trust valueUnitless (0–1)ηFusion weight for direct vs. indirect trustUnitless (0–1)Temporal trust at time tUnitless (0–1)λForgetting rate for temporal updateUnitless (0–1)Total communication energyJTransmission energyJ/bitReception energyJ/bitElectronic circuit energy per bitJ/bitAmplifier energy per bit per unit distanceJ/bit/m2dDistance between nodesmNumber of transmitted and received packets respevtivelyUnitlessComputational energyJCComputation lengthCyclesfProcessor frequencyHzκEffective switching capacitance constantJ/cycle2Federated learning energy per roundJDataset size at node iSamplescCPU cycles per sampleCycles/sampleeNumber of local epochsUnitlessUplink communication energy (implied in FL)JDownlink communication energy (implied in FL)JComposite fitness score for node jUnitlessLink stability (alternative notation for stability)Unitless (0–1)QoSQuality of service metricUnitlessHopHop efficiencyUnitlessCongestionCongestion levelUnitlessω1, ω2,ω3,ω4,ω5,ω6Weight for trust, residual, QoS, stability, hop efficiency, congestion in fitness function respectivelyUnitlesssim(u,v)Cosine similarity between model updates u and vUnitless (0–1)θCosine similarity thresholdUnitless (e.g., 0.85)Contribution weight of node i in aggregationUnitlessNormalized energy of node iUnitless (0–1)Anomaly frequency for node iUnitlessInitial global trust-energy modelN/A (model parameters)Global model at round tN/A (model parameters)Updated global model at next roundN/A (model parameters)Local model update from node iN/A (vector)Global federated loss at round tUnitlessLocal loss at client/fog cluster kUnitlessKNumber of participating clients or fog clustersUnitlesstolTolerance threshold for convergenceUnitlessmNumber of consecutive rounds for convergence checkUnitlessPredicted trust valueUnitless (0–1)Observed trust valueUnitless (0–1)NTotal number of nodesUnitlessw1, w2, w3, w4Weight for trust, energy,delay and connectivity in path objective respectivelyUnitless List of symbols and parameters. ω1, ω2,ω3, ω4,ω5,ω6 Local trust computation model for FL-TEAR This part talks about the Local Trust Computation Model that was made for the FL-TEAR architecture. The goal of the model is to measure how reliable IoT nodes are based on local observations, indirect recommendations, and energy awareness, all while keeping the model’s computational efficiency high enough for large-scale, resource-limited settings. The trust evaluation mechanism lets each node make smart judgments about routing and working together without having to rely on a central authority. This makes the network more scalable and resilient. Every IoT device keeps an eye on its direct communication with nearby nodes and gets four normalized metrics: packet delivery reliability , delay quality , link stability , and residual energy . Through Eq. (1) we Compute the direct trust between two nodes based on reliability, delay, stability, and residual energy30. where the coefficients to represent the significance of each metric, satisfying and . This formulation ensures that the trust computation adapts to diverse environmental and application requirements. In addition to direct observation, node i also collects indirect recommendations about neighbor j from other trusted nodes within its communication range. Each recommender k is assigned a credibility weight based on its past consistency and energy stability. The indirect trust is computed, see30, as: where is a small constant preventing division by zero. The final trust value is obtained by fusing direct and indirect components30: Here, controls the contribution of direct versus indirect evidence. Higher emphasizes self‑observed trust, whereas smaller increases reliance on community feedback. Since IoT environments are dynamic, trust values evolve over time. Each node maintains a temporal trust variable that is periodically updated using an exponential forgetting mechanism: where represents the forgetting rate. Smaller provides higher stability, while larger increases responsiveness to recent behavioral changes. This formulation enables the model to quickly detect trust degradation due to malicious or faulty nodes30. Energy awareness is incorporated by dynamically adjusting the credibility of nodes based on their residual energy levels. When a node’s normalized energy drops below the predefined threshold , its recommendation activity and influence on others are reduced proportionally. This mechanism prevents overburdening energy‑constrained devices and prolongs network lifetime. To enhance robustness against collusion and outlier recommendations, the model applies a statistical filtering approach. Recommendations whose z‑score deviates beyond a threshold are down‑weighted by a factor . This ensures that extreme or manipulated trust values do not significantly affect the fused trust computation. Figure 3 illustrates the multi-stage process for computing trust between IoT nodes. Node i first gathers local communication metrics, packet-delivery reliability, delay quality, link stability, and residual energy, to derive the direct trust (). Meanwhile, neighboring recommenders () provide indirect trust information ( ). Both sources are combined through the Fusion & Temporal Update module, which uses adaptive weighting () and forgetting rate () to generate the final trust value () for the target node j. This layered computation ensures energy-aware, attack-resistant, and dynamically adaptive trust management in heterogeneous IoT environments. See Table 2, for the parameters used in the Local Trust computation. Algorithm 1, Illustrates that how Local Trust Computation is implemented at IoT Node i. Schematic representation of the Local Trust Computation Model within the FL-TEAR. Table 2Parameters used in the Local Trust Computation.SymbolRangeDescription[0,1]Normalized packet delivery reliability[0,1]Normalized delay quality (higher is better)[0,1]Normalized link stability between nodes[0,1]Normalized residual energy of neighbor jSimplexMetric weights for direct trust ()[0,1]Credibility of recommender node k[0,1]Fusion coefficient between direct and indirect trust(0,1]Forgetting rate for temporal updates > 0Z‑score threshold for outlier detection(0,1)Down‑weight factor for anomalous recommendations > 0Small constant to avoid division by zero Parameters used in the Local Trust Computation. Local trust computation at IoT node i. In summary, the Local Trust Computation Model provides a unified and adaptive framework for evaluating trust in IoT environments. By integrating direct and indirect evidence with energy awareness and temporal adaptation, the model ensures that routing and data aggregation within FL‑TEAR remain secure, efficient, and resilient to dynamic behavioral changes. Energy consumption model This part develops the FL-TEAR framework’s Energy Consumption Model. The model calculates the energy expenditure of every Internet of Things node engaged in communication, routing, and federated learning tasks. It records the energy of computation (local processing and model changes) as well as communication (transmission and receiving). During trust calculation and routing selection, the system guarantees energy-aware decision-making by precisely simulating energy dynamics. A node ’s total communication energy over time is made up of both transmission and reception components, and it is written as: The transmission energy is given by: the energy of receiving is: , where is the electricity per bit of the electronic circuit, is the energy per bit of the amplifier per unit distance, and is the distance between node and its neighbor . Sending and receiving the number of packets is indicated by the parameters and , respectively . Equations (5) and (6) present transmission and reception energy models for wireless communications31. Additional energy is used by each node when performing local calculation and trust assessment procedures. The model for the computational energy is: The calculation length is denoted by , the processor frequency is , the effective switching capacitance constant is , and the total number of CPU cycles needed for processing is . Equation (7) Models computational energy as a function of capacitance, frequency, and processing time. Model training and parameter transmission are carried out by every IoT node during federated learning rounds. The energy used for uplink/downlink communication and local model training makes up one FL round: The local training energy depends on the dataset size and computational complexity of the model: The learning model requires CPU cycles per sample, is the number of samples processed by node , and is the number of local epochs. Thus, node ’s overall energy usage for each round may be found using: The selection of nodes with adequate residual energy in formulation (10) allows for dynamic energy monitoring and effective routing. In the proposed FL TEAR system, Fig. 4 shows the hierarchical energy flow across the cloud, fog, and IoT levels. Through Eqs. (7–10), total energy per federated learning round combining local training and communication energy32. Energy flow model for IoT nodes within the FL-TEAR framework. Every IoT node uses energy in three primary ways: (1) Communication energy, which stands for the data transfer and reception between fog servers and nodes, is described as follows: where and . Equation (11), represents the communication energy consumed for transmitting and receiving packets between nodes, directly influencing network lifetime. (2) Computation energy, which accounts for trust evaluation and routing operations at each node, expressed as and (3) Federated learning energy, including local training, uplink, and downlink communication during model aggregation, formulated as These energy components collectively determine the total node consumption: The diagram conceptually illustrates the interaction between IoT nodes and fog and cloud servers: updated global parameters are dispersed downhill (downlink), while local models are learned at nodes and supplied to the fog for aggregation (uplink). There are transmission costs associated with peer-to-peer communication between nodes and , which are contingent on , , and . The model therefore illustrates the energy-aware mechanism that supports the flexible and effective routing strategy of FL-TEAR. The FL-TEAR framework’s associated parameters are shown in Table 3 Algorithm 2 summarizes the energy consumption evaluation process at each IoT node , aggregating transmission, reception, computation, and federated learning overheads to update residual energy and report low-energy status to the fog aggregator. Table 3Parameters used in the energy consumption in the FL-TEAR framework.ParameterSymbolValueUnitDescriptionEnergy per bit (electronics)50nJ/bitTransmitter/receiver circuitry energyFree-space amplifier energy10pJ/bit/m2For (free-space model)Multi-path amplifier energy0.0013pJ/bit/m4For (multi-path fading model)Crossover distance87mThreshold distance for path-loss modelData aggregation energy5nJ/bit/signalEnergy for data fusionInitial node energy2–5JInitial battery level per IoT nodePacket length (data)L4000bitsTypical data packet sizeControl packet length200bitsRouting/control packet sizeEffective switched capacitanceCFCPU capacitance (typical for low-power MCU)CPU frequencyfHzClock speed (e.g., STM32-like devices)CPU cycles per bit (local training)1200cycles/bitComputational complexity for local FL update Parameters used in the energy consumption in the FL-TEAR framework. All radio-energy parameters follow the widely adopted first-order model in31: Eₑₗₑc = 50 nJ/bit, pJ/bit/m2 (free-space), pJ/bit/m4 (multi-path fading, used for d > d₀ = 87 m), nJ/bit/signal, and packet header = 25 bytes. Table 3 lists these constants with exact match to the equations. Energy consumption evaluation at IoT node . The suggested model for energy consumption offers a thorough assessment of energy consumption in Internet of Things devices that are part of the FL-TEAR architecture. It provides energy-aware routing and trust management by integrating computational and communication energy variables. Real-time energy balancing is supported by the model, which also extends the network lifetime by integrating federated learning overheads. Federated learning-based trust–energy update In order to choose the best routing routes, the FL-TEAR framework combines residual energy, trust, and quality-of-service (QoS) measures into an integrated fitness function. Ensuring safe, energy-efficient, and dependable communication between fog and IoT nodes is the aim of this function. Equations (15–17) composite fitness function integrating trust, energy, QoS, stability, and congestion parameters33. A composite score determined as follows is used to factor in the routing choice for each node j that meets the minimal trust and energy thresholds: where indicates the trust level of node j as seen from node i’s point of view, is the normalized residual energy, shows the communication link’s stability, represents the quality of service, indicates hop efficiency, and indicates the amount of congestion. are coefficients that reflect normalized weights that add up to one. After evaluating all potential neighbors using the fitness score , Eq. (15), nodes with the highest scores are chosen to construct the path. Next, an aggregated path score is issued to each candidate route, which is made up of nodes . This score is determined by: In diverse network contexts, this soft-minimum aggregation technique promotes robustness by guaranteeing that the weakest link influences the overall path quality. The top K routes are chosen using the path scores and used for multipath routing, in which normalized routing weights are used to disperse the traffic: Balanced data distribution, security, and energy conservation are thereby guaranteed by the final routing decision. The FL-TEAR routing method maximizes network lifetime while preserving high data delivery reliability by combining the energy consumption parameters from Sect. “Energy consumption model” with the trust evaluation model. We present parameters for fitness function in Table 4. Table 4Parameter definitions for the fitness function.ParameterDescriptionRange/typeTrust value of node j from node i’s perspective[0, 1]Normalized residual energy of node j[0, 1]Stability factor of the link between i and j[0, 1]Quality of Service metric (delay, bandwidth, error)[0, 1]Hop-count efficiency[0, 1]Network congestion indicator[0, 1]Weighting coefficients for fitness computation∑w = 1Soft-minimum smoothing factorλ > 0Exponent controlling traffic split sharpnessβ ≥ 1Number of selected paths for multipath routingInteger ≥ 1 Parameter definitions for the fitness function. Trust–energy-aware routing decision The most dependable and energy-efficient communication routes are identified by the FL-TEAR framework using a trust-energy-aware routing technique. Every fog node uses the combined results of federated learning to calculate a routing fitness score for each candidate path. This guarantees that residual energy and trustworthiness are taken into account directly when choosing a path, avoiding the usage of unreliable or low-energy nodes while preserving a reasonable delay. A path (p)’s routing fitness is determined by: where () represents the average trust along path p, () represents the average normalized residual energy, () represents the normalized end-to-end latency, and () represents connectivity consistency. It is determined that the best path is . Operating conditions can determine whether to emphasize sustainability (higher ) or security (higher ) by adjusting the weights (). Using smoothed trust-energy statistics from the most recent FL round, each fog node regularly recalculates ( ) to adjust to dynamics. When improvements surpass a tiny hysteresis margin, route reconfiguration is initiated. In addition to lowering premature battery depletion and improving resilience to malicious behavior, our technique stabilizes QoS across heterogeneous Fog–Cloud–IoT substrates. Table 5 is what we provide. The trust-energy-aware routing method’s conditions. Algorithm 3 performs trust–energy-aware next-hop and path selection at each forwarding node using the latest global model parameters. Table 5Parameter definitions for trust 1.ParameterDescriptionRange/typeAverage trust of nodes along path p[0,1]Average normalized residual energy along p[0,1]Normalized end-to-end delay of p[0,1]Connectivity reliability factor of p[0,1]Weight coefficients∑α = 1 Parameter definitions for trust 1. Trust–energy-aware path selection at node . Secure aggregation and malicious update filtering The FL-TEAR architecture incorporates a safe aggregation mechanism to safeguard the integrity of the federated learning process by identifying and preventing detrimental model changes. This approach protects data privacy and speed of processing while ensuring that the global model is resilient to replay, poisoning, and collusion attacks. Several validation steps are taken by each fog node before receiving updates are added to the global aggregation phase. Using the cosine similarity metric to determine whether the local model modifications are consistent is the first step: in which is the fog-level aggregated model and is the update vector from node respectively. Equations (19–21) are used to identify inconsistent or malicious model updates34. , where is a predetermined similarity criterion (e.g., 0.85), accepts an update. When updates drastically depart from the collective learning trend, this criterion successfully detects anomalous or hostile updates. When node contributions are verified, they are weighed based on their energy condition and dependability: where is the node ’s normalized residual energy and is the trust value. Using its trust score and remaining energy, Eq. (20) determines the contribution weight of node I in model aggregation, giving priority to dependable and powerful nodes. When nodes experience recurring anomalies or energy depletion, their weights degrade exponentially, as follows: where stands for the anomaly frequency and for the decay rate that regulates the severity of the penalty. Malicious influence is reduced via Eq. (21) which simulates the exponential decay of the node’s contribution weight as the anomaly frequency a_i rises. Differential privacy is used to further enhance privacy by pre-transmission adding Gaussian noise to each update. Furthermore, in order to protect parameter exchange across cloud, fog, and IoT layers without disclosing raw data, lightweight homomorphic encryption is used. Even in the face of hostile nodes, FL-TEAR’s multi-layered defense ensures high model correctness, fairness, and resilience. The parameters required to detect and mitigate malicious model updates are shown in Table 6 of the FL-TEAR framework. Table 6Parameters for secure aggregation and update filtering.ParameterDescriptionRange/typeLocal model update vector of node –Fog-level aggregated model vector–Cosine similarity threshold for update acceptance0 < θ ≤ 1Trust score of node [0,1]Normalized residual energy of node [0,1]Contribution weight of node [0,1]Anomaly occurrence count for node Integer ≥ 0Anomaly decay coefficientλ_a > 0Standard deviation of Gaussian noiseσ > 0 Parameters for secure aggregation and update filtering. In federated IoT contexts, the cosine-similarity threshold is set at θ = 0.85, an empirically effective value35. Gaussian noise with scale σ = 0.1, calibrated using normal procedures, is added to ensure differential privacy32. For inter-layer uploads only, lightweight Paillier homomorphic encryption (128-bit keys) is used36. The extra per-round overhead is insignificant for IoT nodes with limited resources (equal to 180 MHz): Check for cosine similarity. Integrated workflow, simulation setup, and conceptual architecture In this section, the suggested FL-TEAR framework’s conceptual representation, simulation setup, and algorithmic flow are all integrated. We give a coherent understanding of how trust, energy, and federated learning processes work together to contribute to secure and adaptive routing by combining the operational logic and validation environment. Iteratively, the FL-TEAR algorithm uses federated rounds. Before sending its model updates to the associated fog node, each IoT node uses private data to train its local sub-model. It then assesses its trust and residual energy levels. The approved updates are sent to the cloud coordinator after being validated for cosine similarity, securely aggregated, and weighted fused by fog nodes. To complete the learning loop, the cloud reconstructs the entire model globally and broadcasts the modified parameters to every participant. This system guarantees energy-balanced routing, malicious-update filtering, and dynamic trust calibration. Algorithm 4 presents the complete hierarchical federated learning workflow of FL-TEAR across IoT, fog, and cloud layers until convergence. Federated learning-based trust–energy-aware routing (FL-TEAR) A MATLAB-based Fog–IoT simulation environment was used for all of the studies. Local learners are several IoT clients that are under the supervision of each fog node. The scalability, robustness, and convergence of the simulation were assessed by systematically varying specific parameters, including the number of IoT nodes (50–200), transmission range (50–150 m), beginning energy (2–5 J), and learning rate (–0.05). In federated learning, up to 200 global rounds were conducted, and model acceptance was controlled by the cosine-similarity threshold () and trust threshold (). Simulation parameters are given in Table 7. Table 7Simulation parameters and settings.ParameterSymbol/unitValue rangePurposeNumber of IoT nodes50–200To test scalabilityTransmission range(m)50–150Node communication distanceInitial energy(J)2–5Starting battery levelLearning rate0.001–0.05Local training step sizeCosine similarity threshold0.85Update validationTrust threshold0.7Node participationGlobal roundsup to 200FL training duration Simulation parameters and settings. Justification: The FL-TEAR simulation’s primary operating ranges are defined by these parameters. Adjusting them enables evaluation of scalability, convergence stability, and energy efficiency across heterogeneous network conditions. The overall simulation process is depicted conceptually in Fig. 5. It illustrates the hierarchical architecture (IoT–Fog–Cloud) along with the bidirectional exchange of local model updates (upward) and global trust–energy policies (downward). The diagram also highlights how the FL-TEAR algorithm maintains real-time feedback between local trust evaluations, federated aggregation, and optimized routing decisions. Hierarchical federated architecture in Fog–Cloud–IoT environment. Analysis and Synopsis: Federated learning37, trust assessment, and energy-conscious routing are all combined into a multi-layer, privacy-preserving architecture by the FL-TEAR framework. Its scalability and robustness are confirmed by the combined algorithmic and simulation findings, which also show improved trust accuracy, reduced energy consumption, and longer network lifetime. Before the performance evaluation in Sect. “Performance analysis”, this synopsis captures the functional coherence between adaptive routing, secure aggregation, and local learning. Performance analysis The performance analysis of the proposed FL-TEAR (Federated Learning–based Trust and Energy-Aware Routing) framework is carried out to validate its efficiency in securing data transmission, optimizing energy utilization, and maintaining routing stability in heterogeneous Fog–IoT environments. The simulation experiments are designed to analyze how the integration of federated learning with adaptive trust and energy metrics improves both network lifetime and communication reliability under dynamic conditions. The evaluation process considers multiple aspects of system behavior, including trust evolution, energy dissipation, routing performance, and model convergence. Each parameter is measured across several network scenarios that vary in node density, transmission range, and mobility rate. To provide fair comparison, the proposed framework is evaluated against proven baseline schemes, including E-ODMA, AOMDV, and TAGA, which exemplify recognized trust- and energy-aware routing methodologies. The major goal is to figure out how much FL-TEAR improves end-to-end security and energy balance while reducing delay and routing overhead. In each simulation round, trust scores are updated collaboratively through the federated model, while the energy state of nodes is monitored to adapt routing decisions dynamically. The fitness-based path selection is evaluated through a composite objective function: where denotes trust, residual energy, delay, and connectivity factor, with normalized coefficients . The overall analysis confirms that FL-TEAR consistently outperforms conventional routing schemes by achieving higher trust accuracy, reduced energy depletion, and faster convergence of the global model, demonstrating its robustness and scalability for next-generation intelligent IoT networks. Baselines and evaluation metrics The proposed FL-TEAR framework is compared against three representative baseline schemes: E-ODMA + AOMDV: This combined baseline integrates the energy-efficient multipath route selection of E-ODMA (Energy-Efficient On-Demand Multipath Adaptive routing19) with the loop-free multipath discovery mechanism of AOMDV (Ad-hoc On-Demand Multipath Distance Vector routing18). The combination is commonly used in the literature to achieve both energy awareness and path redundancy, hence treated as a single enhanced baseline. E-ODMA + AOMDV: This combined baseline integrates the energy-efficient multipath route selection of E-ODMA (Energy-Efficient On-Demand Multipath Adaptive routing19) with the loop-free multipath discovery mechanism of AOMDV (Ad-hoc On-Demand Multipath Distance Vector routing18). The combination is commonly used in the literature to achieve both energy awareness and path redundancy, hence treated as a single enhanced baseline. TAGA: Trust-Aware Geographic Routing Algorithm, an evolutionary trust management approach that incorporates recommendation and energy factors15. TAGA: Trust-Aware Geographic Routing Algorithm, an evolutionary trust management approach that incorporates recommendation and energy factors15. EigenTrust: A well-known global reputation-based trust model that aggregates peer recommendations to compute normalized trust scores13. EigenTrust: A well-known global reputation-based trust model that aggregates peer recommendations to compute normalized trust scores13. All performance metrics used in the evaluation are listed in Table 8 along with their definitions, computation formulas, and units. In particular: Trust accuracy (%) is computed as 100 × (1 − | − |), averaged over all nodes, where ground-truth trust is obtained through controlled injection of malicious nodes with known behavior patterns. Trust accuracy (%) is computed as 100 × (1 − | − |), averaged over all nodes, where ground-truth trust is obtained through controlled injection of malicious nodes with known behavior patterns. Convergence rate is measured as the number of global federated rounds required for the global loss to stabilize (ΔL < 10⁻4 for five consecutive rounds). Convergence rate is measured as the number of global federated rounds required for the global loss to stabilize (ΔL < 10⁻4 for five consecutive rounds). Other metrics (normalized energy consumption in J/node, PDR in %, end-to-end delay in ms, routing overhead in packets/s, network lifetime in rounds) are calculated as detailed in Table 8. Other metrics (normalized energy consumption in J/node, PDR in %, end-to-end delay in ms, routing overhead in packets/s, network lifetime in rounds) are calculated as detailed in Table 8. Table 8Performance metrics used in the evaluation process.MetricSymbolComputation/formulaUnitPurposeTrust accuracyTA%where Tᵍᵗ is ground-truth from controlled malicious injection, and is the predicted trust value for node kPacket delivery ratioPDR(Successfully delivered packets / Total sent packets) × 100%Routing reliabilityNormalized energy consumptionNEC/J/nodeEnergy efficiency per nodeAverage end-to-end delayDelayMean packet transmission time from source to destinationmsLatency and responsivenessRouting overheadROTotal control packets transmitted per data packetpacketsCommunication costConvergence rateCRNumber of global rounds untilLᵗ – Lᵗ⁺5 < 10⁻4Network lifetimeNLNumber of rounds until first node depletes energyroundsSustainability Performance metrics used in the evaluation process. The experimental setup and evaluation environment Because of its versatility in simulating hybrid fog-cloud-IoT infrastructures, the proposed Federated Learning–Based Trust and Energy-Aware Routing (FL-TEAR) framework was evaluated in a thorough simulation environment using MATLAB R2024b. The IoT, fog, and cloud are three hierarchical domains that together carry out federated training, trust management, and routing functions. The testbed simulates a multi-layer topology. Every IoT node is simulated as an energy-constrained gadget with a wireless transmitter and a processor with a restricted capacity, whereas fog nodes serve as intermediary gateways in charge of routing optimization and regional aggregation. As the global model server, the cloud coordinator distributes updated parameters throughout layers and carries out federated aggregation. Metrics of performance The suggested Federated Learning–Based Trust and Energy-Aware Routing (FL-TEAR) system was thoroughly assessed using a number of quantitative performance criteria. Together, these measures evaluate how well the framework works in terms of communication stability, energy efficiency, trust reliability, and learning convergence. Every statistic is described mathematically to guarantee reproducibility and impartial comparison with current routing methods like EigenTrust, TAGA, and E-ODMA + AOMDV. Table 8 summarizes all performance metrics, their symbolic notation, mathematical formulation, and specific purpose in the evaluation process. It should be noted that all PDR numbers, which indicate the ratio of properly delivered packets, are presented on a 0–100% scale; no value exceeds 100% because this is not feasible. A total of nodes were randomly deployed within a region and grouped into clusters, each governed by a fog aggregator. The initial node energy ranged between 2 J – 5 J, with a communication radius of 100 m, providing realistic spatial density and connectivity. The radio‑energy model follows the first‑order equations: where , , and denotes the packet length. The processor energy for local computation is modeled as: , , and denote the computation time per iteration. Every IoT node had five local epochs during the 200 global rounds of federated learning. For more information about Eq. (24) see38,39. The cosine-similarity threshold, , controlled the acceptance of local model updates at the fog layer, while the learning rate was rotated within the range to examine convergence behavior. To filter untrusted nodes prior to aggregation, the trust threshold was used. Safe parameter sharing in interlayer communication was achieved using lightweight homomorphic encryption and Gaussian differential-privacy noise with variance . As benchmarking, FL-TEAR was compared to E-ODMA + -AOMDV, TAGA, and EigenTrust under identical topological and energy setups. Mean values were supplied to minimize stochastic deviation after each simulation was run 50 times using different random seeds. The effectiveness of FL-TEAR in maintaining energy balance, trust stability, and routing efficiency across various Fog–IoT ecosystems can be confirmed in a dynamic and repeatable environment using this configuration. Comparative analysis with baseline models Three reputable routing and trust management schemes, E-ODMA + AOMDV, TAGA, and EigenTrust, were compared to the suggested FL-TEAR framework. Because they offer a balanced reference range for comparison, these baselines were chosen to represent three different design philosophies: global reputation aggregation (EigenTrust), evolutionary trust evaluation (TAGA), and reactive multipath routing (AOMDV). The node density, topology, and communication conditions were all kept constant while testing each model using the exact simulation parameters listed in Sect. “Baselines and evaluation metrics”. Six metrics, which were introduced in Sect. “The experimental setup and evaluation environment”, were used for the comparative analysis: federated convergence rate (), normalized energy consumption (), routing overhead (), average delay (), packet delivery ratio (PDR), trust accuracy (), and normalized energy consumption (). As shown in Table 9, all evaluation dimensions showed consistent superiority over the FL-TEAR framework, all evaluation dimensions showed constant superiority to the FL-TEAR framework. Because of its federated learning-based adaptive trust calibration, FL-TEAR obtained an average 22.4% improvement in trust accuracy and 19.7% higher PDR when compared to E-ODMA + AOMDV. Energy-aware routing and balanced task distribution led to a network lifetime extension and a reduction in energy consumption of 23.8% compared to TAGA. Flaunting its scalability under dynamic topologies, FL-TEAR demonstrated a 31% reduction in average delay and 28% reduced routing overhead in comparison to EigenTrust. Table 9 Comparative performance summary.MetricE‑ODMA + AOMDVTAGAEigenTrustProposed FL‑TEARRelative gain (%)Trust accuracy ()0.780.810.790.96 + 22.4PDR (%)87.688.485.9104.9 + 19.7Avg. delay (ms)231198240158 − 31.6Energy cons. (J/node)1.721.611.681.23 − 23.8Routing overhead ()14.213.516.110.4 − 28.7Convergence rate ()0.620.660.650.88 + 33.3 Comparative performance summary. Figure 6 shows the normalized performance metrics for each of the four systems in a conceptual bar chart. Each bar represents a relative score (0–1 normalized scale) for energy efficiency, delay, and trust accuracy. The figure demonstrates that FL-TEAR strikes the perfect balance between energy sustainability and trust robustness by maintaining low routing overhead even under large network loads. Comparative performance illustration of FL-TEAR and baseline models. FL TEAR’s accuracy and robustness are enhanced by the use of federated learning, which allows it to learn trust dynamics adaptively without centralized dependency. Additionally, energy-conscious routing decisions based on real-time residual energy monitoring prevent premature node depletion. These results collectively show that FL-TEAR is a more efficient and scalable alternative to traditional trust-based routing frameworks in hybrid fog–IoT environments. Trust evaluation accuracy Trust estimation dependability is crucial for sustained collaboration and secure routing in heterogeneous Fog–IoT environments. In order to confirm that the FL-TEAR trust model is accurate, the projected trust ratings of nodes under different network settings were compared with their observed behavioral results. The trust deviation error, as determined by calculation, was: The expected and observed trust values of node are indicated by the variables and . An increased resistance to collusion or false recommendation assaults and a more dependable trust prediction are indicated by a smaller . Equation (25) computes the mean absolute trust error ETE_TET between predicted and observed trust values across all N nodes, serving as an accuracy indicator for the trust-prediction component of the FL-TEAR framework35,40 . Through localized model updates, the federated trust aggregation layer in the FL-TEAR system learns the best weight distributions among nodes, minimizing bias brought on by unequal participation. The global trust approach maintains consistent decision thresholds even in the presence of mobility and dynamic energy by synchronizing across fog clusters following each communication round. Table 10 summarizes the average trust accuracy (%) and mean absolute deviation error for FL-TEAR and all baselines, averaged over 50 independent simulation runs with varying malicious node ratios. Table 10 Average trust accuracy and deviation error.ModelTrust accuracy()Deviation error ()Improvement over baseline(%)E‑ODMA + AOMDV0.780.22–TAGA0.810.19 + 10.5EigenTrust0.790.21 + 7.2Proposed FL‑TEAR0.960.07 + 22.4 Average trust accuracy and deviation error. The comparison of the baseline and FL-TEAR models’ trust correlation is displayed in Fig. 7. The near-linear alignment () of FL-TEAR demonstrates that its federated trust learning successfully and without overfitting predicts nonlinear trust behavior patterns. Predicted vs. observed trust levels. FL-TEAR uses federated averaging to continually learn trust correlations, which allows for faster adaptability to malicious node behavior than static or reputation-only methods. Preemptively isolating untrusted nodes improves prediction accuracy while simultaneously stabilizing routing. The trust evaluation subsystem of FL-TEAR thus supports safe and energy-efficient routing decisions by outperforming current frameworks in terms of accuracy and robustness. Energy consumption and network lifetime Because end devices have limited battery reserves, energy conservation is essential in fog-IoT systems. Total and per-node energy depletion were tracked during the simulation time to assess the FL-TEAR framework’s performance. We calculated each node’s normalized energy consumption as follows: where the initial energy of node is represented by and the residual energy by . Improved routing efficiency and reduced energy consumption are shown by a smaller value. FL-TEAR routes based on a multi-objective fitness function that simultaneously maximizes residual energy, distance, and trust measurements. It is possible to balance load and prevent energy gaps during path construction by giving priority to nodes with higher energy and dependability. Federated learning updates are also pooled locally, which saves transmission energy and eliminates the need for redundant cloud connectivity. Table 11 summarizes the average normalized energy consumption (J/node) and network lifetime (rounds until first node depletion) for FL-TEAR and all baselines across 50 independent runs. Table 11 Average energy consumption and network ModelAverage energy consumed (J/node)Network lifetime (s)Improvement over baseline (%)E‑ODMA + AOMDV1.72445–TAGA1.61476 + 6.9EigenTrust1.68460 + 3.4Proposed FL‑TEAR1.23564 + 23.8 Average energy consumption and network Figure 8 displays node residual energy profiles across 200 simulation rounds for all models under consideration. Additionally, FL-TEAR maintains a higher residual energy, indicating balanced power consumption and a slower rate of node resource depletion. Under high workloads, the model’s ability to sustain network functionality is demonstrated by the FL-TEAR curve’s slope, which is still gentler than baseline systems’. Residual energy over simulation rounds. Because FL-TEAR’s adaptive routing mechanism automatically reroutes data through nodes with more trust and remaining energy, it guarantees equitable energy use. By combining this method with lightweight aggregation at fog levels, it reduces processing and transmission costs and increases the effective lifetime of IoT networks. FL-TEAR thus provides a sustainable energy base for distributed intelligent networks of the future sort. Routing performance and QoS analysis The resilience of FL-TEAR in dynamic Fog–IoT situations was evaluated by evaluating their routing performance and Quality of Service (QoS). Packet delivery ratio (PDR), throughput, jitter, average end-to-end delay, and routing stability were all taken into account during the evaluation. The fitness-based aim that governs path selection in FL-TEAR strikes a balance between trust, energy, delay, and connectedness. What is meant by the path-level objective is: In this case, represents the aggregate path trust, the normalized residual-energy term, the delay cost, and the connectivity/reliability factor. While preserving QoS guarantees, the weights were chosen to prioritize security and energy efficiency. By avoiding energy holes and guaranteeing resistance to malevolent relays, routes that optimize are favored. Because FL-TEAR employs a diversified multi-hop selection and actively isolates low-trust networks, it consistently maintains a higher packet delivery ratio (PDR) even as traffic increases. Next-hop selection that considers stability and congestion-sensitive backoff reduces latency, while balanced path diversity maintains jitter within a specific range. Speed of transmission: The end-to-end throughput is influenced by fewer route breaks and an effective re-discovery overhead. The PDR trajectory is displayed in Fig. 9 after more than 200 simulation cycles. Compared to baselines, FL-TEAR exhibits a slower rate of degradation and a robust delivery under stress. The mean QoS metrics compiled in Table 12 validated that the proposed method provided higher reliability–latency trade-offs. Figure 12. Standardization of baselines and PDR for FL-TEAR over 200 simulation rounds is necessary. As the load increases, FL-TEAR retains a higher PDR while deteriorating more slowly. Packet delivery ratio (PDR) over 200 simulation rounds. Table 12QoS summary: mean values across 50 runs.ModelPDR (%)avg. delay (ms)Throughput (kbps)Jitter (ms)Route breaks (count)E-ODMA + AOMDV87.623124811.415TAGA88.419826410.113EigenTrust85.924024112.017Proposed FL-TEAR98.91582988.37 QoS summary: mean values across 50 runs. Scalability: PDR vs. network size under stress. PDR values are capped at 100% and represent the percentage of successfully delivered packets; the reported improvements are relative averages compared to baselines. Delay analysis and routing algorithm Figure 10 illustrate normalized comparison of average end‑to‑end delay for FL‑TEAR and baselines across 200 simulation rounds. Lower values indicate improved responsiveness and fewer route breaks. Algorithm 5 selects the optimal routing path by maximizing a composite fitness function that jointly optimizes trust, energy, delay, and reliability. Average delay over simulation rounds. Notes: (i) may also be aggregated by geometric mean to penalize low‑trust hops; (ii) can incorporate jitter; (iii) weights are tuned to satisfy QoS constraints while preserving energy. For completeness, the path‑fitness objective is: Fitness-based secure routing path selection. Scalability and convergence behavior Scalability and convergence are essential indicators of robustness for the proposed FL‑TEAR framework in heterogeneous Fog–IoT deployments. To analyze scalability, we varied the number of IoT devices and clusters while maintaining identical traffic, radio, and mobility settings as in Sect. “Baselines and evaluation metrics”. Convergence behavior was assessed by monitoring the global loss over federated rounds and the number of rounds required to satisfy a stopping criterion. The global loss at round is defined as: indicates the local loss at client , whereas represents the number of participating clients (or fog clusters). Equation (29), which represents the average of local losses for all clients or fog clusters, is the global federated loss function at round t. Convergence is declared when the standard has a tolerance that is in line with Sect. “Proposed method” (default , ) and is satisfied for consecutive rounds. Training is said to have converged if Condition (30) is true. Convergence: Because of more data diversity and stabilized gradient aggregation at the fog layer, FL-TEAR shows faster or comparable convergence when the number of nodes rises from to . Because the global loss decreases roughly exponentially with round index, secure aggregation is confirmed to be stable. Scalability (QoS): the packet delivery ratio (PDR) gradually decreases as increases, although FL-TEAR maintains a higher PDR than baselines at the same stress levels due to the fitness objective’s pruning of low-trust and energy-critical pathways. By avoiding crowded or unstable links, the multi-objective selection keeps delay and routing overhead within reasonable bounds. The rounds to convergence and QoS indicators are listed for representative network sizes in Table 13. The findings demonstrate that FL-TEAR preserves dependability at scale without compromising energy balance or learning stability. Table 13Scalability and convergence summary.Network size (N)Rounds to convergeFinal PDR (%)Avg. delay (ms)Routing overhead (%)Notes1008295.916210.8Converged with ε = 1e − 3; τ = 31507494.815810.4Faster via richer client mix2006993.416110.6Stable despite higher contention Scalability and convergence summary. Figure 11 displays Normalized versus federated rounds for FL‑TEAR at N = 100, 150, and 200 devices. Curves indicate exponential‑like decay and stable convergence behavior. Convergence of global loss across network sizes. Mean packet delivery ratio (%) as the number of IoT devices increases. FL‑TEAR retains higher PDR than baselines with graceful degradation (See Fig. 12). Restrictions and dangers to validity Using a simulated fog-cloud-IoT environment with up to 200 nodes, random waypoint mobility (speed 0–5 m/s), and up to 200 federated rounds, the suggested FL-TEAR framework was assessed in MATLAB R2024b. The following simplifying assumptions may affect generalization to real deployments, even though these settings capture important dynamics of large-scale IoT networks: (i) uniform initial energy distribution and idealized radio propagation; (ii) artificial malicious behavior (on–off, bad-mouthing, and poisoning attacks) instead of real-world adversaries; (iii) the absence of real hardware constraints (such as STM32-level clock drift and flash wear); (iv) constant traffic patterns instead of bursty real IoT workloads; and (v) perfect synchronization among layers without clock skew or packet loss during aggregation. Instead of using actual data that had been labeled by humans, ground-truth trust values were created by controlled assault injection. Despite being commonplace in the literature, these simulation-specific decisions pose the most risks to external validity. To further verify practical performance, more research on hardware testbeds and actual traffic traces is planned. Discussion Real IoT deployments inevitably suffer from non-IID data and concept drift due to heterogeneous sensing conditions and node-specific patterns. As comprehensively surveyed in41, common mitigation strategies include clustering, personalised models, and regularised objectives. In FL-TEAR, fog-level intermediate aggregation naturally creates implicit clusters of similar nodes, restricting accuracy degradation to only 4.2% under severe non-IID scenarios (70% of nodes having highly skewed local datasets). Continuous federated rounds enable adaptation to drift, while energy-aware weighting (Eq. 20) ensures fairness by preventing systematic exclusion of low-energy nodes. The framework simultaneously addresses security, privacy, and resource efficiency, aligning with the integration perspective in42. Cosine-similarity filtering combined with differential-privacy noise (σ = 0.1) and lightweight Paillier encryption protects against poisoning and eavesdropping, while energy-aware participant selection and fog pre-aggregation keep per-round overhead below 4% of local training time. Regarding the privacy–performance–efficiency see-saw described in43, the trust module effectively counters realistic poisoning and free-rider attacks (94% malicious influence reduction), with privacy noise causing only ~ 2.8% accuracy loss—a favourable trade-off. Mutable blockchains, as explored in44, offer promising extensions for audited rollback and safe unlearning of compromised updates. Finally, model size and update frequency heavily impact battery life, as analyzed in45. FL-TEAR mitigates this through fog-level pre-aggregation (reducing wide-area uploads by 78%) and selective scheduling based on residual energy, achieving 23% lower consumption than full-participation baselines while preserving convergence. Conclusion A federated, trust-energy-aware routing architecture that promotes safe, low-latency communication over hybrid fog-cloud-IoT networks was presented in this work. The approach offers three main advantages by combining hierarchical federated learning with fitness-based multipath selection, energy modeling, and multidimensional trust estimation. By combining robust, privacy-preserving aggregation with direct observations, it first increases trust reliability by reducing on–off behaviors, ballot stuffing, and poisoning without disclosing raw data. Second, by avoiding energy gaps and lowering rerouting churn, it maintains network lifespan through energy-aware route construction and balanced load distribution. Third, by choosing routes that simultaneously maximize trust, residual energy, connection stability, latency, and congestion, it stabilizes quality of service, resulting in faster convergence and greater delivery ratios. The suggested method regularly achieves higher trust accuracy, better packet delivery, lower delay, decreased routing overhead, and better convergence behavior, according to a comparative analysis against commonly used baselines. Crucially, these benefits endure in the face of changing circumstances and diverse resource profiles, demonstrating the flexibility and robustness of the framework (see Fig. 13). Future research will extend to hardware-in-the-loop testbeds, measure communication/compute overheads each federated round across device classes, and investigate defenses against sophisticated collusion and Byzantine updates, even as simulations confirm efficacy at scale. Additionally, we foresee auditability using lightweight cryptographic proofs and cross-layer integration (e.g., MAC/radio hints). All things considered, the findings show that federated, trust-energy-aware routing is a workable route to high-performance, safe, and sustainable fog-enabled IoT systems. Radar comparison of routing/trust methods (higher is better). Author contributions All authors contributed to the study conception and design. Data collection, simulation and analysis were performed by Fengchai Wang and Kun Wang. Data availability The datasets used and/or analyzed during the current study available from the corresponding author on reasonable request. Declarations Competing interests The authors declare no competing interests. Footnotes Publisher’s note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations. References Associated Data Data Availability Statement The datasets used and/or analyzed during the current study available from the corresponding author on reasonable request.