With the rapid development of the Internet of Vehicles (IoV), vehicle networks will generate large amounts of data. Vehicle-to-Vehicle (V2V) data sharing can improve driving experience and quality of service, and Vehicle-to-Roadside unit (V2R) communication can improve road transport efficiency. A certain amount of bandwidth is consumed in the process of data sharing between V2V and V2R, and when multiple vehicles request data from the RSU at the same time, there may be network delay or congestion. Therefore, the vehicle obtains data faster by requesting high bandwidth from the RSU. However, since the bandwidth resources of RSUs are limited, optimal bandwidth service strategies need to be investigated. In addition, in order to ensure the safety, efficiency and traceability of data sharing between V2V and V2R, a blockchain-supported IoV needs to be established. Therefore, we design a blockchain-based framework for V2V and V2R transaction framework that integrates DAG blockchain and modern cryptography. The framework ensures security and scalability during the execution of data exchange and completion of bandwidth transactions, improves the service quality of vehicles and realizes decentralized payment. In this work, a two-stage Stackelberg game is established under two pricing schemes of uniform pricing and discriminatory pricing to jointly maximize the benefits of vehicles and RSUs. In Stage I, the RSU sets the corresponding bandwidth service and pricing strategy. In Stage II, the vehicle decides the service demand according to the observed pricing strategy. The optimal bandwidth allocation and pricing strategy between the RSU and the vehicle is determined through the game of both parties, and the existence and uniqueness of the two-stage subgame Nash equilibrium is analyzed by applying backward induction. The correctness of the model is verified by experiments, and the comparative analysis shows that the proposed model has high throughput.