Adaptive Detection Method, Terminal, and Storage Medium for Blockchain Against Sybil Attacks
Patent Information
- Application Number
- CN202211366833.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-01
- Publication Date
- 2026-09-18
- Estimated Expiration
- 2042-11-01
AI Technical Summary
[0008]针对现有技术的不足,本发明提供了一种面向女巫攻击的区块链自适应检测方法、终端及存储介质,解决了上述背景技术中提出的对一个目标进行女巫攻击检测的情况,导致检测效率低,难以及时发现女巫攻击,没有考虑同时对其他多个目标进行女巫攻击检测的情况
[0067] This invention provides an adaptive blockchain detection method, terminal, and storage medium for Sybil attacks. It offers the following advantages:
Smart Images

Figure CN117155594B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of blockchain technology, specifically to an adaptive detection method, terminal, and storage medium for blockchain attacks targeting Sybil attacks. Background Technology
[0002] Blockchain is a brand-new decentralized infrastructure and distributed computing paradigm with features such as decentralization, time-series data, collective maintenance, programmability, and security and trustworthiness. It has been widely used in fields such as finance, energy, and healthcare, and has attracted great attention and widespread interest from government departments, financial institutions, technology companies, and capital markets.
[0003] In blockchain, the consensus algorithm is crucial to its effective application. Currently, mainstream consensus algorithms include Proof of Stake (POS), Delegated Proof of Stake (DPoS), Practical Byzantine Fault Tolerance (PBFT), and Directed Acyclic Graphs (DAG), but these algorithms are vulnerable to Sybil attacks.
[0004] A Sybil attack refers to an attacker deceiving other nodes by impersonating them. The specific attack process is as follows: When nodes are reaching block consensus, the attacker impersonates multiple nodes and continuously sends messages to other nodes, thereby obtaining information about the blockchain network's connectivity and misleading legitimate nodes' routing choices. Ultimately, when the number of nodes impersonated by the attacker reaches a certain level, it can directly affect the block consensus result.
[0005] To effectively combat Sybil attacks and ensure information security in blockchain systems, the system needs to detect Sybil attacks and reduce the impact of Sybil attackers on the consensus algorithm, thereby minimizing the impact of Sybil attacks while maintaining block consensus efficiency. To effectively curb Sybil attacks on blockchains, it is necessary to research a detection method for blockchain Sybil attacks, reduce their impact, and improve the efficiency of block on-chain processing.
[0006] However, most current technologies focus on detecting Sybil attacks on a single target, resulting in low detection efficiency and difficulty in timely detection. They do not consider the scenario of simultaneously detecting Sybil attacks on multiple targets. Furthermore, there is a lack of efficient computational power allocation models and research on optimal computational power allocation for detection. Summary of the Invention
[0007] (a) Technical problems to be solved
[0008] To address the shortcomings of existing technologies, this invention provides an adaptive blockchain detection method, terminal, and storage medium for Sybil attacks. It solves the problems mentioned in the background section, where detecting Sybil attacks on a single target leads to low detection efficiency and difficulty in timely detection, and it does not consider the scenario of simultaneously detecting Sybil attacks on multiple targets. Furthermore, it addresses the lack of an effective computing power allocation model for detection and research on optimal computing power allocation.
[0009] (II) Technical Solution
[0010] To achieve the above objectives, the present invention provides the following technical solution: an adaptive blockchain detection method for Sybil attacks, comprising:
[0011] S1 initializes system parameters and detects the area segmentation;
[0012] S2 constructs an optimized Sybil attack detection model with adaptive computing power allocation;
[0013] S3 constructs a search space and randomly generates multiple detection computing power allocation schemes for the target region within the search space, forming an allocation scheme matrix. It records the current iteration number and the similarity ratio between the current iteration process's detection computing power allocation scheme and the previous iteration process's detection computing power allocation scheme with the same number of iterations.
[0014] S4 determines whether it is in one of the four stages of the AO Eagle optimization algorithm based on the current number of iterations and the similarity ratio.
[0015] If S5 is included, then the detection computing power allocation scheme is updated, and the optimal detection computing power allocation scheme in the current iteration process is calculated.
[0016] If S6 does not belong to the category, the global optimal solution of the witch attack detection optimization model is obtained, and the optimal allocation scheme of detection computing power is obtained.
[0017] S7 adaptively allocates detection computing power to different target areas based on the optimal allocation scheme for detection computing power, and performs detection of Sybil attacks in the target areas.
[0018] Preferably, the system parameters include: the maximum number of iterations M, the current number of iterations m, and the optimal allocation scheme x during the current iteration. best Threshold κ, iteration round threshold STh, reward ratio ρ, and revenue increment ratio ε i and ω i .
[0019] Preferably, the construction of the Sybil attack detection optimization model with adaptive detection computing power allocation includes: letting τ i Let τ represent the proportion of detection computing power allocated to target region i, and α represent the total detection computing power.i α collects behavioral information of all nodes in target region i and uses a threshold method to determine whether the node is a Sybil attacker.
[0020] If the node is a Sybil attacker, its consensus rights are restricted. After 100 blocks of consensus, the node's consensus rights are restarted, and the consensus efficiency of the target region i is calculated. Average transaction latency Average node communication overhead The optimized model for detecting Sybil attacks is established as follows:
[0021]
[0022]
[0023]
[0024] Where r1 represents the consensus efficiency factor, r2 represents the average transaction latency factor, r3 represents the average node communication overhead factor, and N represents the number of target regions.
[0025] Preferably, the step of constructing a search space and randomly generating multiple detection computing power allocation schemes for the target region within the search space, forming an allocation scheme matrix, and recording the current iteration number and the similarity ratio between the current iteration process's detection computing power allocation scheme and the previous iteration process's detection computing power allocation scheme with the same iteration number; includes: constructing a search space based on the constraints in the Sybil attack detection optimization model formula (1), and randomly generating K detection computing power allocation schemes for the detection pool within the search space, forming an allocation scheme matrix X = {x1, x2, ..., x...} k ,...,x K}, where x k This represents the computing power allocation scheme for the k-th detection.
[0026] If the current iteration number is 1, then the similarity ratio S of the computing power allocation scheme is detected. k If it is UTh, then calculate the similarity ratio S between each detection power allocation scheme in the current iteration and the corresponding detection power allocation scheme in the previous iteration. k ,
[0027]
[0028] Among them, S k This represents the similarity ratio between the k-th detection computing power allocation scheme in the current iteration and the k-th detection computing power allocation scheme in the previous iteration. This represents the detection computing power of the j-th target region within the k-th detection computing power allocation scheme during m iterations. This represents the detection computing power of the j-th target region within the k-th detection computing power allocation scheme during the m-1 rounds of iteration.
[0029] Preferably, updating the detection computing power allocation scheme includes:
[0030] When m≤(2×M) / 3 and S k When ≥UTh, the current allocation scheme is far from the optimal allocation scheme. Therefore, the search range of the optimal computing power allocation scheme is quickly determined by simulating the high-altitude flight of an eagle using formula (3), and the detection computing power allocation scheme is updated.
[0031]
[0032] in, Let x represent the power allocation scheme for the k-th detection in the (m+1)-th iteration. c Let x represent a vector of size ω×1 composed of the average values of the current detection computing power allocation scheme matrix X. best This represents the optimal allocation scheme in the current iteration process, and Rand1 represents a random number in the range of 0 to 1;
[0033] When m≤(2×M) / 3 and S k When <UTh, since the search range of the optimal allocation scheme is relatively wide, the eagle hovers above the prey by formula (4), and updates the detection computing power allocation scheme by short gliding and other high-altitude flight actions, further narrowing the current search range, so as to facilitate the rapid approach of the optimal detection computing power allocation scheme in the later stage.
[0034]
[0035] Among them, R L Let x represent the distribution function exhibiting Lévy flight. d This represents the random selection of the detection computing power allocation scheme in the current allocation scheme matrix X, where μ1 and μ2 represent the random value vectors of the simulated eagle spiral search;
[0036] When m > (2×M) / 3 and S k When ≥LTh, considering that the detection computing power allocation scheme needs to transition from large-scale search to small-scale optimization, when simulating the eagle to determine the precise area of the prey through formula (5), low-altitude flight and rapid attack are adopted to update the detection computing power allocation scheme and quickly approach the optimal detection computing power allocation scheme, so as to facilitate the next step to accurately search for the optimal detection computing power allocation scheme.
[0037]
[0038] Where, x meanω1 and ω2 represent the average vector of the current allocation scheme matrix X in different dimensions, ω1 and ω2 represent the allocation scheme search parameters in the range of 0 to 1, Rand2 represents a vector of size n×1 composed of random numbers in the range of 0 to 1, up represents a vector of size n×1 composed of the maximum values in different dimensions, and lp represents a vector of size n×1 composed of the minimum values in different dimensions.
[0039] When m > (2×M) / 3 and S k When <LTh, considering that the detection computing power allocation scheme is close to the optimal solution, the quality function f that ensures accurate search is calculated by formula (6), and combined with formula (7) to simulate the eagle accurately grabbing and capturing prey, the detection computing power allocation scheme is updated, and the optimal detection computing power allocation scheme is found.
[0040]
[0041]
[0042] Where f represents the quality function of the accurate search, g1 represents the random value in the process of simulating an eagle capturing prey, and g2 represents the flight slope in the process of simulating an eagle capturing prey.
[0043] Preferably, the calculation to obtain the optimal allocation scheme of detection computing power in the current iteration process includes: Step 1: For each detection computing power allocation scheme, calculate the similarity ratio difference of the detection computing power allocation scheme under adjacent iteration numbers according to formula (8);
[0044]
[0045] in, This represents the similarity ratio difference of the k-th detection computing power scheme in the m-th iteration. This represents the similarity ratio of the k-th detection computing power scheme in the m-th iteration;
[0046] Based on the above similarity ratio difference calculation results, determine whether the similarity ratio difference of each detection computing power allocation scheme is less than the threshold π, and count the number of detection computing power allocation schemes that are less than the threshold π (sum); when sum reaches the iteration round threshold STh and the optimal computing power allocation scheme x in the current iteration... best If there is no change, that is, if the current solution method is determined to be trapped in a local optimum, then jump to step 2; otherwise, jump directly to step 3.
[0047] Step 2: Generate a new detection computing power allocation scheme according to formula (9), and replace the detection computing power allocation scheme with a similarity ratio difference less than the threshold π. Perform an artificial bee colony solution update mechanism to ensure the difference of the newly generated detection computing power allocation scheme in the search space.
[0048]
[0049] in, This represents the regenerated detection computing power allocation scheme, x t This represents the detection computing power allocation scheme that needs to be replaced in the allocation scheme matrix, x. r1 and x r2 This indicates a randomly selected detection computing power allocation scheme;
[0050] Step 3: Determine whether each detection computing power allocation scheme meets the constraints of model (1). If it does, proceed directly to step 4; otherwise, proceed to step 5.
[0051] Step 4: Generate a new detection computing power allocation scheme according to formula (9), and replace the detection computing power allocation scheme that does not meet the constraints in model (1) to ensure the difference of the newly generated detection computing power allocation scheme in the search space;
[0052] Step 5: Calculate the fitness value of each detection computing power allocation scheme according to formula (10), calculate the similarity ratio of each detection computing power allocation scheme according to formula (2), select the detection computing power allocation scheme with the largest fitness value, and update the optimal allocation scheme x in the current iteration. best ;
[0053]
[0054] Among them, F k This represents the fitness value of the computing power allocation scheme for the k-th pool.
[0055] Step 6: Determine whether the current iteration number m is greater than the maximum iteration number M. If not, the current iteration number m = m + 1, and continue the optimization iteration; otherwise, obtain the global optimal solution of the detection pool revenue model and obtain the optimal allocation scheme of detection computing power.
[0056] This invention also provides a blockchain adaptive detection system for Sybil attacks, comprising:
[0057] Initialization module: Used to initialize system parameters and detect area segmentation;
[0058] Sybil Attack Detection Optimization Model Building Module: Used to build a Sybil Attack Detection Optimization Model with Adaptive Detection Computational Allocation;
[0059] The optimal computing power allocation scheme calculation module is used to construct a search space and randomly generate multiple computing power allocation schemes for the target area within the search space, forming an allocation scheme matrix. It records the current iteration number and the similarity ratio between the current iteration's computing power allocation scheme and the previous iteration's computing power allocation scheme with the same number of iterations.
[0060] Based on the current number of iterations and similarity ratio, determine whether it is in one of the four stages of the AO Eagle optimization algorithm;
[0061] If it is, then the detection computing power allocation scheme is updated, and the optimal detection computing power allocation scheme in the current iteration process is calculated;
[0062] If it does not belong to the category, the global optimal solution of the Sybil attack detection optimization model is obtained, and the optimal allocation scheme of detection computing power is obtained.
[0063] The adaptive allocation module for detection computing power is used to adaptively allocate detection computing power to different target areas according to the optimal allocation scheme for detection computing power, and to detect Sybil attacks in the target areas.
[0064] The present invention also provides a blockchain adaptive detection terminal for Sybil attacks, the terminal comprising a processor and a memory, the memory storing at least one instruction or at least one program, the at least one instruction or the at least one program being loaded and executed by the processor to implement a blockchain adaptive detection method for Sybil attacks as described in any of the preceding claims.
[0065] The present invention also provides a computer-readable storage medium storing a computer program that, when executed by one or more processors, implements the steps of a blockchain adaptive detection method for Sybil attacks as described in any of the preceding claims.
[0066] (III) Beneficial Effects
[0067] This invention provides an adaptive blockchain detection method, terminal, and storage medium for Sybil attacks. It offers the following advantages:
[0068] This invention addresses the scenario where detection computing power is used to detect Sybil attacks across multiple target areas. It uses mathematical formulas to represent the computing power required for hash value calculation and the network performance involved in allocating computing power to multiple target areas for Sybil attack detection. An adaptive Sybil attack detection optimization model is established based on Eagle Optimization. This method improves the selection mechanism for different optimization stages, enhancing the convergence speed of the detection optimization model. It also replaces solutions based on their similarity ratio during multiple iterations, effectively preventing Eagle Optimization from getting trapped in local optima. Through model optimization and adaptive allocation of detection computing power to multiple target areas, this invention helps target areas detect Sybil attacks promptly and reduces their impact, thereby improving the consensus effect of the blockchain. Attached Figure Description
[0069] Figure 1 This invention provides a flowchart of a blockchain adaptive detection method for Sybil attacks.
[0070] Figure 2 This invention provides a structural diagram of a blockchain adaptive detection system for Sybil attacks.
[0071] Figure 3 This invention provides a structural diagram of a blockchain adaptive detection terminal designed to counter Sybil attacks. Detailed Implementation
[0072] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention.
[0073] An adaptive blockchain detection method for Sybil attacks includes:
[0074] Initialize system parameters and detect area segmentation;
[0075] Construct an adaptive Sybil attack detection optimization model based on computing power allocation;
[0076] Construct a search space and randomly generate multiple detection computing power allocation schemes for the target region within the search space, forming an allocation scheme matrix. Record the current iteration number and the similarity ratio between the current iteration process's detection computing power allocation scheme and the previous iteration process's detection computing power allocation scheme with the same number of iterations.
[0077] Based on the current number of iterations and similarity ratio, determine whether it is in one of the four stages of the AO Eagle optimization algorithm;
[0078] If it is, then the detection computing power allocation scheme is updated, and the optimal detection computing power allocation scheme in the current iteration process is calculated;
[0079] If it does not belong to the category, the global optimal solution of the Sybil attack detection optimization model is obtained, and the optimal allocation scheme of detection computing power is obtained.
[0080] Based on the optimal allocation scheme of detection computing power, detection computing power is adaptively allocated to different target areas, and Sybil attacks are detected in the target areas.
[0081] Preferably, the system parameters include: the maximum number of iterations M, the current number of iterations m, and the optimal allocation scheme x during the current iteration. best Threshold κ, iteration round threshold STh, reward ratio ρ, and revenue increment ratio ε i and ω i .
[0082] Preferably, the construction of the Sybil attack detection optimization model with adaptive detection computing power allocation includes: letting τ i Let τ represent the proportion of detection computing power allocated to target region i, and α represent the total detection computing power.i α collects behavioral information of all nodes in target region i and uses a threshold method to determine whether the node is a Sybil attacker.
[0083] If the node is a Sybil attacker, its consensus rights are restricted. After 100 blocks of consensus, the node's consensus rights are restarted, and the consensus efficiency of the target region i is calculated. Average transaction latency Average node communication overhead The optimized model for detecting Sybil attacks is established as follows:
[0084]
[0085]
[0086]
[0087] Where r1 represents the consensus efficiency factor, r2 represents the average transaction latency factor, r3 represents the average node communication overhead factor, and N represents the number of target regions.
[0088] Preferably, the step of constructing a search space and randomly generating multiple detection computing power allocation schemes for the target region within the search space, forming an allocation scheme matrix, and recording the current iteration number and the similarity ratio between the current iteration process's detection computing power allocation scheme and the previous iteration process's detection computing power allocation scheme with the same iteration number; includes: constructing a search space based on the constraints in the Sybil attack detection optimization model formula (1), and randomly generating K detection computing power allocation schemes for the detection pool within the search space, forming an allocation scheme matrix X = {x1, x2, ..., x...} k ,...,x K}, where x k This represents the computing power allocation scheme for the k-th detection.
[0089] If the current iteration number is 1, then the similarity ratio S of the computing power allocation scheme is detected. k If it is UTh, then calculate the similarity ratio S between each detection power allocation scheme in the current iteration and the corresponding detection power allocation scheme in the previous iteration. k ,
[0090]
[0091] Among them, S k This represents the similarity ratio between the k-th detection computing power allocation scheme in the current iteration and the k-th detection computing power allocation scheme in the previous iteration. This represents the detection computing power of the j-th target region within the k-th detection computing power allocation scheme during m iterations. This represents the detection computing power of the j-th target region within the k-th detection computing power allocation scheme during the m-1 rounds of iteration.
[0092] Preferably, updating the detection computing power allocation scheme includes:
[0093] When m≤(2×M) / 3 and S k When ≥UTh, the current allocation scheme is far from the optimal allocation scheme. Therefore, the search range of the optimal computing power allocation scheme is quickly determined by simulating the high-altitude flight of an eagle using formula (3), and the detection computing power allocation scheme is updated.
[0094]
[0095] in, Let x represent the power allocation scheme for the k-th detection in the (m+1)-th iteration. c Let x represent a vector of size ω×1 composed of the average values of the current detection computing power allocation scheme matrix X. best This represents the optimal allocation scheme in the current iteration process, and Rand1 represents a random number in the range of 0 to 1;
[0096] When m≤(2×M) / 3 and S k When <UTh, since the search range of the optimal allocation scheme is relatively wide, the eagle hovers above the prey by formula (4), and updates the detection computing power allocation scheme by short gliding and other high-altitude flight actions, further narrowing the current search range, so as to facilitate the rapid approach of the optimal detection computing power allocation scheme in the later stage.
[0097]
[0098] Among them, R L Let x represent the distribution function exhibiting Lévy flight. d This represents the random selection of the detection computing power allocation scheme in the current allocation scheme matrix X, where μ1 and μ2 represent the random value vectors of the simulated eagle spiral search;
[0099] When m > (2×M) / 3 and S k When ≥LTh, considering that the detection computing power allocation scheme needs to transition from large-scale search to small-scale optimization, when simulating the eagle to determine the precise area of the prey through formula (5), low-altitude flight and rapid attack are adopted to update the detection computing power allocation scheme and quickly approach the optimal detection computing power allocation scheme, so as to facilitate the next step to accurately search for the optimal detection computing power allocation scheme.
[0100]
[0101] Where, x meanω1 and ω2 represent the average vector of the current allocation scheme matrix X in different dimensions, ω1 and ω2 represent the allocation scheme search parameters in the range of 0 to 1, Rand2 represents a vector of size n×1 composed of random numbers in the range of 0 to 1, up represents a vector of size n×1 composed of the maximum values in different dimensions, and lp represents a vector of size n×1 composed of the minimum values in different dimensions.
[0102] When m > (2×M) / 3 and S k When <LTh, considering that the detection computing power allocation scheme is close to the optimal solution, the quality function f that ensures accurate search is calculated by formula (6), and combined with formula (7) to simulate the eagle accurately grabbing and capturing prey, the detection computing power allocation scheme is updated, and the optimal detection computing power allocation scheme is found.
[0103]
[0104]
[0105] Where f represents the quality function of the accurate search, g1 represents the random value in the process of simulating an eagle capturing prey, and g2 represents the flight slope in the process of simulating an eagle capturing prey.
[0106] Preferably, the calculation to obtain the optimal allocation scheme of detection computing power in the current iteration process includes: Step 1: For each detection computing power allocation scheme, calculate the similarity ratio difference of the detection computing power allocation scheme under adjacent iteration numbers according to formula (8);
[0107]
[0108] in, This represents the similarity ratio difference of the k-th detection computing power scheme in the m-th iteration. This represents the similarity ratio of the k-th detection computing power scheme in the m-th iteration;
[0109] Based on the above similarity ratio difference calculation results, determine whether the similarity ratio difference of each detection computing power allocation scheme is less than the threshold π, and count the number of detection computing power allocation schemes that are less than the threshold π (sum); when sum reaches the iteration round threshold STh and the optimal computing power allocation scheme x in the current iteration... best If there is no change, that is, if the current solution method is determined to be trapped in a local optimum, then jump to step 2; otherwise, jump directly to step 3.
[0110] Step 2: Generate a new detection computing power allocation scheme according to formula (9), and replace the detection computing power allocation scheme with a similarity ratio difference less than the threshold π. Perform an artificial bee colony solution update mechanism to ensure the difference of the newly generated detection computing power allocation scheme in the search space.
[0111]
[0112] in, This represents the regenerated detection computing power allocation scheme, x t This represents the detection computing power allocation scheme that needs to be replaced in the allocation scheme matrix, x. r1 and x r2 This indicates a randomly selected detection computing power allocation scheme;
[0113] Step 3: Determine whether each detection computing power allocation scheme meets the constraints of model (1). If it does, proceed directly to step 4; otherwise, proceed to step 5.
[0114] Step 4: Generate a new detection computing power allocation scheme according to formula (9), and replace the detection computing power allocation scheme that does not meet the constraints in model (1) to ensure the difference of the newly generated detection computing power allocation scheme in the search space;
[0115] Step 5: Calculate the fitness value of each detection computing power allocation scheme according to formula (10), calculate the similarity ratio of each detection computing power allocation scheme according to formula (2), select the detection computing power allocation scheme with the largest fitness value, and update the optimal allocation scheme x in the current iteration. best ;
[0116]
[0117] Among them, F k This represents the fitness value of the computing power allocation scheme for the k-th pool.
[0118] Step 6: Determine whether the current iteration number m is greater than the maximum iteration number M. If not, the current iteration number m = m + 1, and continue the optimization iteration; otherwise, obtain the global optimal solution of the detection pool revenue model and obtain the optimal allocation scheme of detection computing power.
[0119] like Figure 2 As shown, the present invention also provides a blockchain adaptive detection system for Sybil attacks, comprising:
[0120] Initialization module: Used to initialize system parameters and detect area segmentation;
[0121] Sybil Attack Detection Optimization Model Building Module: Used to build a Sybil Attack Detection Optimization Model with Adaptive Detection Computational Allocation;
[0122] The optimal computing power allocation scheme calculation module is used to construct a search space and randomly generate multiple computing power allocation schemes for the target area within the search space, forming an allocation scheme matrix. It records the current iteration number and the similarity ratio between the current iteration's computing power allocation scheme and the previous iteration's computing power allocation scheme with the same number of iterations.
[0123] Based on the current number of iterations and similarity ratio, determine whether it is in one of the four stages of the AO Eagle optimization algorithm;
[0124] If it is, then the detection computing power allocation scheme is updated, and the optimal detection computing power allocation scheme in the current iteration process is calculated;
[0125] If it does not belong to the category, the global optimal solution of the Sybil attack detection optimization model is obtained, and the optimal allocation scheme of detection computing power is obtained.
[0126] The adaptive allocation module for detection computing power is used to adaptively allocate detection computing power to different target areas according to the optimal allocation scheme for detection computing power, and to detect Sybil attacks in the target areas.
[0127] The present invention also provides a blockchain adaptive detection terminal for Sybil attacks, the terminal comprising a processor 30 and a memory 31, the memory 31 storing at least one instruction or at least one program, the at least one instruction or the at least one program being loaded and executed by the processor 30 to implement a blockchain adaptive detection method for Sybil attacks as described in any of the preceding claims.
[0128] The present invention also provides a computer-readable storage medium storing a computer program that, when executed by one or more processors, implements the steps of a blockchain adaptive detection method for Sybil attacks as described in any of the preceding claims.
[0129] In summary, this invention considers the scenario where detection computing power is used to detect Sybil attacks across multiple target areas. It uses mathematical formulas to represent the computing power required for hash value calculation and the network performance of allocating computing power to multiple target areas for Sybil attack detection. An adaptive Sybil attack detection optimization model is established. A Sybil attack detection optimization method based on Eagle Optimization is proposed. Building upon the traditional Eagle Optimization method, the selection mechanism for different optimization stages is improved, increasing the convergence speed of the detection optimization model. Solution replacement is performed promptly based on the similarity ratio of solutions during multiple iterations, effectively preventing the Eagle Optimization method from getting trapped in local optima. This invention can adaptively allocate detection computing power to multiple target areas through model optimization, helping target areas to promptly detect Sybil attacks and reduce their impact, thereby improving the consensus effect of the blockchain.
[0130] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.
Claims
1. A blockchain adaptive detection method for Sybil attacks, characterized in that, include: Initialize system parameters and detect area segmentation; Construct an adaptive Sybil attack detection optimization model based on computing power allocation, including: Indicates allocation to the target region The proportion of detection computing power This represents the total computing power used for detection. Collect target area The behavior information of all nodes within the system is used to determine whether a node is a Sybil attacker using a threshold method. If the node is a Sybil attacker, its consensus rights are restricted. After 100 blocks of consensus, the node's consensus rights are restarted to calculate the target region. consensus efficiency Average transaction latency Average node communication overhead The optimized model for detecting Sybil attacks is established as follows: in, This represents the consensus efficiency factor. This represents the average transaction latency factor. This represents the average node communication overhead factor. Indicates the number of target regions; Construct a search space and randomly generate multiple detection computing power allocation schemes for the target region within the search space, forming an allocation scheme matrix. Record the current iteration number and the similarity ratio between the current iteration process's detection computing power allocation scheme and the previous iteration process's detection computing power allocation scheme with the same number of iterations. Based on the current number of iterations and similarity ratio, determine whether it is in one of the four stages of the AO Eagle optimization algorithm; If it is, then the detection computing power allocation scheme is updated, and the optimal detection computing power allocation scheme in the current iteration process is calculated; If it does not belong to the category, the global optimal solution of the Sybil attack detection optimization model is obtained, and the optimal allocation scheme of detection computing power is obtained. Based on the optimal allocation scheme of detection computing power, detection computing power is adaptively allocated to different target areas, and Sybil attacks are detected in the target areas. The calculation to obtain the optimal allocation scheme of detection computing power in the current iteration process includes: Step 1: For each detection computing power allocation scheme, calculate the similarity ratio difference of the detection computing power allocation scheme under adjacent iteration numbers according to formula (8); in, Indicates the first m The first iteration The similarity ratio difference of each detection computing power scheme. Indicates the first m The first iteration The similarity ratio of each detection computing power scheme; Based on the above similarity ratio difference calculation results, determine whether the similarity ratio difference of each detection computing power allocation scheme is less than the threshold. And count those less than the threshold Number of detection computing power allocation schemes ; when Reaching the iteration round threshold And the optimal computing power allocation scheme under the current iteration If there is no change, that is, if the current solution method is determined to be trapped in a local optimum, then jump to step 2; otherwise, jump directly to step 3. Step 2: Generate a new detection computing power allocation scheme according to formula (9), and replace the scheme with a similarity ratio difference less than the threshold. The detection computing power allocation scheme is updated using an artificial bee colony resolution mechanism to ensure the differences in the newly generated detection computing power allocation scheme within the search space. in, This represents the regenerated detection computing power allocation scheme. This indicates the detection computing power allocation schemes that need to be replaced in the allocation scheme matrix. and This indicates a randomly selected detection computing power allocation scheme; Step 3: Determine whether each detection computing power allocation scheme meets the constraints of model (1). If it does, proceed directly to step 4; otherwise, proceed to step 5. Step 4: Generate a new detection computing power allocation scheme according to formula (9), and replace the detection computing power allocation scheme that does not meet the constraints in model (1) to ensure the difference of the newly generated detection computing power allocation scheme in the search space; Step 5: Calculate the fitness value of each detection computing power allocation scheme according to formula (10), calculate the similarity ratio of each detection computing power allocation scheme according to formula (2), select the detection computing power allocation scheme with the largest fitness value, and update the optimal allocation scheme in the current iteration. ; in, Indicates the first The fitness value of the computing power allocation scheme for each pool is tested; Step 6: Determine the current iteration number m Is it greater than the maximum number of iterations? M If not, the current iteration number If the optimization iteration continues, then the global optimal solution of the detection pool revenue model is obtained, and the optimal allocation scheme of detection computing power is obtained.
2. The blockchain adaptive detection method for Sybil attacks according to claim 1, characterized in that, The system parameters include: maximum number of iterations. M Current iteration number m The optimal allocation scheme in the current iteration , and These represent different similarity ratio thresholds and iteration round thresholds. .
3. The blockchain adaptive detection method for Sybil attacks according to claim 1, characterized in that, The process of constructing a search space and randomly generating multiple detection computing power allocation schemes for the target region within the search space, forming an allocation scheme matrix, and recording the current iteration number and the similarity ratio between the current iteration process's detection computing power allocation scheme and the previous iteration process's detection computing power allocation scheme with the same iteration number; includes: constructing a search space by combining the constraints in the Sybil attack detection optimization model formula (1), and randomly generating detection pools within the search space. K Several detection computing power allocation schemes are formed, and an allocation scheme matrix is constructed. ,in Indicates the first A detection computing power allocation scheme; If the current iteration count is 1, then check the similarity ratio of the computing power allocation scheme. for Otherwise, calculate the similarity ratio between each detection computing power allocation scheme in the current iteration and the corresponding detection computing power allocation scheme in the previous iteration. , in, Indicates the current iteration process. The detection computing power allocation scheme is different from the one in the previous iteration. The similarity ratio of each detection computing power allocation scheme express m The first round of iteration Within the first detection computing power allocation scheme The computing power required to detect each target region express The first round of iteration Within the first detection computing power allocation scheme The computing power required to detect each target region Indicates the number of target regions.
4. The blockchain adaptive detection method for Sybil attacks according to claim 3, characterized in that, The update of the detection computing power allocation scheme includes: when When the current allocation scheme is far from the optimal allocation scheme, the search range of the optimal computing power allocation scheme is quickly determined by simulating the high-altitude flight of an eagle using formula (3), and the detection computing power allocation scheme is updated. in, Indicates the first The first iteration A detection computing power allocation scheme This represents the matrix of the current detection computing power allocation scheme. The average composition size is The vector, This represents the optimal allocation scheme in the current iteration process. The size of the random numbers composed of numbers in the range from 0 to 1 is... The column vectors are used to explore perturbations; when Since the search range for the optimal allocation scheme is relatively wide, formula (4) is used to simulate an eagle hovering above its prey and updating the detection computing power allocation scheme through short gliding and other high-altitude flight maneuvers, thereby further narrowing the current search range and facilitating the later optimal detection computing power allocation scheme. The case is rapidly approaching; in, This represents the distribution function exhibiting Lévy flight. Represents the current allocation scheme matrix X The random selection of detection computing power allocation scheme in the middle, Represents a vector of random values simulating a hawk spiral search; when When considering that the detection computing power allocation scheme needs to transition from large-scale search to small-scale optimization, when simulating the eagle to determine the precise area of the prey using formula (5), low-altitude flight and rapid attack are adopted to update the detection computing power allocation scheme and quickly approach the optimal detection computing power allocation scheme, so as to facilitate the next step to accurately search for the optimal detection computing power allocation scheme. in, Represents the current allocation scheme matrix X The average vector in different dimensions This represents the search parameters for allocation schemes within the range of 0 to 1. The size of the random numbers composed of numbers in the range from 0 to 1 is... The column vector is used for random perturbation. The size represents the maximum allowed detection computing power allocation for each target region. The column vector represents the upper limit of the search space. The size of the minimum allowed detection computing power allocation for each target region is represented by: The column vector represents the lower bound of the search space; when Considering that the detection computing power allocation scheme is close to the optimal solution, the quality function that guarantees accurate search is calculated using formula (6). In conjunction with formula (7), the eagle accurately grabs and captures its prey, updates the detection computing power allocation scheme, and finds the optimal detection computing power allocation scheme. in, The quality function representing the accuracy of the search. This represents a random value in the simulation of an eagle capturing its prey. This represents the flight slope during the simulated eagle's capture of prey.
5. A blockchain adaptive detection system for Sybil attacks, characterized in that, include: Initialization module: Used to initialize system parameters and detect area segmentation; Sybil Attack Detection Optimization Model Building Module: Used to build an adaptive Sybil attack detection optimization model with optimized computing power allocation, including: Let Indicates allocation to the target region The proportion of detection computing power This represents the total computing power used for detection. Collect target area Behavior of all nodes The information is used to determine whether the node is a Sybil attacker using a threshold method; If the node is a Sybil attacker, its consensus rights are restricted. After 100 blocks of consensus, the node's consensus rights are restarted to calculate the target region. consensus efficiency Average transaction latency Average node communication overhead Establish an optimized model for Sybil attack detection. for: in, This represents the consensus efficiency factor. This represents the average transaction latency factor. This represents the average node communication overhead factor. Indicates the number of target regions; The optimal computing power allocation scheme calculation module is used to construct a search space and randomly generate multiple computing power allocation schemes for the target area within the search space, forming an allocation scheme matrix. It records the current iteration number and the similarity ratio between the current iteration's computing power allocation scheme and the previous iteration's computing power allocation scheme with the same number of iterations. Based on the current number of iterations and similarity ratio, determine whether it is in one of the four stages of the AO Eagle optimization algorithm; If it is, then the detection computing power allocation scheme is updated, and the optimal detection computing power allocation scheme in the current iteration process is calculated; If it does not belong to the group, the global optimal solution of the witch attack detection optimization model is obtained, and the optimal allocation scheme of detection computing power is obtained. The calculation of the optimal allocation scheme of detection computing power in the current iteration process includes: Step 1: For each detection computing power allocation scheme, the similarity ratio difference of the detection computing power allocation scheme under adjacent iterations is calculated according to formula (8). in, Indicates the first m The first iteration The similarity ratio difference of each detection computing power scheme. Indicates the first m The first iteration The similarity ratio of each detection computing power scheme; Based on the above similarity ratio difference calculation results, determine whether the similarity ratio difference of each detection computing power allocation scheme is less than the threshold. And count those less than the threshold Number of detection computing power allocation schemes ; when Reaching the iteration round threshold And the optimal computing power allocation scheme under the current iteration If there is no change, that is, if the current solution method is determined to be trapped in a local optimum, then jump to step 2; otherwise, jump directly to step 3. Step 2: Generate a new detection computing power allocation scheme according to formula (9), and replace the scheme with a similarity ratio difference less than the threshold. The detection computing power allocation scheme is updated using an artificial bee colony resolution mechanism to ensure the differences in the newly generated detection computing power allocation scheme within the search space. in, This represents the regenerated detection computing power allocation scheme. This indicates the detection computing power allocation schemes that need to be replaced in the allocation scheme matrix. This indicates a randomly selected detection computing power allocation scheme; Step 3: Determine whether each detection computing power allocation scheme meets the constraints of model (1). If it does, proceed directly to step 4; otherwise, proceed to step 5. Step 4: Generate a new detection computing power allocation scheme according to formula (9), and replace the detection computing power allocation scheme that does not meet the constraints in model (1) to ensure the difference of the newly generated detection computing power allocation scheme in the search space; Step 5: Calculate the fitness value of each detection computing power allocation scheme according to formula (10), calculate the similarity ratio of each detection computing power allocation scheme according to formula (2), select the detection computing power allocation scheme with the largest fitness value, and update the optimal allocation scheme in the current iteration. ; in, Indicates the first The fitness value of the computing power allocation scheme for each pool is tested; Step 6: Determine the current iteration number m Is it greater than the maximum number of iterations? M If not, the current iteration number If the optimization iteration continues, then the global optimal solution of the detection pool revenue model is obtained, and the optimal allocation scheme of detection computing power is obtained. The adaptive allocation module for detection computing power is used to adaptively allocate detection computing power to different target areas according to the optimal allocation scheme for detection computing power, and to detect Sybil attacks in the target areas.
6. A blockchain adaptive detection terminal for Sybil attacks, characterized in that, The terminal includes a processor and a memory, the memory storing at least one instruction or at least one program, the at least one instruction or the at least one program being loaded and executed by the processor to implement a blockchain adaptive detection method for Sybil attacks as described in any one of claims 1-4.
7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by one or more processors, implements the steps of the blockchain adaptive detection method for Sybil attacks as described in any one of claims 1-4.
Citation Information
Patent Citations
Model parameter calculation method, device and equipment and storage medium
CN113609761A
Detection system and detection method for Ethereum node Sybil attack in block chain
CN114389859A