Internet of Things-oriented block chain consensus method and system
By counting the frequency of data collection and the number of consensus nodes in the Internet of Things, determining the participation and reputation value in combination with network traffic and sources, adjusting the target value of consensus nodes to generate blocks, the blockchain application bottleneck caused by limited resources of IoT devices is solved, and the effective utilization of resources and system stability is achieved.
Patent Information
- Application Number
- CN202411721166.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-28
- Publication Date
- 2025-02-28
AI Technical Summary
Due to limited computing, storage and bandwidth resources, IoT devices are difficult to effectively apply traditional blockchain consensus algorithms, resulting in waste of resources and performance bottlenecks.
By counting the data acquisition frequency of data acquisition nodes in the Internet of Things and the number of consensus nodes, the target value of consensus is determined, and the participation and reputation value of consensus nodes are determined through network traffic and sources, and the target value of each consensus node is adjusted to generate blocks.
It reduces the consumption of IoT resources, avoids excessive block generation by nodes with strong computing power, and improves system stability and effective resource utilization.
Smart Images

Figure CN119544724A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of Internet of Things, and in particular to a blockchain consensus method and system for the Internet of Things. Background Art
[0002] The IoT system is usually composed of many sensors, actuators and smart devices. These devices have the ability to perceive and communicate, collect environmental information or device status data, and send it to the cloud or edge devices for analysis and processing, so as to achieve remote monitoring, intelligent control and automated management. The application of IoT in smart home, smart manufacturing, smart city and Internet of Vehicles is becoming more and more extensive, but the traditional IoT architecture relies on centralized servers and networks, which makes data management and device control face problems such as privacy leakage, lack of trust and single point failure. Blockchain technology has brought new solutions and application models to the IoT. As a decentralized distributed ledger technology, blockchain has the characteristics of immutability, transparency and automation, and can realize peer-to-peer data exchange and distributed trust management between devices. By recording data on the blockchain, IoT devices can avoid relying on third parties to store and verify data, thereby reducing the risk of privacy leakage.
[0003] IoT devices generally have limited computing, storage, and bandwidth resources, while the current mainstream blockchain consensus algorithms often require a lot of computing power and storage resources. Taking PoW as an example, it requires nodes to perform a large number of hash operations to compete for block accounting rights, which not only consumes a lot of electricity, but also has high requirements on the computing power of the device. Therefore, directly applying traditional blockchain algorithms to IoT scenarios will lead to resource waste and performance bottlenecks. Summary of the invention
[0004] The embodiments of the present invention provide a blockchain consensus method and system for the Internet of Things, which can reduce the problem of limited application of blockchain in the Internet of Things due to limited resources of the Internet of Things.
[0005] In a first aspect, an embodiment of the present invention provides a blockchain consensus method for the Internet of Things, including: Count the frequency of data collection by all data collection nodes in the Internet of Things, and determine the target value of consensus based on the number of consensus nodes and the frequency; Obtain the network traffic and the source of the network traffic of the consensus node from the last block generation to the current moment, use the network traffic and the source of the network traffic and the type of the consensus node to determine the participation of the consensus node in the Internet of Things, use the node of the source of the network traffic as a verification node, and the verification node verifies the participation. If the verification fails, adjust the reputation value of the consensus node based on the amount of data sent by the verification node to the consensus node; The consensus node uses the reputation value and participation to recalculate the target value to obtain its own target value for this block generation, generates a block based on its own target value and adds it to the blockchain.
[0006] In a second aspect, an embodiment of the present invention provides a blockchain consensus system for the Internet of Things, including: A target value determination module is used to count the frequency of data collection by all data collection nodes in the Internet of Things, and determine the consensus target value according to the number of consensus nodes and the frequency; A participation calculation module is used to obtain the network traffic and the source of the network traffic of the consensus node from the last block generation to the current moment, and determine the participation of the consensus node in the Internet of Things by using the network traffic and the source of the network traffic and the type of the consensus node, and use the node of the source of the network traffic as a verification node, and the verification node verifies the participation. If the verification fails, the reputation value of the consensus node is adjusted based on the amount of data sent by the verification node to the consensus node; The consensus module is used for the consensus node to recalculate the target value using the reputation value and participation to obtain its own target value when generating this block, generate a block based on its own target value and add it to the blockchain.
[0007] In a third aspect, an embodiment of the present invention provides an electronic device, comprising: a memory and a processor; wherein the memory is used to store one or more computer instructions, wherein the one or more computer instructions, when executed by the processor, implement the method in the above-mentioned first aspect.
[0008] In a fourth aspect, an embodiment of the present invention provides a computer storage medium for storing a computer program, wherein the computer program enables a computer to implement the method in the first aspect when executed.
[0009] In a fifth aspect, an embodiment of the present invention provides a computer program product, comprising: a computer-readable storage medium storing computer instructions, which, when executed by one or more processors, causes the one or more processors to execute the steps of the method described in the first aspect above.
[0010] In the present invention, the target value is determined according to the number of consensus nodes and the collection frequency of all data collection nodes. When the number of consensus nodes is small and / or the collection frequency is low, the target value is increased, which makes it easier to generate blocks and reduces the consumption of IoT resources. In addition, different types of nodes in the IoT are different. Some types of nodes have strong computing power. In order to prevent nodes with strong computing power from always generating blocks, the network traffic and the source of the network traffic and the type of consensus node are used to determine the participation of the consensus node in the IoT. The participation in the IoT is determined by the type of consensus node and the traffic information of the consensus node, and the participation and reputation value are further used to calculate the target value of each consensus node. In this way, the probability of nodes with strong computing power generating blocks can be reduced, and different types of nodes can be leveled to the same level. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] Figure 1 This is a flow chart of Embodiment 1; Figure 2 Schematic diagram of consensus nodes and verification nodes. DETAILED DESCRIPTION
[0012] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0013] The terms used in the embodiments of the present invention are only for the purpose of describing specific embodiments, and are not intended to limit the present invention. The singular forms "a", "an", and "the" used in the embodiments of the present invention and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings, and "multiple" generally includes at least two, but does not exclude the situation of including at least one.
[0014] It should be understood that the term "and / or" used in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.
[0015] As used herein, the words "if" and "if" may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is detected" may be interpreted as "when it is determined" or "in response to determining" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)", depending on the context.
[0016] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a product or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such a product or system. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the product or system including the elements.
[0017] In addition, the step sequence in the following method embodiments is only an example and not a strict limitation.
[0018] This embodiment provides a blockchain consensus method for the Internet of Things. For details, refer to the attached Figure 1 As shown, including: Step 1: Count the frequency of data collection by all data collection nodes in the Internet of Things, and determine the consensus target value according to the number of consensus nodes and the frequency; Step 2, obtaining the network traffic and the source of the network traffic of the consensus node from the last block generation to the current moment, using the network traffic and the source of the network traffic and the type of the consensus node to determine the participation of the consensus node in the Internet of Things, taking the node of the source of the network traffic as the verification node, and the verification node verifies the participation. If the verification fails, the reputation value of the consensus node is adjusted based on the amount of data sent by the verification node to the consensus node; Step 3: The consensus node uses the reputation value and participation to recalculate the target value to obtain its own target value for this block generation, generates a block based on its own target value, and adds it to the blockchain.
[0019] The specific implementation process and effects of each of the above steps are described in detail below: Step 1: Count the frequency of data collection by all data collection nodes in the Internet of Things, and determine the target value of consensus based on the number of consensus nodes and the frequency.
[0020] There are many types of nodes in the Internet of Things, and different nodes have different roles and importance in the network, so not all nodes are suitable as consensus nodes. The selection of specific types of nodes as consensus nodes is mainly based on factors such as the node's computing power, network stability, and data transmission volume. Data acquisition nodes, also known as sensor nodes, have limited computing power and storage resources, and short battery life. Edge nodes, gateway nodes, management nodes, etc. have strong computing power, and these nodes are used as consensus nodes; management nodes include but are not limited to cloud servers, administrators' computing devices, etc.
[0021] Statistics are made on the data collection frequency of all data collection nodes in the IoT network; the data collection frequency refers to the frequency of data collection by each data collection node, such as how many times data is collected per second, or how many data are collected per hour. According to the number of active consensus nodes in the current network and the statistical data collection frequency, the consensus target value is determined. The consensus target value is used to control the difficulty and frequency of generating new blocks to ensure the stability of the system and the effective use of resources. If the frequency of data collection nodes is high and the number of consensus nodes is small, the consensus target value will be increased and the computational difficulty of generating new blocks will be reduced so that data can be uploaded to the chain in time. On the contrary, if the data collection frequency is low and the number of consensus nodes is large, the target value will be lowered and the computational difficulty of generating new blocks will be increased to reduce resource consumption and balance the time interval for generating blocks.
[0022] In an optional embodiment, the target value of consensus is determined according to the number of consensus nodes and the frequency, specifically: Get the initial target value. Every time the frequency increases by a preset value, increase the first non-zero bit of the initial target value by 1. With each additional consensus node, the initial target value decreases by a preset amount.
[0023] Whenever the data collection frequency increases by a preset value, such as an increment of 1000 times / second, the first non-zero bit in the initial target value is increased by 1, the difficulty of generating blocks will gradually decrease, and the block generation time will be shortened to adapt to the higher data generation frequency. For example, if the initial target value is 000B14A, the first non-zero bit from the front to the back is the 4th bit B, and the hexadecimal B plus one is C, which becomes 000C14A, where the first non-zero bit of the initial target value is the highest bit and the value of the highest bit is not 0. Whenever the number of consensus nodes increases by 1, the system will reduce a preset size based on the initial target value to increase the difficulty of calculation. In one embodiment, a step 1 is executed each time a block is generated.
[0024] Step 2, obtaining the network traffic and the source of the network traffic of the consensus node from the last block generation to the current moment, using the network traffic and the source of the network traffic and the type of the consensus node to determine the participation of the consensus node in the Internet of Things, taking the node of the source of the network traffic as the verification node, and the verification node verifies the participation. If the verification fails, the reputation value of the consensus node is adjusted based on the amount of data sent by the verification node to the consensus node; After each new block is generated, each consensus node starts to count the network traffic in the current cycle and the information of the data source node, where the network traffic is the traffic sent by other nodes to the consensus node, and the source of the traffic is other nodes that send data to the consensus node. For example, if there are 10 nodes sending data to a consensus node, the source of the network traffic of this consensus node is these 10 nodes. The higher the network traffic and the more data source nodes, the more active the consensus node is. However, there are significant differences in the traffic and traffic sources of different types of nodes. For example, the amount of data of the gateway node is larger than that of the edge node, which leads to a greater participation of the network node. In order to eliminate this difference caused by the type of consensus node, the participation of the consensus node in the Internet of Things is also determined according to the type of consensus node.
[0025] Among them, this embodiment does not limit the implementation method of using the network traffic and the source of the network traffic and the type of consensus node to determine the participation of the consensus node in the Internet of Things. In some instances, the participation can be calculated through a pre-trained machine learning model.
[0026] In some other embodiments, the participation is calculated by the interval where the network traffic is located, the interval where the source of the network traffic is located, and the weight determined by the consensus node type. Specifically, the interval where the network traffic is located is determined, and the value corresponding to the interval is used as the activity score of the consensus node; the interval where the number of sources of the network traffic is located is determined, and the value corresponding to the interval is used as the credibility score of the consensus node; the weight is determined according to the type of the consensus node, and the sum of the activity score and the credibility score is adjusted using the weight to obtain the participation of the consensus node in the Internet of Things; wherein the types of consensus nodes include edge nodes, gateway nodes, and management nodes. In one embodiment, the gateway nodes and management nodes are further classified, and the weights of gateways at different levels are different, and the weights of different types of management nodes are different.
[0027] More specifically, several network traffic intervals are predefined, each of which corresponds to an activity score. In one embodiment, the activity score of the low traffic interval is 2, the activity score of the medium traffic interval is 5, the activity score of the high traffic interval is 8, and the activity score of the high traffic interval is 10. Similarly, multiple intervals of the number of traffic sources are preset. In one embodiment, the credibility score of the low connection interval is 3, the credibility score of the medium connection interval is 6, the credibility score of the high connection interval is 8, and the credibility score of the high connection interval is 10. Different types of consensus nodes are assigned different weights. In one embodiment, the weight of the edge node is 0.5, the weight of the gateway node is 0.7, and the weight of the management node is 1.0. Participation score = (activity score + credibility score) × node type weight. For example, a gateway node has an activity score of 8, a credibility score of 6, and a weight of 0.7, then the total score is 8+6 =14, and the participation score is 9.8. The number of network traffic intervals and the number of intervals of traffic source data are not specifically limited.
[0028] Since consensus nodes may forge traffic and traffic sources, in one embodiment, the source node of network traffic, i.e., the node that is directly connected to the consensus node and sends data, is designated as a verification node. These verification nodes are usually nodes that have frequent data interactions with the consensus node, and they can effectively reflect the real activity of the consensus node. For example, if consensus node A receives data traffic from sensor nodes B, C, and D, then nodes B, C, and D will be selected as verification nodes. Figure 2 The relationship between consensus nodes and verification nodes is shown.
[0029] The verification node will check and verify the participation score of the consensus node based on the network traffic, data source, connection frequency and other information of the consensus node. The task of the verification node is to ensure that the participation score of the consensus node is true and accurate, and there is no false reporting. The verification process includes checking the data transmission volume, data integrity, timestamp, etc. of the consensus node. For example, the verification node can check whether the consensus node has indeed received the specified amount of data and processed it within the predetermined time. The verification results can be shared between the verification nodes to jointly confirm whether the participation of the consensus node meets the expected standards. If the verification node fails to verify the participation score of the consensus node, for example, if its traffic data or source is found to be abnormal, the reputation value of the consensus node will be adjusted. The adjustment method is determined based on the relationship between the amount of data sent by the verification node to the consensus node. If the amount of data sent by the verification node is large, but the consensus node fails to reflect the corresponding participation, the system believes that the consensus node has not fully performed its duties and reduces its reputation value. The amount of adjustment of the reputation value can be graded according to the total amount of data of the verification node. For example, if the verification node sends a large amount of data and the consensus node does not reach the expected participation, the reputation value will decrease more; if the amount of data is small, the reduction in the reputation value will be relatively small.
[0030] In another optional embodiment, the verification node obtains the data sent by the consensus node to other verification nodes, and calculates whether the network traffic in the data sent by the consensus node to all verification nodes is equal to the network traffic for calculating the participation. If equal, further verify whether the participation is calculated correctly. If calculated correctly, send confirmation information to the consensus node; if not equal and / or calculated incorrectly, the verification fails.
[0031] Each verification node collects the amount of data sent by the consensus node to other verification nodes, summarizes this data, and compares it with the total network traffic declared by the consensus node. If the total amount of data actually sent to the verification node is equal to the network traffic based on the participation claimed by the consensus node, it means that the data volume declaration of the consensus node in this link is accurate, and enters the next step of verification. If the actual traffic is inconsistent with the declared traffic, for example, the data traffic for calculating participation is greater than the actual amount sent, the verification node will immediately determine that the verification failed and adjust the reputation value of the consensus node without further verification. If the network traffic verification passes, the verification node further checks whether the participation calculation process of the consensus node meets the expected standards. For example, the verification node will compare the activity score and credibility score of the consensus node based on the actual network traffic range and the number of traffic sources to ensure that its calculation results are consistent with the system preset rules. If the verification node confirms that the network traffic and participation calculation of the consensus node are correct, the verification node will send a confirmation message to the consensus node to indicate that its participation verification has passed and confirm that its behavior is authentic and trustworthy. If the participation calculation is incorrect or the data volume is inconsistent, the verification node will determine that the verification failed and adjust the reputation value of the consensus node.
[0032] In a possible embodiment, adjusting the reputation value of the consensus node based on the amount of data sent from the verification node to the consensus node is specifically: Calculate the ratio of the amount of data sent by the verification node to the consensus node to the network traffic of the consensus node from the last block generation to the current moment, and take the product of the ratio and the reputation value of the consensus node as the amount of reputation value reduced by the consensus node.
[0033] For a verification node, the verification node will calculate the ratio of the amount of data sent to the consensus node to the network traffic of the consensus node from the last block generation to the current moment, and multiply the calculated ratio by the current reputation value of the consensus node to determine the amount of reputation value that needs to be reduced. The reduced reputation value is subtracted from the current reputation value of the consensus node to obtain the adjusted reputation value.
[0034] Step 3: The consensus node uses the reputation value and participation to recalculate the target value to obtain its own target value for this block generation, generates a block based on its own target value, and adds it to the blockchain.
[0035] The initial target value is adjusted according to the reputation and participation of the consensus node to obtain the consensus node's own target value. The higher the reputation and participation, the lower the computational difficulty of generating blocks, and the target value will increase accordingly. Based on its own target value, the consensus node generates a new block through proof of work (PoW) calculation. Specifically, the consensus node performs a double SHA-256 hash calculation on the hash value of the previous block and a random number. The random number is continuously adjusted until a random number is found that satisfies the generated hash value less than its own target value. Nodes with high reputation and high participation can find valid random numbers faster and increase the chance of generating new blocks. After generating a new block, the consensus node broadcasts it to the network and other nodes verify it. Once the verification is passed, the block will be officially added to the blockchain and become the latest block on the chain.
[0036] In order to prevent a consensus node from continuously generating blocks, in one embodiment, the interval number is further determined based on the reputation of the consensus node. When a consensus node generates a block, it can only serve as a consensus node after the interval number. For example, if the interval number is 3, if consensus node A generates the 5th block, then when the 6th to 8th blocks are generated, consensus node A will no longer serve as a consensus node, that is, no block generation will be performed. The higher the reputation, the smaller the interval number. In one possible embodiment, the reputation is divided, and each reputation interval corresponds to an interval number.
[0037] Among them, in a possible embodiment, the consensus node uses the reputation value and participation to recalculate the target value to obtain its own target value for the current block generation, specifically: The ratio of the reputation value to the basic reputation value is calculated, and the ratio of the participation degree to the basic participation degree is calculated. The product of the two ratios is used as the weight, and the target value is weighted by the weight to obtain the target value of the current block generation.
[0038] A schematic diagram of the structure of a blockchain consensus system for the Internet of Things provided by an embodiment of the present invention, the system comprising: A target value determination module is used to count the frequency of data collection by all data collection nodes in the Internet of Things, and determine the consensus target value according to the number of consensus nodes and the frequency; A participation calculation module is used to obtain the network traffic and the source of the network traffic of the consensus node from the last block generation to the current moment, and determine the participation of the consensus node in the Internet of Things by using the network traffic and the source of the network traffic and the type of the consensus node, and use the node of the source of the network traffic as a verification node, and the verification node verifies the participation. If the verification fails, the reputation value of the consensus node is adjusted based on the amount of data sent by the verification node to the consensus node; The consensus module is used for the consensus node to recalculate the target value using the reputation value and participation to obtain its own target value when generating this block, generate a block based on its own target value and add it to the blockchain.
[0039] In a possible embodiment, the target value of consensus is determined according to the number of consensus nodes and the frequency, specifically: Get the initial target value. Every time the frequency increases by a preset value, increase the first non-zero bit of the initial target value by 1. With each additional consensus node, the initial target value decreases by a preset amount.
[0040] In a possible embodiment, the use of the network traffic, the source of the network traffic, and the type of the consensus node to determine the participation of the consensus node in the Internet of Things is specifically as follows: Determine the interval in which the network traffic is located, and use the value corresponding to the interval as the activity score of the consensus node; Determine the interval in which the number of sources of network traffic lies, and use the value corresponding to the interval as the credibility score of the consensus node; The weight is determined according to the type of consensus node, and the sum of the activity score and the credibility score is adjusted by using the weight to obtain the participation of the consensus node in the Internet of Things; wherein the types of consensus nodes include edge nodes, gateway nodes, and management nodes.
[0041] In a possible embodiment, the verification node verifies the participation degree by: The verification node obtains the data sent by the consensus node to other verification nodes, and calculates whether the network traffic in the data sent by the consensus node to all verification nodes is equal to the network traffic for calculating the participation. If equal, it further verifies whether the participation is calculated correctly. If the calculation is correct, it sends a confirmation message to the consensus node. If not equal and / or the calculation is incorrect, the verification fails.
[0042] In a possible embodiment, adjusting the reputation value of the consensus node based on the amount of data sent from the verification node to the consensus node is specifically: Calculate the ratio of the amount of data sent by the verification node to the consensus node to the network traffic of the consensus node from the last block generation to the current moment, and take the product of the ratio and the reputation value of the consensus node as the amount of reputation value reduced by the consensus node.
[0043] In a possible embodiment, the consensus node uses the reputation value and participation to recalculate the target value to obtain its own target value for the current block generation, specifically: The ratio of the reputation value to the basic reputation value is calculated, and the ratio of the participation degree to the basic participation degree is calculated. The product of the two ratios is used as the weight, and the target value is weighted by the weight to obtain the target value of the current block generation.
[0044] In a possible embodiment, the block is generated based on the target value itself and added to the blockchain, specifically: The consensus node continuously tries different random numbers, combines the hash value of the previous block with the random number, and generates a hash value through the double SHA-256 hash algorithm; The first consensus node that successfully finds a hash value that is smaller than its own target value obtains the accounting right of the current block and broadcasts it to other network nodes; after verification, other nodes regard the current block as valid and add it to their own blockchain.
[0045] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0046] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, i.e., they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Those of ordinary skill in the art may understand and implement it without creative effort.
[0047] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by adding a necessary general hardware platform, and of course can also be implemented by combining hardware and software. Based on such an understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a computer product, and the present invention can be in the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0048] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable device to produce a machine, so that the instructions executed by the processor of the computer or other programmable device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
Claims
1. A blockchain consensus method for the Internet of Things, characterized in that: include: Count the frequency of data collection by all data collection nodes in the Internet of Things, and determine the target value of consensus based on the number of consensus nodes and the frequency; Obtain the network traffic and the source of the network traffic of the consensus node from the last block generation to the current moment, use the network traffic and the source of the network traffic and the type of the consensus node to determine the participation of the consensus node in the Internet of Things, use the node of the source of the network traffic as a verification node, and the verification node verifies the participation. If the verification fails, adjust the reputation value of the consensus node based on the amount of data sent by the verification node to the consensus node; The consensus node uses the reputation value and participation to recalculate the target value to obtain its own target value for this block generation, generates a block based on its own target value and adds it to the blockchain.
2. The method according to claim 1, characterized in that The target value of consensus is determined according to the number of consensus nodes and the frequency, specifically: Get the initial target value. Every time the frequency increases by a preset value, increase the first non-zero bit of the initial target value by 1. With each additional consensus node, the initial target value decreases by a preset amount.
3. The method according to claim 1, characterized in that The method of determining the participation of the consensus node in the Internet of Things by using the network traffic, the source of the network traffic, and the type of the consensus node is as follows: Determine the interval in which the network traffic is located, and use the value corresponding to the interval as the activity score of the consensus node; Determine the interval in which the number of sources of network traffic lies, and use the value corresponding to the interval as the credibility score of the consensus node; The weight is determined according to the type of consensus node, and the sum of the activity score and the credibility score is adjusted using the weight to obtain the participation of the consensus node in the Internet of Things; wherein the types of consensus nodes include edge nodes, gateway nodes, and management nodes.
4. The method according to claim 1, characterized in that The verification node verifies the participation, specifically: The verification node obtains the data sent by the consensus node to other verification nodes, and calculates whether the network traffic in the data sent by the consensus node to all verification nodes is equal to the network traffic for calculating the participation. If equal, it further verifies whether the participation is calculated correctly. If the calculation is correct, it sends a confirmation message to the consensus node. If not equal and / or the calculation is incorrect, the verification fails.
5. The method according to claim 1, characterized in that The step of adjusting the reputation value of the consensus node based on the amount of data sent by the verification node to the consensus node is specifically as follows: Calculate the ratio of the amount of data sent by the verification node to the consensus node to the network traffic of the consensus node from the last block generation to the current moment, and take the product of the ratio and the reputation value of the consensus node as the amount of reputation value reduced by the consensus node.
6. The method according to claim 1, characterized in that The consensus node uses the reputation value and participation to recalculate the target value to obtain its own target value for this block generation, specifically: The ratio of the reputation value to the basic reputation value is calculated, and the ratio of the participation degree to the basic participation degree is calculated. The product of the two ratios is used as the weight, and the target value is weighted by the weight to obtain the target value of the current block generation.
7. The method according to claim 1, characterized in that The block is generated based on the target value of the self and added to the blockchain, specifically: The consensus node continuously tries different random numbers, combines the hash value of the previous block with the random number, and generates a hash value through the double SHA-256 hash algorithm; The first consensus node that successfully finds a hash value that is smaller than its own target value obtains the accounting right of the current block and broadcasts it to other network nodes; After verification, other nodes regard the current block as valid and add it to their own blockchain.
8. A blockchain consensus system for the Internet of Things, characterized in that: include: A target value determination module is used to count the frequency of data collection by all data collection nodes in the Internet of Things, and determine the consensus target value according to the number of consensus nodes and the frequency; A participation calculation module is used to obtain the network traffic and the source of the network traffic of the consensus node from the last block generation to the current moment, and determine the participation of the consensus node in the Internet of Things by using the network traffic and the source of the network traffic and the type of the consensus node, and use the node of the source of the network traffic as a verification node, and the verification node verifies the participation. If the verification fails, the reputation value of the consensus node is adjusted based on the amount of data sent by the verification node to the consensus node; The consensus module is used for the consensus node to recalculate the target value using the reputation value and participation to obtain its own target value when generating this block, generate a block based on its own target value and add it to the blockchain.
9. The system according to claim 8, characterized in that The target value of consensus is determined according to the number of consensus nodes and the frequency, specifically: Get the initial target value. Every time the frequency increases by a preset value, increase the first non-zero bit of the initial target value by 1. With each additional consensus node, the initial target value decreases by a preset amount.
10. The system according to claim 8, characterized in that The method of determining the participation of the consensus node in the Internet of Things by using the network traffic, the source of the network traffic, and the type of the consensus node is as follows: Determine the interval in which the network traffic is located, and use the value corresponding to the interval as the activity score of the consensus node; Determine the interval in which the number of sources of network traffic lies, and use the value corresponding to the interval as the credibility score of the consensus node; The weight is determined according to the type of consensus node, and the sum of the activity score and the credibility score is adjusted using the weight to obtain the participation of the consensus node in the Internet of Things; wherein the types of consensus nodes include edge nodes, gateway nodes, and management nodes.
Citation Information
Patent Citations
PBFT consensus propagation optimization method based on dynamic reputation value
CN111510502A
Reputation-based blockchain work certification method
CN112600917A
Raft consensus method suitable for Internet of Things
CN113630455A
Block chain consensus method and device, equipment and storage medium
CN118018554A
Federated learning management method and apparatus, and computer device and storage medium
WO2023071106A1
Cited By
Block chain consensus method and system, medium and equipment
CN122312140A