With rapid growth of electric vehicles and development of active distribution network
the dispatching optimization of power systems containing electric vehicles is becoming increasingly important. In this paper
a three levels distributed algorithm including the dispatching optimization of electric vehicle battery swapping stations is proposed. When compared to traditional centralized algorithms
this distributed algorithm is more suitable for modern power systems with dispersed layouts. On this basis
a blockchain data storage and consensus mechanism for this model is constructed to guarantee tamper resistance and traceability of all the historical data. In addition
a vehicle-to-grid(V2G)pricing model for electric vehicle battery swapping stations fitting this algorithm is proposed
which can accurately guide the V2G behaviors of electric vehicle battery swapping stations. For potential line congestions during the optimization process
a dynamic constraint set method is used to revise the optimization results. Finally
a 15-node test system is built to verify the applicability of the model in power systems with a distributed layout.