The emergence of embedded and connected smart technologies, systems, and devices has enabled the concept of smart cities by connecting every “thing’‘ to the Internet and in particular in transportation through the Internet of Vehicles (IoV). The main purpose of IoV is to prevent fatal crashes by resolving traffic and road safety problems. Nevertheless, it is paramount to ensure secure and accurate transmission and recording of data in “Vehicle-to-Vehicle’‘ (V2V) and “Vehicle-to-Infrastructure” (V2I) communication. To improve “Vehicle-to-Everything” (V2X) communication, this work uses Blockchain technology for developing a Blockchain-based IoT system aimed at establishing secure communication and developing a fully decentralized cloud computing platform. Moreover, the authors propose a model-based framework to validate the proposed approach. This framework is mainly based on the use of the Attack Trees (AT) and timed automaton (TA) formalisms in order to test the functional, load and security aspects. An optimization phase for testers placement inspired by fog computing is proposed as well.