Ethereum consensus short-range recombination attack defense method and device based on reputation model

The reputation model is used to score and weight adjustments on nodes in the Ethereum network, which solves the problem of short-range restructuring attacks, improves the stability and reliability of the blockchain, and significantly reduces the attack success rate.

CN118900188APending Publication Date: 2024-11-05BEIHANG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410623140.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-20
Publication Date
2024-11-05

AI Technical Summary

Technical Problem

There are potential harms of short-range restructuring attacks in the Ethereum network, and existing technologies are difficult to effectively defend against such malicious behavior, affecting the stability and reliability of the blockchain.

Method used

Using a reputation model-based method, nodes are scored and weighted to adjust their nodes. By evaluating the behavior of nodes, they are rewarded with normal participation, and the reputation value of nodes with risky behavior is deducted, thereby affecting their weight in consensus voting and reducing short-range reorganization. The success rate of the attack.

Benefits of technology

It effectively increases the difficulty of implementing short-range reorganization attacks, improves the stability and reliability of the Ethereum network, and significantly reduces the success rate of pre- and post-event reorganization attacks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118900188A_ABST
    Figure CN118900188A_ABST
Patent Text Reader

Abstract

The invention discloses an Ethereum consensus short-range recombination attack defense method and device based on a reputation model. According to the method, nodes are scored based on a reputation model, the scoring result can influence the weight of the nodes participating in the consensus, and the lower the score of the nodes is, the lower the weight of the nodes participating in the consensus voting is. According to the reputation model, a comprehensive and reliable node trust system is established by evaluating each node participating in consensus, and potential hazards of malicious behaviors such as short-distance recombination attacks and the like to a block chain network can be relieved or prevented. Experimental results prove that the implementation difficulty of the short-range recombination attack can be effectively increased by utilizing the method, and the stability and the reliability of the Ethereum network can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a method for defending against short-range reorganization attacks on Ethereum consensus based on a reputation model, and also relates to a corresponding short-range reorganization attack defense device for Ethereum consensus, belonging to the technical field of blockchain. Background Art

[0002] Ethereum is an open source blockchain platform that allows developers to create and deploy smart contracts and decentralized applications. Ethereum enables multiple participants to jointly maintain a blockchain, so that participants can reach a consensus on transactions on a blockchain, and no party can tamper with the transaction records on the blockchain without authorization. This feature lays the technical foundation for using Ethereum for transaction authentication.

[0003] In Ethereum, "consensus" refers to the process by which multiple independent nodes (such as computers or servers) in the network reach an agreement through a certain protocol or algorithm. This consensus is about the current state of the blockchain, including the validity of transactions, account balances, the status of smart contracts, and the order and content of blocks. The consensus mechanism is a core component of blockchain technology, which ensures that all participants in the decentralized network have a consistent understanding of the data even in the presence of malicious actors or partial node failures. In Ethereum, the consensus mechanism has undergone a transition from proof of work (PoW) to proof of stake (PoS). In PoW, validators compete for the right to create new blocks by solving complex mathematical puzzles, while in PoS, validators get the opportunity to propose new blocks by staking Ether. These consensus mechanisms ensure the security of the network, prevent double spending and other fraudulent behaviors, while allowing transactions and smart contracts in the network to be executed.

[0004] In the Chinese invention patent with patent number ZL 201910234038.8, a method for processing tampered transactions based on Ethereum is disclosed. The method constructs a "bad node" by sending the tampered transaction to a set node in the Ethereum network, broadcasts the block containing the tampered transaction to all nodes in the Ethereum network through the bad node, and observes whether the normal nodes in the Ethereum network accept the block containing the tampered transaction, thereby verifying the anti-tampering ability of the consensus algorithm in the Ethereum network. On this basis, the tampered transaction is sent to a pre-set node in the Ethereum network, so that the pre-set node broadcasts the block containing the tampered transaction to all nodes in the Ethereum network; based on the information on the chain maintained by the nodes in the Ethereum network, it is determined whether the attack of the tampered transaction on the Ethereum network is successful. Summary of the invention

[0005] The primary technical problem to be solved by the present invention is to provide an Ethereum consensus short-range reorganization attack defense method based on a reputation model.

[0006] Another technical problem to be solved by the present invention is to provide an Ethereum consensus short-range reorganization attack defense device based on a reputation model.

[0007] In order to achieve the above technical objectives, the present invention adopts the following technical solutions:

[0008] According to a first aspect of an embodiment of the present invention, a method for defending against short-range reorganization attacks of Ethereum consensus based on a reputation model is provided, comprising the following steps:

[0009] Create a reputation model for evaluating node behavior; in which each node is assigned an initial reputation value. When a node participates in consensus normally, the node is rewarded with a reputation value. When a node is found to have risky behavior, the node’s reputation value is deducted.

[0010] Scoring nodes in the network according to the reputation model; and adjusting the weight of the nodes in participating in consensus voting based on the scores;

[0011] During the consensus process, the adjusted weights are used to propose and vote on blocks; the probability of a consensus node being selected as a proposer node is associated with the node's reputation value, and the higher the reputation value, the higher the probability of being selected as a proposer.

[0012] Preferably, the reputation value is composed of three parameters: whether the node releases blocks in time, whether the node appends blocks to historical blocks, and the transaction-related behavior of the node.

[0013] Preferably, the calculation formula of the reputation value Ri is as follows:

[0014]

[0015] Among them, B 1 Indicates the weight value of whether the node releases the block in time; C a Indicates the severity of delayed block release; L a Indicates whether the node is the proposer if the node is delayed for release; S a Indicates whether it is delayed; B 2 Indicates the weight value of whether to append the block to the historical block, C b Indicates the severity of delayed block release; L b Indicates whether the node is the proposer when appending a block to the historical block; S b Indicates whether it is delayed; B 3 It is expressed as the weight of the transaction correlation in the consensus block, k is the number of transactions participated by the node in the block, An Represents the weight of each transaction, which is positively correlated with the ether in the transaction; V n Indicates the ether of the transaction; S c Used to adjust the reputation value of the node.

[0016] Preferably, when the reputation value of the nth node is positive, S c is a positive value, otherwise it is a negative value, so that the reputation value of the node increases when trading with a high-reputation node, and decreases when trading with a low-reputation node.

[0017] Preferably, as blocks are generated, the consensus mechanism promptly updates the reputation value of the node.

[0018] Preferably, the probability of the consensus node being selected as the next proposer is:

[0019]

[0020] Among them, P i is the probability that the i-th node becomes the proposer, R i is the reputation value of the i-th node, and k is the total number of consensus nodes.

[0021] Preferably, when the reputation value of the node is negative, R i Set to 0 to indicate that the probability of this node being selected as the proposer is 0.

[0022] Preferably, whether the node releases the block in time means that the attacker controls the proposer of a time slot before attacking the reorganized block and does not release the block in time, and releases the block only when the subsequent blocks are generated and released.

[0023] Preferably, whether the node appends the block to the historical block means that the attacker controls the proposer of a time slot after the block to be reorganized, and appends the block to the latest block, and ordinary nodes vote on the block.

[0024] According to a second aspect of an embodiment of the present invention, there is provided an Ethereum consensus short-range reorganization attack defense device based on a reputation model, comprising a processor and a memory, wherein the memory is coupled to the processor; wherein:

[0025] The memory is used to store a computer program, which, when executed by the processor, is used to implement the above-mentioned Ethereum consensus short-range reorganization attack defense method.

[0026] Compared with the prior art, the Ethereum consensus short-range reorganization attack defense method and device provided in the embodiment of the present invention scores nodes based on a reputation model. The scoring result will affect the weight of the node participating in the consensus. The lower the score of the node, the lower its weight when participating in the consensus vote. The reputation model evaluates each node participating in the consensus and establishes a comprehensive and reliable node trust system, which can slow down or prevent the potential harm of malicious behaviors such as short-range reorganization attacks to the blockchain network. Experimental results show that the method provided in the embodiment of the present invention can effectively increase the difficulty of implementing short-range reorganization attacks, which helps to improve the stability and reliability of the Ethereum network. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] Figure 1 This is the staking flow chart of proof of stake in the Ethereum consensus mechanism;

[0028] Figure 2 This is a simplified model diagram of pre-reorganization and post-reorganization in the Ethereum consensus mechanism;

[0029] Figure 3 A flowchart of a method for defending against short-range reorganization attacks on Ethereum consensus provided by an embodiment of the present invention;

[0030] Figure 4 Schematic diagram of experimental results of defending against ex ante reorganization attacks based on reputation model;

[0031] Figure 5 Schematic diagram of experimental results of defending against post-reorganization attacks based on reputation model;

[0032] Figure 6 Schematic diagram of experimental results of defending against refined pre-reorganization attacks based on reputation model;

[0033] Figure 7 A schematic diagram of an Ethereum consensus short-range reorganization attack defense device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0034] The technical content of the present invention is described in detail below with reference to the accompanying drawings and specific embodiments.

[0035] In the consensus mechanism of Ethereum, the commonly used basic concepts are shown in Table 1:

[0036] Table 1 Basic concepts in consensus mechanism

[0037]

[0038] like Figure 1As shown in Figure 1, the proof-of-stake (PoS) staking process in the Ethereum consensus mechanism is divided into three stages: preparation, verification node application, and verification node activation. Shortrange reorganization attacks in Ethereum are a potential attack method against proof-of-stake (PoS). In this attack method, the attacker may hide some information from other validators and then release this information at a specific time; or, delete transactions by maliciously reorganizing the blockchain in order to achieve double spending or extract maximum transaction value by front-running large transactions. The key point of short-range reorganization attacks is that they rely on the control of information and its release at a specific time, rather than continuously controlling a large amount of staked equity.

[0039] There are five main roles in launching a short-range reorganization attack. Different entities may play multiple roles at the same time.

[0040] 1) Proposer node P, in each time slot, will pre-select a unique node from the committee through a random algorithm as the proposer node, responsible for the generation of the block;

[0041] 2) The authentication node V, in each time slot, will pre-select other nodes from the committee through a random algorithm, except for the proposing node, to vote on the block;

[0042] 3) Attacker A, the initiator of the attack, can control any behavior of one or more nodes to achieve the purpose of short-range reorganization;

[0043] 4) During the consensus process, the honest node H proposes blocks or votes according to the LMD GHOST rules (see the paper Combining GHOST and Casper by Vitalik Buterin et al., see https: / / arxiv.org / abs / 2003.03052 for details);

[0044] 5) Malicious node M, during the consensus process, proposes or votes according to the attacker's needs, including the following behaviors:

[0045] a. When acting as a proposer, you can issue conflicting blocks and will be punished;

[0046] b. When acting as a proposer, you can choose not to generate a block, or keep the block and broadcast it when needed, and this behavior will not be punished;

[0047] c. When voting, violating the LMD GHOST rules and voting on conflicting blocks will be punished;

[0048] d. When voting, violate the LMD GHOST rule and vote for a chain with a low weight;

[0049] e. When voting, the voting message can be broadcast to specific target nodes when necessary to influence consensus behavior;

[0050] Therefore, if the set of verification nodes is defined as N, the relationship between the verification nodes and the committee C is as follows:

[0051] N=(C 1 , C 2 ,C 3 ,…} (1)

[0052] If the committee is defined as C, the relationship between the committee and each node is as follows:

[0053] C={P∪{V}}∩{{H}∪{M} (2)

[0054] The malicious node is a key node in the short-range reorganization attack. In the embodiment of the present invention, it is defined that at time slot i, the malicious node is:

[0055] M(a,R i , S i , D i ) (3)

[0056] Among them, a represents the malicious node address, which is the unique identifier in the network; Ri is the role of the malicious node in time slot i, including the proposer and authenticator; Si represents the attack behavior of the malicious node in the consensus process of time slot i. If it is a proposer, it means withholding blocks or issuing two conflicting blocks. If it is an authenticator, it indicates how to vote; Di represents a specific target node to which the malicious node broadcasts.

[0057] When an attacker is able to control some nodes, he can use the loopholes in the consensus mechanism to launch a short-range reorganization attack. The attack behavior is mainly to coordinate the malicious nodes to make appropriate operations at the right time. Figure 2 As shown, the main attack modes of short-range reorganization attacks include two types: pre-reorganization and post-reorganization.

[0058] Pre-reorganization means that the attacker constructs m consecutive blocks in the network in advance to form a forked chain Chain A , and keep it from broadcasting to the network. Only the attacker knows the existence of these reserved private chains. Then, after a while, suddenly broadcast it to the network. Since the previous m blocks are unknown to the honest nodes, during this period of time, the honest nodes will form a public chain different from the malicious nodes. B, the length of the forked chain is n. When the malicious node broadcasts the private chain, other nodes make fork selections according to the consensus rules. A The weight of the honest node is greater than the chain Chain B The weight of Chain B The attacker achieves the purpose of a short-range reorganization in advance. The purpose of this attack is to use the consensus rules to deceive the consensus algorithm of the network, so that the network accepts the alternative chain built by the attacker as the new valid chain. By building blocks on the private chain and voting, the attacker can quickly push the private chain to surpass the public chain in a short period of time, thereby achieving control over the blockchain. This pre-prepared short-range reorganization attack may lead to security issues such as double spending, which undermines the immutability and trust mechanism of the blockchain.

[0059] Post-reorganization means that when an attacker wants to launch an attack in the network, he wants to reorganize the public chain before the time of the attack in order to achieve the purpose of rolling back the public chain. First, the attacker generally needs to occupy the majority of nodes in the entire network, then select the number of blocks that need to be rolled back, and finally quickly generate a forked chain Chain. A Or for the forked chain Chain A Voting to make the forked chain Chain A The weight is greater than the public fork chain Chain to be attacked B Once Chain A Greater than Chain B , then according to the consensus rules, all subsequent nodes will add new blocks to the chain regardless of whether they are honest or not. A After that, Chain B The forked chain is discarded, and the post-reorganization attack is successful. Post-reorganization attacks may also lead to confusion in consensus and a decrease in security, posing a threat to the stability and reliability of the blockchain system.

[0060] In essence, the Ethereum consensus mechanism is a consensus algorithm based on Byzantine fault tolerance and proof of stake, where multiple nodes participate in consensus and vote to generate blocks. To achieve the purpose of the attack, the attacker needs to control multiple nodes and make the controlled nodes cooperate strictly according to the attacker's instructions to achieve the purpose of the attack. The subject of the attack is the node. During the entire attack process, the attack behavior is visible to other participants, and the attack behavior can occur multiple times.

[0061] Based on these characteristics of short-range reorganization attacks, the embodiment of the present invention proposes a short-range reorganization attack defense method for Ethereum consensus based on a reputation model. The characteristic of this defense method is to score nodes based on a reputation model, and the scoring result will affect the weight of the node in participating in the consensus. The lower the score of the node, the lower its weight in participating in the consensus vote. The introduction of the reputation model aims to establish a comprehensive and reliable node trust system by evaluating each node participating in the consensus, so as to slow down or prevent the potential harm of malicious attacks such as short-range reorganization attacks to the blockchain.

[0062] Below, the specific implementation steps of the above-mentioned Ethereum consensus short-range reorganization attack defense method are described in detail from three aspects: pre-reorganization, post-reorganization and refined pre-reorganization.

[0063] The characteristic of pre-reorganization is that the attacker controls the proposer of a time slot before attacking the reorganized block, and does not release the block in time, but only releases the block when the subsequent block is generated and released. Therefore, in this attack process, the node delays the release of the block and the node votes on the delayed release block, which will carry the risk of reorganization. It should be noted that the node delaying the release of the block does not necessarily mean that it is a malicious node. It is also possible that the node causes the delayed propagation of the block due to network reasons.

[0064] The characteristic of post-reorganization is that the attacker controls the proposer of a time slot after the block to be reorganized, and appends the block to the latest block, and ordinary nodes vote on the block. Therefore, in this process, the node appends the block to the old block and the node votes on the block, which will carry the risk of reorganization. It should be noted that the node appending the block to the old block is not necessarily a malicious node. It is also possible that the node did not receive the latest block due to network reasons, resulting in the latest block in the node's local area being the old block, so the node can only append to the old block under the network view.

[0065] The characteristic of refined pre-reorganization is that the attacker needs to detect the network in advance. Similar to pre-reorganization, before attacking the reorganized block, the proposer of a certain time slot is controlled and the block is not released in time. The controlled block is released after the new block is generated, and the weight balance of the two chains is maintained. In the subsequent time slots, the attacker uses the controlled nodes to vote on the historical blocks in turn to maintain the chain weight balance. In this process, the node delays the release of the block and the node votes on the historical block, which will bring the risk of short-range reorganization.

[0066] For the above attack features, we can identify that the risky behaviors of the nodes are that the nodes delay releasing blocks, the nodes append blocks to old blocks, and the nodes trade with abnormal nodes, so as to perform subsequent processing respectively. In addition, for the risky behaviors of the nodes detected above, it is necessary to first evaluate the various risk weights. The analytic hierarchy process (abbreviated as AHP) is used in the embodiment of the present invention for analysis and evaluation. The analytic hierarchy process decomposes the problem into a hierarchical structure and compares the factors at different levels in pairs, thereby establishing a weight system to quantify the contribution of each factor to the final decision. Through a series of mathematical operations, the analytic hierarchy process can calculate the weight of each factor and then determine the best decision choice.

[0067] As shown in Table 2, through in-depth analysis of the factors that may lead to short-range reorganization attacks, a security risk assessment indicator system for this attack was established.

[0068] Table 2 Safety risk assessment index system for short-term reorganization

[0069]

[0070] The AHP method interprets the judgment matrix according to the scale meaning shown in Table 3 in the process of determining the relative weights of each element by constructing a pairwise comparison matrix. Here, the result of a single comparison is called the advantage coefficient, which is used to indicate the importance of the elements compared to each other. This analysis method allows the factors to be compared one by one and the weights to be obtained through mathematical calculations, providing a quantitative basis for systematic evaluation and final decision-making.

[0071] Table 3 Meaning of the scale of the AHP judgment matrix

[0072] grade meaning 1 Equally important 3 Slightly important 5 Clearly important 7 Much more important 9 Extremely important

[0073] In the application of the AHP, in order to conduct a more in-depth decision analysis, a first-level indicator judgment matrix is ​​usually introduced. This level of matrix is ​​used to compare each first-level indicator pairwise to determine their relative weights in the decision hierarchy. By constructing this matrix, the relative importance of different first-level indicators can be quantified, providing a more refined and comprehensive analysis of decision-making problems. This further enhances the effectiveness of the AHP method in dealing with multi-level complex problems and provides decision makers with a more accurate and reliable basis for weighing. As shown in Table 4, the order of the first-level indicator decision matrix is ​​3×3.

[0074] Table 4 Risk indicator judgment first-level indicator matrix

[0075] A <![CDATA[B 1 ]]> <![CDATA[B 2 ]]> <![CDATA[B 3 ]]> <![CDATA[B 1 ]]> 1 1 3 <![CDATA[B 2 ]]> 1 1 3 <![CDATA[B 3 ]]> 1 / 3 1 / 3 1

[0076] The comprehensive weight of the first-level indicators is calculated by the analytic hierarchy process and a consistency check is performed. The total weight of the alternatives can be calculated by using the principle of hierarchical combination, that is, the local weight of each element is multiplied by the local weight of the corresponding upper-level element, and then the products are added. For the second-level indicators, the weight vector of the first-level indicators is used to establish a hierarchical structure, and the relative importance of indicators at all levels is quantitatively evaluated by the analytic hierarchy process, thereby providing a more credible comprehensive weighing basis for decision-making.

[0077] In one embodiment of the present invention, after calculation, the weight of B1 is 0.4, the weight of B2 is 0.4, the weight of B3 is 0.2, and the CR value is 0.03, which passes the consistency check. As shown in Table 5, the order of the decision matrix for the node to delay releasing the block is 5×5.

[0078] Table 5 Decision matrix of node delaying block release

[0079] A <![CDATA[C 1 ]]> <![CDATA[C 2 ]]> <![CDATA[C 3 ]]> <![CDATA[C 4 ]]> <![CDATA[C 5 ]]> <![CDATA[C 1 ]]> 1 1 1 / 3 1 / 5 1 / 9 <![CDATA[C 2 ]]> 3 1 3 1 / 3 1 / 7 <![CDATA[C 3 ]]> 5 3 1 1 / 3 1 / 5 <![CDATA[C 4 ]]> 9 3 3 1 1 / 3 <![CDATA[C 5 ]]> 9 7 5 3 1

[0080] After calculation, the weight of C1 is 0.4, the weight of C2 is 0.4, the weight of C3 is 0.2, the weight of C4 is 0.2, the weight of C5 is 0.2, and the CR value is 0.03, which passes the consistency check. The final safety risk evaluation index weights of short-range reorganization are shown in Table 6. The weight of the secondary index is the weight relative to the primary index.

[0081] Table 6 Safety risk index weights for short-term reorganization

[0082]

[0083] The risk decision matrix of a node appending a block to an old block is consistent with the risk decision matrix of a node delaying the release of a block. The embodiment of the present invention will not repeat the calculation and directly use the delayed matrix. By analyzing the short-range reorganization attack behavior, the risk behavior that may lead to short-range reorganization has been identified, and the severity of different risk behaviors has been analyzed through the hierarchical analysis method.

[0084] like Figure 3As shown, the Ethereum consensus short-range reorganization attack defense method provided by the embodiment of the present invention will construct a reputation model based on the above analysis results to enhance the security of the Ethereum consensus mechanism. The basic idea of ​​the reputation model is to assign an initial reputation value to each consensus node. When the node participates in the consensus normally, the node reputation value is rewarded. When a node is found to have risky behavior, the reputation value of the node is deducted. Then, the existing consensus algorithm is improved. At present, the probability of all nodes being selected as the proposer node of the time slot is consistent. It is necessary to change the probability of the consensus node being selected as the proposer node to be associated with the reputation value of the node. The higher the reputation value, the higher the probability of being selected as the proposer. The logic after the consensus process remains unchanged. Next, it will be explained from two aspects: the calculation of the reputation score and the probability of the node being selected as the proposer.

[0085] The reputation value of a node is composed of three parameters: whether the node releases blocks in a timely manner, whether the node appends blocks to historical blocks, and the transaction association behavior of the node. The reputation value of a node is calculated by the value of the previous block in the next block. The calculation formula of the reputation value is as follows:

[0086]

[0087] In the above formula, B 1 Indicates the weight value of whether the node releases the block in time; C a Indicates the severity of delayed release of the block. If the block is not delayed, the value is 1; L a Indicates whether the node is a proposer when the node is delayed for release. If it is a proposer, it is 10, and if it is an authentication node, it is 1; S a Indicates whether to delay, 10 -4 Indicates timely release, 0 means not participating in this consensus, -1 means not released in time. 2 Indicates the weight value of whether to append the block to the historical block, C b Indicates the severity of delayed block release; L b Indicates whether the node is the proposer when appending a block to the historical block. If it is the proposer, it is 10, and if it is the authentication node, it is 1; S b Indicates whether to delay, 10 -4 Indicates timely release, 0 means not participating in this consensus, -1 means not released in time. 3 It is expressed as the weight of the transaction correlation in the consensus block, k is the number of transactions participated by the node in the block, A n Represents the weight of each transaction, which is positively correlated with the ether in the transaction; V n Indicates the ether of the transaction; S c Used to adjust the reputation value of the node. When the reputation value of the nth node is positive, S cIt is a positive value, otherwise it is a negative value, which means that trading with a high-reputation node will increase its reputation value, while trading with a low-reputation node will reduce its reputation value. Therefore, nodes are reluctant to trade with nodes with lower reputations to encourage each node to actively maintain a high reputation status.

[0088] As blocks are generated, the consensus mechanism will update the reputation value of the node in a timely manner. The reputation value will affect the probability of the node becoming a proposer in the future. Assuming that the proposer is selected at the end of the previous period, the probability of the node being selected as the next proposer is as follows:

[0089]

[0090] In the above formula, P i is the probability that the i-th node becomes the proposer; R i is the reputation value of the i-th node. When the reputation value of the node is negative, R i Set to 0, indicating that the probability of the node being selected as the proposer is 0; k is the total number of consensus nodes. Then, P i Indicates the ratio of the node's reputation value to the reputation values ​​of all nodes.

[0091] In one embodiment of the present invention, it is assumed that the key parameters are the malicious node ratio m, the reorganization mode R, the number of reorganized blocks B, the total number of nodes is 4096, and 82125 is the number of experiments. We further analyze how the changes in these parameters affect the success rate. The formula is as follows:

[0092] P=f(4096,m,R,B,82125)

[0093] When R is a prior reorganization, the experimental results are as follows Figure 4 shown. Figure 4The effects of different ratios of malicious nodes on success are shown in turn, from reorganizing 1 block in advance to reorganizing 8 blocks. When reorganizing 1 block in advance and the ratio of malicious nodes is low, the success rate of the attack is low. When the ratio of malicious nodes is less than 0.11, the success rate of the attack is basically 0. This shows that in most cases, short-range reorganization attacks cannot succeed. As the ratio of malicious nodes increases, the success rate of the attack gradually increases. At a ratio of about 0.33, the success rate of the attack is close to 0.5%. When reorganizing 2 blocks in advance, the attacker needs at least 18% of malicious nodes to have the opportunity to launch a short-range reorganization attack within 1 year, and when the ratio of malicious nodes reaches 0.4, the success rate of short-range reorganization attacks slows down. When reorganizing 4 blocks, the attacker needs at least 24% of malicious nodes to have the opportunity to launch a short-range reorganization attack within 1 year, and when the ratio of malicious nodes reaches 0.45, the success rate of short-range reorganization attacks slows down. When reorganizing 8 blocks, the corresponding data are 0.31 and 0.5. In summary, compared with the success rate before the implementation of the reputation mechanism, it is found that the implementation of the reputation mechanism can greatly reduce the success rate of the ex ante reorganization attack.

[0094] When R is post-recombination, the experimental results are as follows Figure 5 shown. Figure 5 The effects of different malicious node ratios on success are shown in turn, from post-reorganization of 1 block to reorganization of 8 blocks. When 1 block is reorganized post-event and the malicious node ratio is less than 0.47, the attack success rate is 0, that is, the blockchain system is relatively safe and has not been significantly attacked. When the malicious node ratio exceeds 0.47, the attack success rate quickly approaches 0.36%, and the security of the blockchain system decreases. When 2 blocks are reorganized post-event, the attacker needs at least 50% of the malicious nodes to have the opportunity to launch a post-event reorganization attack within 1 year, and when the malicious node ratio exceeds 0.5, the attack success rate quickly approaches 0.17%. When 4 blocks are reorganized post-event and the malicious node ratio exceeds 0.53, the attack success rate quickly approaches 0.08%. When the number of reorganized blocks reaches 8 and the malicious node ratio exceeds 0.57, the attack success rate quickly approaches 0.03%. In summary, compared with the success rate before the implementation of the reputation mechanism, the implementation of the reputation mechanism can greatly reduce the success rate of post-event reorganization attacks.

[0095] When R is refined reorganization and the malicious node ratio is 0.1, the experimental results are as follows: Figure 6 shown. Figure 6The effects of the degree of honest node split on success are shown in turn, from fine-grained reorganization of 2 blocks to reorganization of 16 blocks. The experiment shows that: as the degree of split increases, the probability of successful attack increases; the minimum degree of split required for reorganizing different blocks is different, 0.08 for reorganizing 2 blocks, 0.46 for reorganizing 4 blocks, 0.66 for reorganizing 8 blocks, and 0.74 for reorganizing 16 blocks; the highest success rate of reorganizing different block lengths decreases with the increase of the length of the reorganized block, and the highest success rate of reorganizing 2 blocks can reach 78%, while the success rate of reorganizing 16 blocks can only reach 0.18%. In short, defending against fine-grained reorganization attacks based on reputation mechanisms can greatly increase the difficulty of fine-grained reorganization attacks. Although attackers who control a small number of nodes can initiate the reorganization of long blocks, the probability of success is extremely small.

[0096] The comprehensive impact of the node weight control strategy based on the reputation mechanism on the three reorganization attack modes shows that this strategy can reduce the success rate of the attack, and the greater the ratio of malicious nodes, the more significant the effect.

[0097] In Ethereum, the consensus mechanism is mainly to achieve transaction authentication through proof of stake (PoS). The specific process is as follows:

[0098] The user initiates a transaction request through the Ethereum client, specifying the recipient of the transaction, the amount, and the data that may be included (for smart contract interactions). The transaction request is signed with the user's private key to ensure the non-repudiation and security of the transaction. In this process, a set of standards can be defined to evaluate the reputation of both parties to the transaction. These standards may include but are not limited to the online time of both parties to the transaction, the success rate of transaction processing, historical behavior, security record, degree of participation in community activities, etc.

[0099] The signed transaction is sent to the Ethereum network and propagated by nodes in the network.

[0100] After receiving the transaction, the node will put it into the transaction pool and perform some basic verification, such as the validity of the signature and the basic logic of the transaction.

[0101] In Ethereum 2.0, through the Proof of Stake consensus mechanism, validators in the network are randomly selected to propose new blocks. Validators pack transactions into a block and send it to the network. After receiving the new block, other validator nodes will verify whether the transactions in the block are valid and whether the proposer has followed the consensus rules. If the verification is passed, other nodes will accept the block and add it to the blockchain. This process is called block confirmation. In this process, a reputation score can be calculated for each node based on the collected data and community feedback to identify and reward positive behavior patterns. The calculated reputation score is then published to a public platform, such as a blockchain browser or a dedicated reputation portal, for community members to view. The reputation score of the node can be used as an additional security layer during the transaction authentication process. For example, only nodes with a certain reputation standard are allowed to participate in transaction verification.

[0102] In the proof-of-stake mechanism, validators will be rewarded with ether if they honestly propose and verify blocks. If validators do evil (such as proposing invalid blocks), their staked ether will be confiscated as the cost of attacking the network.

[0103] In Ethereum 2.0, by using a mechanism called "checkpoints", the network will eventually reach a consensus on the final state of the block, which is called finality. Once a block obtains finality, it cannot be changed.

[0104] Based on the above-mentioned Ethereum consensus short-range reorganization attack defense method based on the reputation model, the present invention further provides an Ethereum consensus short-range reorganization attack defense device based on the reputation model. Figure 7 As shown, the Ethereum consensus short-range reorganization attack defense device includes one or more processors and a memory. The memory is coupled to the processor and is used to store one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the Ethereum consensus short-range reorganization attack defense method based on the reputation model in the above embodiment.

[0105] Among them, the processor is used to control the overall operation of the Ethereum consensus short-range reorganization attack defense device based on the reputation model to complete all or part of the steps of the Ethereum consensus short-range reorganization attack defense method based on the reputation model. In an embodiment of the present invention, the processor is preferably a GPU (graphics processing unit), but it can also be an FPGA (field programmable gate array), an ASIC (application-specific integrated circuit), a DSP (digital signal processor), etc. The memory is used to store various types of data to support the operation of the Ethereum consensus short-range reorganization attack defense method based on the reputation model, and these data may include, for example, instructions for any application or method operating on the Ethereum consensus short-range reorganization attack defense device based on the reputation model, as well as application-related data.

[0106] The memory can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, etc.

[0107] In an exemplary embodiment, the above-mentioned Ethereum consensus short-range reorganization attack defense device based on the reputation model can be specifically implemented by a computer chip or entity, or by a product with a certain function, for executing the above-mentioned Ethereum consensus short-range reorganization attack defense method based on the reputation model, and achieving the technical effect consistent with the above-mentioned method. A typical embodiment is a computer. Specifically, the computer can be, for example, a personal computer, a laptop computer, a vehicle-mounted human-computer interaction device, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.

[0108] In another exemplary embodiment, the present invention further provides a computer-readable storage medium including program instructions, which, when executed by a processor, implements the steps of the Ethereum consensus short-range reorganization attack defense method based on a reputation model in any of the above embodiments. For example, the computer-readable storage medium may be a memory including program instructions, and the above program instructions may be executed by a processor of the Ethereum consensus short-range reorganization attack defense device based on a reputation model to complete the above Ethereum consensus short-range reorganization attack defense method based on a reputation model, and achieve the technical effect consistent with the above method.

[0109] Compared with the prior art, the Ethereum consensus short-range reorganization attack defense method and device provided in the embodiment of the present invention scores nodes based on a reputation model. The scoring result will affect the weight of the node participating in the consensus. The lower the score of the node, the lower its weight when participating in the consensus vote. The reputation model evaluates each node participating in the consensus and establishes a comprehensive and reliable node trust system, which can slow down or prevent the potential harm of malicious behaviors such as short-range reorganization attacks to the blockchain network. Experimental results show that the method provided in the embodiment of the present invention can effectively increase the difficulty of implementing short-range reorganization attacks, which helps to improve the stability and reliability of the Ethereum network.

[0110] It should be noted that the above-mentioned multiple embodiments are only examples, and the technical solutions of various embodiments can be combined, all of which are within the protection scope of the present invention.

[0111] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.

[0112] The above is a detailed description of the Ethereum consensus short-range reorganization attack defense method and device based on the reputation model provided by the present invention. For those skilled in the art, any obvious changes made to it without departing from the essence of the present invention will constitute an infringement of the patent right of the present invention and will bear the corresponding legal liability.

Claims

1. A short-range reorganization attack defense method for Ethereum consensus based on reputation model, Features The steps include: Create a reputation model for evaluating node behavior; in which each node is assigned an initial reputation value. When a node participates in consensus normally, the node is rewarded with a reputation value. When a node is found to have risky behavior, the node’s reputation value is deducted. Scoring nodes in the network according to the reputation model; and adjusting the weight of the nodes in participating in consensus voting based on the scores; During the consensus process, the adjusted weights are used to propose and vote on blocks; the probability of a consensus node being selected as a proposer node is associated with the node's reputation value, and the higher the reputation value, the higher the probability of being selected as a proposer.

2. The Ethereum consensus short-range reorganization attack defense method as claimed in claim 1, Features: The reputation value is composed of three parameters: whether the node releases blocks in time, whether the node appends blocks to historical blocks, and the transaction association behavior of the node.

3. The Ethereum consensus short-range reorganization attack defense method as claimed in claim 2, Features: The calculation formula of the reputation value Ri is as follows: Among them, B 1 Indicates the weight value of whether the node releases the block in time; C a Indicates the severity of delayed block release; L a Indicates whether the node is the proposer if the node is delayed for release; S a Indicates whether it is delayed; B 2 Indicates the weight value of whether to append the block to the historical block, C b Indicates the severity of delayed block release; L b Indicates whether the node is the proposer when appending a block to the historical block; S b Indicates whether it is delayed; B 3 It is expressed as the weight of the transaction correlation in the consensus block, k is the number of transactions participated by the node in the block, A n Represents the weight of each transaction, which is positively correlated with the ether in the transaction; V n Indicates the ether of the transaction; S c Used to adjust the reputation value of the node.

4. The Ethereum consensus short-range reorganization attack defense method as claimed in claim 3, Features: When the reputation value of the nth node is positive, S c is a positive value, otherwise it is a negative value, so that the reputation value of the node increases when trading with a high-reputation node, and decreases when trading with a low-reputation node.

5. The Ethereum consensus short-range reorganization attack defense method as claimed in claim 1, Features: As blocks are generated, the consensus mechanism promptly updates the reputation value of the node.

6. The Ethereum consensus short-range reorganization attack defense method as claimed in claim 1, Features: The probability of the consensus node being selected as the next proposer is: Among them, P i is the probability that the i-th node becomes the proposer, R i is the reputation value of the i-th node, and k is the total number of consensus nodes.

7. The Ethereum consensus short-range reorganization attack defense method as claimed in claim 6, Features: When the reputation value of the node is negative, R i Set to 0 to indicate that the probability of this node being selected as the proposer is 0.

8. The Ethereum consensus short-range reorganization attack defense method as claimed in claim 2, Features: Whether the node releases the block in time refers to the attacker controlling the proposer of a time slot before attacking the reorganized block, and not releasing the block in time, and only releasing the block when the subsequent blocks are generated and released.

9. The Ethereum consensus short-range reorganization attack defense method as claimed in claim 2, Features: Whether the node appends the block to the historical block means that the attacker controls the proposer of a time slot after the block to be reorganized, and appends the block to the latest block, while ordinary nodes vote on the block.

10. A short-range reorganization attack defense device for Ethereum consensus based on reputation model, Features It includes a processor and a memory, wherein the memory is coupled to the processor; wherein, The memory is used to store a computer program, which, when executed by the processor, is used to implement the Ethereum consensus short-range reorganization attack defense method described in any one of claims 1 to 9.