Wireless service providers (WSPs) are seeking cooperation to share both resources (spectrum, infrastructures) and costs. In particular, cooperation is critical for vehicle-to-everything (V2X) applications that value quality-of-service foremost. However, cooperation is inefficient without strong trust bases. Recently, blockchain arises as a promising solution to decentralized trust, owing to its transparency and immutability. Therefore, we propose a WSP cooperation framework based on blockchain, which keeps a shared ledger on resource utilization. In this paper, we first study the WSP selection problem of vehicles by evolutionary game. Then, we make the blockchain public to vehicles to maintain its decentralization and enhance its security by crowdsourcing idle computing resources from vehicles. To deal with the mobility of vehicles, as well as to improve the consensus efficiency, we propose delegated proof-of-work (DPoW) scheme, which introduces delegate nodes for participating in the blockchain consensus on behalf of the vehicles. The alternating direction method of multipliers (ADMM) optimization framework is further used to derive optimal consensus parameters including block size, computing resource demand of delegate nodes, and prices paid for vehicles. We conduct extensive simulations to show the effectiveness of the proposed methods.