Power grid federal learning block chain security management method, system and device, and storage medium
By deploying local training strategy contracts and multi-dimensional anomaly detection in power grid federated learning, and combining them with blockchain technology, the problems of insufficient model integrity verification and unfair node weight allocation are solved, thus realizing the credibility and accuracy of power grid federated learning.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- GUANGXI POWER GRID CORP
- Filing Date
- 2025-12-16
- Publication Date
- 2026-05-12
AI Technical Summary
In the context of power grid environments, federated learning architectures suffer from problems such as insufficient model integrity verification, lack of training process auditing, inability to guarantee the credibility of the global model, insufficient ability to detect abnormal nodes, and lack of adaptability in node weight allocation.
By deploying local training strategy contracts to record key parameters of the training process, introducing multi-dimensional anomaly detection, verifying the integrity of the local model, calculating node reputation scores, and dynamically allocating aggregation weights based on data volume and quality factors, blockchain technology is used to ensure the integrity and traceability of the model.
It achieves full traceability of the power grid federated learning process, identifies and isolates abnormal nodes, prevents model poisoning attacks, enhances anti-attack capabilities, improves the accuracy and fairness of the global model, and reduces the risk of misoperation.
Smart Images

Figure CN122021964A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of blockchain security technology, and in particular to a method, system, device and storage medium for blockchain security management of power grid federated learning. Background Technology
[0002] The smart meters, substation monitoring equipment, distribution automation terminals, and power grid dispatching systems deployed in the power grid system generate massive amounts of power data. This data is mainly analyzed through machine learning models to output power grid status monitoring, fault prediction, load forecasting, and power quality analysis data. However, traditional centralized machine learning methods require the raw data from each power grid node to be collected on a central server, which poses a risk of data leakage. If federated learning is used as a distributed machine learning technology, it allows each power grid node to collaboratively train the model without sharing the raw data, and also provides a way to solve the problem of power grid data privacy.
[0003] However, existing federated learning architectures have several problems in power grid applications. The lack of unified oversight and auditing among power grid nodes during local model training makes it difficult to ensure the standardization of the training process. The power grid dispatch center lacks verification methods when receiving local models from each node, making it vulnerable to model poisoning attacks from malicious nodes. Power grid nodes cannot verify whether the received global model has been tampered with, posing a risk of receiving incorrect models and causing power grid malfunctions. There is a lack of transparent collaboration mechanisms among power grid operators, making it unclear which nodes participated in model training and lacking traceability. Furthermore, existing solutions do not fully consider the differences in data quality and historical performance among different power grid nodes during model aggregation, leading to the aggregation results being affected by low-quality nodes and reducing the accuracy of the global model. Summary of the Invention
[0004] In view of the problems existing in the prior art, the present invention is proposed.
[0005] Therefore, the problem to be solved by this invention is how to address issues such as insufficient model integrity verification, lack of training process auditing, inability to guarantee global model credibility, insufficient abnormal node detection capability, and lack of adaptability in node weight allocation in federated learning architectures under power grid environments.
[0006] To solve the above-mentioned technical problems, the present invention provides the following technical solution: In a first aspect, embodiments of the present invention provide a power grid federated learning blockchain security management method, which includes: acquiring local power data of each node of the power grid, deploying local training strategy contracts to each power grid node, recording key parameters of the training process and generating local model hash values; Multi-dimensional anomaly detection is introduced to monitor gradient anomalies, loss function anomalies, and model similarity anomalies in real time during the training process. Each power grid node performs local model training based on local power data and generates a local model by dynamically adjusting the learning rate. Verify the integrity of the local model by calculating the local model hash value and comparing it with the local training strategy contract record value, verifying the standardization of training parameters and the accuracy of model, and calculating the node reputation score. Deploy the aggregation strategy contract to manage the global model aggregation process and record the information of participating nodes. Assign aggregation weights based on the amount of node data and data quality factors. Distribute the global model to each power grid node according to the list of participating nodes in the aggregation strategy contract.
[0007] As a preferred embodiment of the power grid federated learning blockchain security management method described in this invention, the local power data includes power grid operation status data, power quality monitoring data, load forecast data, and fault diagnosis data, and the local training strategy contract includes recording node identifier, model architecture, training rounds, number of cycles, model accuracy, local model hash value, gradient norm, loss function value, and training timestamp.
[0008] As a preferred embodiment of the power grid federated learning blockchain security management method described in this invention, the multi-dimensional anomaly detection includes calculating the degree of deviation between the gradient update of each node and the average gradient of all nodes, and determining the gradient anomaly when the degree of deviation exceeds the anomaly threshold. Calculate the difference between the loss function value of each node and the average loss value, as well as the rate of change of loss. When the difference or rate of change exceeds the threshold, it is determined that the loss function is abnormal. Calculate the similarity between the model parameters of each node and the global model. If the similarity is lower than the threshold, it is judged as an abnormal model similarity.
[0009] The beneficial effects of this preferred technical solution are as follows: By calculating the deviation of the gradient update of each node from the average gradient of all nodes, nodes with abnormal gradient changes during training can be identified, preventing malicious nodes from polluting the global model by injecting abnormal gradients; by analyzing the difference between the loss function value of each node and the average loss value, as well as the rate of change of loss, nodes with abnormal convergence or divergence during training can be discovered, eliminating local models with substandard training quality; by calculating the similarity between the model parameters of each node and the global model, nodes that deviate from the normal training trajectory can be detected, preventing model poisoning attacks and backdoor attacks. These three dimensions of anomaly detection complement each other, constructing a complete abnormal behavior monitoring system from the gradient, loss, and model levels, enabling the identification and isolation of abnormal nodes before the local model is submitted.
[0010] As a preferred embodiment of the power grid federated learning blockchain security management method described in this invention, the method further includes: encrypted transmission of power grid data before verifying the integrity of the local model. Each power grid node encrypts its local model; a secure communication key is established through key exchange. Each power grid node digitally signs its local model; the digital signature is then verified.
[0011] As a preferred embodiment of the power grid federated learning blockchain security management method of the present invention, wherein: verifying the integrity of the local model includes receiving an encrypted local model and a local training strategy contract; Decrypt the local model; calculate the hash value of the local model and compare it with the hash value recorded in the local training strategy contract; Check whether the training parameters meet the preset specifications; check whether the model accuracy meets the requirements of power grid applications. Check if the gradient norm is within the preset range; detect if the model parameter distribution is abnormal. Node reputation scores are calculated based on historical performance and current round performance.
[0012] As a preferred embodiment of the blockchain security management method for power grid federated learning described in this invention, the aggregation strategy contract includes: recording the unique identifier of the global model; recording the training round of the current federated learning; recording the list of power grid node IDs participating in this round of aggregation; recording the accuracy index of the global model; recording the integrity hash value of the global model; recording the aggregation weight coefficient of each participating node; recording the list of node IDs detected as abnormal; and recording the consensus verification result status.
[0013] As a preferred embodiment of the power grid federated learning blockchain security management method of the present invention, the step of allocating aggregation weights based on node data volume and data quality factor includes obtaining the data volume of each power grid node; Calculate the data quality factor for each node, taking into account the security scores from multiple historical rounds; dynamically calculate the aggregation weight of each node in the current round based on the data volume and data quality factor; reduce or remove the aggregation weight of abnormal nodes.
[0014] The beneficial effects of this preferred technical solution are as follows: By acquiring the data volume of each power grid node, nodes with larger data volumes can obtain higher weights in aggregation, ensuring that the aggregation results better reflect the training effect of rich data; by calculating the data quality factor and comprehensively considering the security scores of multiple historical rounds, nodes with stable historical performance and high training quality can obtain higher trust levels, avoiding the influence of accidental performance in a single instance; dynamically calculating aggregation weights based on data volume and data quality factors can adjust the influence of each node according to its actual contribution, improving the fairness and accuracy of aggregation compared to fixed weight methods; reducing or removing the aggregation weight of abnormal nodes can further isolate the influence of abnormal nodes during the aggregation stage, and even if some abnormal nodes pass the initial detection, their destructive effect on the global model can be reduced through weight adjustment, which is suitable for the actual needs of power grid applications.
[0015] In a second aspect, embodiments of the present invention provide a power grid federated learning blockchain security management system, which includes a data acquisition module, which acquires local power data of each node of the power grid, deploys local training strategy contracts to each power grid node, records key parameters of the training process and generates local model hash values. The model training module introduces multi-dimensional anomaly detection to monitor gradient anomalies, loss function anomalies, and model similarity anomalies in real time during the training process. Each power grid node performs local model training based on local power data and generates a local model by dynamically adjusting the learning rate. The data comparison module verifies the integrity of the local model, calculates the hash value of the local model and compares it with the record value of the local training strategy contract, verifies the standardization of training parameters and the accuracy of the model, and calculates the node reputation score. The data distribution module deploys aggregation strategy contracts, manages the global model aggregation process and records information of participating nodes, allocates aggregation weights based on node data volume and data quality factors, and distributes the global model to each power grid node according to the list of participating nodes in the aggregation strategy contract.
[0016] Thirdly, embodiments of the present invention provide a computer device, including a memory and a processor, wherein the memory stores a computer program, wherein: when the computer program instructions are executed by the processor, they implement the steps of the power grid federated learning blockchain security management method as described in the first aspect of the present invention.
[0017] Fourthly, embodiments of the present invention provide a computer-readable storage medium having a computer program stored thereon, wherein: when the computer program instructions are executed by a processor, they implement the steps of the power grid federated learning blockchain security management method as described in the first aspect of the present invention.
[0018] The beneficial effects of this invention are as follows: By deploying local training strategy contracts to each power grid node, this invention records key parameters such as node identifier, model architecture, training rounds, model accuracy, and local model hash value, achieving full traceability of the power grid federated learning training process and solving the problem of lack of auditing in the training process of existing solutions; it introduces multi-dimensional anomaly detection to monitor training anomalies in real time from three levels: gradient, loss function, and model similarity, identifying nodes with abnormal gradient changes, abnormal training convergence, and deviations from the normal training trajectory before local model submission, preventing malicious nodes from polluting the global model through model poisoning attacks, and improving the anti-attack capability of power grid federated learning; through hash value comparison, training parameter standardization verification, and model accuracy... A six-layer verification mechanism, including accuracy compliance verification, gradient norm interval verification, model parameter distribution detection, and reputation score calculation, rejects local models that fail to meet accuracy standards or exhibit anomalies from participating in aggregation, ensuring that only high-quality models contribute to the global model. Aggregation weights are dynamically allocated based on node data volume and data quality factors, granting higher weights to nodes with large data volumes and stable historical performance, while reducing or removing the weights of abnormal nodes to prevent low-quality nodes from lowering the accuracy of the global model. This improves the fairness of aggregation compared to fixed-weight methods. Through blockchain Byzantine fault-tolerant consensus verification and tamper-proof storage, each power grid node can verify the hash value to confirm that the model has not been tampered with when receiving the global model, eliminating the risk of power grid malfunctions caused by receiving incorrect models. Attached Figure Description
[0019] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0020] Figure 1 A flowchart for learning blockchain security management methods for a federated power grid. Figure 2 A diagram of computer equipment used for learning blockchain security management methods in a federated power grid. Figure 3 A framework diagram of a smart contract-based power grid federated learning security management system for power grid federated learning blockchain security management methods; Figure 4 A flowchart illustrating the workflow of a smart contract-based local training strategy and verification process for power grid nodes to learn blockchain security management methods in a federated power grid. Figure 5 A flowchart illustrating the workflow of a global power grid model aggregation strategy based on smart contracts for learning blockchain security management methods in a federated power grid system. Figure 6A schematic diagram of a power grid federated learning security management system based on smart contract policy control, which is a blockchain security management method for power grid federated learning; Figure 7 A schematic diagram of a smart contract-based security mechanism for power grid federated learning blockchain security management. Detailed Implementation
[0021] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
[0022] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of the invention. Therefore, the invention is not limited to the specific embodiments disclosed below.
[0023] Secondly, the term "an embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The phrase "in one embodiment" appearing in different places throughout this specification does not necessarily refer to the same embodiment, nor is it a single embodiment or an embodiment selectively excluded from other embodiments.
[0024] Example 1 Reference Figure 1 - Figure 2 This is the first embodiment of the present invention, which provides a method for secure management of a power grid federated learning blockchain, including: S100: Obtain local power data from each node of the power grid, deploy local training strategy contracts to each power grid node, record key parameters of the training process, and generate local model hash values.
[0025] S200: Introduces multi-dimensional anomaly detection to monitor gradient anomalies, loss function anomalies, and model similarity anomalies in real time during the training process. Each power grid node performs local model training based on local power data and generates a local model by dynamically adjusting the learning rate.
[0026] S300: Verify the integrity of the local model, calculate the local model hash value and compare it with the local training strategy contract record value, verify the standardization of training parameters and the accuracy of model, and calculate the node reputation score.
[0027] S400: Deploys aggregation strategy contracts, manages the global model aggregation process and records information of participating nodes, allocates aggregation weights based on node data volume and data quality factors, and distributes the global model to each power grid node according to the list of participating nodes in the aggregation strategy contract.
[0028] It should be noted that the power data of each node in the power grid system is sensitive and privacy-sensitive, involving user electricity consumption behavior and grid operation status. Traditional centralized machine learning requires the raw data to be aggregated to a central server, posing a risk of data leakage. While federated learning allows nodes to collaboratively train models without sharing raw data, the lack of unified oversight during local training makes them vulnerable to model poisoning attacks by malicious nodes. The dispatch center lacks verification methods when receiving local models from each node, failing to ensure model integrity. When receiving the global model, nodes cannot verify whether it has been tampered with, posing a risk of receiving incorrect models and causing grid malfunctions.
[0029] Therefore, through steps S100-S400, a local training strategy contract is deployed to record key parameters of the training process for each node, outputting full traceability of the training process; multi-dimensional anomaly detection is introduced to monitor gradient, loss function, and model similarity anomalies in real time, enabling the identification and isolation of abnormal nodes during the training phase; hash value comparison and multi-level verification ensure the integrity of the local model and prevent malicious nodes from submitting and polluting the model; an aggregation strategy contract is deployed to record information on participating nodes and aggregation weights, dynamically adjusting weight allocation based on data quality to reduce the impact of low-quality nodes on the global model; the finally generated global model undergoes integrity verification and blockchain storage, allowing each node to verify its credibility upon receipt.
[0030] Example 2 Reference Figure 2 - Figure 7 This is the second embodiment of the present invention.
[0031] In this embodiment, the local power data and local training strategy contract in step S100 include the following step A1: A1: Local power data includes power grid operation status data, power quality monitoring data, load forecasting data, and fault diagnosis data. The local training strategy contract includes recording node identifier, model architecture, training rounds, number of cycles, model accuracy, local model hash value, gradient norm, loss function value, and training timestamp.
[0032] Specifically, each node in the power grid acquires local power data through edge computing and data acquisition devices deployed in substations, distribution stations, smart meter concentrators, and dispatch centers. Power grid operation status data includes real-time voltage, current, active power, reactive power, frequency, and phase angle data collected by each node. The voltage acquisition range is 0-500kV, the current acquisition range is 0-5000A, and the acquisition ranges for active and reactive power are determined based on the node capacity.
[0033] Power quality monitoring data includes voltage deviation, frequency deviation, three-phase unbalance, total harmonic distortion (THD), and voltage sag and rise event records. Voltage deviation is calculated by dividing the difference between the actual voltage and the rated voltage by the rated voltage. Frequency deviation is calculated by the difference between the actual frequency and the standard frequency of 50Hz. Three-phase unbalance is calculated as the ratio of the negative-sequence component to the positive-sequence component of the three-phase voltage or current. THD is calculated as the ratio of the square root of the sum of the squares of all harmonic values to the fundamental frequency value. A voltage sag event is defined as a voltage drop below 90% of the rated value for more than 10 ms, and a voltage rise event is defined as a voltage rise above 110% of the rated value for more than 10 ms. Each node performs statistical analysis on the power quality monitoring data, calculating the average, maximum, and minimum voltage deviation, the average and standard deviation of the frequency deviation, the average three-phase unbalance, the average THD, and the number and duration of voltage sag and rise events within one hour.
[0034] Load forecasting data includes historical load data and environmental factor data. Historical load data includes hourly load values over the past 30 days, daily peak load times, valley load times, daily load rate, and load volatility. Environmental factor data includes temperature, humidity, wind speed, rainfall, holiday identifiers, and weekday identifiers. Each node aligns the historical load data and environmental factor data by time to form the input feature vector for load forecasting. The feature vector includes the load value of the 24 hours prior to the current time, the load values of the same time in the previous 7 days, temperature, humidity, time codes (including hour codes, weekday codes, and month codes), and holiday identifiers.
[0035] Fault diagnosis data includes records of abnormal operating parameters of power grid equipment, protection action records, equipment maintenance records, and historical fault records. Records of abnormal operating parameters include abnormal transformer oil temperature, abnormal switch contact temperature, and abnormal cable partial discharge. Protection action records include the time, location, and parameters of overcurrent protection actions, differential protection actions, and distance protection actions. Equipment maintenance records include the maintenance time, maintenance items, maintenance results, and information on replaced parts. Historical fault records include fault type (short circuit fault, ground fault, open circuit fault), fault location, fault cause, fault impact range, and fault handling time. Each node performs feature extraction on the fault diagnosis data, converting textual data into numerical features, such as encoding fault types as 0 – short circuit fault, 1 – ground fault, and 2 – open circuit fault.
[0036] The strategy control center deploys local training strategy contracts to each power grid node. These local training strategy contracts are in the form of smart contracts and include the following fields: The node identifier field records the node's unique ID, which consists of 16 hexadecimal characters. The first 4 digits indicate the node type (0001 for substations, 0002 for distribution stations, 0003 for smart meter concentrators, and 0004 for dispatch centers), the middle 8 digits represent the geographic location code, and the last 4 digits represent the node sequence number. The model architecture field records the type of machine learning model used by the node: Long Short-Term Memory (LSTM) network for load forecasting tasks, Convolutional Neural Network (CNN) for fault diagnosis tasks, and Fully Connected Neural Network (DNN) for power quality analysis tasks.
[0037] The local model hash value field records the hash value of the local model generated after node training, using the SHA-256 hash algorithm. The hash value calculation process is as follows: all parameters of the local model are arranged in hierarchical order, concatenated into a long vector, and then the long vector is subjected to SHA-256 hash operation to generate a 256-bit hash value. The gradient norm field records the L2 norm of the model gradient update during local training. The formula for calculating the L2 norm is: in, This represents the gradient value of the i-th parameter of the model, and n represents the total number of model parameters.
[0038] The loss function value field records the loss function value of the last cycle during local training. For load forecasting tasks, the mean squared error (MSE) loss function is used; for fault diagnosis tasks, the cross-entropy loss loss function is used; and for power quality analysis tasks, the mean squared error loss function is used.
[0039] The strategy control center deploys the local training strategy contract to the blockchain network, and each grid node obtains the contract content by accessing the blockchain. Before starting local training, each node reads the model architecture field in the contract and initializes the local model according to the model architecture. The node downloads the initial parameters of the global model or the parameters of the previous round of global model from the strategy control center as the starting point for local training. During local training, the node monitors the training rounds, epochs, model accuracy, gradient norm, and loss function value in real time and records these parameters in the local training strategy contract. After completing local training, the node calculates the hash value of the local model, records the training timestamp, submits the updated local training strategy contract to the blockchain network, and simultaneously submits the encrypted local model to the strategy control center.
[0040] In this embodiment, the multi-dimensional anomaly detection and local model training in step S200 include the following step B1: B1: Multi-dimensional anomaly detection includes calculating the degree of deviation between the gradient update of each node and the average gradient of all nodes. When the degree of deviation exceeds the anomaly threshold, it is determined to be a gradient anomaly. Calculate the difference between the loss function value of each node and the average loss value, as well as the rate of change of loss. When the difference or rate of change exceeds the threshold, it is determined that the loss function is abnormal. Calculate the similarity between the model parameters of each node and the global model. If the similarity is lower than the threshold, it is judged as an abnormal model similarity.
[0041] Specifically, multi-dimensional anomaly detection is performed in real time during the local training process at each power grid node. The anomaly detection engine is deployed in the policy control center, receiving training process parameters submitted by each node and performing anomaly detection in three dimensions: gradient, loss function, and model similarity.
[0042] Gradient anomaly detection monitors the gradient updates generated by each node during local training. At the end of each training cycle, each node calculates the gradient vector of the model parameters. The gradient vector contains the gradient values of all model parameters. For an LSTM model, the gradient vector includes the gradients of the input gate weights, forget gate weights, output gate weights, cell state weights, and the gradients of the bias terms for each layer.
[0043] The anomaly detection engine collects the L2 norm of the gradients of all nodes participating in the current round of federated learning and calculates the mean of the gradients of all nodes. and standard deviation For the gradient L2 norm submitted by the nth node Calculate its deviation from the mean: in, This represents the normalized value of the gradient deviation at node n. The anomaly detection engine sets the gradient anomaly threshold τ. =3.0, when >τ When a gradient anomaly is detected, node n is determined to have an anomaly. Gradient anomalies typically indicate that the node's training data quality is poor, the training process is unstable, or the node has been maliciously attacked and injected with abnormal gradients. The anomaly detection engine records the node ID with the gradient anomaly in the anomaly node list and lowers the node's reputation score.
[0044] Loss function anomaly detection monitors the loss function values of each node during local training. After completing local training, each node submits the loss function value for the final epoch. For load forecasting tasks, the normal range for loss function values is typically between 0.01 and 0.10; for fault diagnosis tasks, the normal range is typically between 0.1 and 0.5; and for power quality analysis tasks, the normal range is typically between 0.005 and 0.05.
[0045] The anomaly detection engine collects the loss function values of all nodes and calculates the average loss value. The loss function value for the nth node. Calculate the difference between it and the average loss value: At the same time, the node also needs to submit the loss function value from the previous training round. The anomaly detection engine calculates the rate of change of loss for node n: The anomaly detection engine sets a loss difference threshold τ. L =0.2 and the loss change rate threshold τ r =0.5. When >τ L or | ∣>τ r At that time, it is determined that node n has an abnormal loss function.
[0046] Model similarity anomaly detection monitors the local model parameters generated during training at each node. After completing local training, each node generates its local model parameter vector. Submit to the anomaly detection engine.
[0047] The anomaly detection engine obtains the global model parameter vector from the previous round. Calculate the local model parameter vector of node n. With global model parameter vector Cosine similarity: in, This represents the dot product of two vectors. and Let L2 and L2 represent the L2 norms of the two vectors, respectively. The cosine similarity ranges from -1 to 1. The closer the similarity is to 1, the more similar the two models are. The closer the similarity is to -1, the more opposite the directions of the two models are.
[0048] Anomaly detection engine sets model similarity threshold τ s =0.85. When <τ sWhen a node n is found to have an abnormal model similarity, it is determined that the node's local model deviates from the normal training trajectory. This could be due to the node being subjected to a model poisoning attack, such as being injected with a backdoor or Trojan, or it could be that the node's training data differs from that of other nodes.
[0049] While performing multi-dimensional anomaly detection, each power grid node trains a local model based on local power data. For load forecasting, the node uses a Long Short-Term Memory (LSTM) network model. The LSTM model consists of an input layer, LSTM hidden layers, and an output layer. The input layer receives a feature vector with a dimension of 48, including the load value of the previous 24 hours (24-dimensional), the load value of the same time in the previous 7 days (7-dimensional), temperature (1-dimensional), humidity (1-dimensional), time encoding (12-dimensional hourly encoding and 7-dimensional weekday encoding), and holiday identifier (1-dimensional). The LSTM hidden layer contains 128 LSTM units, each including an input gate, a forget gate, an output gate, and a cell state. The output layer is a fully connected layer with a dimension of 1, representing the predicted load value.
[0050] The forward propagation process of the LSTM model is as follows: Input feature vector x t After linear transformation in the input layer, the input is fed into the LSTM hidden layer. The computation of the LSTM hidden layer includes the input gate i. t Forgotten Gate t Output gate o t and cell state c t The LSTM hidden layer updates by controlling the degree of reception of current input information, the forget gate controlling the degree of forgetting of historical information, and the output gate controlling the output information at the current moment. Cell states are propagated over time, preserving long-term dependencies. The output h of the LSTM hidden layer... t After a fully connected transformation at the output layer, the predicted load value y is obtained. t .
[0051] After each node completes local model training, it generates a local model parameter vector, calculates the local model hash value, and updates the local training policy contract. The node then submits its local model parameters, training policy contract, and training process parameters (gradient L2 norm, loss function value) to the policy control center. The anomaly detection engine performs multi-dimensional anomaly detection on the submitted training process parameters, identifying nodes with gradient anomalies, loss function anomalies, and model similarity anomalies.
[0052] In this embodiment, the encrypted transmission of power grid data and the integrity verification of the local model in step S300 include the following steps C1-C2: C1: Before verifying the integrity of the local model, encrypted transmission of power grid data is also included. Each power grid node encrypts its local model; a secure communication key is established through key exchange. Each power grid node digitally signs its local model; the digital signature is then verified.
[0053] Specifically, after completing local model training, each power grid node needs to submit its local model to the policy control center for integrity verification. Since the local model contains the node's training characteristics and data distribution information, direct transmission poses a risk of theft or tampering; therefore, encrypted transmission of the local model is required.
[0054] Each grid node first encrypts its local model. The encryption process uses the AES-256 symmetric encryption algorithm. The AES-256 algorithm uses a 256-bit key to encrypt the data, providing high security. The node serializes the local model parameters into a byte stream; the length of the byte stream depends on the number of parameters in the model. For an LSTM model containing 1 million parameters, the byte stream length is approximately 4MB. The node then generates a 256-bit random key K. AES The byte stream is then encrypted using AES with this key to generate the encrypted model ciphertext C. model The encryption process uses CBC (Cryptographic Block Chaining) mode, and the initialization vector (Ⅳ) is randomly generated by the node and has a length of 128 bits.
[0055] While encrypting the local model, each node needs to establish a secure communication key with the policy control center for transmitting the AES key. Key exchange uses the Diffie-Hellman key exchange protocol. The Diffie-Hellman protocol allows communicating parties to negotiate a shared key over an insecure channel. The protocol execution process is as follows: The policy control center pre-selects a large prime number p and a generator g, and publishes p and g. The policy control center randomly selects a private key a and calculates the public key A=g. a modp sends the public key A to the node. The node randomly selects a private key b and calculates the public key B=g. b mod p, sends the public key B to the policy control center. The node calculates the shared key K. shared =A b mod p, the policy control center calculates the shared key K shared =B a mod p. Because A b =(g a ) b =g ab =(g b ) a =B a Therefore, the shared key calculated by the node and the policy control center is the same.
[0056] The node uses the shared key K shared AES key KAES Encryption is performed to generate the encrypted AES key ciphertext C. key The node will encrypt the local model ciphertext C. model The encrypted AES key ciphertext C key It is packaged together with the initialization vector IV and is ready to be sent to the policy control center.
[0057] To ensure the integrity and non-repudiation of the local model, nodes also need to digitally sign the local model. The digital signature uses the RSA algorithm. Nodes pre-generate an RSA key pair, including the private key SK. n PK with public key n The private key is kept confidential by the node, while the public key is registered with the policy control center. The node uses the local model's encrypted C... model Calculate the SHA-256 hash value to obtain the message digest H. model The node uses the private key SK. n For message digest H model Encrypt and generate a digital signature. : Where N is the modulus of the RSA algorithm. The node will digitally sign... It is appended to the data packet and sent to the policy control center along with the encrypted local model ciphertext, the encrypted AES key ciphertext, and the initialization vector.
[0058] After receiving a data packet from a node, the policy control center first verifies the digital signature. The policy control center then extracts the digital signature from the data packet. and the encrypted local model ciphertext C model The policy control center uses the node's public key (PK). n Decrypt the digital signature to obtain the message digest. : The policy control center receives the local model ciphertext C. model Calculate the SHA-256 hash value to obtain the message digest. Comparison of Strategy Control Centers and Are they equal? If they are equal, it means the digital signature verification passed, the local model was not tampered with during transmission, and it was indeed sent by the node. If they are not equal, it means the digital signature verification failed, the local model may have been tampered with or forged, the policy control center refuses to accept the local model, and marks the node as an abnormal node.
[0059] After the digital signature verification is successful, the policy control center decrypts the encrypted AES key. The policy control center uses the shared key K. sharedThe encrypted AES key ciphertext C key Decrypt to obtain the AES key K AES The policy control center uses AES keys. AES And initialization vector IV, for the encrypted local model ciphertext C model Decryption is performed to obtain the byte stream of local model parameters.
[0060] C2: Verifying the integrity of the local model includes receiving the encrypted local model and local training strategy contract; Decrypt the local model; calculate the hash value of the local model and compare it with the hash value recorded in the local training strategy contract; Check whether the training parameters meet the preset specifications; check whether the model accuracy meets the requirements of power grid applications. Check if the gradient norm is within the preset range; detect if the model parameter distribution is abnormal. Node reputation scores are calculated based on historical performance and current round performance.
[0061] Specifically, after completing digital signature verification and model decryption, the policy control center performs integrity verification on the local model. Integrity verification includes multiple levels of checks to ensure the trustworthiness and security of the local model.
[0062] The first layer of verification is a hash value comparison verification. The policy control center calculates the SHA-256 hash value of the decrypted local model parameters to obtain the locally calculated hash value. The policy control center reads the local training policy contract submitted by the node from the blockchain network and extracts the local model hash value recorded in the contract. The policy control center compares the hash value with the local model hash value to see if they are equal. If they are equal, it means that the received local model is completely consistent with the local model generated by the node, and the model has not been modified during transmission. If they are not equal, it means that there is an inconsistency in the model, which may be due to the node submitting an incorrect model or the model being tampered with during transmission. The policy control center rejects the local model and records the anomaly.
[0063] The second layer of verification is the validation of training parameter conformity. The policy control center extracts training parameters from the local training policy contract, including the training epochs, number of cycles, and model architecture. The policy control center checks whether the training epochs are consistent with the current global epochs, ensuring that the node submits the model trained in the current epoch, not an old model from a previous epoch. The policy control center checks whether the number of cycles is within the specified range. For substation nodes, the number of cycles should be between 40 and 60; for smart meter concentrator nodes, the number of cycles should be between 15 and 25. If the number of cycles is too low, it indicates that the node is not sufficiently trained; if the number of cycles is too high, it indicates that the node may be overfitting or maliciously consuming computing resources. The policy control center checks whether the model architecture is consistent with the task requirements. For load forecasting tasks, the model architecture should be LSTM; for fault diagnosis tasks, the model architecture should be CNN. If the training parameters do not conform to the specifications, the policy control center lowers the node's reputation score.
[0064] The third layer of verification is the model accuracy compliance verification. The policy control center extracts the model accuracy index from the locally trained policy contract. For load forecasting tasks, the model accuracy uses the mean absolute percentage error (MAPE), and grid applications require a MAPE of less than 5%. The policy control center checks whether the MAPE submitted by the node is less than 5%. If the MAPE is greater than 5%, it indicates that the node's local model prediction accuracy is insufficient and cannot be used for load forecasting applications. The policy control center rejects the local model or reduces its aggregation weight.
[0065] For fault diagnosis tasks, the model accuracy is based on classification accuracy, and power grid applications require an accuracy greater than 90%. The strategy control center checks whether the accuracy submitted by the nodes is greater than 90%. If the accuracy is lower than 90%, it indicates that the node's local model diagnostic capability is insufficient and cannot be used for fault diagnosis applications.
[0066] For power quality analysis tasks, the model accuracy is measured using the root mean square error (RMSE), and grid applications require an RMSE less than 3.0. The policy control center checks whether the RMSE submitted by the nodes is less than 3.0. If the RMSE is greater than 3.0, it indicates that the node's local model analysis accuracy is insufficient.
[0067] The strategy control center manages the model accuracy requirements for different tasks in a unified manner. For nodes that do not meet the accuracy requirements, the accuracy deviation value is recorded and used for subsequent reputation score calculation.
[0068] The fourth layer of validation is gradient norm interval validation. The policy control center extracts the gradient norm ∥ablaθ∥2 from the local training policy contract. Based on the model type and task characteristics, the policy control center sets a reasonable interval for the gradient norm. For the load prediction task of the LSTM model, the reasonable interval for the gradient norm is [0.1, 10.0]. For the fault diagnosis task of the CNN model, the reasonable interval for the gradient norm is [0.05, 5.0]. For the power quality analysis task of the DNN model, the reasonable interval for the gradient norm is [0.01, 2.0].
[0069] The fifth layer of validation is the detection of anomalies in model parameter distribution. The policy control center performs statistical analysis on the parameter distribution of the local model to detect any abnormal patterns. The policy control center calculates the mean μθ and standard deviation σθ of the local model parameters. For a normally trained model, the parameter distribution is usually close to a normal distribution, with the mean close to 0 and the standard deviation within a reasonable range. The policy control center checks whether the parameter mean is within the interval [-0.1, 0.1] and whether the parameter standard deviation is within the interval [0.1, 1.0].
[0070] The policy control center also checks for extreme values in the model parameters. It counts the number of extreme values exceeding 3σ. If the number of extreme values exceeds 1% of the total number of parameters, it indicates an abnormal parameter distribution, potentially indicating anomaly injection or training errors. The policy control center calculates the skewness and kurtosis of the parameters to check the symmetry and tail characteristics of the parameter distribution. If the absolute value of the skewness is greater than 1 or the kurtosis is greater than 5, it indicates that the parameter distribution deviates from a normal distribution, potentially indicating anomalies.
[0071] The sixth layer of validation involves calculating a node reputation score. The policy control center calculates a node's reputation score based on its historical performance and current round performance. Historical performance includes the node's safety score in the past R rounds of federated learning. The safety score comprehensively considers factors such as whether the node passes multi-dimensional anomaly detection, whether the model accuracy meets the requirements, and whether the training parameters are standardized. For nodes that pass all validations, the safety score for the current round is 1.0; for nodes with minor anomalies, the safety score is 0.8; for nodes with severe anomalies, the safety score is 0.5; and for nodes that fail validation, the safety score is 0.
[0072] Reputation score of node n in round t The calculation formula is: in, This represents the reputation score of node n in the previous round. This represents the performance score of node n in the current round (i.e., the safety score of the current round), and α is the historical weighting coefficient, typically ranging from 0.7 to 0.9. This formula reflects the cumulative effect of reputation scores; nodes with good historical performance have higher reputations, and even if there are minor anomalies in the current round, the decline in their reputation scores is smaller. Nodes with poor historical performance have lower reputation scores and need to perform well in the current round to gradually recover their reputation.
[0073] After completing verification at all levels, the policy control center generates a verification report. The verification report includes the node ID, verification result (pass / fail), anomaly type (gradient anomaly / loss function anomaly / model similarity anomaly / accuracy failure / parameter anomaly), and reputation score. The policy control center sends the verified local models and verification reports to the blockchain aggregation manager, preparing for global model aggregation. Local models that fail verification are rejected, the corresponding node's reputation score is lowered, and it is recorded in the list of anomalous nodes.
[0074] In this embodiment, step S400, which involves the aggregation strategy contract and weight allocation, includes the following steps D1-D2: D1: The aggregation strategy contract includes: recording the unique identifier of the global model; recording the training round of the current federated learning; recording the list of grid node IDs participating in this round of aggregation; recording the accuracy index of the global model; recording the integrity hash value of the global model; recording the aggregation weight coefficient of each participating node; recording the list of node IDs detected as abnormal; and recording the consensus verification result status.
[0075] Specifically, after receiving and verifying the local models of each power grid node, the strategy control center deploys aggregation strategy contracts to manage the aggregation process of the global model.
[0076] The global model unique identifier field of the aggregation strategy contract records the ID of the global model generated in this round of aggregation. The global model ID consists of 32 hexadecimal characters. The first 8 bits represent the task type (load forecasting is 00000001, fault diagnosis is 00000002, and power quality analysis is 00000003), the middle 16 bits represent the timestamp (a Unix timestamp accurate to the second), and the last 8 bits represent the round number. The global model ID ensures that each global model generated in each round has a unique identifier, facilitating traceability and management.
[0077] The participating node list field of the aggregation strategy contract records the grid node IDs participating in this round of aggregation. The participating node list contains all node IDs that have passed integrity verification. For a federated learning system with 100 grid nodes, if 5 nodes fail verification or exhibit serious anomalies, the participating node list will contain 95 node IDs. The participating node list is used to track which nodes contributed to the global model in this round and is also used for subsequent model distribution, ensuring that only nodes that participated in training receive the global model.
[0078] The global model accuracy metric field in the aggregation strategy contract records the performance of the global model after aggregation. For load forecasting tasks, the global model accuracy uses the mean absolute percentage error (MAPE). After aggregation, the strategy control center uses a test dataset to evaluate the MAPE of the global model. The test dataset contains representative samples uploaded by each grid node, with the sample size being 5% of the local data of each node. The strategy control center calculates the MAPE of the global model on the test set and records it in the aggregation strategy contract.
[0079] For fault diagnosis tasks, global model accuracy is measured by classification accuracy, precision, recall, and F1 score. The policy control center calculates the various metrics of the global model on the test set and records them in the aggregation policy contract. For power quality analysis tasks, global model accuracy is measured by root mean square error (RMSE) and mean absolute error (MAE).
[0080] The global model hash field of the aggregation strategy contract records the integrity hash of the aggregated global model. The strategy control center calculates the SHA-256 hash value of the global model parameters generated by aggregation, generating a 256-bit hash value. The hash value calculation process is the same as the local model hash value calculation: all parameters of the global model are arranged in hierarchical order, concatenated into a long vector, and then the long vector is subjected to SHA-256 hash operation.
[0081] The node weight allocation field in the aggregation strategy contract records the weight coefficient of each participating node in this round of aggregation. The weight coefficient reflects the degree of contribution of a node to the global model; the larger the weight coefficient, the greater the impact of the node's local model on the global model. Weight allocation uses an adaptive algorithm, comprehensively considering the node's data volume, data quality factor, and reputation score. The sum of the weight coefficients of all nodes is 1. For example, for 95 participating nodes, node 1's weight coefficient is 0.015, node 2's weight coefficient is 0.012, and so on. The weight coefficients are recorded in the aggregation strategy contract for executing the weighted federated average algorithm.
[0082] The "Abnormal Node List" field in the aggregation strategy contract records the node IDs detected as abnormal during this round of training and validation. Abnormal nodes include gradient anomalies, loss function anomalies, model similarity anomalies, accuracy failures, non-standard training parameters, and model parameter distribution anomalies. The abnormal node list includes the node ID and the anomaly type. For example, node 15 is recorded due to gradient anomalies, and node 28 is recorded due to model accuracy failures. The abnormal node list is used to monitor security status. For nodes that frequently appear in the anomaly list, administrators can conduct manual reviews to determine if there are malicious attacks or equipment malfunctions.
[0083] The consensus verification result field of the aggregation strategy contract records the consensus verification status of the global model by the blockchain network. Consensus verification employs the Byzantine Fault Tolerance (BFT) algorithm to ensure that the global model reaches consensus within the blockchain network. The consensus verification result includes verification pass / fail, the number of blockchain nodes participating in the consensus, and the voting results. For example, if the consensus verification passes, the number of blockchain nodes participating in the consensus is 20, and the voting result is 20 votes in favor and 0 votes against. The consensus verification result is recorded in the aggregation strategy contract to prove the credibility of the global model.
[0084] D2: Assign aggregation weights based on node data volume and data quality factors, including obtaining the data volume of each power grid node; Calculate the data quality factor for each node, taking into account the security scores from multiple historical rounds; dynamically calculate the aggregation weight of each node in the current round based on the data volume and data quality factor; reduce or remove the aggregation weight of abnormal nodes.
[0085] Specifically, after receiving the local model verified by the policy control center, the blockchain aggregation manager executes an adaptive weight allocation algorithm to assign aggregation weights to each node. This algorithm considers both the amount and quality of data from each node, dynamically adjusting the weights to improve the accuracy and robustness of the global model.
[0086] The blockchain aggregation manager first obtains the data volume of each power grid node. The data volume represents the number of local data samples used by the node in this round of training. For load forecasting tasks, the data volume of a node is the number of historical load data samples; typically, a substation node has 10,000–50,000 samples, and a smart meter concentrator node has 5,000–20,000 samples. For fault diagnosis tasks, the data volume of a node is the number of historical fault records; typically, a substation node has 500–2,000 fault samples, and a distribution station node has 200–1,000 fault samples. For power quality analysis tasks, the data volume of a node is the number of power quality monitoring data samples; typically, a substation node has 20,000–100,000 samples.
[0087] Node data volume The data is extracted from the local training strategy contract or reported by nodes when submitting their local models. The blockchain aggregation manager collects the data from all participating nodes and calculates the total data volume. Where N is the number of participating nodes.
[0088] The blockchain aggregation manager then calculates the data quality factor for each node. The data quality factor reflects the node's training quality and historical reliability, taking into account the node's security scores across multiple rounds of historical federated learning. The data quality factor for node n... The calculation formula is: Where R is the number of historical rounds, typically ranging from 5 to 10. Let t be the security score of node n in round k, and t be the current round. This formula calculates the average security score of the node over the past R rounds, which serves as the data quality factor. If a node has passed validation multiple times in historical rounds and performed well, the data quality factor is close to 1.0; if a node has experienced anomalies or validation failures multiple times in historical rounds, the data quality factor is low.
[0089] For newly joined nodes in federated learning, since they lack historical security scores, the blockchain aggregation manager assigns an initial data quality factor, typically set to 0.8. The data quality factor is dynamically adjusted only after new nodes undergo multiple rounds of training and validation, accumulating historical performance data.
[0090] The blockchain aggregation manager dynamically calculates the aggregation weight of each node in the current round based on data volume and data quality factors. The aggregation weight wnt of node n in round t is calculated using the following formula: in, Let n be the amount of data in node n. Let N be the data quality factor for node n, and N be the number of participating nodes.
[0091] The blockchain aggregation manager adjusts the weights of anomalous nodes. For nodes detected as anomalous during this training round, the aggregation manager reduces or removes their aggregation weights based on the severity of the anomalousness. For slightly anomalous nodes (such as gradient norms slightly exceeding the reasonable range or model accuracy slightly below requirements), the blockchain aggregation manager reduces their weights by 50%, resulting in adjusted weights of [weight not specified]. =0.5⋅ For severely anomalous nodes (such as gradient anomalies exceeding 3 times the threshold, model similarity below 0.7, or severely non-standard training parameters), the blockchain aggregation manager removes their aggregation weight and sets... =0, this node does not participate in the global model aggregation in this round.
[0092] After adjusting the weights of abnormal nodes, the blockchain aggregation manager renormalizes the weights of the remaining nodes to ensure that the total weight is 1. For example, if there were originally 100 participating nodes, and 5 nodes had their weights removed, the total weight of the remaining 95 nodes will still be 1 after renormalization.
[0093] After the blockchain aggregation manager completes the weight allocation, it executes the weighted federated average algorithm to generate the global model. The formula for the weighted federated average algorithm is: in, This represents the global model parameters in round t+1. This represents the aggregate weight of node n in round t. This represents the local model parameters of node n in the t-th round of training, and N represents the number of nodes participating in the aggregation.
[0094] After receiving the global model, the blockchain database manager performs Byzantine Fault Tolerance (PBFT) consensus verification. The PBFT consensus uses the Practical Byzantine Fault Tolerance (PBFT) algorithm, which can tolerate a maximum of ⌊(n−1) / 3⌋ malicious nodes, where n is the total number of blockchain nodes. For a network with 20 blockchain nodes, the PBFT algorithm can tolerate a maximum of 6 malicious nodes.
[0095] The PBFT consensus process is as follows: The blockchain aggregator, acting as the master node, broadcasts the global model and aggregation strategy contract to all blockchain nodes. Upon receiving the global model, each blockchain node calculates its hash value and compares it with the hash value recorded in the aggregation strategy contract. If the hash values match, the blockchain node votes in favor of the global model; otherwise, it votes against it. Each blockchain node broadcasts its voting results to other nodes. When a global model receives more than 2n / 3 of the votes in favor, it passes consensus verification.
[0096] The global model, verified through consensus, is packaged into a new block by the blockchain database manager and added to the blockchain. The new block contains the global model parameters, the aggregation strategy contract, a timestamp, and the hash value of the previous block. The blockchain database manager calculates the hash value of the new block and appends it to the end of the blockchain. The immutability of the blockchain ensures that once the global model is stored, it cannot be modified or deleted, guaranteeing its trustworthiness and traceability.
[0097] The strategy control center reads the globally validated model and aggregated strategy contract from the blockchain network. Based on the list of participating nodes recorded in the aggregated strategy contract, the strategy control center distributes the global model to each grid node. Upon receiving the global model, each node calculates its hash value and compares it with the hash value recorded in the aggregated strategy contract to verify the model's integrity. If verification is successful, the node replaces its local model with the global model, serving as the starting point for the next round of local training. Nodes can also apply the global model to practical grid applications such as load forecasting, fault diagnosis, and power quality analysis.
[0098] In summary, this embodiment acquires local power data and deploys a local training strategy contract in S100, recording key parameters of the training process to achieve full traceability of the training process; introduces multi-dimensional anomaly detection and executes local model training in S200, identifying nodes with gradient anomalies, loss function anomalies, and model similarity anomalies during the training phase, preventing malicious nodes from polluting the global model; performs encrypted transmission and multi-level integrity verification in S300, comprehensively evaluating the credibility of the local model through hash value comparison, training parameter normalization verification, model accuracy verification, gradient norm verification, parameter distribution detection, and reputation score calculation; deploys an aggregation strategy contract and executes adaptive weight allocation in S400, dynamically adjusting aggregation weights based on node data volume and data quality factors to reduce the impact of low-quality and abnormal nodes on the global model; and ensures the traceability of the global model through blockchain consensus verification and tamper-proof storage.
[0099] Example 3 The above is an illustrative scheme of a power grid federated learning blockchain security management method. It should be noted that the technical solution of this power grid federated learning blockchain security management system and the technical solution of the aforementioned power grid federated learning blockchain security management method belong to the same concept. Details not described in detail in this embodiment can be found in the description of the technical solution of the aforementioned power grid federated learning blockchain security management method.
[0100] This embodiment also provides a power grid federated learning blockchain security management system, including: The data acquisition module acquires local power data from each node of the power grid, deploys local training strategy contracts to each power grid node, records key parameters of the training process, and generates local model hash values. The model training module introduces multi-dimensional anomaly detection to monitor gradient anomalies, loss function anomalies, and model similarity anomalies in real time during the training process. Each power grid node performs local model training based on local power data and generates a local model by dynamically adjusting the learning rate. The data comparison module verifies the integrity of the local model, calculates the hash value of the local model and compares it with the record value of the local training strategy contract, verifies the standardization of training parameters and the accuracy of the model, and calculates the node reputation score. The data distribution module deploys aggregation strategy contracts, manages the global model aggregation process and records information of participating nodes, allocates aggregation weights based on node data volume and data quality factors, and distributes the global model to each power grid node according to the list of participating nodes in the aggregation strategy contract.
[0101] This embodiment also provides an electronic device suitable for the security management of a power grid federated learning blockchain, comprising: a memory and a processor; the memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement the power grid federated learning blockchain security management method proposed in the above embodiment.
[0102] This embodiment also provides a storage medium on which a computer program is stored. When the program is executed by a processor, it implements the power grid federated learning blockchain security management method proposed in the above embodiments.
[0103] The storage medium proposed in this embodiment and the method for implementing blockchain security management of power grid federated learning proposed in the above embodiments belong to the same inventive concept. Technical details not described in detail in this embodiment can be found in the above embodiments, and this embodiment has the same beneficial effects as the above embodiments.
[0104] Based on the above description of the implementation methods, those skilled in the art can clearly understand that the present invention can be implemented using software and necessary general-purpose hardware, and of course, it can also be implemented using hardware. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory (RAM), flash memory, hard disk, or optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods of the various embodiments of the present invention.
[0105] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.
Claims
1. A blockchain security management method for power grid federated learning, characterized in that: This includes acquiring local power data from each node of the power grid, deploying local training strategy contracts to each power grid node, recording key parameters of the training process, and generating local model hash values. Multi-dimensional anomaly detection is introduced to monitor gradient anomalies, loss function anomalies, and model similarity anomalies in real time during the training process. Each power grid node performs local model training based on local power data and generates a local model by dynamically adjusting the learning rate. Verify the integrity of the local model by calculating the local model hash value and comparing it with the local training strategy contract record value, verifying the standardization of training parameters and the accuracy of model, and calculating the node reputation score. Deploy the aggregation strategy contract to manage the global model aggregation process and record the information of participating nodes. Assign aggregation weights based on the amount of node data and data quality factors. Distribute the global model to each power grid node according to the list of participating nodes in the aggregation strategy contract.
2. The power grid federated learning blockchain security management method as described in claim 1, characterized in that: The local power data includes power grid operation status data, power quality monitoring data, load forecasting data, and fault diagnosis data. The local training strategy contract includes recording node identifiers, model architecture, training rounds, number of cycles, model accuracy, local model hash value, gradient norm, loss function value, and training timestamp.
3. The power grid federated learning blockchain security management method as described in claim 2, characterized in that: The multi-dimensional anomaly detection includes calculating the degree of deviation between the gradient update of each node and the average gradient of all nodes, and determining the gradient anomaly when the degree of deviation exceeds the anomaly threshold. Calculate the difference between the loss function value of each node and the average loss value, as well as the rate of change of loss. When the difference or rate of change exceeds the threshold, it is determined that the loss function is abnormal. Calculate the similarity between the model parameters of each node and the global model. If the similarity is lower than the threshold, it is judged as an abnormal model similarity.
4. The power grid federated learning blockchain security management method as described in claim 3, characterized in that: Before verifying the integrity of the local model, the encrypted transmission of power grid data is also included: Each power grid node encrypts its local model; a secure communication key is established through key exchange. Each power grid node digitally signs its local model; the digital signature is then verified.
5. The power grid federated learning blockchain security management method as described in claim 4, characterized in that: The verification of local model integrity includes receiving an encrypted local model and a local training strategy contract; Decrypt the local model; calculate the hash value of the local model and compare it with the hash value recorded in the local training strategy contract; Check whether the training parameters meet the preset specifications; check whether the model accuracy meets the requirements of power grid applications. Check if the gradient norm is within the preset range; detect if the model parameter distribution is abnormal. Node reputation scores are calculated based on historical performance and current round performance.
6. The power grid federated learning blockchain security management method as described in claim 5, characterized in that: The aggregation strategy contract includes: recording the unique identifier of the global model; recording the training round of the current federated learning; recording the list of grid node IDs participating in this round of aggregation; recording the accuracy index of the global model; recording the integrity hash value of the global model; recording the aggregation weight coefficient of each participating node; recording the list of node IDs detected as abnormal; and recording the consensus verification result status.
7. The power grid federated learning blockchain security management method as described in claim 6, characterized in that: The method of allocating aggregation weights based on node data volume and data quality factors includes obtaining the data volume of each power grid node; Calculate the data quality factor for each node, taking into account the security scores from multiple historical rounds; dynamically calculate the aggregation weight of each node in the current round based on the data volume and data quality factor. Reduce or remove the aggregate weight of abnormal nodes.
8. A power grid federated learning blockchain security management system, based on the power grid federated learning blockchain security management method according to any one of claims 1 to 7, characterized in that: It also includes a data acquisition module, which acquires local power data from each node of the power grid, deploys local training strategy contracts to each power grid node, records key parameters of the training process, and generates local model hash values. The model training module introduces multi-dimensional anomaly detection to monitor gradient anomalies, loss function anomalies, and model similarity anomalies in real time during the training process. Each power grid node performs local model training based on local power data and generates a local model by dynamically adjusting the learning rate. The data comparison module verifies the integrity of the local model, calculates the hash value of the local model and compares it with the record value of the local training strategy contract, verifies the standardization of training parameters and the accuracy of the model, and calculates the node reputation score. The data distribution module deploys aggregation strategy contracts, manages the global model aggregation process and records information of participating nodes, allocates aggregation weights based on node data volume and data quality factors, and distributes the global model to each power grid node according to the list of participating nodes in the aggregation strategy contract.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, it implements the steps of the power grid federated learning blockchain security management method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by the processor, it implements the steps of the power grid federated learning blockchain security management method according to any one of claims 1 to 7.