ISSN 2277-2685 IJESR/Jan-Mar 2023/ Vol-13/Issue-1/117-132 Dharma Teja Valivarthi et. al., / International Journal of Engineering & Science Research 117 Fog Computing-Based Optimized and Secured IoT Data Sharing Using CMA-ES and Firefly Algorithm with DAG Protocols and Federated Byzantine Agreement Dharma Teja Valivarthi, Tek Leaders, Texas, USA teja89.ai@gmail.com Sreekar Peddi, Tek Leaders, Texas, USA sreekarpeddi95@gmail.com Swapna Narla, Tek Yantra Inc, California, USA swapnanarla8883@gmail.com Sai Sathish Kethu, NeuraFlash, Georgia, USA skethu86@gmail.com Durai Rajesh Natarajan, Estrada Consulting Inc, California, USA durairajeshnatarajan@gmail.com ABSTRACT Background information: Secure, low-latency data sharing has become more difficult as a result of the Internet of Things' explosive expansion. This paper suggests a fog computing system that uses Federated Byzantine Agreement (FBA) for safe and scalable data sharing, Directed Acyclic Graph (DAG) protocols, and Covariance Matrix Adaptation Evolution Strategy (CMA-ES) and Firefly Algorithm for optimization. By addressing latency and security, the method guarantees effective data sharing. In a variety of IoT scenarios, the results demonstrate increased throughput, security, and decreased latency. Methods: The project incorporates DAG protocols for data routing, FBA for consensus, and CMA-ES and Firefly Algorithm for optimization in fog computing settings. Using a decentralized, fault-tolerant architecture to optimize resource utilization and improve security, these methods guarantee reliable, low-latency data transfer. Objectives: The goal of this research is to create a framework for safe and effective IoT data sharing based on fog computing. Using CMA-ES and the Firefly Algorithm for optimization, it aims to lower latency and improve scalability. It also employs FBA for strong consensus processes and DAG protocols for organized data routing, guaranteeing data integrity and defence against malevolent attacks. Results: Data sharing was significantly enhanced by the suggested paradigm, which also showed increases in throughput of 94%, energy efficiency of 85%, and latency reduction of