## 1 Introduction  
SDN centralizes device management within a specified area of the network. SDN controllers oversee communication among a wide array of Internet of Things (IoT) devices. However, integration of these systems brings forth certain challenges [1, 2]. Primarily, enhancements in quality-of-service metrics such as throughput, packet loss rate, delay, and jitter are limited. Additionally, security concerns persist, encompassing various attack vectors, privacy issues, and unaddressed vulnerabilities [3]. Research attention has been directed towards intrusion detection systems (IDS) to classify security breaches within the SDN framework [4, 5]. Addressing latency and extensive IoT traffic in SDN is achieved by leveraging the capabilities of 5G and offering rapid and adaptable support to end users. Despite the benefits, IoT devices encounter challenges concerning security and limited resources amid substantial data traffic [6]. Consequently, the evolving concept of IDS plays a vital role in these integrated paradigms. Methods such as multi-stage intrusion detection are applied to detect attack packets operating within the data plane, control plane, or both. Despite the capability of several IDS techniques to differentiate diverse attacks, a common issue is the prevalence of false alarms [7, 8]. Artificial intelligence (AI) shows promise in achieving low false alarm rates while detecting malicious data packets network-wide. However, existing deep learning algorithms face challenges in detecting intrusions and new attack types, which are affected by high computational complexity, inadequate training data, and lengthy operation times [9]. This is especially problematic for resource-constrained IoT devices. Blockchain technology offers a lightweight, effective solution to address these issues. Blockchain's immutable nature ensures transparency and resistance to tampering [10; 11; 12], making it ideal for enhancing security and trustworthiness in 5G networks. In an SDN controller, transactions are executed in a single location due to the global architecture [13]. The main role of blockchain in this work is to enhance the security and trustworthiness of the 5G network, particularly in the context of intrusion detection and prevention. In an SDN controller, transactions are executed in a single location due to the global architecture [13]. It provides a decentralized ledger for registering and authenticating mobile users, ensuring only authorized devices access the network [14]. This research introduces an innovative intrusion detection system to address cyber-security challenges in advanced network environments, especially in 5G SDN networks where security is paramount. The suggested work flow diagram consists of a data acquisition layer, where users register and authenticate using the lightweight encryption algorithm through a trusted third party (TTP), which verifies user identity and records it on the blockchain ledger for network access. At the switches layer, the optimal switches are selected using the mud-ring algorithm, and the data flow rules are secured by using the blockchain ledger and searchable encryption algorithms. Blockchain also helps maintain the integrity of network switches and flow tables by recording and verifying transactions and configurations. The domain controller layer utilizes binarized deep spiking capsule fire hawk neural network (BSHNN) for real-time data packet classification within the control plane layer, while the smart controller layer uses enhanced adapting hidden attribute-weighted naive bayes (EAWNB) to identify suspicious packets during data transmission to the user's application. The proposed system addresses resource limitations in SDN controllers and switches, ensuring network efficiency and reliability [15]. An integrated security system with five layers is proposed for the protection of mobile users and network integrity.