Significant efforts have been made for vehicle-to-vehicle communications that now enable the Internet of Vehicles (IoV). However, current IoV solutions are unable to capture traffic data both accurately and securely. Another drawback of current IoV models that are based on deep learning is that the methods used do not tune hyperparameters efficiently. In this paper, a new system known as Secure and Intelligent System for the Internet of Vehicles (SISIV) is developed. A deep learning architecture based on graph convolutional networks and an attention mechanism are implemented. In addition, blockchain technology is used to protect data transmission between nodes in the IoV system. Moreover, the hyperparameters of the generated deep learning model are intelligently selected using a branch-and-bound technique. To validate SISIV, experiments were conducted on four networked vehicle databases dealing with prediction problems. In terms of forecasting rate ( <inline-formula xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink"> <tex-math notation="LaTeX">$>$</tex-math> </inline-formula> 90%), F-measure ( <inline-formula xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink"> <tex-math notation="LaTeX">$>$</tex-math> </inline-formula> 80%), and attack detection ( <inline-formula xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink"> <tex-math notation="LaTeX">$<$</tex-math> </inline-formula> 75%), the results clearly show the superiority of SISIV over baseline systems. Moreover, compared to state-of-the-art solutions based on traffic prediction, SISIV enables efficient and reliable prediction of traffic flow in an IoV context.