Sybil attack dynamic defense method and system in power carbon transaction block chain
By adopting a dynamic defense method combining GAT and entropy weight method in the power carbon trading blockchain, we can identify and respond to Sybil attacks, improve the detection accuracy and defense capabilities, and ensure the security and stability of power carbon trading.
Patent Information
- Application Number
- CN202510738854.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-04
- Publication Date
- 2025-09-19
AI Technical Summary
Existing technologies have low accuracy in detecting Sybil attacks in the electricity carbon trading blockchain and lack effective defense mechanisms, making it difficult to cope with new attack modes. The detection and defense mechanisms are independent and lack collaborative work, making it impossible to fully guarantee the security of the blockchain network.
A Sybil attack detection model is adopted, which consists of a GAT-based dynamic topology learning module, a multi-scale feature extraction module, and an attention feature fusion module. The entropy weight method is combined to evaluate the node status. The dynamic response strategy includes master node election, malicious node isolation, and victim node score compensation, triggering a conservative communication mode.
It improves the accuracy of Sybil attack detection, enhances the defense capability of the power carbon trading blockchain, ensures the security and stability of transactions, and achieves efficient dynamic defense.
Smart Images

Figure CN120675746A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of energy data security technology, and more specifically, to a method and system for dynamic defense against Sybil attacks in a power carbon trading blockchain. Background Art
[0002] Power carbon trading is an important market-based approach to achieving energy conservation and emission reduction. Blockchain technology, with its decentralized, tamper-proof, and traceable nature, provides reliable data support for the power carbon trading market, effectively promoting the coordinated development of the power carbon market and driving the power industry toward emission reduction targets. Therefore, ensuring the security and stability of nodes within the power carbon trading blockchain is crucial to the proper functioning of the entire system.
[0003] However, this power carbon trading blockchain faces a serious threat from Sybil attacks. A Sybil attack involves an attacker creating a large number of Sybil nodes, masquerading as multiple independent entities, to manipulate the network or obtain improper benefits. In the power carbon trading scenario, Sybil attacks can lead to various malicious behaviors. For example, Sybil nodes repeatedly submit the same emission reduction quota to obtain multiple benefits, resulting in duplicate calculations and benefits in power carbon trading. A large number of Sybil nodes can also consume network resources, reduce transaction processing efficiency, increase system operating costs, and seriously affect the fairness and stability of the power carbon trading market.
[0004] To address this situation, a range of research has been conducted. At the detection level, machine learning is primarily used to detect Sybil attacks. By extracting node operational data and building detection models using classification algorithms or clustering methods, these models identify anomalous node behavior and locate potential Sybil nodes. Regarding defense strategies, existing methods have devised node reputation assessment mechanisms, generating reputation scores based on metrics such as node history and network contribution. These methods then implement communication restrictions and transaction privilege downgrades for low-reputation nodes, thereby curbing the malicious activities of Sybil nodes. However, these methods fail to fully learn the relationships between nodes and lack sufficient feature information. Furthermore, attack defense methods based on node reputation scores have relatively simple scoring rules and lack adaptive defense measures. Furthermore, detection and defense methods are relatively independent, making effective integration difficult.
[0005] In summary, the problems existing in the prior art are: (1) Although machine learning-based detection methods can identify Sybil attacks to a certain extent, their detection accuracy is not high enough. In addition, Sybil attack methods are constantly changing, and these methods are limited in their adaptability in different scenarios and are difficult to deal with new attack patterns. Existing methods rely on known features and may not be able to detect new attack methods in a timely manner.
[0006] (2) The defense mechanism based on the reputation model has limitations. On the one hand, the node reputation evaluation index is relatively simple, making it difficult to identify potential Sybil nodes. At the same time, it does not consider the situation where the victim node's reputation value decreases due to attacks. On the other hand, when the network suffers a serious attack, there is a lack of further response measures, making it impossible to effectively defend against high-intensity attacks.
[0007] (3) Most existing research separates detection and defense, lacking a systematic integration of the two. Although detection methods can identify attack behaviors, they lack corresponding defense mechanisms. Detection and defense mechanisms are difficult to work together, unable to form a complete security protection system and difficult to fully guarantee the security of blockchain networks. Summary of the Invention
[0008] In response to the problems existing in the existing technology, the present invention provides a dynamic defense method for Sybil attacks in the power carbon trading blockchain. The technical solution is as follows: The first aspect provides a dynamic defense method for Sybil attacks in a power carbon trading blockchain, including: System initialization step, initializes the blockchain network nodes, sets the blockchain network parameters, loads the trained Sybil attack detection model parameters, and initializes the node status information including the node comprehensive score and historical records; The Sybil attack detection step pre-processes the node data collected from the blockchain network and performs Sybil attack detection using a trained Sybil attack detection model. The Sybil attack detection model includes a GAT-based dynamic topology learning module, a multi-scale feature extraction module, an attention feature fusion module, and an output module. Using the trained Sybil attack detection model to perform Sybil attack detection includes: using the extracted transaction behavior characteristics and network characteristics of the points to obtain the initial feature vector of the node, dynamically learning the topological relationship between nodes and assigning attention weights through the GAT-based dynamic topology learning module, further extracting multi-scale features through the multi-scale parallel void convolution of the multi-scale feature extraction module, and then weighted fusion of different scale features through the attention feature fusion module. Finally, the output module outputs the node classification results to identify normal nodes, three types of attacker nodes, three types of Sybil nodes, and three types of victim nodes. In the node status assessment step, based on the results of the Sybil attack detection step and the node's communication completion rate, stage completion performance, attack detection status, auxiliary indicators, historical scoring information, and victim node scoring compensation indicators, the entropy weight method is used to calculate the weight of each indicator and perform weighted summation to obtain the node's comprehensive score. Nodes are then divided into five levels based on the node's comprehensive score: candidate master nodes, honest nodes, ordinary nodes, vulnerable nodes, and malicious nodes, and differentiated permissions are assigned to nodes at each level. Dynamic response step: take corresponding defense measures based on the node status assessment results.
[0009] In one embodiment, the system initialization step includes: S101: Initialize the power carbon trading blockchain network and set network parameters, including the number of nodes, initial node status, and network topology; S102: Load the trained Sybil attack detection model parameters, initialize the node status information, set the node comprehensive score initial value and score interval [0, 1], and set the node historical level vector to zero vector.
[0010] In one embodiment, the Sybil attack detection step includes: S201: Collect transaction data and network traffic data, and perform data preprocessing on the collected data; S202: Select Sybil attack detection related features from the pre-processed data, including transaction amount and transaction frequency Transaction time interval, transaction in-degree, transaction out-degree, number of transaction counterparties, network delay characteristics, node connectivity, node traffic characteristics, and connection duration are used to form a node feature vector; S203: Input the set of node feature vectors into the GAT-based dynamic topology learning module to calculate the node and The attention coefficient between ; then normalize , get the normalized attention weight ;according to Aggregate the feature vectors of neighboring nodes and update the node The feature vector of each node is then derived based on the multi-head attention mechanism. And the overall new node feature set is ,in, 、 and are the feature vectors of the first, second and Nth nodes respectively; S204: Input the entire new node feature set into the four parallel convolutions of the multi-scale feature extraction module respectively. The original convolution kernel size of the first three dilated convolutions is 3. 3, the void rates are 1, 2, and 3 respectively, and the convolution kernel size of the fourth vertical differential convolution is 3 3. According to the formula Calculate the convolution kernel size for dilated convolution ,in, is the original convolution kernel size, is the void rate; after four convolutions, the data is input into the normalization layer and the activation layer respectively; S205: After the data passes through four parallel convolutions, the output features of the four parallel convolution layers are combined into six groups of input pairs, which are respectively sent to the multi-scale feature fusion module for fusion. The six groups of AFF output features are spliced in the channel dimension and average pooled to fuse the multi-scale information extracted by different convolutions and reduce the data size. S206: The feature data after average pooling is input into the output module, which includes a fully connected layer and a softmax layer. The output node is classified into ten types of probabilities and classification results, including normal nodes, eclipse witch attacker nodes, DDoS witch attacker nodes, double-flower witch attacker nodes, eclipse witch nodes, DDoS witch nodes, double-flower witch nodes, eclipse victim nodes, DDoS victim nodes, and double-flower victim nodes.
[0011] In one embodiment, in S205, the processing of the multi-scale feature fusion module includes: Compute channel attention of local features in multi-scale channel attention module ,in, Pass 1 1-point convolution operation reduces the input The number of channels, Pass 1 1Convolution changes the number of channels to the same as the input Consistent, is the BatchNorm layer, is the ReLU function; Compute channel attention of global features in multi-scale channel attention module ; For input data Perform a global average pooling operation and calculate the weight value and Perform attention operations together and calculate features ,in, The attention weights generated for the multi-scale channel attention module, is the Sigmoid function, is the feature obtained by attention calculation.
[0012] In one embodiment, the node status evaluation step includes: S301: Calculate the communication completion rate of the node , the calculation phase completes the performance , calculate the change in consensus participation , and then calculate the attack detection situation , among which, the node that is judged to be one of the three types of Sybil attacker nodes and Sybil nodes, Assign 0 to nodes that are not directly classified, and add the probabilities of the three types of Sybil attacker nodes and the three types of Sybil nodes to get ,calculate ; Calculate auxiliary indicators by taking the average value of some network features input into the Sybil attack detection model ;in, is the network delay characteristic, is the node connectivity, is the node traffic characteristic, Calculate high-level historical scoring information for connection duration (where the molecule represents the node The historical situation of being classified into the first and second levels, the denominator represents all The sum of the historical situations in which nodes are classified into the first and second levels) and low-level historical scoring information (where the molecule represents the node The historical situation of being classified into the third, fourth and fifth levels, the denominator represents all the The sum of the historical situations in which the node is classified into the third, fourth, and fifth levels; and According to the node history level vector Calculate, in this vector - Reflection Node According to the historical situation that the node score is classified into 1-5 levels, its initial value is zero vector); calculate the victim node Rating compensation , and then the entropy weight method is used to determine the weight of each indicator - ; Calculate nodes based on each indicator Overall rating ;calculate After that, update ; S302: Based on the comprehensive scoring of nodes Nodes are divided into five levels. The first level is the candidate master node, which has the priority to be elected as the PBFT consensus master node; the second level is the honest node, which has the authority to participate in consensus and participate in the election of the master node; the third level is the ordinary node, which can participate in the consensus process normally; the fourth level is the vulnerable node, which is temporarily isolated and does not have the authority to participate in the consensus; the fifth level is the malicious node, which is prohibited from participating in any network activities and is removed from the blockchain network.
[0013] In one embodiment, taking corresponding defense measures based on the node status evaluation result includes: From the candidate master nodes, the highest-scoring candidate master node is selected as the PBFT consensus master node, taking into account the voting results of honest nodes and the node comprehensive score factors. The fifth-level malicious nodes are directly eliminated. For the fourth-level vulnerable nodes, the isolation threshold is calculated by combining the average potential malicious probability and the variance of the node comprehensive score, and the vulnerable nodes with a comprehensive score less than the isolation threshold are eliminated; Based on the type and intensity of the attack suffered by the victim node, the time decay factor and the node historical level factor, the score compensation that the victim node deserves is calculated and compensated to the corresponding node in subsequent cycles. Among them, if the ratio of the sum of the number of malicious nodes and victim nodes in the network to the total number of nodes reaches the preset threshold, the conservative communication mode is triggered, and only the top two levels of nodes are allowed to participate in the consensus, and other nodes are temporarily isolated.
[0014] In one embodiment, the dynamic response step includes: S401: Master node election, calculate the score of each node among the candidate master nodes ,in, , represents the number of half of the nodes randomly selected from the honest nodes, Represents an honest node Whether to give it to the candidate master node A vote was held, For honest nodes The comprehensive rating of is an honest node randomly selected from [0, 1] Random voting weights of Indicates a candidate master node For the The probability of a Sybil attacker node; Reflects the ranking of candidate masternodes at different stages in the past; the candidate masternode with the highest score is elected as the masternode. ,in, is the number of candidate master nodes, The node that is finally elected as the master node; S402: Isolate malicious nodes and calculate the average potential malicious probability ,in, Indicates the number of vulnerable nodes, Indicates vulnerable nodes For the The probability of a Sybil node; calculate the variance of the node comprehensive score ,in, is the average comprehensive score of vulnerable nodes; combined and Calculating the isolation threshold , and is the weight coefficient; the fifth-level malicious nodes are directly eliminated, and for the fourth-level vulnerable nodes, according to Decide whether to isolate and remove the vulnerable node. When it is 1, the node is isolated and removed; when it is 0, it is not isolated and removed; S403: Victim node scoring compensation, calculate the compensation that the victim node deserves ,in, and is the weight coefficient, Representation node for The probability of a victim-like node, in is the attenuation coefficient, Represents the victim node the time since the last compensated rating; S404: Conservative communication mode is triggered, and the ratio of the sum of the number of fifth-level malicious nodes and victim nodes in the network to the total number of nodes is calculated. ,in, Indicates the number of fifth-level malicious nodes, represents the number of victim nodes, Indicates the total number of nodes, When , the conservative communication mode is triggered, only the first two levels of nodes are allowed to participate in the consensus, and other nodes are temporarily isolated. , maintain normal mode.
[0015] Based on the same inventive concept, the second aspect of the present invention provides a dynamic defense system for Sybil attacks in the power carbon trading blockchain, comprising: The system initialization module is used to perform system initialization steps, including: initializing blockchain network nodes, setting blockchain network parameters, loading trained Sybil attack detection model parameters, and initializing node status information including node comprehensive scores and historical records; A Sybil attack detection module is used to execute the Sybil attack detection step, pre-process the node data collected from the blockchain network, and perform Sybil attack detection using a trained Sybil attack detection model. The Sybil attack detection model includes a GAT-based dynamic topology learning module, a multi-scale feature extraction module, an attention feature fusion module, and an output module. Using the trained Sybil attack detection model to perform Sybil attack detection includes: using the extracted transaction behavior characteristics and network characteristics of the points to obtain the initial feature vector of the node, dynamically learning the topological relationship between nodes and assigning attention weights through the GAT-based dynamic topology learning module, further extracting multi-scale features through the multi-scale parallel void convolution of the multi-scale feature extraction module, and then weighted fusion of different scale features through the attention feature fusion module. Finally, the output module outputs the node classification results to identify normal nodes, three types of attacker nodes, three types of Sybil nodes, and three types of victim nodes. The node status assessment module is used to perform the node status assessment step. Based on the results of the Sybil attack detection step and the node's communication completion rate, stage completion performance, attack detection status, auxiliary indicators, historical scoring information, and victim node scoring compensation indicators, the entropy weight method is used to calculate the weight of each indicator and perform weighted summation to obtain the node's comprehensive score. The node is then divided into five levels based on the node's comprehensive score: candidate master node, honest node, ordinary node, vulnerable node, and malicious node, and differentiated permissions are assigned to nodes at each level. The dynamic response module is used to execute dynamic response steps and take corresponding defense measures based on the node status evaluation results.
[0016] Based on the same inventive concept, the third aspect of the present invention provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the dynamic defense method for Sybil attacks in the electricity carbon trading blockchain described in the first aspect.
[0017] Based on the same inventive concept, the fourth aspect of the present invention provides a computer device, including a memory, a processor, and a computer program stored in the memory and runnable on the processor. When the processor executes the program, the dynamic defense method for Sybil attacks in the power carbon trading blockchain described in the first aspect is implemented.
[0018] Compared with the prior art, the advantages and beneficial technical effects of the present invention are as follows: This invention provides a dynamic defense method for Sybil attacks in a power carbon trading blockchain, including system initialization, Sybil attack detection, node status assessment, and dynamic response steps. The method involves initializing the blockchain network and model parameters; preprocessing data and identifying different node types using GAT and multi-scale parallel convolution techniques in combination with AFF; performing node status assessment based on multiple indicators, including detection results, to comprehensively score and grade nodes; and dynamically responding based on the assessment results, performing master node election, malicious node isolation, victim node score compensation, and triggering a conservative communication mode. By combining attack detection with dynamic defense based on node status assessment, the method improves the accuracy of Sybil attack detection in the power carbon trading blockchain. This method enhances the blockchain's defense against Sybil attacks with a high malicious node rejection rate, thereby ensuring the security of power carbon trading. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0020] Figure 1 Schematic diagram of a dynamic defense architecture against Sybil attacks in a power carbon trading blockchain according to an embodiment of the present invention.
[0021] Figure 2 This is a schematic diagram of the steps of the dynamic defense method for Sybil attacks in the power carbon trading blockchain provided by an embodiment of the present invention.
[0022] In the figure: S1, system initialization step. S2, Sybil attack detection step. S3, node status assessment step. S4, dynamic response step. DETAILED DESCRIPTION
[0023] Example 1 This embodiment provides a dynamic defense method for Sybil attacks in the electricity carbon trading blockchain. Figure 2 ,include: S1: System initialization step, initializing blockchain network nodes, setting blockchain network parameters, loading the parameters of the trained Sybil attack detection model, and initializing node status information including node comprehensive scores and historical records; S2: Sybil attack detection step, pre-processing the node data collected from the blockchain network, and performing Sybil attack detection using the trained Sybil attack detection model, wherein the Sybil attack detection model includes a GAT-based dynamic topology learning module, a multi-scale feature extraction module, an attention feature fusion module, and an output module. Using the trained Sybil attack detection model to perform Sybil attack detection includes: using the extracted transaction behavior characteristics and network characteristics of the points to obtain the initial feature vector of the node, dynamically learning the topological relationship between nodes and assigning attention weights through the GAT-based dynamic topology learning module, and further extracting multi-scale features through the multi-scale parallel void convolution of the multi-scale feature extraction module, and then performing weighted fusion of different scale features through the attention feature fusion module. Finally, the output module outputs the node classification results to identify normal nodes, three types of attacker nodes, three types of Sybil nodes, and three types of victim nodes; S3: Node status assessment step. Based on the results of the Sybil attack detection step and the node's communication completion rate, stage completion performance, attack detection status, auxiliary indicators, historical scoring information, and victim node scoring compensation indicators, the entropy weight method is used to calculate the weight of each indicator and perform weighted summation to obtain the node's comprehensive score. Nodes are then divided into five levels based on the node's comprehensive score: candidate master node, honest node, ordinary node, vulnerable node, and malicious node. Differentiated permissions are assigned to nodes at each level. S4: Dynamic response step, taking corresponding defense measures based on the node status evaluation results.
[0024] Specifically, if Figure 1 As shown in the figure, the dynamic defense method consists of a Sybil attack detection architecture and a Sybil attack dynamic defense architecture. The Sybil attack detection architecture is implemented through a Sybil attack detection model, including data preprocessing and feature selection, dynamic topology learning based on GAT, and multi-scale feature extraction and fusion. The Sybil attack dynamic defense architecture includes node status evaluation and dynamic response strategy, among which the node status evaluation includes node comprehensive evaluation and node classification, and the dynamic response strategy includes master node election, malicious node isolation, victim node score compensation, and conservative communication mode triggering.
[0025] The present invention provides a dynamic defense method for Sybil attacks in the power carbon trading blockchain. By constructing a specific dynamic defense framework and combining it with Sybil attack detection, it can effectively detect and defend against Sybil attacks in the power carbon trading blockchain, thereby ensuring the security and stability of the power carbon trading blockchain.
[0026] Figure 2 This is a schematic diagram of the steps of the dynamic defense method for Sybil attacks in the power carbon trading blockchain provided by an embodiment of the present invention.
[0027] In one embodiment, S1 may be implemented as follows: S101: Initialize the power carbon trading blockchain network and set network parameters, including the number of nodes, initial node status, and network topology; S102: Load the trained Sybil attack detection model parameters, initialize the node status information, set the node comprehensive score initial value and score interval [0, 1], and set the node historical level vector to zero vector.
[0028] Specifically, the Sybil attack detection model parameters include GAT (graph attention network) parameters, parallel convolution parameters, and AFF (feature fusion) parameters.
[0029] In one embodiment, S2 may be implemented as follows: S201: Collect transaction data and network traffic data, and perform data preprocessing on the collected data; S202: Select Sybil attack detection related features from the pre-processed data, including transaction amount and transaction frequency Transaction time interval, transaction in-degree, transaction out-degree, number of transaction counterparties, network delay characteristics, node connectivity, node traffic characteristics, and connection duration are used to form a node feature vector; S203: Input the set of node feature vectors into the GAT-based dynamic topology learning module to calculate the node and The attention coefficient between ; then normalize , get the normalized attention weight ;according to Aggregate the feature vectors of neighboring nodes and update the node The feature vector of each node is then derived based on the multi-head attention mechanism. And the overall new node feature set is ,in, 、 and are the feature vectors of the first, second and Nth nodes respectively; S204: Input the entire new node feature set into the four parallel convolutions of the multi-scale feature extraction module respectively. The original convolution kernel size of the first three dilated convolutions is 3. 3, the void rates are 1, 2, and 3 respectively, and the convolution kernel size of the fourth vertical differential convolution is 3 3. According to the formula Calculate the convolution kernel size for dilated convolution ,in, is the original convolution kernel size, is the void rate; after four convolutions, the data is input into the normalization layer and the activation layer respectively; S205: After the data passes through four parallel convolutions, the output features of the four parallel convolution layers are combined into six groups of input pairs, which are respectively sent to the multi-scale feature fusion module for fusion. The six groups of AFF output features are spliced in the channel dimension and average pooled to fuse the multi-scale information extracted by different convolutions and reduce the data size. S206: The feature data after average pooling is input into the output module, which includes a fully connected layer and a softmax layer. The output node is classified into ten types of probabilities and classification results, including normal nodes, eclipse witch attacker nodes, DDoS witch attacker nodes, double-flower witch attacker nodes, eclipse witch nodes, DDoS witch nodes, double-flower witch nodes, eclipse victim nodes, DDoS victim nodes, and double-flower victim nodes.
[0030] In the specific implementation process, S201 includes: Remove noise data and duplicate records through data cleaning, and use mean filling method to fill missing values ,in, is the missing value after filling in, is the sample value, is the number of samples; the data is normalized based on Min-Max , map the data to the range [0, 1]; calculate , remove outliers greater than 3, where and are the mean and standard deviation of the data respectively; The Sybil attack detection related features selected in S202, including transaction amount , transaction frequency , transaction time interval , transaction entry , transaction out-degree , number of counterparties , network delay characteristics , node connectivity Node traffic characteristics , Connection Duration , forming the node feature vector .
[0031] in, 、 、 Represents the amounts of the most recent 1st, 2nd and nth transactions respectively. It is the time for a PBFT consensus cycle.
[0032] S203's GAT module, according to Compute nodes and The attention coefficient between them, where the vector and matrix is a learnable parameter, is a nonlinear activation function; then normalized ,according to Get the normalized attention weights, where is a node The neighbor node set of Aggregate the feature vectors of neighbor nodes, based on Update Node The eigenvector of is a nonlinear activation function; then based on the multi-head attention mechanism Get each node and overall ,in, is the number of attention heads.
[0033] In S205, the processing process of the multi-scale feature fusion module includes: Compute channel attention of local features in multi-scale channel attention module ,in, Pass 1 1-point convolution operation reduces the input The number of channels, Pass 1 1Convolution changes the number of channels to the same as the input Consistent, is the BatchNorm layer, is the ReLU function; Compute channel attention of global features in multi-scale channel attention module ; For input data Perform a global average pooling operation and calculate the weight value and Perform attention operations together and calculate features ,in, The attention weights generated for the multi-scale channel attention module, is the Sigmoid function, is the feature obtained by attention calculation.
[0034] In one embodiment, S3 can be implemented as follows: S301: Calculate the communication completion rate of the node , the calculation phase completes the performance , calculate the change in consensus participation , and then calculate the attack detection situation , among which, the node that is judged to be one of the three types of Sybil attacker nodes and Sybil nodes, Assign 0 to nodes that are not directly classified, and add the probabilities of the three types of Sybil attacker nodes and the three types of Sybil nodes to get ,calculate ; Calculate auxiliary indicators by taking the average value of some network features input into the Sybil attack detection model ;in, is the network delay characteristic, is the node connectivity, is the node traffic characteristic, Calculate high-level historical scoring information for connection duration (where the molecule represents the node The historical situation of being classified into the first and second levels, the denominator represents all The sum of the historical situations in which nodes are classified into the first and second levels) and low-level historical scoring information (where the molecule represents the node The historical situation of being classified into the third, fourth and fifth levels, the denominator represents all the The sum of the historical situations in which the node is classified into the third, fourth, and fifth levels; and According to the node history level vector Calculate, in this vector - Reflection Node According to the historical situation that the node score is classified into 1-5 levels, its initial value is zero vector); calculate the victim node Rating compensation , and then the entropy weight method is used to determine the weight of each indicator - ; Calculate nodes based on each indicator Overall rating ;calculate After that, update ; S302: Based on the comprehensive scoring of nodes Nodes are divided into five levels. The first level is the candidate master node, which has the priority to be elected as the PBFT consensus master node; the second level is the honest node, which has the authority to participate in consensus and participate in the election of the master node; the third level is the ordinary node, which can participate in the consensus process normally; the fourth level is the vulnerable node, which is temporarily isolated and does not have the authority to participate in the consensus; the fifth level is the malicious node, which is prohibited from participating in any network activities and is removed from the blockchain network.
[0035] Specifically, S301 passes Calculate the communication completion rate of the node, where is the actual number of communications, is the theoretical number of communications; The calculation phase completes the performance, where is the number of consensus stages, For the stage Theoretically, the fastest time to complete. For the stage node The average time it takes to receive messages from other nodes; Calculate the change in consensus participation, where Representative Node Consensus participation as of this cycle, Representation node Consensus participation as of the last cycle.
[0036] In one embodiment, taking corresponding defense measures based on the node status evaluation result includes: From the candidate master nodes, the highest-scoring candidate master node is selected as the PBFT consensus master node, taking into account the voting results of honest nodes and the node comprehensive score factors. The fifth-level malicious nodes are directly eliminated. For the fourth-level vulnerable nodes, the isolation threshold is calculated by combining the average potential malicious probability and the variance of the node comprehensive score, and the vulnerable nodes with a comprehensive score less than the isolation threshold are eliminated; Based on the type and intensity of the attack suffered by the victim node, the time decay factor and the node historical level factor, the score compensation that the victim node deserves is calculated and compensated to the corresponding node in subsequent cycles. Among them, if the ratio of the sum of the number of malicious nodes and victim nodes in the network to the total number of nodes reaches the preset threshold, the conservative communication mode is triggered, and only the top two levels of nodes are allowed to participate in the consensus, and other nodes are temporarily isolated.
[0037] In one embodiment, S4 may be implemented as follows: S401: Master node election, calculate the score of each node among the candidate master nodes ,in, , represents the number of half of the nodes randomly selected from the honest nodes, Represents an honest node Whether to give it to the candidate master node A vote was held, For honest nodes The comprehensive rating of is an honest node randomly selected from [0, 1] Random voting weights of Indicates a candidate master node For the The probability of a Sybil attacker node; Reflects the ranking of candidate masternodes at different stages in the past; the candidate masternode with the highest score is elected as the masternode. ,in, is the number of candidate master nodes, The node that is finally elected as the master node; S402: Isolate malicious nodes and calculate the average potential malicious probability ,in, Indicates the number of vulnerable nodes, Indicates vulnerable nodes For the The probability of a Sybil node; calculate the variance of the node comprehensive score ,in, is the average comprehensive score of vulnerable nodes; combined and Calculating the isolation threshold , and is the weight coefficient; the fifth-level malicious nodes are directly eliminated, and for the fourth-level vulnerable nodes, according to Decide whether to isolate and remove the vulnerable node. When it is 1, the node is isolated and removed; when it is 0, it is not isolated and removed; S403: Victim node scoring compensation, calculate the compensation that the victim node deserves ,in, and is the weight coefficient, Representation node for The probability of a victim-like node, in is the attenuation coefficient, Represents the victim node the time since the last compensated rating; S404: Conservative communication mode is triggered, and the ratio of the sum of the number of fifth-level malicious nodes and victim nodes in the network to the total number of nodes is calculated. ,in, Indicates the number of fifth-level malicious nodes, represents the number of victim nodes, Indicates the total number of nodes, When , the conservative communication mode is triggered, only the first two levels of nodes are allowed to participate in the consensus, and other nodes are temporarily isolated. , maintain normal mode.
[0038] Specifically, in the dynamic response step, the candidate master node Score in the masternode election phase Voting by honest nodes , comprehensive score of its own node , the probability of various Sybil attacker nodes and historical rating factors Comprehensive calculation, The highest node is elected as the master node, and then the fifth-level malicious nodes are eliminated, and the fourth-level vulnerable nodes are and Calculating the isolation threshold ,when When , it is determined to be a high-risk node and removed, and then the probability of each type of victim node is , time decay factor , and historical grade factors Comprehensive calculation of victim nodes Rating compensation , then the conservative communication mode is triggered, calculating the malicious nodes in the network With the victim node The proportion of , The conservative mode is triggered when the first-level candidate master nodes and second-level honest nodes are allowed to participate in the PBFT consensus.
[0039] It should be noted that the various policy parameters in the dynamic response step can be dynamically adjusted according to the actual network environment. For example, the conservative mode trigger threshold can be lowered during peak hours of electricity carbon trading, or the victim compensation attenuation coefficient can be increased in low-attack risk scenarios to balance scoring stability and response efficiency.
[0040] In general, the present invention implements a dynamic defense method for Sybil attacks on the power carbon trading blockchain network. It uses a combination of dilated convolution and vertical differential convolution to extract multi-scale features without increasing parameters and computational complexity, and dynamically weights and fuses features of different branches through AFF technology, with an accuracy rate of up to 98.5%. At the same time, it adopts a method of comprehensively scoring nodes based on eight indicators, divides nodes into five levels according to the comprehensive score, and implements dynamic response strategies such as master node election and malicious node isolation. When it is detected that the proportion of malicious nodes in the network reaches a threshold, the conservative communication mode is triggered in time, and flexible adjustments are made according to changes in the network environment, thereby achieving efficient, secure and flexible dynamic defense against Sybil attacks on the power carbon trading blockchain network.
[0041] Example 2 Based on the same inventive concept, this embodiment discloses a dynamic defense system against Sybil attacks in the power carbon trading blockchain, including: The system initialization module is used to perform system initialization steps, including: initializing blockchain network nodes, setting blockchain network parameters, loading trained Sybil attack detection model parameters, and initializing node status information including node comprehensive scores and historical records; A Sybil attack detection module is used to execute the Sybil attack detection step, pre-process the node data collected from the blockchain network, and perform Sybil attack detection using a trained Sybil attack detection model. The Sybil attack detection model includes a GAT-based dynamic topology learning module, a multi-scale feature extraction module, an attention feature fusion module, and an output module. Using the trained Sybil attack detection model to perform Sybil attack detection includes: using the extracted transaction behavior characteristics and network characteristics of the points to obtain the initial feature vector of the node, dynamically learning the topological relationship between nodes and assigning attention weights through the GAT-based dynamic topology learning module, further extracting multi-scale features through the multi-scale parallel void convolution of the multi-scale feature extraction module, and then weighted fusion of different scale features through the attention feature fusion module. Finally, the output module outputs the node classification results to identify normal nodes, three types of attacker nodes, three types of Sybil nodes, and three types of victim nodes. The node status assessment module is used to perform the node status assessment step. Based on the results of the Sybil attack detection step and the node's communication completion rate, stage completion performance, attack detection status, auxiliary indicators, historical scoring information, and victim node scoring compensation indicators, the entropy weight method is used to calculate the weight of each indicator and perform weighted summation to obtain the node's comprehensive score. The node is then divided into five levels based on the node's comprehensive score: candidate master node, honest node, ordinary node, vulnerable node, and malicious node, and differentiated permissions are assigned to nodes at each level. The dynamic response module is used to execute dynamic response steps and take corresponding defense measures based on the node status evaluation results.
[0042] Specifically, the Sybil attack detection module includes data preprocessing and feature selection, GAT-based dynamic topology learning, and multi-scale feature extraction and fusion components. The node status assessment module includes node classification, node comprehensive evaluation, and node grading components. The dynamic response module includes master node election, malicious node isolation, victim node score compensation, and conservative communication mode triggering components. The main functions or roles of each component are as follows: Data preprocessing and feature selection are used to perform preprocessing operations such as cleaning and denoising on the raw transaction data and network status data collected from the power carbon trading blockchain network, remove outliers and duplicate data, and filter out key information related to transaction behavior characteristics and network characteristics; Dynamic topology learning based on GAT is used to track the dynamic changes of nodes in the power carbon trading blockchain network in real time. It dynamically constructs the network topology structure based on the real-time interaction relationship between nodes, and uses the attention mechanism to assign weights to different nodes and connections between nodes, capturing the complex relationships between nodes in different periods and different interaction scenarios. Multi-scale feature extraction and fusion uses a parallel dilated convolution structure to extract features from data at different convolution kernel scales, obtaining a multi-scale feature set that includes local detail features and global macro features. AFF technology performs weighted fusion of features from different branches based on the importance of each scale feature in identifying Sybil attacks. Node classification: Based on the fused multi-scale features, a classification model is used to classify the nodes in the power carbon trading blockchain network; Node comprehensive evaluation, using multi-index information to calculate the comprehensive score of each node; Node grading: Using the scores output by comprehensive node evaluation, nodes are divided into different levels, and differentiated management and defense measures are taken for nodes of different levels; Masternode election: Based on the node level and honest node voting, the masternode is selected from the candidate masternodes to coordinate the PBFT consensus process; Malicious node isolation: Once a node is identified as a malicious node, it will be immediately isolated to prevent it from continuing to carry out malicious behavior in the network; Victim node scoring compensation: For victim nodes affected by a Sybil attack, scoring compensation is performed based on the extent of the attack to restore their reasonable level in the network; Conservative communication mode is triggered. When the number of malicious nodes and victim nodes in the network reaches a certain threshold, the conservative communication mode is triggered, and only the top two level nodes are allowed to participate in the consensus.
[0043] During the specific implementation process, data preprocessing and feature selection refer to cleaning and screening key features of the original data; GAT-based dynamic topology learning refers to real-time tracking of network node dynamics, building topology based on interaction relationships, and allocating node and connection weights using the attention mechanism; multi-scale feature extraction and fusion refers to using parallel void convolution to extract features from different scales and weighted fusion using AFF technology; master node election refers to coordinating consensus by selecting the master node based on the comprehensive node score and voting; victim node score compensation refers to compensating the attacked node according to the degree of impact; conservative communication mode triggering means that when the malicious and victim nodes reach the threshold, only the first two levels of nodes are allowed to participate in the consensus.
[0044] The dynamic defense system adopts a multi-feature fusion and node status dynamic evaluation mechanism in the detection and defense process. The Sybil attack detection module uses a combination of void convolution and vertical differential convolution to extract multi-scale features without increasing parameters and computational complexity, and highlights the feature changes in the vertical direction by calculating the difference between adjacent elements of the data in the vertical direction. At the same time, the features of different branches are dynamically weighted and fused through the AFF technology; the Sybil attack dynamic defense module comprehensively scores the nodes by combining eight indicators, and divides the nodes into five levels according to the comprehensive scoring results: candidate master nodes, honest nodes, ordinary nodes, vulnerable nodes and malicious nodes, and implements corresponding dynamic response strategies according to the node grading results, including master node election, malicious node isolation, victim node score compensation and conservative communication mode triggering.
[0045] Specifically, if necessary, the data after multi-scale feature extraction can be further optimized through dimensionality reduction algorithms to reduce redundant information and improve feature processing efficiency without losing key features.
[0046] Since the system described in Example 2 of the present invention is the system used to implement the method described in Example 1, those skilled in the art will be able to understand the specific structure and variations of the system based on the method described in Example 1 of the present invention, and therefore will not be described in detail here. All systems used in the method described in Example 1 of the present invention fall within the scope of protection of the present invention.
[0047] Example 3 Based on the same inventive concept, the present invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the dynamic defense method for Sybil attacks in the power carbon trading blockchain of embodiment one.
[0048] Since the computer-readable storage medium described in Example 3 of the present invention is used to implement the method for dynamically defending against Sybil attacks in the power carbon trading blockchain described in Example 1 of the present invention, the specific structure and variations of the computer-readable storage medium are readily understood by those skilled in the art based on the method described in Example 1 of the present invention, and thus will not be further described here. All computer-readable storage media used in the method of Example 1 of the present invention fall within the scope of protection of the present invention.
[0049] Example 4 Based on the same inventive concept, the present invention also provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method described in Embodiment 1 when executing the program.
[0050] Since the computer device described in Example 4 of the present invention is used to implement the method for dynamically defending against Sybil attacks in the power carbon trading blockchain described in Example 1 of the present invention, the specific structure and variations of the computer device are readily understood by those skilled in the art based on the method described in Example 1 of the present invention, and therefore will not be further described here. All computer devices used in the method described in Example 1 of the present invention fall within the scope of protection of the present invention.
[0051] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0052] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowcharts and / or block diagrams. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0053] Although preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they are aware of the basic inventive concepts. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention. Obviously, those skilled in the art may make various changes and modifications to the embodiments of the present invention without departing from the spirit and scope of the embodiments of the present invention. Thus, the present invention is intended to include such changes and modifications to the embodiments of the present invention if they fall within the scope of the claims and their equivalents.
Claims
1. A dynamic defense method for Sybil attacks in the power carbon trading blockchain, characterized in that: include: System initialization step, initializes the blockchain network nodes, sets the blockchain network parameters, loads the trained Sybil attack detection model parameters, and initializes the node status information including the node comprehensive score and historical records; The Sybil attack detection step pre-processes the node data collected from the blockchain network and performs Sybil attack detection using a trained Sybil attack detection model. The Sybil attack detection model includes a GAT-based dynamic topology learning module, a multi-scale feature extraction module, an attention feature fusion module, and an output module. Using the trained Sybil attack detection model to perform Sybil attack detection includes: using the extracted transaction behavior characteristics and network characteristics of the points to obtain the initial feature vector of the node, dynamically learning the topological relationship between nodes and assigning attention weights through the GAT-based dynamic topology learning module, further extracting multi-scale features through the multi-scale parallel void convolution of the multi-scale feature extraction module, and then weighted fusion of different scale features through the attention feature fusion module. Finally, the output module outputs the node classification results to identify normal nodes, three types of attacker nodes, three types of Sybil nodes, and three types of victim nodes. In the node status assessment step, based on the results of the Sybil attack detection step and the node's communication completion rate, stage completion performance, attack detection status, auxiliary indicators, historical scoring information, and victim node scoring compensation indicators, the entropy weight method is used to calculate the weight of each indicator and perform weighted summation to obtain the node's comprehensive score. Nodes are then divided into five levels based on the node's comprehensive score: candidate master nodes, honest nodes, ordinary nodes, vulnerable nodes, and malicious nodes, and differentiated permissions are assigned to nodes at each level. Dynamic response step: take corresponding defense measures based on the node status assessment results.
2. The dynamic defense method for Sybil attacks in the power carbon trading blockchain according to claim 1 is characterized in that: System initialization steps include: S101: Initialize the power carbon trading blockchain network and set network parameters, including the number of nodes, initial node status, and network topology; S102: Load the trained Sybil attack detection model parameters, initialize the node status information, set the node comprehensive score initial value and score interval [0, 1], and set the node historical level vector to zero vector.
3. The dynamic defense method for Sybil attacks in the power carbon trading blockchain according to claim 1 is characterized in that: Sybil attack detection steps include: S201: Collect transaction data and network traffic data, and perform data preprocessing on the collected data; S202: Select Sybil attack detection related features from the pre-processed data, including transaction amount and transaction frequency Transaction time interval, transaction in-degree, transaction out-degree, number of transaction counterparties, network delay characteristics, node connectivity, node traffic characteristics, and connection duration are used to form a node feature vector; S203: Input the set of node feature vectors into the GAT-based dynamic topology learning module to calculate the node and The attention coefficient between ; then normalize , get the normalized attention weight ;according to Aggregate the feature vectors of neighboring nodes and update the node The feature vector of each node is then derived based on the multi-head attention mechanism. And the overall new node feature set is ,in, 、 and are the feature vectors of the first, second and Nth nodes respectively; S204: Input the entire new node feature set into the four parallel convolutions of the multi-scale feature extraction module respectively. The original convolution kernel size of the first three dilated convolutions is 3. 3, the void rates are 1, 2, and 3 respectively, and the convolution kernel size of the fourth vertical differential convolution is 3 3. According to the formula Calculate the convolution kernel size for dilated convolution ,in, is the original convolution kernel size, is the void rate; after four convolutions, the data is input into the normalization layer and the activation layer respectively; S205: After the data passes through four parallel convolutions, the output features of the four parallel convolution layers are combined into six groups of input pairs, which are respectively sent to the multi-scale feature fusion module for fusion. The six groups of AFF output features are spliced in the channel dimension and average pooled to fuse the multi-scale information extracted by different convolutions and reduce the data size. S206: The feature data after average pooling is input into the output module, which includes a fully connected layer and a softmax layer. The output node is classified into ten types of probabilities and classification results, including normal nodes, eclipse witch attacker nodes, DDoS witch attacker nodes, double-flower witch attacker nodes, eclipse witch nodes, DDoS witch nodes, double-flower witch nodes, eclipse victim nodes, DDoS victim nodes, and double-flower victim nodes.
4. The dynamic defense method for Sybil attacks in the power carbon trading blockchain according to claim 3 is characterized in that: In S205, the processing process of the multi-scale feature fusion module includes: Compute channel attention of local features in multi-scale channel attention module ,in, Pass 1 1-point convolution operation reduces the input The number of channels, Pass 1 1Convolution changes the number of channels to the same as the input Consistent, is the BatchNorm layer, is the ReLU function; Compute channel attention of global features in multi-scale channel attention module ; For input data Perform a global average pooling operation and calculate the weight value and Perform attention operations together and calculate features ,in, The attention weights generated for the multi-scale channel attention module, is the Sigmoid function, is the feature obtained by attention calculation.
5. The dynamic defense method for Sybil attacks in the power carbon trading blockchain according to claim 1, characterized in that: Node status evaluation steps include: S301: Calculate the communication completion rate of the node , the calculation phase completes the performance , calculate the change in consensus participation , and then calculate the attack detection situation , among which, the node that is judged to be one of the three types of Sybil attacker nodes and Sybil nodes, Assign 0 to nodes that are not directly classified, and add the probabilities of the three types of Sybil attacker nodes and the three types of Sybil nodes to get ,calculate ; Calculate auxiliary indicators by taking the average value of some network features input into the Sybil attack detection model ;in, is the network delay characteristic, is the node connectivity, is the node traffic characteristic, Calculate high-level historical scoring information for connection duration (where the molecule represents the node The historical situation of being classified into the first and second levels, the denominator represents all The sum of the historical situations in which nodes are classified into the first and second levels) and low-level historical scoring information (where the molecule represents the node The historical situation of being classified into the third, fourth and fifth levels, the denominator represents all the The sum of the historical situations in which the node is classified into the third, fourth, and fifth levels; and According to the node history level vector Calculate, in this vector - Reflection Node According to the historical situation that the node score is classified into 1-5 levels, its initial value is zero vector); calculate the victim node Rating compensation , and then the entropy weight method is used to determine the weight of each indicator - ; Calculate nodes based on each indicator Overall rating ;calculate After that, update ; S302: Based on the comprehensive scoring of nodes Nodes are divided into five levels. The first level is the candidate master node, which has the priority to be elected as the PBFT consensus master node; the second level is the honest node, which has the authority to participate in consensus and participate in the election of the master node; the third level is the ordinary node, which can participate in the consensus process normally; the fourth level is the vulnerable node, which is temporarily isolated and does not have the authority to participate in the consensus; the fifth level is the malicious node, which is prohibited from participating in any network activities and is removed from the blockchain network.
6. The dynamic defense method for Sybil attacks in the power carbon trading blockchain according to claim 1, characterized in that: Take appropriate defensive measures based on the node status assessment results, including: From the candidate master nodes, the highest-scoring candidate master node is selected as the PBFT consensus master node, taking into account the voting results of honest nodes and the node comprehensive score factors. The fifth-level malicious nodes are directly eliminated. For the fourth-level vulnerable nodes, the isolation threshold is calculated by combining the average potential malicious probability and the variance of the node comprehensive score, and the vulnerable nodes with a comprehensive score less than the isolation threshold are eliminated; Based on the type and intensity of the attack suffered by the victim node, the time decay factor and the node historical level factor, the score compensation that the victim node deserves is calculated and compensated to the corresponding node in subsequent cycles. Among them, if the ratio of the sum of the number of malicious nodes and victim nodes in the network to the total number of nodes reaches the preset threshold, the conservative communication mode is triggered, and only the top two levels of nodes are allowed to participate in the consensus, and other nodes are temporarily isolated.
7. The dynamic defense method for Sybil attacks in the power carbon trading blockchain according to claim 1, characterized in that: The dynamic response steps include: S401: Master node election, calculate the score of each node among the candidate master nodes ,in, , represents the number of half of the nodes randomly selected from the honest nodes, Represents an honest node Whether to give it to the candidate master node A vote was held, For honest nodes The comprehensive rating of is an honest node randomly selected from [0, 1] Random voting weights of Indicates a candidate master node For the The probability of a Sybil attacker node; Reflects the ranking of candidate masternodes at different stages in the past; the candidate masternode with the highest score is elected as the masternode. ,in, is the number of candidate master nodes, The node that is finally elected as the master node; S402: Isolate malicious nodes and calculate the average potential malicious probability ,in, Indicates the number of vulnerable nodes, Indicates vulnerable nodes For the The probability of a Sybil node; calculate the variance of the node comprehensive score ,in, is the average comprehensive score of vulnerable nodes; combined and Calculating the isolation threshold , and is the weight coefficient; the fifth-level malicious nodes are directly eliminated, and for the fourth-level vulnerable nodes, according to Decide whether to isolate and remove the vulnerable node. When it is 1, the node is isolated and removed; when it is 0, it is not isolated and removed; S403: Victim node scoring compensation, calculate the compensation that the victim node deserves ,in, and is the weight coefficient, Representation node for The probability of a victim-like node, in is the attenuation coefficient, Represents the victim node the time since the last compensated rating; S404: Conservative communication mode is triggered, and the ratio of the sum of the number of fifth-level malicious nodes and victim nodes in the network to the total number of nodes is calculated. ,in, Indicates the number of fifth-level malicious nodes, represents the number of victim nodes, Indicates the total number of nodes, When , the conservative communication mode is triggered, only the first two levels of nodes are allowed to participate in the consensus, and other nodes are temporarily isolated. , maintain normal mode.
8. A dynamic defense system for Sybil attacks in the electricity carbon trading blockchain, characterized in that: include: The system initialization module is used to perform system initialization steps, including: initializing blockchain network nodes, setting blockchain network parameters, loading trained Sybil attack detection model parameters, and initializing node status information including node comprehensive scores and historical records; A Sybil attack detection module is used to execute the Sybil attack detection step, pre-process the node data collected from the blockchain network, and perform Sybil attack detection using a trained Sybil attack detection model. The Sybil attack detection model includes a GAT-based dynamic topology learning module, a multi-scale feature extraction module, an attention feature fusion module, and an output module. Using the trained Sybil attack detection model to perform Sybil attack detection includes: using the extracted transaction behavior characteristics and network characteristics of the points to obtain the initial feature vector of the node, dynamically learning the topological relationship between nodes and assigning attention weights through the GAT-based dynamic topology learning module, further extracting multi-scale features through the multi-scale parallel void convolution of the multi-scale feature extraction module, and then weighted fusion of different scale features through the attention feature fusion module. Finally, the output module outputs the node classification results to identify normal nodes, three types of attacker nodes, three types of Sybil nodes, and three types of victim nodes. The node status assessment module is used to perform the node status assessment step. Based on the results of the Sybil attack detection step and the node's communication completion rate, stage completion performance, attack detection status, auxiliary indicators, historical scoring information, and victim node scoring compensation indicators, the entropy weight method is used to calculate the weight of each indicator and perform weighted summation to obtain the node's comprehensive score. The node is then divided into five levels based on the node's comprehensive score: candidate master node, honest node, ordinary node, vulnerable node, and malicious node, and differentiated permissions are assigned to nodes at each level. The dynamic response module is used to execute dynamic response steps and take corresponding defense measures based on the node status evaluation results.
9. A computer-readable storage medium, characterized in that A computer program is stored thereon, which, when executed by a processor, implements the dynamic defense method for Sybil attacks in the electricity carbon trading blockchain as described in any one of claims 1 to 7.
10. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the dynamic defense method for Sybil attacks in the electricity carbon trading blockchain as described in any one of claims 1 to 7 is implemented.