Recently, researchers have applied blockchain technology in vehicular networks to take benefit of its security features, such as confidentiality, authenticity, immutability, integrity, and non-repudiation. The resource-intensive nature of the blockchain consensus algorithm makes it a challenge to integrate it with vehicular networks due to the time-sensitive message dissemination requirements. Moreover, most of the researchers have used the Proof-of-Work consensus algorithm, or its variant to add a block to a blockchain, which is a highly resource-intensive process with greater latency. In this paper, we propose a consensus algorithm for vehicular networks named as Vehicular network Based Consensus Algorithm (VBCA) to ensure data security across the network using blockchain that maintains a secured pool of confirmed messages exchanged in the network. The proposed scheme, based on a consortium blockchain, reduces average transaction latency, and increases the number of confirmed transactions in a decentralized manner, without compromising the integrity and security of data. The simulation results show improved performance in terms of confirmed transactions, transaction latency, number of blocks, and block creation time.