A large-scale heterogeneous Internet of Things node consensus method and electronic device
Through the KYC identity evaluation and dynamic election of representative full nodes, combined with transaction set DAG and communication DAG, the problem of inefficiency of consensus in large-scale heterogeneous Internet of Things systems is solved, efficient identity authentication and change is achieved, and transaction throughput is improved and security.
Patent Information
- Application Number
- CN202310012407.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-01-05
- Publication Date
- 2024-11-22
- Estimated Expiration
- 2043-01-05
AI Technical Summary
The existing consensus algorithms are not effectively applicable to large-scale heterogeneous Internet of Things systems, especially in the case of large number of nodes, uneven performance, heterogeneous multi-layer and high timeliness, which cannot achieve efficient consensus.
Identity evaluation is carried out through the KYC node identity identification protocol, calculate the communication status and physical state evaluation values of the node, dynamically elect representatives of the entire node, build a transaction set DAG, and adopt the Gossip propagation protocol based on the communication DAG and the identity weight voting mechanism of the transaction set DAG-based Gossip propagation protocol and the transaction set DAG-based identity weight voting mechanism , realize node identity authentication and change, and optimize transaction propagation and verification.
It reduces the cost of device identity authentication and change, improves transaction throughput and verification efficiency, enhances the security and consensus efficiency of the system, and reduces the risk of consensus attacks.
Smart Images

Figure CN116132060B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of Internet of Things, and in particular to a large-scale heterogeneous Internet of Things node consensus method and an electronic device. Background Art
[0002] The Internet of Things is composed of different kinds of physical and virtual objects, and all objects are connected and exchange data collected from the adjacent environment. With the development of the Internet of Things, the number of devices connected to the Internet of Things is increasing, which requires the collection, exchange and authentication of a large amount of data. However, in the face of the heterogeneous, multi-dimensional and multi-target network characteristics of the new Internet of Things, the inefficiency and security risks of data exchange and authentication in traditional Internet of Things systems are gradually exposed. For example, data exchange and authentication in traditional Internet of Things systems are only completed through central servers, which has the risk of single point failure, and data sharing between different business systems is difficult to achieve, resulting in "data island" problems and privacy security issues. At the same time, malicious attacks on Internet of Things systems around the world are rapidly increasing, causing serious impacts on personal life or industrial environment. Therefore, a blockchain technology is needed. Through tamper-proof distributed storage, point-to-point transmission and encryption algorithms, it will greatly reduce the trust cost, thereby improving the production efficiency and security of the Internet of Things system. However, in the blockchain-based Internet of Things system, the consensus algorithm between nodes is the key to determining whether the system can be effectively applied.
[0003] As one of the core technologies of blockchain, consensus algorithm can solve the problem of data consistency among distributed nodes in the system. At present, the mainstream consensus algorithms include POW (Proof of Work), POS (Proof of Stake), PBFT (PracticalByzantine Fault Tolerance), PoET (Proof of Elapsed Time) and other consensus. However, the above consensus algorithms do not take into account the characteristics of large number, uneven performance, heterogeneous multi-layer nodes in the IoT system, and require high timeliness requirements in block consensus efficiency, and are not yet applicable to the consensus between large-scale devices with different storage power consumption. Summary of the invention
[0004] 1. Technical issues to be resolved
[0005] In view of the shortcomings of the prior art, the present invention provides a large-scale heterogeneous Internet of Things node consensus method and electronic device, which solves the problem that the consensus algorithms proposed in the above background technology do not take into account the characteristics of large number, uneven performance, heterogeneous multi-layer and other nodes in the Internet of Things system, and have high timeliness requirements on block consensus efficiency, and are not yet applicable to the consensus problem between large-scale devices with different storage power consumption.
[0006] (II) Technical solution
[0007] To achieve the above objectives, the present invention is implemented through the following technical solutions:
[0008] A large-scale heterogeneous IoT node consensus method, comprising:
[0009] Parameters are initialized and network time t starts counting;
[0010] When a new IoT node M joins the blockchain-based IoT network, it needs to be authenticated through the KYC-based node identity authentication protocol;
[0011] If the authentication fails, the IoT node M is not allowed to join the network, and the IoT field layer checks and removes the node M;
[0012] If the authentication is successful, the identity of node M is evaluated, and the communication status and physical status evaluation values of node M are calculated. According to the communication status and physical status information of the node, the identity of the power-limited IoT node is initially evaluated as a light node, and the identity of the large IoT node with good performance is initially evaluated as a full node;
[0013] Calculate the capacity evaluation values of the top 2ρ full nodes in terms of computing power;
[0014] When the network status update interval reaches the threshold ε1, the status evaluation value of the nodes in the network is calculated and updated;
[0015] If the node's status evaluation value If the identity change conditions are met, the KYC-based identity change method will be executed to achieve the node's identity update;
[0016] When the node interval time reaches the threshold ε2, the network executes the dynamic election IoT representative full node selection mechanism, calculates the capability evaluation value of each initial representative full node, and selects the first ρ nodes from high to low to form a full node group D (d1, d2, ...);
[0017] Calculate the communication connection relationship value between node M and its neighboring full nodes;
[0018] The representative full node collects the transaction information submitted by each node in the region to build a transaction set;
[0019] The representative full node sorts the nodes in descending order according to their transaction scores; the representative full node collects the vote information of other nodes and calculates the transaction votes of different weighted ticket types under different identities;
[0020] When the number of votes for a transaction reaches the threshold δ1, the transaction is verified and the transaction status changes to state(1). If more than 2 / 3 of the transactions in the transaction set are in state(1), the transaction set meets the on-chain standard, and the transactions in state(1) in the transaction set are selected to form the transaction set to be on-chain.
[0021] Calculate the correlation between the transaction set to be verified and the most recent multiple historical transaction sets, select the transaction set with a correlation greater than the threshold δ2 for association, and update the transaction set Hash value, so that the transaction set is successfully put on the chain and the transaction set DAG is constructed;
[0022] After the transaction set DAG is successfully uploaded to the chain, the entire network is synchronized, and the nodes save and record the data.
[0023] Preferably, if the authentication is passed, the identity of the node M is evaluated, and the communication state and physical state evaluation value of the node M are calculated, including:
[0024] Randomly select from the authenticated nodes to form a representative full node;
[0025] The representative full node calculates the communication status evaluation value of the node through formula (1),
[0026]
[0027] in, represents the communication status evaluation value between the ith node and the representative full node r at time t, Delay represents the communication delay between the ith node and the representative full node r at time t. yu represents the normalized threshold of communication delay, PLR represents the communication packet loss rate between the ith node and the representative full node r at time t. yu represents the normalized threshold of packet loss rate;
[0028] The representative full node calculates the physical status evaluation value of the node through formula (2),
[0029]
[0030] Among them, P i t represents the physical state evaluation value of the ith node at time t, P i t _Storage represents the available storage of the i-th node at time t, P i t _Total represents the total storage of the i-th node at time t, P i t _Power represents the computing power of the ith node at time t, Pi t _Consume represents the power consumption of the i-th node at time t.
[0031] Preferably, the computing power ranking of the top 2ρ full node capability evaluation values includes:
[0032] The node capability evaluation value of the network is calculated by formula (3):
[0033]
[0034] Among them, T represents the maximum time the network can maintain. It is represented by the node capability evaluation value of the representative node r for the i-th node at time t, ω1 represents the communication state weight, and ω2 represents the physical state weight. According to the capability evaluation value, ρ nodes are selected from high to low to be updated as candidate representative full nodes.
[0035] Preferably, the computing capability evaluation values of the top 2ρ full nodes in terms of computing power also include:
[0036] Considering the different importance of nodes of different identity types such as light nodes, full nodes and malicious nodes in the region, different weights and different ticket types are used for voting. The number of votes obtained by the newly generated ρ candidate representative full nodes is calculated by formula (4):
[0037]
[0038] in, represents the number of votes for the jth candidate node at time t, I k Represents the identity weights of light nodes, full nodes, and malicious nodes, Vc k Vu represents the number of votes cast by the k-th identity type node in favor, k Indicates the number of votes cast by the k-th identity type node against the node. According to the number of votes, the nodes are re-sorted from high to low, and the first 2 / 3ρ nodes are selected to officially become representative full nodes, while the last 1 / 3ρ nodes that failed to be elected are added as standby representative full nodes.
[0039] Preferably, when the network status update interval reaches the threshold ε1, calculating and updating the status evaluation value of the node in the network comprises:
[0040] When the network status update interval reaches the threshold ε1, the representative full node calculates and updates the status evaluation value of the node in the network through formula (5);
[0041]
[0042] in, represents the state evaluation value of the i-th node at time t, λ represents the attenuation coefficient, It represents the transaction score of the i-th node at time t, which reflects the node's enthusiasm and reliability in the consensus process. It is composed of the node's offline time, number of offline times, capacity evaluation value, number of confirmed consensus transactions, number of discarded transactions, and number of unfinished transactions in the period (t-ε, t], which can be expressed as:
[0043]
[0044] Among them, OffineT i (t-ε,t] represents the offline time of the ith node in the period (t-ε,t], represents the number of offline times of the ith node in the period (t-ε,t], represents the number of transactions correctly agreed upon by the ith node in the period (t-ε, t], represents the number of transactions discarded by the i-th node in the period (t-ε,t], represents the number of unfinished transactions of the ith node in the period (t-ε, t], μ1, μ2 and μ3 represent the feature weights, and They are respectively represented as the weights of transaction consensus.
[0045] Preferably, the state evaluation value of the node If the identity change conditions are met, the KYC-based identity change method will be executed to update the node's identity, including:
[0046] 1) If the evaluation values of light nodes, representative full nodes, and non-representative full nodes are Below the minimum threshold α1, or the evaluation value Transaction points in When it is lower than the set threshold β1, the node is changed to a malicious node;
[0047] 2) If the evaluation value of the malicious node and state value N i The value is higher than the set threshold α2 and the accumulated time reaches the set lower limit L down When the malicious node is detected, the malicious node is changed to a full node to verify and reduce the misjudgment rate of the malicious node;
[0048] 3) If the status value N of the non-representative full node i If the non-representative node is in the top ρ and the number of votes reaches the top 2 / 3ρ, the non-representative node will be changed to a representative full node. If the evaluation value of the representative full node at this moment is Below the minimum threshold α1, or the evaluation value Transaction points in If it is lower than the set threshold β1, it is changed to a malicious node, and the node is removed, and a standby representative full node is randomly selected to be changed to the representative full node;
[0049] 4) If the state value N represents the full node i If it is outside the first ρ, the representative node will be changed to a non-representative full node;
[0050] 5) If the full nodes in the network cannot reach consensus because they are changed to malicious nodes or the number of nodes joining is lower than the set threshold N1, the light nodes with better performance will be changed to full nodes;
[0051] 6) If the evaluation value of the full node Or state value N i The value is lower than the set threshold value α3 (α2>α3>α1) and the accumulated time reaches the set upper limit L up , the full node will be changed to a light node, and the representative will be replaced from the backup representative full node to become the representative full node accordingly.
[0052] Preferably, the calculation of the communication connection relationship value between the node M and the neighboring full node includes:
[0053] The representative full node calculates the communication connection relationship value between node M and its neighbor full nodes through formula (7):
[0054]
[0055] in, represents the communication connection relationship value between the ith node and its m neighbor nodes at time t, represents the communication status evaluation value between the ith node and its m neighbor nodes at time t, represents the physical state evaluation value of the mth neighbor node at time t, Represents the number of light nodes around the i-th node at time t, and ω3, ω4, and ω5 represent the weights of different evaluation values. If a full node needs to send data, the full node will sort the communication connection relationship values from large to small according to the information in the information status table, and select the first n neighbor full nodes as forwarding nodes to send data. The forwarding node selects the unbroadcasted node to forward the data according to the information status table of the neighbor node. The full node sends node query packets from time to time, and the surrounding light nodes receive the node query packets, select the full node with smaller latency and smaller number of connected light nodes as the parent node, and access the communication DAG. Therefore, according to the communication connection relationship value, the node can establish an information status table with the neighbor full node and build a node communication DAG.
[0056] Preferably, the representative full node sorts the nodes in descending order from high to low according to the transaction scores of the nodes; the representative full node collects the vote information of other nodes and calculates the transaction votes of different weighted ticket types under different identities, including:
[0057] Represents the full node according to the node's transaction points Sort the nodes from high to low in descending order, assigning strong ranks to the top 1 / 3 of the nodes, medium ranks to the 1 / 3 to 2 / 3 of the nodes, and weak ranks to the bottom 1 / 3 of the nodes;
[0058] If the representative full node collects new transactions generated in this area, it generates a transaction set in chronological order, and according to the communication DAG of the transaction generation node, it gives priority to the node group with good communication connection relationship value for dissemination and verification, and disseminates it to other nodes through the gossip protocol based on the communication DAG;
[0059] Then, after receiving the new transaction set information from other representative full nodes, each node will vote for or against each transaction in the new transaction set based on its own historical transaction set information, and feedback to the representative full node;
[0060] The representative full node collects the vote information of other nodes and calculates the transaction votes of different weighted ticket types under different identities. The representative full node collects the vote information of other nodes and calculates the votes of each transaction in the transaction set through formula (8), assigns different weights to the affirmative and negative votes, and counts the votes according to the weights.
[0061]
[0062] in, represents the number of votes for the jth transaction in round r, and Indicates the number of votes in favor and against the jth transaction by nodes with strong level A in round r, and Indicates the number of votes in favor and against the jth transaction by the node with the identity of medium level B in round r, and Indicates the number of votes in favor and against the jth transaction by the nodes with the identity of medium level C in round r. 1 , ψ 2 and ψ 3 Represent the voting weights of different identities.
[0063] Preferably, the calculation of the correlation between the transaction set to be verified and the most recent multiple historical transaction sets, selecting the transaction set with a correlation greater than a threshold δ2 for correlation, and updating the transaction set Hash value, thereby successfully putting the transaction set on the chain and constructing a transaction set DAG, includes:
[0064] Formula (9) is used to calculate the correlation between the transaction set to be verified and the most recent multiple historical transaction sets. The transaction set with a correlation greater than the threshold δ2 is selected for association, and the transaction set Hash value is updated. In this way, the transaction set is successfully uploaded to the chain and the transaction set DAG is constructed;
[0065] Rel j,k =(n_same j,k +τ1×n_Psee j,k +τ2×n_Osee j,k ) / n k +τ3×T j,k +τ4×S j,k (9)
[0066] Among them, Rel j,k Indicates the correlation between the j-th transaction set and the k-th transaction set, n_same j,k Indicates that the j-th transaction set and the k-th transaction set contain the same number of transactions, n_Psee j,k Indicates the number of transactions that the k-th transaction set contains the parent transaction in the j-th transaction set, n_Osee j,k Indicates the number of transactions that the kth transaction set contains other ancestor transactions in the jth transaction set, n k represents the number of transactions in the kth transaction set, T j,k represents the timestamp interval between the jth transaction set and the kth transaction set, S j,k represents the number of transaction sets j and k generated by the same representative node, τ1, τ2, τ3 and τ4 represent the weights of different parameters.
[0067] An electronic device comprises a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute any of the above methods through the computer program.
[0068] (III) Beneficial effects
[0069] The present invention provides a large-scale heterogeneous Internet of Things node consensus method and electronic device. It has the following beneficial effects:
[0070] The present invention aims at the identity authentication and change mechanism. Considering that the IoT system based on blockchain is vulnerable to pseudo-node consensus attacks, the KYC mechanism is combined to realize the identity authentication of IoT nodes. Considering the heterogeneity of IoT device node power consumption, the physical state and communication state information of controllers, actuators, sensors, edge gateways and other devices are evaluated according to the device computing power and status. According to the evaluation value, the nodes joining the network are initially identified as light nodes, representative full nodes, non-representative full nodes, and malicious nodes, and the identities of nodes that meet the node identity change conditions are updated and converted, thereby realizing low-cost and high-efficiency IoT device identity authentication and change. For the construction of communication and transaction set DAG, considering the large number of IoT devices and the difference in device power consumption, the communication connection relationship value between the full node itself and the neighbor full node is calculated according to the information such as the delay and packet loss rate of the surrounding neighbor full nodes communicating with each other, and a construction method of communication DAG between full nodes is proposed, which preferentially propagates randomly within a node group with good communication status.
[0071] At the same time, combined with the relevance of IoT devices, by representing all nodes to collect transactions generated in a specified time period and spatial domain, multiple transactions are constructed into a transaction set, and the framework of the transaction set DAG is proposed, thereby improving the transaction throughput. For the dual DAG efficient consistency consensus, in the transaction set propagation stage, a Gossip propagation protocol based on communication DAG is proposed. In the hash graph network, the representative full node selects nodes with good communication connection relationship values according to the communication DAG of the transaction generation node to preferentially propagate. By preferentially propagating transactions to nodes with good communication connection relationship values, the data difference between nodes is small, it is easier to achieve final consistency, and the anti-entropy effect is better. In the transaction set verification stage, an identity weight voting mechanism based on the transaction set DAG is proposed, and voting weights are assigned to transactions in the transaction set according to different node identities. The transaction set DAG is constructed by the correlation between the transaction sets, thereby realizing batch chaining and accelerating verification efficiency. The present invention can not only reduce the cost of device identity authentication and change, improve transaction throughput, but also accelerate the batch chaining of verification efficiency through the proposed identity authentication and change, communication and transaction set DAG construction and dual DAG efficient consistency consensus, effectively reducing consensus attacks while improving consensus efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0072] Figure 1 It is a hardware environment schematic diagram of a large-scale heterogeneous Internet of Things node consensus method provided by an embodiment of the present invention;
[0073] Figure 2 A flow chart of a large-scale heterogeneous Internet of Things node consensus method provided by an embodiment of the present invention;
[0074] Figure 3 A structural diagram of a large-scale heterogeneous Internet of Things node consensus electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0075] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present invention.
[0076] The method embodiments provided in the embodiments of the present application can be executed in a computer terminal, a device terminal or a similar computing device. Taking running on a computer terminal as an example, Figure 1 Schematic diagram of the hardware environment of a large-scale heterogeneous IoT node consensus method according to an embodiment of the present application. Figure 1 As shown, the computer terminal may include one or more ( Figure 1 Only one is shown in the figure) processor 102 (processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data. In an exemplary embodiment, the computer terminal may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above-mentioned computer terminal. Figure 1 More or fewer components as shown, or with Figure 1 Equivalent functions or comparisons shown Figure 1 A different configuration with more features is shown.
[0077] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the method for sending message push in the embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the computer terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0078] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of a computer terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0079] like Figure 2 As shown, a large-scale heterogeneous Internet of Things node consensus method according to an embodiment of the present invention includes:
[0080] S1 parameters are initialized and network time t starts counting;
[0081] S2 When a new IoT node M joins the blockchain-based IoT network, it needs to be authenticated through the KYC-based node identity authentication protocol;
[0082] If S3 fails the authentication, the IoT node M is not allowed to join the network, and the IoT field layer checks and removes the node M;
[0083] If the authentication is successful, S4 will evaluate the identity of node M, calculate the communication status and physical status evaluation value of node M, and initially evaluate the identity of the power-limited IoT node as a light node based on the communication status and physical status information of the node, and initially evaluate the identity of the large IoT node with good performance as a full node;
[0084] S5 calculates the capacity evaluation value of the top 2ρ full nodes in terms of computing power;
[0085] S6 When the network status update interval reaches the threshold ε 1 When , calculate and update the state evaluation value of the nodes in the network;
[0086] S7 If the node status evaluation value If the identity change conditions are met, the KYC-based identity change method will be executed to achieve the node's identity update;
[0087] S8 When the node interval time reaches the threshold ε 2 When , the network executes the dynamic election IoT representative full node selection mechanism, calculates the capability evaluation value of each initial representative full node, and selects the first ρ nodes from high to low to form the full node group D (d1, d2, ...);
[0088] S9 calculates the communication connection relationship value between node M and its neighboring full nodes;
[0089] S10 builds a transaction set by collecting transaction information submitted by each node in the region on behalf of the full node;
[0090] S11 represents the full node, which sorts the nodes in descending order according to their transaction scores; it represents the full node, which collects vote information from other nodes and calculates the transaction votes of different weighted ticket types under different identities;
[0091] S12: When the number of votes in a transaction reaches the threshold δ1, the transaction is verified and the transaction status changes to state(1). If more than 2 / 3 of the transactions in the transaction set are in state(1), the transaction set meets the on-chain standard, and the transactions in the transaction set with state(1) are selected to form the transaction set to be on-chain.
[0092] S13 calculates the correlation between the transaction set to be verified and the most recent multiple historical transaction sets, selects the transaction set with a correlation greater than the threshold δ2 for correlation, and updates the transaction set Hash value, so that the transaction set is successfully put on the chain and the transaction set DAG is constructed;
[0093] After the S14 transaction set DAG is successfully uploaded to the chain, the entire network is synchronized, and the nodes save and record the data.
[0094] Preferably, if the authentication is successful, performing identity evaluation on the node M, and calculating the communication state and physical state evaluation value of the node M, includes:
[0095] Randomly select from the authenticated nodes to form a representative full node;
[0096] The representative full node calculates the communication status evaluation value of the node through formula (1),
[0097]
[0098] in, represents the communication status evaluation value between the ith node and the representative full node r at time t, Delay represents the communication delay between the ith node and the representative full node r at time t. yu represents the normalized threshold of communication delay, PLR represents the communication packet loss rate between the ith node and the representative full node r at time t. yu represents the normalized threshold of packet loss rate;
[0099] The representative full node calculates the node's physical status evaluation value through formula (2),
[0100]
[0101] Among them, P i t represents the physical state evaluation value of the i-th node at time t, Pi t _Storage represents the available storage of the i-th node at time t, P i t _Total represents the total storage of the i-th node at time t, P i t _Power represents the computing power of the ith node at time t, P i t _Consume represents the power consumption of the i-th node at time t.
[0102] Preferably, the computing power ranking of the top 2ρ full node capability evaluation values includes:
[0103] The node capability evaluation value of the network is calculated by formula (3):
[0104]
[0105] Among them, T represents the maximum time the network can maintain. It is represented by the node capability evaluation value of the representative node r for the i-th node at time t, ω1 represents the communication state weight, and ω2 represents the physical state weight. According to the capability evaluation value, ρ nodes are selected from high to low to be updated as candidate representative full nodes.
[0106] Preferably, the computing capability evaluation values of the top 2ρ full nodes in terms of computing power also include:
[0107] Considering the different importance of nodes of different identity types such as light nodes, full nodes and malicious nodes in the region, different weights and different ticket types are used for voting. The number of votes obtained by the newly generated ρ candidate representative full nodes is calculated by formula (4):
[0108]
[0109] in, represents the number of votes for the jth candidate node at time t, I k Represents the identity weights of light nodes, full nodes, and malicious nodes, Vc k Vu represents the number of votes cast by the k-th identity type node in favor, k Indicates the number of votes cast by the k-th identity type node against the node. According to the number of votes, the nodes are re-sorted from high to low, and the first 2 / 3ρ nodes are selected to officially become representative full nodes, while the last 1 / 3ρ nodes that failed to be elected are added as standby representative full nodes.
[0110] Preferably, when the network status update interval reaches a threshold ε 1 , calculate and update the status evaluation value of the nodes in the network; including:
[0111] When the network status update interval reaches the threshold ε1, the representative full node calculates and updates the status evaluation value of the node in the network through formula (5);
[0112]
[0113] in, represents the state evaluation value of the i-th node at time t, λ represents the attenuation coefficient, It represents the transaction score of the i-th node at time t, which reflects the node's enthusiasm and reliability in the consensus process. It is composed of the node's offline time, number of offline times, capacity evaluation value, number of confirmed consensus transactions, number of discarded transactions, and number of unfinished transactions in the period (t-ε, t], which can be expressed as:
[0114]
[0115] Among them, OffineT i (t-ε,t] represents the offline time of the ith node in the period (t-ε,t], represents the number of offline times of the ith node in the period (t-ε,t], represents the number of transactions correctly agreed upon by the ith node in the period (t-ε, t], represents the number of transactions discarded by the i-th node in the period (t-ε,t], represents the number of unfinished transactions of the ith node in the period (t-ε, t], μ1, μ2 and μ3 represent the feature weights, and They are respectively represented as the weights of transaction consensus.
[0116] Preferably, the state evaluation value of the node If the identity change conditions are met, the KYC-based identity change method will be executed to update the node's identity, including:
[0117] 1) If the evaluation values of light nodes, representative full nodes, and non-representative full nodes are Below the minimum threshold α1, or the evaluation value Transaction points in When it is lower than the set threshold β1, the node is changed to a malicious node;
[0118] 2) If the evaluation value of the malicious node and state value N i The value is higher than the set threshold α2 and the accumulated time reaches the set lower limit L down When the malicious node is detected, the malicious node is changed to a full node to verify and reduce the misjudgment rate of the malicious node;
[0119] 3) If the status value N of the non-representative full node i If the non-representative node is in the top ρ and the number of votes reaches the top 2 / 3ρ, the non-representative node will be changed to a representative full node. If the evaluation value of the representative full node at this moment is Below the minimum threshold α1, or the evaluation value Transaction points in If it is lower than the set threshold β1, it is changed to a malicious node, and the node is removed, and a standby representative full node is randomly selected to be changed to the representative full node;
[0120] 4) If the state value N represents the full node i If it is outside the first ρ, the representative node will be changed to a non-representative full node;
[0121] 5) If the full nodes in the network cannot reach consensus because they are changed to malicious nodes or the number of nodes joining is lower than the set threshold N1, the light nodes with better performance will be changed to full nodes;
[0122] 6) If the evaluation value of the full node Or state value N i The value is lower than the set threshold value α3 (α2>α3>α1) and the accumulated time reaches the set upper limit L up , the full node will be changed to a light node, and the representative will be replaced from the backup representative full node to become the representative full node accordingly.
[0123] Preferably, when the node interval reaches the threshold ε 2 When , the network implements the dynamic election of the IoT representative full node selection mechanism, calculates the capability evaluation value of each initial representative full node through formula (3), and selects the first ρ nodes from high to low to form the full node group D (d1, d2, ...).
[0124] Preferably, the calculation of the communication connection relationship value between the node M and the neighboring full node includes:
[0125] The representative full node calculates the communication connection relationship value between node M and its neighbor full nodes through formula (7):
[0126]
[0127] in, represents the communication connection relationship value between the ith node and its m neighbor nodes at time t, represents the communication status evaluation value between the ith node and its m neighbor nodes at time t, represents the physical state evaluation value of the mth neighbor node at time t, represents the number of light nodes around the i-th node at time t, and ω3, ω4, and ω5 represent the weights of different evaluation values. If a full node needs to send data, the full node will sort the communication connection relationship values from large to small according to the information in the information status table, and select the first n neighbor full nodes as forwarding nodes to send data.
[0128] The forwarding node selects a non-broadcast node to forward data based on the information status table of the neighboring nodes.
[0129] The full node sends node query packets from time to time, and the surrounding light nodes receive the node query packets, select the full node with smaller latency and fewer connected light nodes as the parent node, and connect to the communication DAG. Therefore, according to the communication connection relationship value, the node can establish an information status table with the neighboring full node and build the node communication DAG.
[0130] Preferably, a transaction set is constructed by collecting transaction information submitted by each node in the region on behalf of the full node. A transaction includes a transaction timestamp (Timestamp), transaction content (Transactions), a digital signature (Digital Signature), a transaction hash value (Hash), and a transaction state (State). Among them, the transaction state includes a historical transaction State (0) that does not reach the verification threshold, a transaction State (1) that reaches the verification threshold, and a new transaction State (2) to be verified. The transaction set consists of a transaction set event stamp (STimestamp), a digital signature (SDigital Signature), a transaction number (Number), its own transaction set hash value, a parent transaction set hash value, and multiple transactions (historical transactions that do not reach the verification threshold, historical transactions that reach the verification threshold, and new transactions to be verified). Among them, historical transactions that have not reached the verification threshold refer to transactions generated by the full node collection node in the previous time period (t-2ε, t-ε] and have not been visible and verified by the majority of transactions. New transactions to be verified refer to transactions generated by the full node collection node in the current time period (t-ε, t], and ε represents the time interval for transactions in the collection area set by the full node. Multiple transactions are packaged into a transaction set and sent together for transaction verification consensus. When a node receives multiple transactions containing new transaction information data, it combines and adds the transactions it knows to form a new transaction set. The entire transaction set contains two hashes, the first one is the hash of multiple historical transaction sets, and the other is the hash of its own transaction set. After the full node builds the transaction set Message to be verified, it needs to select nodes with good communication connection relationship values through the node communication DAG generated by formula (7) for priority transmission;
[0131] Preferably, the representative full node sorts the nodes in descending order from high to low according to the transaction scores of the nodes; the representative full node collects the vote information of other nodes and calculates the transaction votes of different weighted ticket types under different identities, including:
[0132] Represents the full node according to the node's transaction points Sort the nodes from high to low in descending order, assigning strong ranks to the top 1 / 3 of the nodes, medium ranks to the 1 / 3 to 2 / 3 of the nodes, and weak ranks to the bottom 1 / 3 of the nodes;
[0133] If the representative full node collects new transactions generated in this area, it generates a transaction set in chronological order, and according to the communication DAG of the transaction generation node, it gives priority to the node group with good communication connection relationship value for dissemination and verification, and disseminates it to other nodes through the gossip protocol based on the communication DAG;
[0134] Then, after receiving the new transaction set information from other representative full nodes, each node will vote for or against each transaction in the new transaction set based on its own historical transaction set information, and feedback to the representative full node;
[0135] The representative full node collects the vote information of other nodes and calculates the transaction votes of different weighted ticket types under different identities. The representative full node collects the vote information of other nodes and calculates the votes of each transaction in the transaction set through formula (8), assigns different weights to the affirmative and negative votes, and counts the votes according to the weights.
[0136]
[0137] in, represents the number of votes for the jth transaction in round r, and Indicates the number of votes in favor and against the jth transaction by nodes with strong level A in round r, and Indicates the number of votes in favor and against the jth transaction by the node with the identity of medium level B in round r, and Indicates the number of votes in favor and against the jth transaction by the node with the identity of medium level C in round r. ψ1, ψ2 and ψ3 represent the voting weights of different identities respectively.
[0138] Preferably, the calculation of the correlation between the transaction set to be verified and the most recent multiple historical transaction sets, selecting the transaction set with a correlation greater than a threshold δ2 for correlation, and updating the transaction set Hash value, thereby successfully putting the transaction set on the chain and constructing a transaction set DAG, includes:
[0139] Formula (9) is used to calculate the correlation between the transaction set to be verified and the most recent multiple historical transaction sets. The transaction set with a correlation greater than the threshold δ2 is selected for association, and the transaction set Hash value is updated. In this way, the transaction set is successfully uploaded to the chain and the transaction set DAG is constructed;
[0140] Rel j,k =(n_same j,k +τ1×n_Psee j,k +τ2×n_Osee j,k ) / n k +τ3×T j,k +τ4×S j,k (9)
[0141] Among them, Rel j,k Indicates the correlation between the j-th transaction set and the k-th transaction set, n_same j,k Indicates that the j-th transaction set and the k-th transaction set contain the same number of transactions, n_Psee j,k Indicates the number of transactions that the k-th transaction set contains the parent transaction in the j-th transaction set, n_Osee j,k Indicates the number of transactions that the k-th transaction set contains other ancestor transactions in the j-th transaction set, n k represents the number of transactions in the kth transaction set, T j,k represents the timestamp interval between the jth transaction set and the kth transaction set, S j,k represents the number of transaction sets j and k generated by the same representative node, τ1, τ2, τ3 and τ4 represent the weights of different parameters.
[0142] like Figure 3 As shown, an embodiment of the present invention further provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the method as described in any of the preceding items through the computer program.
[0143] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A large-scale heterogeneous Internet of Things node consensus method, characterized by: include: Parameters are initialized and network time t starts counting; When a new IoT node M joins the blockchain-based IoT network, it needs to be authenticated through the KYC-based node identity authentication protocol; If the authentication fails, the IoT node M will not be allowed to join the network, and the IoT field layer will check and remove the node M; If the authentication is successful, the identity of node M is evaluated, and the communication status and physical status evaluation values of node M are calculated. Based on the communication status and physical status information of the node, the identity of the power-limited IoT node is initially evaluated as a light node, and the identity of the large IoT node with better performance is initially evaluated as a full node; Calculate the capacity evaluation values of the top 2ρ full nodes in terms of computing power; When the network status update interval reaches the threshold ε1, the status evaluation value of the nodes in the network is calculated and updated; If the node's status evaluation value If the identity change conditions are met, the KYC-based identity change method will be executed to update the node's identity; When the node interval time reaches the threshold ε2, the network executes the dynamic election IoT representative full node selection mechanism, calculates the capability evaluation value of each initial representative full node, and selects the top ρ nodes from high to low to form the full node group D(d1,d2,...); Calculate the communication connection relationship value between node M and its neighboring full nodes; The representative full node collects the transaction information submitted by each node in the region to build a transaction set; The full node will sort the nodes in descending order based on their transaction scores; Collect vote information from other nodes on behalf of the full node, and calculate the transaction votes of different weighted ticket types under different identities; When the number of votes for a transaction reaches the threshold δ1, the transaction is verified and the transaction status changes to state(1). If more than 2 / 3 of the transactions in the transaction set are in state(1), the transaction set meets the on-chain standard, and the transactions in state(1) in the transaction set are selected to form the transaction set to be on-chain. Calculate the correlation between the transaction set to be verified and the most recent historical transaction sets, select the transaction sets with a correlation greater than the threshold δ2 for correlation, and update the transaction set hash value to successfully upload the transaction set to the chain and construct the transaction set DAG; After the transaction set DAG is successfully uploaded to the chain, it is synchronized with the entire network, and the nodes save and record the data.
2. A large-scale heterogeneous Internet of Things node consensus method according to claim 1, characterized in that: If the authentication is successful, the identity of the node M is evaluated, and the communication status and physical status evaluation values of the node M are calculated, including: Randomly select from the authenticated nodes to form a representative full node; The communication status evaluation value of the node is calculated by the formula (1) on behalf of all nodes. in, represents the communication status evaluation value between the i-th node and the representative full node r at time t, Delay represents the communication delay between the i-th node and the representative full node r at time t. yu represents the communication delay normalization threshold, PLR represents the packet loss rate of communication between the i-th node and the representative full node r at time t. yu represents the normalized threshold of packet loss rate; The physical state evaluation value of the node is calculated by the formula (2) on behalf of the full node. Among them, P i t represents the physical state evaluation value of the i-th node at time t, P i t _Storage represents the available storage of the i-th node at time t, P i t _Total represents the total storage of the i-th node at time t, P i t _Power represents the computing power of the i-th node at time t, P i t _Consume represents the power consumption of the i-th node at time t.
3. A large-scale heterogeneous Internet of Things node consensus method according to claim 2, characterized in that: The computing power of the top 2ρ full nodes is evaluated by computing power, including: The capability evaluation value of the node joining the network is calculated by formula (3): Among them, T represents the maximum time the network can maintain. It is represented as the node capability evaluation value of the representative node r for the i-th node at time t, ω1 represents the communication state weight, and ω2 represents the physical state weight; according to the capability evaluation value, ρ nodes are selected from high to low to be updated as candidate representative full nodes.
4. A large-scale heterogeneous Internet of Things node consensus method according to claim 3, characterized in that: The computing power ranking of the top 2ρ full nodes also includes: Considering the different importance of light nodes, full nodes and malicious nodes in the region, different weights and different ticket types are used for voting. The number of votes obtained by the newly generated ρ candidate representative full nodes is calculated by formula (4): in, represents the number of votes for the jth representative candidate node at time t, I k Represents the identity weights of light nodes, full nodes, and malicious nodes, Vc k Vu represents the number of votes cast in favor by the k-th identity type node, k Indicates the number of votes cast by the k-th identity type node against the proposal; based on the number of votes, the nodes are re-sorted from high to low, and the top 2 / 3ρ nodes are selected to officially become representative full nodes, while the bottom 1 / 3ρ nodes that are not selected are added to the backup representative full nodes.
5. A large-scale heterogeneous Internet of Things node consensus method according to claim 4, characterized in that: When the network status update interval reaches the threshold ε1, the status evaluation value of the node in the network is calculated and updated; including: When the network status update interval reaches the threshold ε1, all nodes on behalf of the network calculate and update the status evaluation value of the nodes in the network through formula (5); in, represents the state evaluation value of the i-th node at time t, λ represents the attenuation coefficient, It represents the transaction score of the i-th node at time t, which reflects the node's enthusiasm and reliability in the consensus process. It is composed of the node's offline time, number of offline times, capacity evaluation value, number of confirmed consensus transactions, number of discarded transactions, and number of unfinished transactions in the period (t-ε, t]), which can be expressed as: Among them, OffineT i (t-ε,t] represents the offline time of the i-th node in the period (t-ε,t], OfflineS i (t-ε,t] represents the number of offline times of the i-th node in the period (t-ε,t], represents the number of transactions correctly agreed upon by the i-th node during the period (t-ε, t], represents the number of transactions discarded by the i-th node during the period (t-ε,t], represents the number of unfinished transactions of the i-th node in the period (t-ε, t], μ1, μ2 and μ3 represent the feature weights, and They are respectively represented as the weights of transaction consensus.
6. A large-scale heterogeneous Internet of Things node consensus method according to claim 5, characterized in that: If the state evaluation value of the node If the identity change conditions are met, the KYC-based identity change method will be executed to update the node's identity, including: 1) If the evaluation values of light nodes, representative full nodes, and non-representative full nodes Below the minimum threshold α1, or the evaluation value Transaction points in When it is lower than the set threshold β1, the node is changed to a malicious node; 2) If the evaluation value of the malicious node and state value N i The value is higher than the set threshold α2 and the accumulated time reaches the set lower limit L down When the malicious node is changed to a full node, the malicious node is verified and the misjudgment rate of the malicious node is reduced; 3) If the status value N of the non-representative full node i If the non-representative full node is in the top ρ and the number of votes reaches the top 2 / 3ρ, then the non-representative full node will be changed to a representative full node. If the evaluation value of the representative full node at this moment is Below the minimum threshold α1, or the evaluation value Transaction points in If the node is lower than the set threshold β1, it is changed to a malicious node, and the node is removed, and a random backup representative full node is selected to be replaced by the representative full node; 4) If the state value N represents the full node i If it is outside the first ρ, the representative node will be changed to a non-representative full node; 5) If a full node in the network cannot reach consensus due to being changed to a malicious node or the number of nodes joining falls below the set threshold N1, the light node with better performance will be changed to a full node; 6) If the evaluation value of the full node Or status value N i Lower than the set threshold α3, α2>α3>α1 and the cumulative time reaches the set upper limit L up , the full node will be changed to a light node, and the representative will be replaced from the backup representative full node to become the representative full node accordingly.
7. A large-scale heterogeneous Internet of Things node consensus method according to claim 6, characterized in that: The communication connection relationship value between the computing node M and the neighboring full nodes includes: The representative full node calculates the communication connection relationship value between node M and its neighbor full nodes through formula (7), in, represents the communication connection relationship value between the i-th node and its m neighbor nodes at time t, represents the communication status evaluation value between the i-th node and its m neighbor nodes at time t, represents the physical state evaluation value of the mth neighbor node at time t, represents the number of light nodes around the i-th node at time t, and ω3, ω4 and ω5 represent the weights of different evaluation values respectively; if a full node needs to send data, the full node will sort the communication connection relationship values from large to small according to the information in the information status table, and select the first n neighboring full nodes as forwarding nodes to send data; the forwarding node selects the unbroadcasted node to forward the data according to the information status table of the neighboring node; the full node sends node query packets from time to time, and the surrounding light nodes receive the node query packets, select the full node with smaller latency and smaller number of connected light nodes as the parent node, and connect to the communication DAG; thus, according to the communication connection relationship value, the node can establish an information status table with the neighboring full nodes and construct the node communication DAG.
8. A large-scale heterogeneous Internet of Things node consensus method according to claim 7, characterized in that: The representative full node sorts the nodes in descending order from high to low according to the transaction score of the nodes; Collect vote information from other nodes on behalf of the full node, and calculate the transaction votes of different weighted ticket types under different identities, including: Represents the full node based on the node's transaction points Sort the nodes from high to low in descending order, assigning strong rank to the top 1 / 3 of the nodes, medium rank to the 1 / 3 to 2 / 3 of the nodes, and weak rank to the bottom 1 / 3 of the nodes; If the representative full node collects new transactions generated in the region, it generates a transaction set in chronological order. Based on the communication DAG of the transaction generating node, it prioritizes the node group with good communication connection value for dissemination and verification, and then disseminates it to other nodes through the gossip protocol based on the communication DAG; Then, after receiving the new transaction set information from other representative full nodes, each node votes for or against each transaction in the new transaction set based on its own historical transaction set information, and feeds back to the representative full node; The representative full node collects the vote information of other nodes and calculates the transaction votes of different weighted ticket types under different identities; the representative full node collects the vote information of other nodes and calculates the votes of each transaction in the transaction set by formula (8), assigns different weights to the affirmative and negative votes, and counts the votes according to the weights. in, represents the number of tickets for the jth transaction in round r, and Indicates the number of votes in favor and against the j-th transaction by nodes with strong level A in round r, and Indicates the number of votes in favor and against the j-th transaction by the node with the identity of medium level B in round r, and represents the number of votes in favor and against the j-th transaction by the node with the identity of medium level C in round r; ψ1, ψ2 and ψ3 represent the voting weights of different identities respectively.
9. A large-scale heterogeneous Internet of Things node consensus method according to claim 8, characterized in that: The calculation of the correlation between the transaction set to be verified and the most recent multiple historical transaction sets is performed, and the transaction sets with correlation greater than the threshold δ2 are selected for correlation. The transaction set hash value is then updated, and the transaction set is successfully uploaded to the chain to construct the transaction set DAG. include: The correlation between the transaction set to be verified and the most recent multiple historical transaction sets is calculated using formula (9); transaction sets with a correlation greater than the threshold δ2 are selected for correlation and the transaction set hash value is updated; thus, the transaction set is successfully uploaded to the chain and the transaction set DAG is constructed; Rel j,k =(n_same j,k +τ1×n_Psee j,k +τ2×n_Osee j,k ) / n k +τ3×T j,k +τ4×S j,k (9) Among them, Rel j,k Indicates the correlation between the jth transaction set and the kth transaction set, n_same j,k Indicates that the j-th transaction set and the k-th transaction set contain the same number of transactions, n_Psee j,k Indicates the number of transactions in the kth transaction set that contain the parent transaction in the jth transaction set, n_Osee j,k Indicates the number of transactions in the kth transaction set that contain other ancestor transactions in the jth transaction set, n k represents the number of transactions in the kth transaction set, T j,k S represents the timestamp interval between the jth transaction set and the kth transaction set. j,k represents the number of transaction sets j and k generated by the same representative node, τ1, τ2, τ3 and τ4 represent the weights of different parameters.
10. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to execute the method according to any one of claims 1 to 9 through the computer program.
