###### Abstract  
In modern society, the proliferation of electric vehicles (EVs) is continuously increasing, presenting new challenges that necessitate integration with smart grids. The operational data from electric vehicles are voluminous, and the secure storage and management of these data are crucial for the efficient operation of the power grid. This paper proposes a novel system that utilizes blockchain technology to securely store and manage the black box data of electric vehicles. By leveraging the core characteristics of blockchain--immutability and transparency--the system records the operational data of electric vehicles and uses federated learning (FL) to predict their energy consumption based on these data. This approach allows the balanced management of the power grid's load, optimization of energy supply, and maintenance of grid stability while reducing costs. Additionally, the paper implements a searchable black box data storage system using a public blockchain, which offers cost efficiency and robust anonymity, thereby enhancing convenience for electric vehicle users and strengthening the stability of the power grid. This research presents an innovative approach to the integration of electric vehicles and smart grids, exploring ways to enhance the stability and energy efficiency of the power grid. The proposed system has been validated through real data and simulations, demonstrating its effectiveness and performance in managing black box data and predicting energy consumption, thereby improving the efficiency and stability of the power grid. This system is expected to empower electric vehicle users with data ownership and provide power suppliers with more accurate energy demand predictions, promoting sustainable energy consumption and efficient power grid operations. Electric vehicles; blockchain; federated learning; energy management; data security; machine learning +
Footnote †: journal: Applied Sciences  
the integration of intermittent renewable energy sources such as solar and wind into the grid, coupled with the mismatch between EV charging/discharging demands and output patterns, exacerbates the challenges in balancing power supply and demand [5]. Studies by [PERSON] and [PERSON] [5] have shown that in scenarios where the California Independent System Operator (CAISO) has a renewable generation share of 33%, the variability in net load can increase to up to 13 GW/h. This necessitates increased regulation and spinning reserve capacities, leading to significant additional costs. Moreover, such system instability negatively impacts the renewable energy hosting capacity, potentially hindering long-term energy transition goals. Therefore, sophisticated forecasting of EV demand patterns and consider charging scheduling are essential for stable and economical power system operations. During the operation of EVs, the collection of various data, including vehicle location, energy usage, and battery energy remaining, through black box systems plays a crucial role in predicting power demand and optimizing charging schedules [6]. For instance, [PERSON] et al. [7] have successfully developed a deep neural network-based model for predicting energy consumption using GPS and battery management system (BMS) data collected from vehicle operations, achieving an error rate within 3.5%. However, the centralized management of such sensitive operational data can make them vulnerable to hacking or insider attacks [8]. According to [PERSON] et al. [9], the incidence of cyberattacks related to automotive data has increased approximately 18-fold from 2010 to 2019, with attacks targeting telematics and vehicle monitoring systems showing significant growth. From the perspective of EV users, the data subjects, it is challenging to control how their data are collected and utilized, leading to persistent concerns about privacy breaches. Research by [PERSON] and [PERSON] [10] revealed that about 67% of respondents expressed privacy concerns regarding the collection of connected car data.