CN117155594A - Blockchain adaptive detection method, terminal and storage medium for Sybil attacks - Google Patents

Blockchain adaptive detection method, terminal and storage medium for Sybil attacks Download PDF

Info

Publication number
CN117155594A
CN117155594A CN202211366833.0A CN202211366833A CN117155594A CN 117155594 A CN117155594 A CN 117155594A CN 202211366833 A CN202211366833 A CN 202211366833A CN 117155594 A CN117155594 A CN 117155594A
Authority
CN
China
Prior art keywords
detection
distribution scheme
optimal
force distribution
calculation force
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211366833.0A
Other languages
Chinese (zh)
Inventor
陈友荣
章阳
缪克雷
王章权
张旭东
吕晓雯
任条娟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang Shuren University
Original Assignee
Zhejiang Shuren University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang Shuren University filed Critical Zhejiang Shuren University
Priority to CN202211366833.0A priority Critical patent/CN117155594A/en
Publication of CN117155594A publication Critical patent/CN117155594A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/14Network architectures or network communication protocols for network security for detecting or protecting against malicious traffic
    • H04L63/1441Countermeasures against malicious traffic
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/14Network analysis or design
    • H04L41/145Network analysis or design involving simulating, designing, planning or modelling of a network

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Hardware Design (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The invention provides a block chain self-adaptive detection method facing Sybil attack, which comprises the following steps: initializing system parameters and detecting regional slicing; constructing a detection and calculation power distribution self-adaptive detection and optimization model for the witch attack; constructing a search space, randomly generating a plurality of detection calculation force distribution schemes of a detection target area in the search space to form a distribution scheme matrix, and recording the current iteration times and the similarity ratio of the detection calculation force distribution scheme in the current iteration process to the detection calculation force distribution scheme in the previous iteration process when the same iteration times are achieved; judging whether the model is in an AO hawk optimization algorithm or not according to the current iteration times and the similarity ratio; if the detection algorithm belongs to the detection algorithm, updating a detection algorithm distribution scheme, and calculating to obtain a detection algorithm optimal distribution scheme in the current iteration process; if not, obtaining a global optimal solution of the witch attack detection optimization model; and according to the optimal distribution scheme of the detection power, the detection power is distributed in a self-adaptive mode to different target areas, and the detection of the target area witches attack is carried out.

Description

面向女巫攻击的区块链自适应检测方法、终端及存储介质Blockchain adaptive detection method, terminal and storage medium for Sybil attacks

技术领域Technical field

本发明涉及区块链技术领域,具体为一种面向女巫攻击的区块链自适应检测方法、终端及存储介质。The present invention relates to the field of blockchain technology, specifically a blockchain adaptive detection method, terminal and storage medium for sybil attacks.

背景技术Background technique

区块链是一种全新的去中心化基础架构和分布式计算范式,具有去中心化、时序数据、集体维护、可编程和安全可信等特点,已广泛应用于金融、能源、医疗等领域,已经引起政府部门、金融机构、科技企业和资本市场的高度重视和广泛关注。Blockchain is a brand-new decentralized infrastructure and distributed computing paradigm. It has the characteristics of decentralization, time series data, collective maintenance, programmability, security and trustworthiness. It has been widely used in finance, energy, medical and other fields. , has attracted great attention and widespread attention from government departments, financial institutions, technology companies and capital markets.

在区块链中,共识算法是决定区块链能否有效应用的关键。目前主流共识算法主要为POS(Proof of Stake)、DPOS(Delegated Proof of Stake)、PBFT(PracticalByzantine Fault Tolerance)、DAG(Directed Acyclic Graphs)共识等,但是这些共识算法容易遭受女巫攻击。In the blockchain, the consensus algorithm is the key to determining whether the blockchain can be effectively applied. Currently, the mainstream consensus algorithms are POS (Proof of Stake), DPOS (Delegated Proof of Stake), PBFT (Practical Byzantine Fault Tolerance), DAG (Directed Acyclic Graphs) consensus, etc. However, these consensus algorithms are susceptible to witch attacks.

女巫攻击是指攻击者通过伪装身份的方式欺骗其他节点。具体攻击过程如下:当节点进行区块共识的时候,攻击者通过伪装多个节点的身份向其他节点不断发送消息,从而获得区块链网络的连接情况,误导正常节点的路由选择。最终当攻击者所伪装的节点数量达到一定程度时,有可能直接影响的区块共识结果。A witch attack is when an attacker deceives other nodes by disguising their identity. The specific attack process is as follows: When nodes perform block consensus, the attacker continuously sends messages to other nodes by disguising the identities of multiple nodes, thereby obtaining the connection status of the blockchain network and misleading the routing selection of normal nodes. Eventually, when the number of nodes disguised by the attacker reaches a certain level, it may directly affect the block consensus results.

为了有效应对女巫攻击与保证区块链系统中信息的安全性,系统需要检测女巫攻击,降低女巫攻击者对共识算法的影响,从而在保证区块共识效率的同时尽可能降低女巫攻击的影响。为了有效遏制区块链的女巫攻击,需要研究一种针对区块链女巫攻击的检测方法,降低女巫攻击的影响,提高区块链的区块上链效率。In order to effectively respond to Sybil attacks and ensure the security of information in the blockchain system, 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 ensuring the efficiency of block consensus. In order to effectively curb witch attacks in the blockchain, it is necessary to study a detection method for witch attacks in the blockchain, reduce the impact of witch attacks, and improve the efficiency of the block chaining of the blockchain.

但是目前大部分技术侧重于研究对一个目标进行女巫攻击检测的情况,导致检测效率低,难以及时发现女巫攻击,没有考虑同时对其他多个目标进行女巫攻击检测的情况。同时,缺乏检测算力的有效算力分配计算模型以及最优检测算力分配的研究。However, most current technologies focus on studying the detection of Sybil attacks on one target, resulting in low detection efficiency and difficulty in detecting Sybil attacks in time. They do not consider the situation of detecting Sybil attacks on multiple other targets at the same time. At the same time, there is a lack of effective computing power allocation calculation models for detection computing power and research on optimal detection computing power allocation.

发明内容Contents of the invention

(一)解决的技术问题(1) Technical problems solved

针对现有技术的不足,本发明提供了一种面向女巫攻击的区块链自适应检测方法、终端及存储介质,解决了上述背景技术中提出的对一个目标进行女巫攻击检测的情况,导致检测效率低,难以及时发现女巫攻击,没有考虑同时对其他多个目标进行女巫攻击检测的情况。同时,缺乏检测算力的有效算力分配计算模型以及最优检测算力分配的研究的问题。In view of the shortcomings of the existing technology, the present invention provides a blockchain adaptive detection method, terminal and storage medium for Sybil attacks, which solves the problem of detecting a Sybil attack on a target proposed in the above background technology, resulting in detection The efficiency is low, it is difficult to detect Sybil attacks in time, and the situation of detecting Sybil attacks on multiple other targets at the same time is not considered. At the same time, there is a lack of effective computing power allocation calculation models for detection computing power and research issues on optimal detection computing power allocation.

(二)技术方案(2) Technical solutions

为实现以上目的,本发明通过以下技术方案予以实现:一种面向女巫攻击的区块链自适应检测方法,包括:In order to achieve the above objectives, the present invention is implemented through the following technical solutions: a blockchain adaptive detection method for Sybil attacks, including:

S1初始化系统参数,检测区域分片;S1 initializes system parameters and detects area fragmentation;

S2构建检测算力分配自适应的女巫攻击检测优化模型;S2 builds a Witch attack detection optimization model with adaptive detection computing power distribution;

S3构建搜索空间并在搜索空间内随机产生检测目标区域的多个检测算力分配方案,并组成分配方案矩阵,记录当前迭代次数以及当前迭代过程检测算力分配方案与上一次迭代过程相同迭代次数时的检测算力分配方案的相似比;S3 constructs a search space and randomly generates multiple detection computing power allocation plans for the detection target area in the search space, and forms an allocation plan matrix, recording the current iteration number and the current iteration process detection computing power allocation plan with the same number of iterations as the previous iteration process. The similarity ratio of the detection computing power allocation plan at the time;

S4根据当前的迭代次数和相似比,判断是否处于AO鹰优化算法的四个阶段中;S4 determines whether it is in the four stages of the AO Eagle optimization algorithm based on the current iteration number and similarity ratio;

S5若属于,则进行检测算力分配方案更新,计算获得当前迭代过程中的检测算力最优分配方案;If S5 belongs, the detection computing power distribution plan is updated, and the optimal detection computing power distribution plan in the current iteration process is calculated and obtained;

S6若不属于,则获得女巫攻击检测优化模型的全局最优解,获得检测算力最优分配方案;If S6 does not belong, obtain the global optimal solution of the Sybil attack detection optimization model and obtain the optimal allocation plan of detection computing power;

S7根据检测算力最优分配方案,对不同目标区域自适应分配检测算力,并进行目标区域女巫攻击的检测。S7 adaptively allocates detection computing power to different target areas based on the optimal allocation plan for detection computing power, and detects Sybil attacks in the target area.

优选地,所述系统参数,包括:最大迭代次数M,当前迭代次数m,当前迭代过程中最优分配方案xbest、阈值κ、迭代轮次阈值STh、报酬比例ρ、收益增量比例εi和ωiPreferably, the system parameters include: the maximum number of iterations M, the current number of iterations m, the optimal allocation plan x best in the current iteration process, the threshold κ, the iteration round threshold STh, the reward ratio ρ, and the income increment ratio ε i and ω i .

优选地,所述构建检测算力分配自适应的女巫攻击检测优化模型,包括:令τi表示分配给目标区域i的检测算力占比,α表示检测总算力,则检测算力τiα收集目标区域i内所有节点的行为信息,通过阈值法判断该节点是否为女巫攻击者;Preferably, the construction of a Sybil attack detection optimization model with adaptive detection computing power distribution includes: Let τ i represent the proportion of detection computing power allocated to the target area i, and α represent the total detection computing power, then the detection computing power τ i α Collect the behavioral information of all nodes in the target area i, and use the threshold method to determine whether the node is a Sybil attacker;

如果该节点是女巫攻击者,则限制该节点的共识权利,经过100个区块共识后,则重新开始该节点的共识权利,计算该目标区域i的共识效率平均交易时延/>平均节点通信开销/>建立女巫攻击检测优化模型为:If the node is a Sybil attacker, the node's consensus rights are limited. After 100 blocks of consensus, the node's consensus rights are restarted and the consensus efficiency of the target area i is calculated. Average transaction latency/> Average node communication overhead/> The establishment of a Sybil attack detection optimization model is:

其中,r1表示共识效率因子,r2表示平均交易时延因子,r3表示平均节点通信开销因子,N表示目标区域数量。Among them, r 1 represents the consensus efficiency factor, r 2 represents the average transaction delay factor, r 3 represents the average node communication overhead factor, and N represents the number of target areas.

优选地,所述构建搜索空间并在搜索空间内随机产生检测目标区域的多个检测算力分配方案,并组成分配方案矩阵,记录当前迭代次数以及当前迭代过程检测算力分配方案与上一次迭代过程相同迭代次数时的检测算力分配方案的相似比;包括:结合女巫攻击检测优化模型公式(1)中约束条件,构建搜索空间,且在搜索空间内随机产生检测池K个检测算力分配方案,并组成分配方案矩阵X={x1,x2,...,xk,...,xK},其中xk表示第k个检测算力分配方案;Preferably, the search space is constructed and multiple detection computing power distribution plans for the detection target area are randomly generated in the search space, and a distribution plan matrix is formed to record the current number of iterations and the detection computing power distribution plan of the current iteration process and the previous iteration. The similarity ratio of the detection computing power allocation scheme when the process has the same number of iterations; including: combining the constraints in the Sybil attack detection optimization model formula (1), constructing a search space, and randomly generating detection pool K detection computing power allocations in the search space plan, and form an allocation plan matrix X = {x 1 , x 2 ,..., x k ,..., x K }, where x k represents the kth detection computing power allocation plan;

如果当前迭代次数为1,则检测算力分配方案的相似比Sk为UTh,否则,计算当前迭代过程中每一个检测算力分配方案与前一次迭代过程中对应检测算力分配方案的相似比SkIf the current iteration number is 1, then the similarity ratio S k of the detection computing power distribution plan is UTh. Otherwise, calculate the similarity ratio of each detection computing power distribution plan in the current iteration process and the corresponding detection computing power distribution plan in the previous iteration process. Sk ,

其中,Sk表示当前迭代过程中第k个检测算力分配方案与上一次迭代过程中第k个检测算力分配方案的相似比,表示m轮迭代过程中第k个检测算力分配方案内第j个目标区域的检测算力大小,/>表示m-1轮迭代过程中第k个检测算力分配方案内第j个目标区域的检测算力大小。Among them, S k represents the similarity ratio between the kth detection computing power distribution plan in the current iteration process and the kth detection computing power distribution plan in the previous iteration process. Indicates the detection computing power of the j-th target area within the k-th detection computing power allocation plan in the m-round iteration process,/> Indicates the detection computing power of the j-th target area in the k-th detection computing power allocation plan during the m-1 iteration process.

优选地,所述进行检测算力分配方案更新,包括:Preferably, the detection of updates to the computing power allocation plan includes:

当m≤(2×M)/3且Sk≥UTh时,当前的分配方案与最优分配方案存在较远距离,则通过公式(3)模拟鹰的高空翱翔来快速确定最优算力分配方案的搜索范围,更新检测算力分配方案;When m≤(2×M)/3 and S k ≥ UTh, there is a long distance between the current allocation plan and the optimal allocation plan. Then the optimal computing power allocation can be quickly determined by simulating the high-altitude flight of an eagle through formula (3). Search scope of the plan, update detection computing power allocation plan;

其中,表示第m+1迭代下的第k个检测算力分配方案,xc表示由当前检测算力分配方案矩阵X的平均值组成大小为ω×1的向量,xbest表示当前迭代过程中的最优分配方案,Rand1表示由0到1范围内中的随机数;in, represents the kth detection computing power distribution plan under the m+1 iteration, x c represents a vector of size ω × 1 composed of the average value of the current detection computing power distribution plan matrix X, and x best represents the best value in the current iteration process. Optimal allocation plan, Rand 1 represents a random number in the range from 0 to 1;

当m≤(2×M)/3且Sk<UTh时,由于最优分配方案存在的搜索范围较为宽泛,则通过公式(4)模拟鹰在猎物上方盘旋,通过短滑翔等高飞行动作,更新检测算力分配方案,进一步缩小当前的搜索范围,便于后期最优检测算力分配方案的快速靠近;When m≤(2×M)/3 and S k <UTh, since the search range of the optimal allocation scheme is relatively wide, formula (4) is used to simulate the eagle hovering above the prey and flying at short gliding and equal altitudes. Update the detection computing power allocation plan to further narrow the current search scope and facilitate the rapid approach to the optimal detection computing power allocation plan in the future;

其中,RL表示呈莱维飞行的分布函数,xd表示当前分配方案矩阵X中随机选择的检测算力分配方案,μ1和μ2表示模拟鹰螺旋搜索的随机值向量;Among them, R L represents the distribution function of Levi flight, x d represents the randomly selected detection computing power allocation plan in the current allocation plan matrix X, μ 1 and μ 2 represent the random value vectors simulating the eagle spiral search;

当m>(2×M)/3且Sk≥LTh时,考虑检测算力分配方案需要从大范围搜寻到小范围优化的过渡,因此通过公式(5)模拟鹰确定猎物精确区域时,采用低空飞行和快速攻击,更新检测算力分配方案,快速靠近最优检测算力分配方案的,便于下一环节准确搜寻最优检测算力分配方案;When m>(2×M)/3 and S k ≥ LTh, considering that the detection computing power allocation plan requires a transition from large-scale search to small-scale optimization, therefore when simulating the eagle to determine the precise area of the prey through formula (5), use Low-altitude flight and fast attack, update the detection computing power allocation plan, and quickly approach the optimal detection computing power allocation plan, which facilitates the accurate search for the optimal detection computing power allocation plan in the next step;

其中,xmean表示当前分配方案矩阵X在不同维度上的平均值向量,ω1和ω2表示0到1范围内的分配方案搜寻参数,Rand2表示由0到1范围内中的随机数组成大小为n×1的向量,up表示由不同维度的最大值组成大小为n×1的向量,lp表示由不同维度的最小值组成大小为n×1的向量; Among them, x mean represents the average vector of the current allocation plan matrix A vector of size n×1, up represents a vector of size n×1 composed of the maximum values of different dimensions, and lp represents a vector of size n×1 composed of the minimum values of different dimensions;

当m>(2×M)/3且Sk<LTh时,考虑到检测算力分配方案已经接近最优解,因此通过公式(6)计算保证准确搜索的质量函数f,并结合公式(7)模拟鹰准确抓取和捕获猎物,更新检测算力分配方案,寻找到最优检测算力分配方案;When m>(2×M)/3 and Sk ) Simulate the eagle to accurately grasp and capture prey, update the detection computing power allocation plan, and find the optimal detection computing power allocation plan;

其中,f表示准确搜索的质量函数,g1表示模拟鹰捕获猎物过程中的随机值,g2表示模拟鹰捕获猎物过程中的飞行斜率。Among them, f represents the quality function of accurate search, g 1 represents the random value during the simulated eagle capturing prey, and g 2 represents the flight slope during the simulated eagle capturing prey.

优选地,所述计算获得当前迭代过程中的检测算力最优分配方案,包括:步骤1:对于每一个检测算力分配方案,根据公式(8)计算相邻迭代次数下检测算力分配方案的相似比差值;Preferably, the calculation to obtain the optimal detection computing power distribution plan in the current iteration process includes: Step 1: For each detection computing power distribution plan, calculate the detection computing power distribution plan for adjacent iterations according to formula (8) The similarity ratio difference;

其中,表示第m迭代下的第k个检测算力方案的相似比差值,/>表示第m迭代下的第k个检测算力方案的相似比;in, Represents the similarity ratio difference of the k-th detection computing power solution under the m-th iteration, /> Represents the similarity ratio of the k-th detection computing power solution under the m-th iteration;

根据上述相似比差值计算结果,判断每一个检测算力分配方案相似比差值是否小于阈值π,并统计小于阈值π的检测算力分配方案次数sum;当sum达到迭代轮次阈值STh且当前迭代下的最优算力分配方案xbest未变化,即确定当前求解方法陷入局部最优解,则跳入步骤2,否则直接跳到步骤3;Based on the above similarity ratio difference calculation results, determine whether the similarity ratio difference of each detection computing power allocation plan is less than the threshold π, and count the number of detection computing power allocation plans that are less than the threshold π sum; when sum reaches the iteration round threshold STh and the current The optimal computing power allocation plan x best under iteration has not changed, that is, it is determined that the current solution method has fallen into the local optimal solution, then jump to step 2, otherwise jump directly to step 3;

步骤2:根据公式(9)生成新的检测算力分配方案,并替换相似比差值小于阈值π的检测算力分配方案,进行人工蜂群解更新机制,保证新生成的检测算力分配方案在搜索空间内的差异;Step 2: Generate a new detection computing power distribution plan according to formula (9), replace the detection computing power distribution plan with a similarity ratio difference less than the threshold π, and perform an artificial bee colony solution update mechanism to ensure the newly generated detection computing power distribution plan differences within the search space;

其中,表示重新生成后的检测算力分配方案,xt表示分配方案矩阵中需要进行替换的检测算力分配方案,xr1和xr2表示随机选择的检测算力分配方案;in, represents the regenerated detection computing power allocation plan, x t represents the detection computing power allocation plan that needs to be replaced in the allocation plan matrix, x r1 and x r2 represent the randomly selected detection computing power allocation plan;

步骤3:判断每一个检测算力分配方案是否符合模型(1)的约束条件,如果符合则直接跳入步骤4,否则跳入步骤5;Step 3: Determine whether each detection computing power allocation plan meets the constraints of model (1). If it meets the constraints, jump directly to step 4, otherwise jump to step 5;

步骤4:根据公式(9)生成新的检测算力分配方案,对不符合模型(1)中约束条件的检测算力分配方案进行替换,从而保证新生成的检测算力分配方案在搜索空间内的差异;Step 4: Generate a new detection computing power distribution plan according to formula (9), and replace the detection computing power distribution plan that does not meet the constraints in model (1) to ensure that the newly generated detection computing power distribution plan is within the search space difference;

步骤5:根据公式(10)计算每一个检测算力分配方案的适应度值,通过公式(2)计算每一个检测算力分配方案的相似比,选择适应度值最大的检测算力分配方案,更新当前迭代过程中最优分配方案xbestStep 5: Calculate the fitness value of each detection computing power distribution plan according to formula (10), calculate the similarity ratio of each detection computing power distribution plan through formula (2), and select the detection computing power distribution plan with the largest fitness value. Update the optimal allocation plan x best in the current iteration process;

其中,Fk表示第k个池检测算力分配方案的适应度值;Among them, F k represents the fitness value of the k-th pool detection computing power allocation plan;

步骤6:判断当前迭代次数m是否大于最大迭代次数M,如果不是,当前迭代次数m=m+1,继续进行寻优迭代;否则,则获得检测池收益模型的全局最优解,获得检测算力最优分配方案。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 detection calculation The optimal distribution plan of power.

本发明还提供一种面向女巫攻击的区块链自适应检测系统,包括:The present invention also provides a blockchain adaptive detection system for Sybil attacks, including:

初始化模块:用于初始化系统参数,检测区域分片;Initialization module: used to initialize system parameters and detect area fragmentation;

女巫攻击检测优化模型构建模块:用于构建检测算力分配自适应的女巫攻击检测优化模型;Sybil attack detection optimization model building module: used to build a Sybil attack detection optimization model with adaptive detection computing power distribution;

检测算力最优分配方案计算模块:用于构建搜索空间并在搜索空间内随机产生检测目标区域的多个检测算力分配方案,并组成分配方案矩阵,记录当前迭代次数以及当前迭代过程检测算力分配方案与上一次迭代过程相同迭代次数时的检测算力分配方案的相似比;Calculation module for the optimal allocation plan of detection computing power: used to construct a search space and randomly generate multiple detection computing power allocation plans for the detection target area in the search space, and form an allocation plan matrix to record the current iteration number and the current iteration process detection calculation The similarity ratio between the force distribution plan and the detection computing power distribution plan at the same number of iterations in the previous iteration process;

根据当前的迭代次数和相似比,判断是否处于AO鹰优化算法的四个阶段中;Based on the current iteration number and similarity ratio, determine whether it is in the four stages of the AO Eagle optimization algorithm;

若属于,则进行检测算力分配方案更新,计算获得当前迭代过程中的检测算力最优分配方案;If so, the detection computing power distribution plan is updated, and the optimal detection computing power distribution plan in the current iteration process is calculated and obtained;

若不属于,则获得女巫攻击检测优化模型的全局最优解,获得检测算力最优分配方案;If not, obtain the global optimal solution of the Sybil attack detection optimization model and obtain the optimal allocation plan for detection computing power;

检测算力自适应分配模块:用于根据检测算力最优分配方案,对不同目标区域自适应分配检测算力,并进行目标区域女巫攻击的检测。Detection computing power adaptive allocation module: used to adaptively allocate detection computing power to different target areas according to the optimal allocation scheme of detection computing power, and detect witch attacks in the target area.

本发明还提供一种面向女巫攻击的区块链自适应检测终端,所述终端包括处理器和存储器,所述存储器中存储有至少一条指令或至少一段程序,所述至少一条指令或所述至少一段程序由所述处理器加载并执行以实现如前任一项所述的一种面向女巫攻击的区块链自适应检测方法。The present invention also provides a blockchain adaptive detection terminal for Sybil attacks. The terminal includes a processor and a memory. At least one instruction or at least one program is stored in the memory. The at least one instruction or the at least one program is stored in the memory. A program is loaded and executed by the processor to implement a blockchain adaptive detection method for Sybil attacks as described in the previous item.

本发明还提供一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被一个或多个处理器执行时实现如前任一项所述一种面向女巫攻击的区块链自适应检测方法步骤。The present invention also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by one or more processors, it implements a Sybil attack-oriented method as described in the previous item. Blockchain adaptive detection method steps.

(三)有益效果(3) Beneficial effects

本发明提供了一种面向女巫攻击的区块链自适应检测方法、终端及存储介质。具备以下有益效果:The present invention provides a blockchain adaptive detection method, terminal and storage medium for witch attack. It has the following beneficial effects:

本发明技术方案考虑到检测算力对多个目标区域进行女巫攻击检测的情况,用数学公式表示检测算力计算哈希值算力,分配给多个目标区域进行女巫攻击检测算力的网络性能等公式,建立检测算力分配自适应的女巫攻击检测优化模型,基于鹰优化的女巫攻击检测优化方法,在传统鹰优化方法的基础上,改进不同优化环节的选择机制,提高检测优化模型的收敛速度,根据解决方案在多次迭代过程的相似比及时进行解决方案替换,有效避免鹰优化方法陷入局部最优解,本发明通过模型优化,自适应分配对多个目标区域的检测算力,帮助目标区域及时发现女巫攻击,并降低女巫攻击的影响,从而提高区块链的共识效果。The technical solution of the present invention takes into account the situation where the detection computing power detects Sybil attacks on multiple target areas, uses mathematical formulas to express the detection computing power, calculates the hash value computing power, and distributes the network performance of the computing power to multiple target areas for Sybil attack detection. and other formulas, establish a Witch attack detection optimization model with adaptive detection computing power distribution, and a Witch attack detection optimization method based on Eagle optimization. Based on the traditional Eagle optimization method, the selection mechanism of different optimization links is improved to improve the convergence of the detection optimization model. Speed, the solution is replaced in time according to the similarity ratio of the solution in multiple iteration processes, effectively preventing the Eagle optimization method from falling into the local optimal solution. The present invention adaptively allocates the detection computing power to multiple target areas through model optimization, helping The target area can detect Sybil attacks in time and reduce the impact of Sybil attacks, thereby improving the consensus effect of the blockchain.

附图说明Description of the drawings

图1为本发明实施例提供一种面向女巫攻击的区块链自适应检测方法流程图;Figure 1 is a flow chart of a blockchain adaptive detection method for Sybil attacks provided by an embodiment of the present invention;

图2为本发明实施例提供一种面向女巫攻击的区块链自适应检测系统结构图;Figure 2 is a structural diagram of a blockchain adaptive detection system for Sybil attacks provided by an embodiment of the present invention;

图3为本发明实施例提供一种面向女巫攻击的区块链自适应检测终端结构图。Figure 3 is a structural diagram of a blockchain adaptive detection terminal for Sybil attacks provided by an embodiment of the present invention.

具体实施方式Detailed ways

下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述。The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention.

一种面向女巫攻击的区块链自适应检测方法,包括:A blockchain adaptive detection method for Sybil attacks, including:

初始化系统参数,检测区域分片;Initialize system parameters and detect area fragmentation;

构建检测算力分配自适应的女巫攻击检测优化模型;Construct a detection optimization model for Sybil attack detection with adaptive detection computing power distribution;

构建搜索空间并在搜索空间内随机产生检测目标区域的多个检测算力分配方案,并组成分配方案矩阵,记录当前迭代次数以及当前迭代过程检测算力分配方案与上一次迭代过程相同迭代次数时的检测算力分配方案的相似比;Construct a search space and randomly generate multiple detection computing power allocation plans for the detection target area in the search space, and form an allocation plan matrix to record the current iteration number and when the current iteration process detection computing power allocation plan has the same number of iterations as the previous iteration process The similarity ratio of the detection computing power distribution plan;

根据当前的迭代次数和相似比,判断是否处于AO鹰优化算法的四个阶段中;Based on the current iteration number and similarity ratio, determine whether it is in the four stages of the AO Eagle optimization algorithm;

若属于,则进行检测算力分配方案更新,计算获得当前迭代过程中的检测算力最优分配方案;If so, the detection computing power distribution plan is updated, and the optimal detection computing power distribution plan in the current iteration process is calculated and obtained;

若不属于,则获得女巫攻击检测优化模型的全局最优解,获得检测算力最优分配方案;If not, obtain the global optimal solution of the Sybil attack detection optimization model and obtain the optimal allocation plan for detection computing power;

根据检测算力最优分配方案,对不同目标区域自适应分配检测算力,并进行目标区域女巫攻击的检测。According to the optimal allocation plan of detection computing power, the detection computing power is adaptively allocated to different target areas, and the detection of Witch attack in the target area is carried out.

优选地,所述系统参数,包括:最大迭代次数M,当前迭代次数m,当前迭代过程中最优分配方案xbest、阈值κ、迭代轮次阈值STh、报酬比例ρ、收益增量比例εi和ωiPreferably, the system parameters include: the maximum number of iterations M, the current number of iterations m, the optimal allocation plan x best in the current iteration process, the threshold κ, the iteration round threshold STh, the reward ratio ρ, and the income increment ratio ε i and ω i .

优选地,所述构建检测算力分配自适应的女巫攻击检测优化模型,包括:令τi表示分配给目标区域i的检测算力占比,α表示检测总算力,则检测算力τiα收集目标区域i内所有节点的行为信息,通过阈值法判断该节点是否为女巫攻击者;Preferably, the construction of a Sybil attack detection optimization model with adaptive detection computing power distribution includes: Let τ i represent the proportion of detection computing power allocated to the target area i, and α represent the total detection computing power, then the detection computing power τ i α Collect the behavioral information of all nodes in the target area i, and use the threshold method to determine whether the node is a Sybil attacker;

如果该节点是女巫攻击者,则限制该节点的共识权利,经过100个区块共识后,则重新开始该节点的共识权利,计算该目标区域i的共识效率平均交易时延/>平均节点通信开销/>建立女巫攻击检测优化模型为:If the node is a Sybil attacker, the node's consensus rights are limited. After 100 blocks of consensus, the node's consensus rights are restarted and the consensus efficiency of the target area i is calculated. Average transaction latency/> Average node communication overhead/> The establishment of a Sybil attack detection optimization model is:

其中,r1表示共识效率因子,r2表示平均交易时延因子,r3表示平均节点通信开销因子,N表示目标区域数量。Among them, r 1 represents the consensus efficiency factor, r 2 represents the average transaction delay factor, r 3 represents the average node communication overhead factor, and N represents the number of target areas.

优选地,所述构建搜索空间并在搜索空间内随机产生检测目标区域的多个检测算力分配方案,并组成分配方案矩阵,记录当前迭代次数以及当前迭代过程检测算力分配方案与上一次迭代过程相同迭代次数时的检测算力分配方案的相似比;包括:结合女巫攻击检测优化模型公式(1)中约束条件,构建搜索空间,且在搜索空间内随机产生检测池K个检测算力分配方案,并组成分配方案矩阵X={x1,x2,...,xk,...,xK},其中xk表示第k个检测算力分配方案;Preferably, the search space is constructed and multiple detection computing power distribution plans for the detection target area are randomly generated in the search space, and a distribution plan matrix is formed to record the current number of iterations and the detection computing power distribution plan of the current iteration process and the previous iteration. The similarity ratio of the detection computing power allocation scheme when the process has the same number of iterations; including: combining the constraints in the Sybil attack detection optimization model formula (1), constructing a search space, and randomly generating detection pool K detection computing power allocations in the search space plan, and form an allocation plan matrix X = {x 1 , x 2 ,..., x k ,..., x K }, where x k represents the kth detection computing power allocation plan;

如果当前迭代次数为1,则检测算力分配方案的相似比Sk为UTh,否则,计算当前迭代过程中每一个检测算力分配方案与前一次迭代过程中对应检测算力分配方案的相似比SkIf the current iteration number is 1, then the similarity ratio S k of the detection computing power distribution plan is UTh. Otherwise, calculate the similarity ratio of each detection computing power distribution plan in the current iteration process and the corresponding detection computing power distribution plan in the previous iteration process. Sk ,

其中,Sk表示当前迭代过程中第k个检测算力分配方案与上一次迭代过程中第k个检测算力分配方案的相似比,表示m轮迭代过程中第k个检测算力分配方案内第j个目标区域的检测算力大小,/>表示m-1轮迭代过程中第k个检测算力分配方案内第j个目标区域的检测算力大小。Among them, S k represents the similarity ratio between the kth detection computing power distribution plan in the current iteration process and the kth detection computing power distribution plan in the previous iteration process. Indicates the detection computing power of the j-th target area within the k-th detection computing power allocation plan in the m-round iteration process,/> Indicates the detection computing power of the j-th target area in the k-th detection computing power allocation plan during the m-1 iteration process.

优选地,所述进行检测算力分配方案更新,包括:Preferably, the detection of updates to the computing power allocation plan includes:

当m≤(2×M)/3且Sk≥UTh时,当前的分配方案与最优分配方案存在较远距离,则通过公式(3)模拟鹰的高空翱翔来快速确定最优算力分配方案的搜索范围,更新检测算力分配方案;When m≤(2×M)/3 and S k ≥ UTh, there is a long distance between the current allocation plan and the optimal allocation plan. Then the optimal computing power allocation can be quickly determined by simulating the high-altitude flight of an eagle through formula (3). Search scope of the plan, update detection computing power allocation plan;

其中,表示第m+1迭代下的第k个检测算力分配方案,xc表示由当前检测算力分配方案矩阵X的平均值组成大小为ω×1的向量,xbest表示当前迭代过程中的最优分配方案,Rand1表示由0到1范围内中的随机数;in, represents the kth detection computing power distribution plan under the m+1 iteration, x c represents a vector of size ω × 1 composed of the average value of the current detection computing power distribution plan matrix X, and x best represents the best value in the current iteration process. Optimal allocation plan, Rand 1 represents a random number in the range from 0 to 1;

当m≤(2×M)/3且Sk<UTh时,由于最优分配方案存在的搜索范围较为宽泛,则通过公式(4)模拟鹰在猎物上方盘旋,通过短滑翔等高飞行动作,更新检测算力分配方案,进一步缩小当前的搜索范围,便于后期最优检测算力分配方案的快速靠近;When m≤(2×M)/3 and S k <UTh, since the search range of the optimal allocation scheme is relatively wide, formula (4) is used to simulate the eagle hovering above the prey and flying at short gliding and equal altitudes. Update the detection computing power allocation plan to further narrow the current search scope and facilitate the rapid approach to the optimal detection computing power allocation plan in the future;

其中,RL表示呈莱维飞行的分布函数,xd表示当前分配方案矩阵X中随机选择的检测算力分配方案,μ1和μ2表示模拟鹰螺旋搜索的随机值向量;Among them, R L represents the distribution function of Levi flight, x d represents the randomly selected detection computing power allocation plan in the current allocation plan matrix X, μ 1 and μ 2 represent the random value vectors simulating the eagle spiral search;

当m>(2×M)/3且Sk≥LTh时,考虑检测算力分配方案需要从大范围搜寻到小范围优化的过渡,因此通过公式(5)模拟鹰确定猎物精确区域时,采用低空飞行和快速攻击,更新检测算力分配方案,快速靠近最优检测算力分配方案的,便于下一环节准确搜寻最优检测算力分配方案;When m>(2×M)/3 and S k ≥ LTh, considering that the detection computing power allocation plan requires a transition from large-scale search to small-scale optimization, therefore when simulating the eagle to determine the precise area of the prey through formula (5), use Low-altitude flight and fast attack, update the detection computing power allocation plan, and quickly approach the optimal detection computing power allocation plan, which facilitates the accurate search for the optimal detection computing power allocation plan in the next step;

其中,xmean表示当前分配方案矩阵X在不同维度上的平均值向量,ω1和ω2表示0到1范围内的分配方案搜寻参数,Rand2表示由0到1范围内中的随机数组成大小为n×1的向量,up表示由不同维度的最大值组成大小为n×1的向量,lp表示由不同维度的最小值组成大小为n×1的向量; Among them, x mean represents the average vector of the current allocation plan matrix A vector of size n×1, up represents a vector of size n×1 composed of the maximum values of different dimensions, and lp represents a vector of size n×1 composed of the minimum values of different dimensions;

当m>(2×M)/3且Sk<LTh时,考虑到检测算力分配方案已经接近最优解,因此通过公式(6)计算保证准确搜索的质量函数f,并结合公式(7)模拟鹰准确抓取和捕获猎物,更新检测算力分配方案,寻找到最优检测算力分配方案;When m>(2×M)/3 and Sk ) Simulate the eagle to accurately grasp and capture prey, update the detection computing power allocation plan, and find the optimal detection computing power allocation plan;

其中,f表示准确搜索的质量函数,g1表示模拟鹰捕获猎物过程中的随机值,g2表示模拟鹰捕获猎物过程中的飞行斜率。Among them, f represents the quality function of accurate search, g 1 represents the random value during the simulated eagle capturing prey, and g 2 represents the flight slope during the simulated eagle capturing prey.

优选地,所述计算获得当前迭代过程中的检测算力最优分配方案,包括:步骤1:对于每一个检测算力分配方案,根据公式(8)计算相邻迭代次数下检测算力分配方案的相似比差值;Preferably, the calculation to obtain the optimal detection computing power distribution plan in the current iteration process includes: Step 1: For each detection computing power distribution plan, calculate the detection computing power distribution plan for adjacent iterations according to formula (8) The similarity ratio difference;

其中,表示第m迭代下的第k个检测算力方案的相似比差值,/>表示第m迭代下的第k个检测算力方案的相似比;in, Represents the similarity ratio difference of the k-th detection computing power solution under the m-th iteration, /> Represents the similarity ratio of the k-th detection computing power solution under the m-th iteration;

根据上述相似比差值计算结果,判断每一个检测算力分配方案相似比差值是否小于阈值π,并统计小于阈值π的检测算力分配方案次数sum;当sum达到迭代轮次阈值STh且当前迭代下的最优算力分配方案xbest未变化,即确定当前求解方法陷入局部最优解,则跳入步骤2,否则直接跳到步骤3;Based on the above similarity ratio difference calculation results, determine whether the similarity ratio difference of each detection computing power allocation plan is less than the threshold π, and count the number of detection computing power allocation plans that are less than the threshold π sum; when sum reaches the iteration round threshold STh and the current The optimal computing power allocation plan x best under iteration has not changed, that is, it is determined that the current solution method has fallen into the local optimal solution, then jump to step 2, otherwise jump directly to step 3;

步骤2:根据公式(9)生成新的检测算力分配方案,并替换相似比差值小于阈值π的检测算力分配方案,进行人工蜂群解更新机制,保证新生成的检测算力分配方案在搜索空间内的差异;Step 2: Generate a new detection computing power distribution plan according to formula (9), replace the detection computing power distribution plan with a similarity ratio difference less than the threshold π, and perform an artificial bee colony solution update mechanism to ensure the newly generated detection computing power distribution plan differences within the search space;

其中,表示重新生成后的检测算力分配方案,xt表示分配方案矩阵中需要进行替换的检测算力分配方案,xr1和xr2表示随机选择的检测算力分配方案;in, represents the regenerated detection computing power allocation plan, x t represents the detection computing power allocation plan that needs to be replaced in the allocation plan matrix, x r1 and x r2 represent the randomly selected detection computing power allocation plan;

步骤3:判断每一个检测算力分配方案是否符合模型(1)的约束条件,如果符合则直接跳入步骤4,否则跳入步骤5;Step 3: Determine whether each detection computing power allocation plan meets the constraints of model (1). If it meets the constraints, jump directly to step 4, otherwise jump to step 5;

步骤4:根据公式(9)生成新的检测算力分配方案,对不符合模型(1)中约束条件的检测算力分配方案进行替换,从而保证新生成的检测算力分配方案在搜索空间内的差异;Step 4: Generate a new detection computing power distribution plan according to formula (9), and replace the detection computing power distribution plan that does not meet the constraints in model (1) to ensure that the newly generated detection computing power distribution plan is within the search space difference;

步骤5:根据公式(10)计算每一个检测算力分配方案的适应度值,通过公式(2)计算每一个检测算力分配方案的相似比,选择适应度值最大的检测算力分配方案,更新当前迭代过程中最优分配方案xbestStep 5: Calculate the fitness value of each detection computing power distribution plan according to formula (10), calculate the similarity ratio of each detection computing power distribution plan through formula (2), and select the detection computing power distribution plan with the largest fitness value. Update the optimal allocation plan x best in the current iteration process;

其中,Fk表示第k个池检测算力分配方案的适应度值;Among them, F k represents the fitness value of the k-th pool detection computing power allocation plan;

步骤6:判断当前迭代次数m是否大于最大迭代次数M,如果不是,当前迭代次数m=m+1,继续进行寻优迭代;否则,则获得检测池收益模型的全局最优解,获得检测算力最优分配方案。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 detection calculation The optimal distribution plan of power.

如图2所示,本发明还提供一种面向女巫攻击的区块链自适应检测系统,包括:As shown in Figure 2, the present invention also provides a blockchain adaptive detection system for Sybil attacks, including:

初始化模块:用于初始化系统参数,检测区域分片;Initialization module: used to initialize system parameters and detect area fragmentation;

女巫攻击检测优化模型构建模块:用于构建检测算力分配自适应的女巫攻击检测优化模型;Sybil attack detection optimization model building module: used to build a Sybil attack detection optimization model with adaptive detection computing power distribution;

检测算力最优分配方案计算模块:用于构建搜索空间并在搜索空间内随机产生检测目标区域的多个检测算力分配方案,并组成分配方案矩阵,记录当前迭代次数以及当前迭代过程检测算力分配方案与上一次迭代过程相同迭代次数时的检测算力分配方案的相似比;Calculation module for the optimal allocation plan of detection computing power: used to construct a search space and randomly generate multiple detection computing power allocation plans for the detection target area in the search space, and form an allocation plan matrix to record the current iteration number and the current iteration process detection calculation The similarity ratio between the force distribution plan and the detection computing power distribution plan at the same number of iterations in the previous iteration process;

根据当前的迭代次数和相似比,判断是否处于AO鹰优化算法的四个阶段中;Based on the current iteration number and similarity ratio, determine whether it is in the four stages of the AO Eagle optimization algorithm;

若属于,则进行检测算力分配方案更新,计算获得当前迭代过程中的检测算力最优分配方案;If so, the detection computing power distribution plan is updated, and the optimal detection computing power distribution plan in the current iteration process is calculated and obtained;

若不属于,则获得女巫攻击检测优化模型的全局最优解,获得检测算力最优分配方案;If not, obtain the global optimal solution of the Sybil attack detection optimization model and obtain the optimal allocation plan for detection computing power;

检测算力自适应分配模块:用于根据检测算力最优分配方案,对不同目标区域自适应分配检测算力,并进行目标区域女巫攻击的检测。Detection computing power adaptive allocation module: used to adaptively allocate detection computing power to different target areas according to the optimal allocation scheme of detection computing power, and detect witch attacks in the target area.

本发明还提供一种面向女巫攻击的区块链自适应检测终端,所述终端包括处理器30和存储器31,所述存储器31中存储有至少一条指令或至少一段程序,所述至少一条指令或所述至少一段程序由所述处理器30加载并执行以实现如前任一项所述的一种面向女巫攻击的区块链自适应检测方法。The present invention also provides a blockchain adaptive detection terminal for Sybil attacks. The terminal includes a processor 30 and a memory 31. The memory 31 stores at least one instruction or at least a program. The at least one instruction or The at least one program is loaded and executed by the processor 30 to implement a blockchain adaptive detection method for Sybil attacks as described in the previous item.

本发明还提供一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被一个或多个处理器执行时实现如前任一项所述一种面向女巫攻击的区块链自适应检测方法步骤。The present invention also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by one or more processors, it implements a Sybil attack-oriented method as described in the previous item. Blockchain adaptive detection method steps.

综上所述,本发明实施例考虑到检测算力对多个目标区域进行女巫攻击检测的情况,用数学公式表示检测算力计算哈希值算力,分配给多个目标区域进行女巫攻击检测算力的网络性能等公式,建立检测算力分配自适应的女巫攻击检测优化模型。提出一种基于鹰优化的女巫攻击检测优化方法,在传统鹰优化方法的基础上,改进不同优化环节的选择机制,提高检测优化模型的收敛速度,根据解决方案在多次迭代过程的相似比及时进行解决方案替换,有效避免鹰优化方法陷入局部最优解,本发明能够通过模型优化,自适应分配对多个目标区域的检测算力,帮助目标区域及时发现女巫攻击,并降低女巫攻击的影响,从而提高区块链的共识效果。In summary, the embodiments of the present invention take into account the situation where the detection computing power detects Sybil attacks on multiple target areas, uses mathematical formulas to express the detection computing power, calculates the hash value computing power, and allocates it to multiple target areas for Sybil attack detection. Network performance and other formulas of computing power are used to establish an optimization model for detecting and adapting to the detection of computing power distribution. This paper proposes a Witch attack detection optimization method based on Eagle optimization. Based on the traditional Eagle optimization method, it improves the selection mechanism of different optimization links and improves the convergence speed of the detection optimization model. Based on the similarity ratio of the solution in multiple iteration processes, it can be implemented in real time. Solution replacement is performed to effectively prevent the Eagle optimization method from falling into a local optimal solution. The present invention can adaptively allocate detection computing power to multiple target areas through model optimization, helping the target area to detect witch attacks in a timely manner and reducing the impact of witch attacks. , thereby improving the consensus effect of the blockchain.

尽管已经示出和描述了本发明的实施例,对于本领域的普通技术人员而言,可以理解在不脱离本发明的原理和精神的情况下可以对这些实施例进行多种变化、修改、替换和变型,本发明的范围由所附权利要求及其等同物限定。Although the embodiments of the present invention have been shown and described, those of ordinary skill in the art will understand that various changes, modifications, and substitutions can be made to these embodiments without departing from the principles and spirit of the invention. and modifications, the scope of the invention is defined by the appended claims and their equivalents.

Claims (9)

1. A block chain self-adaptive detection method facing Sybil attack is characterized by comprising the following steps:
initializing system parameters and detecting regional slicing;
constructing a detection and calculation power distribution self-adaptive detection and optimization model for the witch attack;
constructing a search space, randomly generating a plurality of detection calculation force distribution schemes of a detection target area in the search space, forming a distribution scheme matrix, and recording the current iteration times and the similarity ratio of the detection calculation force distribution scheme in the current iteration process to the detection calculation force distribution scheme in the previous iteration process when the same iteration times are achieved;
judging whether the model is in four stages of an AO hawk optimization algorithm according to the current iteration times and the similarity ratio;
if the detection algorithm belongs to the detection algorithm, updating a detection algorithm distribution scheme, and calculating to obtain a detection algorithm optimal distribution scheme in the current iteration process;
if the detection result does not belong to the detection result, obtaining a global optimal solution of the detection optimization model of the witch attack, and obtaining a detection calculation power optimal allocation scheme;
according to the optimal distribution scheme of the detection power, the detection power is distributed to different target areas in a self-adaptive mode, and the detection of the witch attack in the target areas is carried out.
2. The adaptive detection method of block chains for witches attacks according to claim 1, wherein the system parameters comprise: most preferably, the first to fourthLarge iteration number M, current iteration number M, and optimal allocation scheme x in current iteration process best Threshold kappa, iteration round threshold STh, reward ratio ρ, gain increment ratio ε i And omega i
3. The adaptive detection method of the block chain for the witches attack according to claim 2, wherein the constructing the adaptive detection optimization model for the witches attack with detection capacity distribution comprises: let τ i Representing the detection calculation force duty ratio allocated to the target region i, and alpha represents the detection total calculation force, then the detection calculation force tau i Alpha, collecting behavior information of all nodes in a target area i, and judging whether the nodes are Sybil attackers or not through a threshold method;
if the node is a witch attacker, limiting the consensus right of the node, restarting the consensus right of the node after 100 blocks of consensus, and calculating the consensus efficiency of the target area iAverage transaction delay->Average node communication overhead->Establishing an Sybil attack detection optimization model as follows:
wherein r is 1 Represents consensus efficiency factor, r 2 Represents an average transaction delay factor, r 3 Representing the average node communication overhead factor and N represents the number of target areas.
4. The block chain self-adaptive detection method for the Sybil attack according to claim 3, wherein the search space is constructed, a plurality of detection calculation force distribution schemes of the detection target area are randomly generated in the search space, an distribution scheme matrix is formed, and the similarity ratio of the current iteration times and the detection calculation force distribution schemes of the current iteration process to the detection calculation force distribution schemes of the last iteration times is recorded; comprising the following steps: constructing a search space by combining constraint conditions in the Sybil attack detection optimization model formula (1), randomly generating K detection calculation force distribution schemes of a detection pool in the search space, and forming a distribution scheme matrix X= { X 1 ,x 2 ,...,x k ,...,x K X, where x k Representing a kth detection algorithm assignment scheme;
if the current iteration number is 1, detecting the similarity ratio S of the computing force distribution scheme k UTh if not, calculating the similarity ratio S of each detection calculation force distribution scheme in the current iteration process to the corresponding detection calculation force distribution scheme in the previous iteration process k
Wherein S is k Representing the similarity ratio of the kth detection computing force distribution scheme in the current iteration process to the kth detection computing force distribution scheme in the last iteration process,representing the detection calculation force of the jth target area in the kth detection calculation force distribution scheme in the m rounds of iterative process,/>The detection calculation force of the jth target area in the kth detection calculation force distribution scheme in the m-1 round of iterative process is represented.
5. The adaptive detection method for a block chain for an witch attack of claim 4, wherein said performing a detection algorithm update comprises:
when M is less than or equal to (2 xM)/3 and S k When the searching range of the optimal power distribution scheme is more than or equal to UTh, if the current distribution scheme is far away from the optimal distribution scheme, the searching range of the optimal power distribution scheme is rapidly determined by simulating the high-altitude soaring of hawk through a formula (3), and the detection power distribution scheme is updated;
wherein,representing the kth detection calculation force distribution scheme under the m+1 iteration, x c Representing a vector of size omega X1, X being composed of the mean value of the current detection power allocation scheme matrix X best Represents the optimal allocation scheme in the current iteration process, rand 1 Representing a random number in the range from 0 to 1;
when M is less than or equal to (2 xM)/3 and S k When the power distribution scheme is less than UTh, the searching range of the optimal distribution scheme is wider, so that eagle is simulated to spin on the prey through a formula (4), and the detection power distribution scheme is updated through short gliding equal-altitude flight action, so that the current searching range is further narrowed, and the rapid approach of the later optimal detection power distribution scheme is facilitated;
wherein R is L Representing a distribution function in the form of a Lewy flight, x d Representing randomly selected detection algorithm assignment scheme, mu, in the current assignment scheme matrix X 1 Sum mu 2 A random value vector representing a simulated eagle spiral search;
when M > (2 XM)/3 and S k When the detection power distribution scheme is more than or equal to LTh, the transition from a large-range searching to a small-range optimizing is considered, so that when the accurate area of the hunting is determined by simulating hawk according to the formula (5), the detection power distribution scheme is updated by adopting low-altitude flight and quick attack, and the detection power distribution scheme is quickly close to the optimal detection power distribution scheme, so that the next link can accurately search the optimal detection power distribution scheme;
wherein x is mean Mean value vector omega representing current allocation scheme matrix X in different dimensions 1 And omega 2 Representing the allocation scheme search parameters in the range of 0 to 1, rand 2 Representing a vector of size n x 1 composed of random numbers in the range of 0 to 1, up representing a vector of size n x 1 composed of maxima of different dimensions, lp representing a vector of size n x 1 composed of minima of different dimensions;
when M > (2 XM)/3 and S k When the detection calculation force distribution scheme is less than LTh, the detection calculation force distribution scheme is considered to be close to an optimal solution, so that a quality function f which ensures accurate searching is calculated through a formula (6), hawk is simulated to accurately grasp and capture a prey by combining with a formula (7), the detection calculation force distribution scheme is updated, and the optimal detection calculation force distribution scheme is found;
wherein f represents the quality function of the exact search, g 1 Representing a simulated hawkRandom value during capturing prey, g 2 Representing the slope of the flight during simulated eagle capture of the prey.
6. The adaptive detection method for the block chain oriented to the witch attack of claim 5, wherein the calculating obtains an optimal distribution scheme of detection calculation force in the current iteration process, and the method comprises the following steps:
step 1: for each detection calculation force distribution scheme, calculating a similarity ratio difference value of the detection calculation force distribution scheme under adjacent iteration times according to a formula (8);
wherein,representing the similarity ratio difference of the kth detection algorithm at the mth iteration, +.>Representing the similarity ratio of the kth detection algorithm at the mth iteration;
judging whether the similarity ratio difference value of each detection calculation force distribution scheme is smaller than a threshold pi according to the similarity ratio difference value calculation result, and counting the detection calculation force distribution scheme times sum smaller than the threshold pi; when sum reaches iteration round threshold STh and optimal calculation force distribution scheme x under current iteration best If the current solution method is not changed, determining that the current solution method falls into a local optimal solution, jumping to the step 2, otherwise, directly jumping to the step 3;
step 2: generating a new detection calculation force distribution scheme according to the formula (9), replacing the detection calculation force distribution scheme with the similarity ratio difference value smaller than the threshold pi, and carrying out an artificial bee colony solution updating mechanism to ensure the difference of the newly generated detection calculation force distribution scheme in the search space;
wherein,representing the regenerated detection calculation force distribution scheme, x t Indicating the detection algorithm power distribution scheme which needs to be replaced in the distribution scheme matrix, x r1 And x r2 Representing a randomly selected detection algorithm distribution scheme;
step 3: judging whether each detection calculation force distribution scheme accords with the constraint condition of the model (1), if so, directly jumping to the step 4, otherwise, jumping to the step 5;
step 4: generating a new detection computing force distribution scheme according to the formula (9), and replacing the detection computing force distribution scheme which does not meet the constraint conditions in the model (1), so as to ensure the difference of the newly generated detection computing force distribution scheme in the search space;
step 5: calculating the fitness value of each detection calculation force distribution scheme according to a formula (10), calculating the similarity ratio of each detection calculation force distribution scheme according to a formula (2), selecting the detection calculation force distribution scheme with the largest fitness value, and updating the optimal distribution scheme x in the current iteration process best
Wherein F is k A fitness value representing a kth pool detection computing power allocation scheme;
step 6: judging whether the current iteration number M is larger than the maximum iteration number M, if not, continuing optimizing iteration, wherein the current iteration number m=m+1; otherwise, obtaining a global optimal solution of the detecting pool profit model, and obtaining a detecting capacity optimal allocation scheme.
7. A block chain adaptive detection system for witches attacks, comprising:
an initialization module: the method comprises the steps of initializing system parameters and detecting regional fragments;
the witch attack detection optimization model building module comprises a witch attack detection optimization model building module: the method is used for constructing a detection and calculation power distribution self-adaptive detection and optimization model for the witch attack;
the detection calculation module of the optimal distribution scheme of the power: the method comprises the steps of constructing a search space, randomly generating a plurality of detection calculation force distribution schemes of a detection target area in the search space, forming a distribution scheme matrix, and recording the current iteration times and the similarity ratio of the detection calculation force distribution scheme of the current iteration process to the detection calculation force distribution scheme of the previous iteration process when the same iteration times are achieved;
judging whether the model is in four stages of an AO hawk optimization algorithm according to the current iteration times and the similarity ratio;
if the detection algorithm belongs to the detection algorithm, updating a detection algorithm distribution scheme, and calculating to obtain a detection algorithm optimal distribution scheme in the current iteration process;
if the detection result does not belong to the detection result, obtaining a global optimal solution of the detection optimization model of the witch attack, and obtaining a detection calculation power optimal allocation scheme;
detection power self-adaptive distribution module: the method is used for adaptively distributing the detection power to different target areas according to the optimal distribution scheme of the detection power and detecting the witch attack of the target areas.
8. A block chain adaptive detection terminal for a witch attack, wherein the terminal comprises a processor and a memory, at least one instruction or at least one program is stored in the memory, and the at least one instruction or the at least one program is loaded and executed by the processor to implement a block chain adaptive detection method for a witch attack according to any one of claims 1-6.
9. A computer readable storage medium, characterized in that it stores a computer program, which when executed by one or more processors implements the steps of a block chain adaptive detection method for a witch attack according to any of claims 1-6.
CN202211366833.0A 2022-11-01 2022-11-01 Blockchain adaptive detection method, terminal and storage medium for Sybil attacks Pending CN117155594A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211366833.0A CN117155594A (en) 2022-11-01 2022-11-01 Blockchain adaptive detection method, terminal and storage medium for Sybil attacks

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211366833.0A CN117155594A (en) 2022-11-01 2022-11-01 Blockchain adaptive detection method, terminal and storage medium for Sybil attacks

Publications (1)

Publication Number Publication Date
CN117155594A true CN117155594A (en) 2023-12-01

Family

ID=88899325

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211366833.0A Pending CN117155594A (en) 2022-11-01 2022-11-01 Blockchain adaptive detection method, terminal and storage medium for Sybil attacks

Country Status (1)

Country Link
CN (1) CN117155594A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117742976A (en) * 2024-02-20 2024-03-22 广东省科技基础条件平台中心 Common node selection method based on dung beetle optimization algorithm

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117742976A (en) * 2024-02-20 2024-03-22 广东省科技基础条件平台中心 Common node selection method based on dung beetle optimization algorithm
CN117742976B (en) * 2024-02-20 2024-05-24 广东省科技基础条件平台中心 Common node selection method based on dung beetle optimization algorithm

Similar Documents

Publication Publication Date Title
Chang et al. Solving the dynamic weapon target assignment problem by an improved artificial bee colony algorithm with heuristic factor initialization
CN107832885A (en) A kind of fleet Algorithm of Firepower Allocation based on adaptive-migration strategy BBO algorithms
Xiao et al. Network security situation prediction method based on MEA-BP
CN113177583B (en) An air target clustering method
CN116866084B (en) Intrusion response decision-making method and system based on reinforcement learning
CN112487431B (en) Optimal Steady-State Policy Solving Method for Intrusion Detection System Based on Incomplete Information
CN114048474A (en) Image recognition backdoor defense method, device and medium based on swarm intelligence
CN112070418A (en) Weapon target allocation method of multi-target whale optimization algorithm
CN117155594A (en) Blockchain adaptive detection method, terminal and storage medium for Sybil attacks
Sun et al. A modified surrogate-assisted multi-swarm artificial bee colony for complex numerical optimization problems
CN113162919A (en) Intrusion detection method based on network abnormal flow identification
Zhu et al. Simple and efficient partial graph adversarial attack: A new perspective
CN111027709A (en) Information recommendation method and device, server and storage medium
CN114862152A (en) Target importance evaluation method based on complex network
CN114564681A (en) A data analysis method of soil inorganic salt content in woodland
CN117590757B (en) Multi-unmanned aerial vehicle cooperative task allocation method based on Gaussian distribution sea-gull optimization algorithm
CN116702583B (en) Method and device for optimizing performance of block chain under Internet of things based on deep reinforcement learning
CN107516020A (en) Method, device, equipment and storage medium for determining the importance of sequence sites
CN118012571A (en) A container scheduling method and system based on cloud platform
Fu et al. Intelligent grouping algorithms for regular expressions in deep inspection
CN116956081A (en) Social tag prediction method and system for out-of-distribution generalization of heterogeneous social networks
CN117196186A (en) Multi-missile task allocation method based on binary gorilla army optimizer
Gao et al. Modified harmony search methods for uni-modal and multi-modal optimization
CN114997400A (en) Neural network acceleration reasoning method
Naem et al. Optimizing community detection in social networks using antlion and K-median

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination