The advancements in telematics and communication technology for automobiles have contributed to the development of Vehicular ad Hoc Networks (VANETs). These networks serve as the foundation for Intelligent Transportation Systems (ITS). Communication across various VANET entities is challenging due to the open communication environment and the highly dynamic nature of VANETs. One of the major challenges in VANETs is ensuring stable and secure transmission. To address these factors, several studies have been conducted. The article discusses a clustering algorithm for VANETs that leverages SCVAN-DPSO to create stable clusters and provide secure communication for mitigating malicious nodes. Additionally, Hyperelliptic Curve Cryptography (HECC) with signcryption in blockchain is proposed. This algorithm is designed to identify and mitigate malicious nodes, ensuring robust and secure communication within the network. To verify vehicles in VANETs, this study also suggests a safe and reliable key management method that generates and stores cryptographic keys using blockchain’s distributed ledger technology. By doing so, the risk of rogue nodes is reduced, and a safe, stable connection between vehicles is guaranteed. This work has been implemented using NS 3.34 simulation with the SUMO real-time traffic mobility simulator, and its performance has been evaluated. The proposed algorithm SCVAN-BKM provides a 99.6 % packet delivery ratio for 20 nodes, 0.4 % packet loss, end-to-end delay of 32.65 ms, throughput of 9.522 Mbps, and a cluster lifetime of 105 s. As the number of nodes increases in the communication zone, stable communication is maintained due to the clustering algorithm used in the proposed approach, as cluster formation supports stability in the high-mobility nature of vehicles, while secure communication is ensured using blockchain technology. The findings demonstrate that our approach is more effective and yields better outcomes than existing systems.