Cognitive Radio Ad-hoc Networks (CRAHNs) combines characteristics of ad-hoc networks with cognitive radios to facilitate a variety of communication scenarios. However, these networks are subject to persistent attacks from internal and external adversaries, such as Masquerading, Spoofing, Spying, and Distributed Denial of Service (DDoS). Existing deep learning models proposed to counter these attacks suffer from complexity, real-time processing limitations, and a lack of network scalability. In addition, their limited IP tracing capabilities make them unsuitable for real-time deployments. To address these issues, this paper proposes a novel blockchain-based model for deep traffic pattern analysis and mitigation of malicious attacks in CRAHNs. The proposed model employs a multi-step methodology. The collected traffic patterns are then used to train a deep Convolutional Neural Network (dCNN) model. This trained model permits the temporal classification of incoming real-time traffic packets. The packets are stored on a distributed network based on blockchain technology to ensure data integrity, transparency, and traceability. This blockchain implementation renders the packets immutable and easily accessible, while also facilitating the recommendation of improved mitigation strategies. The blockchain employs a Proof-of-Trust (PoT) consensus mechanism and is managed via a Genetic Algorithm (GA)-based sidechaining model, which significantly reduces access and writing delays for various packets. The proposed model achieves a significant reduction in communication delay in comparison to existing models, with decreases of 35.4%, 19.5%, and 23.5% for BIDS, BIST WM, and GAN, respectively. Additionally, energy consumption is reduced by 18.5%, 18.3%, and 24.5%, respectively. In addition, the model exhibits an increase in throughput of 14.5%, 16.4%, and 15.5%, respectively. Lastly, it improves the accuracy of attack detection during various communications by 8.3%, 23.2%, and 8.3%, respectively. This paper presents a promising solution for enhancing the security of CRAHNs by providing a robust defense against malicious attacks and real-time protection for dynamic ad hoc networks. The integration of deep learning, blockchain technology, and optimization techniques results in significant improvements in performance metrics, demonstrating the potential of the proposed model for ensuring the security and integrity of CRAHNs.