This invention seeks protection for a
consensus method for vehicle-to-everything (V2X) networks based on a two-layer
blockchain, belonging to the field of V2X security technology. It includes: S1, constructing a two-layer architecture of a bottom-layer sharded chain and a top-layer main chain; S2, selecting vehicle nodes participating in the sharded chain
consensus through a multi-dimensional
consensus node
election algorithm; S3, determining the sharded chain consensus master node using a hidden master node election mechanism; S4, completing consensus within the sharded chains using a practical Byzantine fault-tolerant
algorithm; S5, the main chain adopts a
directed acyclic graph consensus mechanism and introduces a dynamic
verification quantity calculation model. The advantages of this invention are: (1) The multi-dimensional
election algorithm selects high-quality nodes, improving consensus stability and security; (2) The layered architecture divides the V2X network into parallel consensus domains, with the bottom layer handling local consensus in parallel to reduce
communication complexity, and the top layer coordinating cross-
shard transactions to improve
scalability; (3) The dynamic
verification quantity calculation model adaptively adjusts the
verification quantity according to network load, significantly improving
system throughput.