Consensus method and device for wireless blockchain network

By dynamically adjusting the contention window and forwarding probability of the wireless blockchain network, the wireless PBFT consensus process is optimized, solving the problems of low channel resource utilization and broadcast message collision, thereby improving network operating efficiency and consensus success rate.

CN119316882BActive Publication Date: 2025-10-28BEIJING UNIV OF POSTS & TELECOMM
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411186012.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-27
Publication Date
2025-10-28
Estimated Expiration
2044-08-27

AI Technical Summary

Technical Problem

In wireless blockchain networks, the existing PBFT consensus process cannot adapt to the dynamic characteristics of nodes, resulting in low channel resource utilization and increased broadcast message collisions, which affects consensus efficiency.

Method used

By adjusting the competition window parameters and forwarding probability of the second consensus round based on the competition window parameters of the first consensus round and the redundant data counted by the counter array during the pre-prepare phase of the consensus process, the broadcasting of pre-prepare messages is optimized, ensuring the effective propagation of prepare messages in the prepare and commit phases, and confirming the consensus success of honest nodes.

Benefits of technology

It effectively balanced network load, improved the operating efficiency of the wireless blockchain network, and ensured the utilization rate of channel resources and the success rate of consensus.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119316882B_ABST
    Figure CN119316882B_ABST
Patent Text Reader

Abstract

This invention provides a consensus method and apparatus for a wireless blockchain network. The method includes: in the pre-prepare phase, obtaining the contention window parameters of the block corresponding to the first consensus round, updating the contention window parameters of the block corresponding to the second consensus round, and adjusting the forwarding probability of all nodes broadcasting the pre-prepare message for the block corresponding to the second consensus round based on the redundant data counted by the counter array of the block corresponding to the first consensus round, thereby obtaining a prepare message; and, if the prepare message passes through the broadcasting and verification of the prepare and commit phases in sequence, determining that the consensus of honest nodes has been successful, and uploading the block corresponding to the second consensus round to the wireless blockchain network. The method of this invention automatically adjusts the contention window and forwarding probability in the network when generating new blocks, improving channel resource utilization and network operating efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of blockchain technology, and in particular to a consensus method and apparatus for a wireless blockchain network. Background Technology

[0002] In the future, the exchange of massive amounts of information will rely on wireless communication. Wireless communication is limited by unstable wireless channels and scarce spectrum resources, which will affect the consensus of wireless blockchain networks. The PBFT (Practical Byzantine Fault Tolerance) algorithm commonly used in consortium blockchains, under the traditional broadcast method in wireless environments, uses the minimum contention window and the highest possible forwarding probability to broadcast messages, which will generate a large number of message collisions and resource consumption, thus leading to the failure of wireless blockchain network consensus.

[0003] In related technologies, the existing wireless PBFT consensus process uses a fixed contention window size, which cannot adapt to the dynamic characteristics of nodes. For example, a large contention window will lead to low channel resource utilization, while a small contention window will lead to serious message collision problems when the number of nodes increases. In addition, traditional forwarding strategies cannot adapt to the consensus characteristics of wireless blockchain networks. For example, a high forwarding probability will waste channel resources and cause broadcast collisions, while a low forwarding probability will affect the propagation of consensus messages and cause consensus failure. Summary of the Invention

[0004] This invention provides a consensus method and apparatus for a wireless blockchain network, which addresses the shortcomings of existing wireless PBFT consensus processes, such as the inability of the contention window size to adapt to the dynamic characteristics of nodes and the inability of the forwarding strategy to adapt to the consensus characteristics of wireless blockchain networks, resulting in low channel resource utilization and increased broadcast message collisions, thereby improving the operating efficiency of wireless blockchain networks.

[0005] This invention provides a consensus method for a wireless blockchain network, applied to a wireless blockchain network including a master node and multiple replica nodes. The nodes communicate with each other using broadcast. Different nodes set up a counter array for different blocks in the wireless blockchain network. The counter array is used to count the redundancy between the consensus information of all nodes. The method includes:

[0006] In the pre-prepare phase of the consensus process executed in the wireless blockchain network, the competition window parameters of the block corresponding to the second consensus round are updated according to the competition window parameters of the block corresponding to the first consensus round. Furthermore, the forwarding probability of all nodes broadcasting the pre-prepare message in the second consensus round is adjusted based on the redundant data collected from the counter array of the block corresponding to the first consensus round, thus obtaining the prepare message. The first consensus round block executes the consensus process before the second consensus round block. The pre-prepare message includes the consensus view number corresponding to the second consensus round, the number of the block corresponding to the second consensus round, the block's digest information, the competition window parameters, the key signature information, and the block content.

[0007] If the prepare message is broadcast and verified sequentially through the prepare and commit phases of the consensus process, it is determined that the honest node has successfully reached consensus in the second consensus round, and the block corresponding to the second consensus round is uploaded to the wireless blockchain network. The honest node belongs to all nodes.

[0008] According to a consensus method for a wireless blockchain network provided by the present invention, the first consensus round corresponds to blocks including blocks in which the master node consensus is successful or blocks in which the master node consensus fails.

[0009] The step of updating the competition window parameters of the block corresponding to the second consensus round based on the competition window parameters of the block corresponding to the first consensus round includes:

[0010] In the case where the block corresponding to the first consensus round is a block in which the master node has achieved consensus, the size of the competition window corresponding to the block in the first consensus round is reduced by a first ratio to obtain the competition window of the block corresponding to the second consensus round.

[0011] In the case where the block corresponding to the first consensus round is a block in which the master node consensus fails, the size of the competition window corresponding to the block corresponding to the first consensus round is expanded according to the second ratio to obtain the competition window corresponding to the block corresponding to the second consensus round.

[0012] According to a consensus method for a wireless blockchain network provided by the present invention, the step of reducing the size of the competition window corresponding to the block corresponding to the first consensus round by a first ratio to obtain the competition window corresponding to the block corresponding to the second consensus round includes:

[0013] ;

[0014] in, This represents the competition window size for the block corresponding to the second consensus round. This is the minimum value among the competing window sizes of each block. M It is a positive integer;

[0015] The step of enlarging the competition window size corresponding to the block corresponding to the first consensus round according to a second ratio to obtain the competition window for the block corresponding to the second consensus round includes:

[0016] ;

[0017] in, This represents the competition window size for the block corresponding to the second consensus round. This represents the maximum value among the competing window sizes of each block. It is a positive integer.

[0018] According to a consensus method for a wireless blockchain network provided by the present invention, the step of adjusting the forwarding probability of all nodes broadcasting the pre-prepare message when broadcasting the pre-prepare message based on the redundant data counted by the counter array of the block corresponding to the first consensus round includes:

[0019] If the average value of the redundant data is greater than the redundancy threshold, the forwarding probability is adjusted according to the following formula:

[0020] ;

[0021] in, p The forwarding probability is... Adjust the step size for probability;

[0022] If the average value of the redundant data is less than or equal to the redundancy threshold, the forwarding probability is adjusted according to the following formula:

[0023] .

[0024] According to a consensus method for a wireless blockchain network provided by the present invention, determining that the honest node has successfully achieved consensus in the second consensus round, when the prepare message is broadcast and verified sequentially through the prepare and commit phases of the consensus process, includes:

[0025] During the prepare phase of the consensus process executed in the wireless blockchain network, and when the honest node of the block corresponding to the second consensus round receives and verifies the prepare message sent by the first number of replica nodes, a commit message is generated and forwarded according to the forwarding probability corresponding to the second consensus round; wherein, the first number is determined based on the number of multiple nodes;

[0026] During the commit phase of the consensus process executed on the wireless blockchain network, if the honest node of the block corresponding to the second consensus round receives and verifies the commit message sent by the second number of replica nodes, the master node consensus of the block corresponding to the second consensus round is determined to be successful; wherein the second number is greater than the first number.

[0027] According to a consensus method for a wireless blockchain network provided by the present invention, after receiving the prepare message, the method further includes:

[0028] If the prepare message fails to be broadcast and verified in either the prepare or commit phase of the consensus process, the master node consensus for the block corresponding to the second consensus round is determined to have failed.

[0029] The present invention also provides a consensus device for a wireless blockchain network, comprising:

[0030] The configuration module is used to update the competition window parameters of the block corresponding to the second consensus round according to the competition window parameters of the block corresponding to the first consensus round during the pre-prepare phase of the consensus process in the wireless blockchain network, and adjust the forwarding probability of all nodes broadcasting the pre-prepare message in the block corresponding to the second consensus round according to the redundant data counted by the counter array of the block corresponding to the first consensus round, so as to obtain the prepare message.

[0031] The consensus process is executed before that of the block corresponding to the first consensus round; the pre-prepare message includes the consensus view number corresponding to the second consensus round, the number of the block corresponding to the second consensus round, the block summary information, the contention window parameter, the key signature information, and the block content; the wireless blockchain network includes one master node and multiple replica nodes, which communicate with each other using broadcast, and different nodes set up counter arrays for different blocks in the wireless blockchain network, which are used to count the redundancy between the consensus information of all nodes;

[0032] The consensus module is used to determine that an honest node has successfully reached consensus in the second consensus round when the prepare message is broadcast and verified sequentially through the prepare and commit phases of the consensus process, and to upload the block corresponding to the second consensus round to the wireless blockchain network. The honest node belongs to all nodes.

[0033] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement a consensus method for any of the wireless blockchain networks described above.

[0034] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a consensus method for a wireless blockchain network as described above.

[0035] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements a consensus method for any of the wireless blockchain networks described above.

[0036] The consensus method and apparatus for a wireless blockchain network provided by this invention, in the pre-prepare stage of the consensus process, updates the competition window parameters of the block corresponding to the second consensus round according to the competition window parameters of the block corresponding to the first consensus round, and adjusts the forwarding probability of all nodes broadcasting the pre-prepare message for the block corresponding to the second consensus round according to the redundant data counted by the counter array of the block corresponding to the first consensus round, thereby obtaining the prepare message. After the prepare message passes through the broadcast and verification of the prepare and commit stages of the consensus process in sequence, it is determined that the consensus of honest nodes is successful, and the block corresponding to the second consensus round is added to the wireless blockchain network. The PBFT consensus process of this invention automatically adjusts the size of the competition window and the forwarding probability in the network each time a new block is generated, effectively balancing the network load, ensuring wireless PBFT consensus while ensuring channel resource utilization, and improving network operating efficiency. Attached Figure Description

[0037] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0038] Figure 1 This is one of the flowcharts illustrating the consensus method for a wireless blockchain network provided by the present invention.

[0039] Figure 2 This is the second flowchart illustrating the consensus method for the wireless blockchain network provided by this invention.

[0040] Figure 3 This is a schematic diagram of the structure of the consensus device for the wireless blockchain network provided by the present invention.

[0041] Figure 4 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation

[0042] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.

[0043] It should be noted that the consensus process executed by the wireless blockchain network includes the request phase, pre-prepare phase, prepare phase, commit phase, and reply phase.

[0044] In the request phase, the client initiates a request, and after the master node receives the client's request, it will trigger the core consensus process.

[0045] In the pre-prepare phase, the master node receives the request sent by the client and constructs a pre-prepare message for it (or puts it in the buffer to wait for a batch construction of a pre-prepare message). Other nodes, after receiving the pre-prepare message sent by the master node, verify the signature and check the request. If it passes, it enters the prepare phase. After receiving the pre-prepare message sent by the master node, the node checks the following aspects: (1) the signature is correct and the message is correct; (2) the node is consistent with the master node in the pre-prepare message; there are no other pre-prepare messages that conflict with the pre-prepare message, etc.

[0046] During the prepare phase, after a node receives a pre-prepare message from the master node, it verifies the signature and checks the request. If the verification is successful, it constructs a prepare message and broadcasts it to other nodes (since the pre-prepare message is sent by the master node, the master node no longer participates in sending prepare messages; each node receives the master node's prepare message by default). After a node receives prepare messages from other nodes, it verifies the signature and checks whether the master node, sequence number, and digest in the prepare message are consistent. If they are consistent, the message is prepared on this node, and the node enters the commit phase for this message.

[0047] During the commit phase, a commit message is constructed and broadcast to other nodes, and commit messages sent by other nodes are received. After receiving commit messages (including its own) from different nodes, the signature of the commit message is verified. If the verification passes, the client request corresponding to the message containing its own message is submitted for execution.

[0048] During the reply phase, after a node completes its execution, it constructs a reply message based on the execution result and returns it to the client that sent the request. If the client receives multiple identical reply messages, it means that its request was successfully executed.

[0049] The following is combined with Figures 1-3 This invention describes a consensus method and apparatus for a wireless blockchain network.

[0050] Figure 1 This is one of the flowcharts illustrating the consensus method for a wireless blockchain network provided by the present invention, such as... Figure 1 As shown, the consensus method of this wireless blockchain network is applied to a wireless blockchain network, which includes a master node and multiple replica nodes. The nodes communicate with each other using broadcast. Different nodes set up counter arrays for different blocks in the wireless blockchain network. The counter arrays are used to count the redundancy between the consensus information of all nodes. The method includes the following steps:

[0051] Step 110: In the pre-prepare phase of the consensus process in the wireless blockchain network, update the competition window parameters of the block corresponding to the second consensus round according to the competition window parameters of the block corresponding to the first consensus round, and adjust the forwarding probability of the pre-prepare message broadcast by all nodes of the block corresponding to the second consensus round according to the redundant data counted by the counter array of the block corresponding to the first consensus round, to obtain the prepare message; wherein, the block corresponding to the first consensus round executes the consensus process before the block corresponding to the second consensus round; the pre-prepare message includes the consensus view number corresponding to the second consensus round, the number of the block corresponding to the second consensus round, the block digest information, the competition window parameters, the key signature information, and the block content.

[0052] In this step, the competition window parameter includes the number of competition windows.

[0053] In this embodiment, the master node can be set according to user needs. For example, the master node for the current consensus round can be determined by view rotation.

[0054] In this embodiment, the IEEE 802.11 protocol is deployed in the wireless blockchain network, and nodes are configured to communicate using broadcast; wherein each node sets up a counter array for each block. This is used to calculate the redundancy of consensus information received from all nodes.

[0055] In this embodiment, if the block corresponding to the first consensus round is the first block to execute the consensus process, the contention window parameter in the pre-prepare message of the block corresponding to the first consensus round can be set according to user requirements, and other information is determined by the attributes of the current consensus round and the current block. If the block corresponding to the first consensus round is not the first block to execute the consensus process, the contention window parameter in the block corresponding to the first consensus round and the message forwarding probability of the current block can be determined by the contention window parameter of the block corresponding to the previous consensus round and the redundant data statistically obtained from the counter array of the corresponding block. Based on this, the contention window parameter and message forwarding probability of the block corresponding to the second consensus round can be determined by the contention window parameter of the block corresponding to the first consensus round and the redundant data statistically obtained from the counter array.

[0056] In this embodiment, when entering the consensus process, the initialization parameters of the wireless blockchain network are first set, including the number of nodes. Transmit power, initial forwarding probability Forwarding probability adjustment step size and redundancy threshold The aforementioned competitive window information is incorporated into the consensus process, and message credibility is guaranteed through digital signatures.

[0057] In this embodiment, the pre-prepare message can be formatted as follows:

[0058] ;

[0059] in, Assign a consensus view number, For block number, This is the summary information for the block. This represents the size of the contention window. This indicates that the master node key is used for signing. This refers to the content of the block.

[0060] In this embodiment, during the pre-prepare stage, the master node packages transactions to form a block corresponding to the second consensus round. The contention window size required for this second consensus round block is set. After signing with its own key, a pre-prepare message is generated and broadcast to other replica nodes. After receiving the block message, the node verifies the legality of the message (including the legality of the signature and the legality of the transaction) and sets the contention window CW in the pre-prepare to the corresponding value in the message.

[0061] In this embodiment, the competition window of the block corresponding to the second consensus round can be the competition window of the block corresponding to the first consensus round adjusted according to the established rules. In this way, the master node of the next block stage adjusts the size of the competition window used for the next stage of consensus according to its own consensus situation, ensuring that the current competition window of different blocks is sufficient to complete the consensus task, thereby adapting to the dynamic characteristics of the nodes and improving consensus efficiency.

[0062] In this embodiment, the forwarding probability of messages in the block corresponding to the second consensus round can also be adjusted based on the redundant data counted by the counter array of the block corresponding to the first consensus round. For example, if there is a lot of redundant data counted by the counter array of the block corresponding to the first consensus round, the forwarding probability is reduced; if there is little redundant data, the forwarding probability is increased, thereby improving the channel resource utilization and reducing resource waste.

[0063] Step 120: If the prepare message is broadcast and verified sequentially through the prepare and commit phases of the consensus process, the honest node is determined to have successfully reached consensus in the second consensus round, and the corresponding block of the second consensus round is uploaded to the wireless blockchain network. The honest node belongs to all nodes.

[0064] In this step, the honest node is a non-Byzantine node in the PBFT algorithm.

[0065] In this embodiment, during the prepare phase of the consensus process in the wireless blockchain network, after other replica nodes of the block corresponding to the second consensus round receive the pre-prepare message sent by the master node, they verify the signature and check the request. If the verification is successful, the prepare message is broadcast to other nodes. After receiving the prepare message sent by other nodes, honest nodes verify the signature and check whether the master node, sequence number, and digest in the prepare message are consistent. If they are consistent, the node enters the commit phase. In the commit phase, the commit message is broadcast to other nodes, and commit messages sent by other replica nodes are received. After receiving commit messages (including its own) from different nodes, the node verifies the signature and checks the commit message. If the check is successful, the node submits the client request corresponding to the message containing its own message.

[0066] It should be noted that there are multiple honest nodes. A node in the current stage can only move to the next stage after a certain number of messages have been successfully verified.

[0067] In this embodiment, after receiving the prepare message, the method further includes: if the prepare message fails to be broadcast and verified in either the prepare phase or the commit phase of the consensus process, determining that the honest node failed to achieve consensus in the second consensus round.

[0068] The consensus method for wireless blockchain networks provided in this invention updates the competition window parameters of the block corresponding to the second consensus round based on the competition window parameters of the block corresponding to the first consensus round during the pre-prepare phase of the consensus process. It also adjusts the forwarding probability of all nodes broadcasting pre-prepare messages for the block corresponding to the second consensus round based on redundant data collected from the counter array of the block corresponding to the first consensus round, thus obtaining a prepare message. Once the prepare message has been broadcast and verified sequentially through the prepare and commit phases of the consensus process, it is determined that the consensus of honest nodes has succeeded, and the block corresponding to the second consensus round is uploaded to the wireless blockchain network. This invention's PBFT consensus process automatically adjusts the competition window and forwarding probability in the network each time a new block is generated, effectively balancing network load, ensuring wireless PBFT consensus while maintaining channel resource utilization, and improving network operating efficiency.

[0069] In some embodiments, the block corresponding to the first consensus round includes a block where the master node consensus is successful or a block where the master node consensus fails. Updating the competition window parameters of the block corresponding to the second consensus round according to the competition window corresponding to the block corresponding to the first consensus round includes: if the block corresponding to the first consensus round is a block where the master node consensus is successful, reducing the size of the competition window corresponding to the block corresponding to the first consensus round by a first ratio to obtain the competition window of the block corresponding to the second consensus round; if the block corresponding to the first consensus round is a block where the master node consensus fails, expanding the size of the competition window corresponding to the block corresponding to the first consensus round by a second ratio to obtain the competition window of the block corresponding to the second consensus round.

[0070] In this embodiment, if the master node consensus of the block corresponding to the first consensus round is successful (commit phase completed), it is considered that the wireless environment is stable and the current contention window is sufficient to complete the consensus task. In this case, the contention window of the block corresponding to the second consensus round is reduced by a certain proportion to improve consensus efficiency. If the master node consensus fails, it is considered that message collisions in the channel are serious and the current contention window is insufficient to complete the consensus task. In this case, the contention window of the block corresponding to the second consensus round is increased by a certain proportion.

[0071] Specifically, the competition window corresponding to the block of the first consensus round is reduced according to the first ratio to obtain the competition window for the block corresponding to the second consensus round, which includes:

[0072] ;

[0073] in, This refers to the competition window size for the block corresponding to the second consensus round. This is the minimum value among the competing window sizes of each block. M The value is a positive integer; the competition window corresponding to the block of the first consensus round is expanded according to the second ratio to obtain the competition window corresponding to the block of the second consensus round, which includes:

[0074] ;

[0075] in, This refers to the competition window size for the block corresponding to the second consensus round. This represents the maximum value among the competing window sizes of each block. It is a positive integer.

[0076] In this embodiment, under the IEEE 802.11 protocol The value is 1024. The master node packages transactions into blocks, signs them using the key, broadcasts the blocks to the CW, and begins the next stage of consensus.

[0077] The consensus method for a wireless blockchain network provided in this invention reduces the size of the competition window corresponding to the block in the first consensus round by a first ratio when the block in the first consensus round is a block in which the master node has successfully reached consensus; and expands the size of the competition window corresponding to the block in the first consensus round by a second ratio when the block in the first consensus round is a block in which the master node has failed to reach consensus. This ensures that the current competition window of different blocks is sufficient to complete the consensus task, thereby further improving consensus efficiency.

[0078] In some embodiments, adjusting the forwarding probability when the master node broadcasts a pre-prepare message for the block corresponding to the second consensus round based on the redundant data counted by the counter array of the block corresponding to the first consensus round includes: adjusting the forwarding probability according to the following formula when the average value of the redundant data is greater than the redundancy threshold:

[0079] ;

[0080] in, p Forwarding probability, Adjust the step size for probability;

[0081] When the average value of redundant data is less than or equal to the redundancy threshold, the forwarding probability is adjusted according to the following formula:

[0082] .

[0083] In this embodiment, the format of the prepare message is as follows: ,in Number the node itself. This indicates that the node key is used for signing.

[0084] The consensus method for wireless blockchain networks provided in this invention improves the utilization rate of channel resources by increasing the forwarding probability of a node when consensus fails due to insufficient consensus data, and dynamically adjusting the forwarding probability based on the redundancy of the consensus data received by the node when consensus is successful.

[0085] In some embodiments, determining that an honest node has successfully reached consensus in the second consensus round involves the following steps: During the prepare phase of the consensus process in the wireless blockchain network, if the honest node of the block corresponding to the second consensus round receives and verifies a prepare message sent by a first number of replica nodes, a commit message is generated and forwarded using the forwarding probability corresponding to the second consensus round; wherein the first number is determined based on the number of nodes; During the commit phase of the consensus process in the wireless blockchain network, if the honest node of the block corresponding to the second consensus round receives and verifies a commit message sent by a second number of replica nodes, an honest node is determined to have successfully reached consensus in the second consensus round; wherein the second number is greater than the first number.

[0086] In this embodiment, the first quantity can be obtained by the following formula:

[0087] ,in ;

[0088] Where N is the number of nodes. The floor symbol is used for rounding down; the second quantity equals +1.

[0089] In this embodiment, the commit message can be formatted as follows:

[0090] In this embodiment, during the prepare phase, when the node receives... ( After the prepare message for the corresponding block in the second consensus round is sent by one of the other replica nodes and verified, it is probabilistically... Forward the first received prepare message; if the node receives If a node receives a prepare message from a different replica node, the node (including the primary node) enters the commit phase, generating a commit message for broadcast. If a node receives... Once a commit message from different nodes (including the node itself) for the block corresponding to the second consensus round is received and verified, the block consensus is considered successful, and the node will put the block corresponding to the second consensus round on the chain.

[0091] The consensus method for a wireless blockchain network provided in this invention, during the prepare phase of the consensus process in the wireless blockchain network, generates a commit message when the honest node of the block corresponding to the second consensus round receives and verifies the prepare message sent by the first number of replica nodes. The commit message is then forwarded using the forwarding probability corresponding to the second consensus round. During the commit phase of the consensus process in the wireless blockchain network, if the honest node of the block corresponding to the second consensus round receives and verifies the commit message sent by the second number of replica nodes, the consensus of the honest node is determined to be successful. This forms a closed loop in the consensus process of each block in the wireless blockchain network and ensures that the block corresponding to the node with successful consensus can be uploaded to the blockchain, thereby improving the security of the block upload.

[0092] Figure 2 This is the second flowchart illustrating the consensus method for a wireless blockchain network provided by this invention. Figure 2 In the illustrated embodiment, during the pre-prepare phase, network initialization parameters are first set, and the master node broadcasts a pre-prepare message. Nodes set the contention window for their current block based on the contention window of the previous block, and adjust the message forwarding probability of their current block based on the redundant data counted by the counter array of the previous block, in order to generate the corresponding prepare message. When other nodes verify the prepare message, The prepare message is forwarded to the replica nodes, which then broadcast the prepare message. During the prepare phase, if the current node receives 2f prepare messages, each node enters the commit phase, generates a commit message, and broadcasts it to all nodes. During the commit phase, if the current node receives 2f+1 commit messages, it determines that the current block consensus is successful and adds the current block to the chain. Then, it checks whether there is a next block to execute the consensus process. If there is, it adjusts the contention window corresponding to the master node and uses the adjusted contention window as the contention window in the pre-prepare message of the next block. If the prepare message fails to pass the broadcast and verification of either the prepare phase or the commit phase of the consensus process, it is determined that the master node consensus for the block corresponding to the second consensus round has failed.

[0093] The consensus device for the wireless blockchain network provided by the present invention will be described below. The consensus device for the wireless blockchain network described below can be referred to in correspondence with the consensus method for the wireless blockchain network described above.

[0094] Figure 3 This is a schematic diagram of the consensus device of the wireless blockchain network provided by the present invention, as shown below. Figure 3 As shown, the consensus device of the wireless blockchain network includes: a configuration module 310 and a consensus module 320.

[0095] Configuration module 310 is used to update the competition window parameters of the block corresponding to the second consensus round according to the competition window parameters of the block corresponding to the first consensus round during the pre-prepare phase of the consensus process in the wireless blockchain network, and to adjust the forwarding probability of the pre-prepare message broadcast by all nodes of the block corresponding to the second consensus round according to the redundancy data counted by the counter array of the block corresponding to the first consensus round, thereby obtaining the prepare message; wherein, the block corresponding to the first consensus round executes the consensus process before the block corresponding to the second consensus round; the pre-prepare message includes the consensus view number corresponding to the second consensus round, the number of the block corresponding to the second consensus round, the block digest information, the competition window parameters, the key signature information, and the block content; the wireless blockchain network includes one master node and multiple replica nodes, and the nodes communicate with each other using broadcast, and different nodes set counter arrays for different blocks in the wireless blockchain network, and the counter arrays are used to count the redundancy between the consensus information of all nodes;

[0096] Consensus module 320 is used to determine that honest nodes have successfully reached consensus in the second consensus round when the prepare message is broadcast and verified in the prepare and commit phases of the consensus process, and to put the corresponding block of the second consensus round on the wireless blockchain network. Honest nodes belong to all nodes.

[0097] The consensus device for the wireless blockchain network provided in this invention updates the competition window parameters of the block corresponding to the second consensus round based on the competition window parameters of the block corresponding to the first consensus round during the pre-prepare stage of the consensus process. It also adjusts the forwarding probability of all nodes broadcasting the pre-prepare message for the block corresponding to the second consensus round based on redundant data collected from the counter array of the block corresponding to the first consensus round, thus obtaining the prepare message. Once the prepare message has been broadcast and verified sequentially through the prepare and commit stages of the consensus process, it is determined that the master node consensus of the block corresponding to the second consensus round has been successful, and the block corresponding to the second consensus round is uploaded to the wireless blockchain network. The PBFT consensus process of this invention automatically adjusts the size of the competition window and forwarding probability in the network each time a new block is generated, effectively balancing the network load, ensuring wireless PBFT consensus while maintaining channel resource utilization, and improving network operating efficiency.

[0098] Figure 4 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 4As shown, the electronic device may include: a processor 410, a communications interface 420, a memory 430, and a communication bus 440. The processor 410, communications interface 420, and memory 430 communicate with each other via the communication bus 440. The processor 410 can call logical instructions in the memory 430 to execute a consensus method for a wireless blockchain network. This method is applied to the wireless blockchain network, which includes a master node and multiple replica nodes. Nodes communicate using broadcast. Different nodes set counter arrays for different blocks in the wireless blockchain network. These counter arrays are used to calculate the redundancy between the consensus information of all nodes. This includes: in the pre-prepare phase of the consensus process in the wireless blockchain network, updating the competition window parameters of the block corresponding to the second consensus round based on the competition window parameters of the block corresponding to the first consensus round, and adjusting the second consensus round based on the redundancy data calculated by the counter array of the block corresponding to the first consensus round. All nodes in the corresponding block broadcast the forwarding probability of the pre-prepare message to obtain the prepare message; the consensus process for the block corresponding to the first consensus round is executed before that for the block corresponding to the second consensus round; the pre-prepare message includes the consensus view number corresponding to the second consensus round, the number of the block corresponding to the second consensus round, the block digest information, the contention window parameters, the key signature information, and the block content; if the prepare message is broadcast and verified sequentially through the prepare and commit phases of the consensus process, it is determined that the honest node has successfully reached consensus in the second consensus round, and the block corresponding to the second consensus round is uploaded to the wireless blockchain network. The honest node belongs to all nodes.

[0099] Furthermore, the logical instructions in the aforementioned memory 430 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0100] On the other hand, the present invention also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the consensus method for a wireless blockchain network provided by the above-described methods. This method is applied to a wireless blockchain network, which includes a master node and multiple replica nodes. The nodes communicate with each other using broadcast. Different nodes are used to set counter arrays for different blocks in the wireless blockchain network. The counter arrays count the redundancy between the consensus information corresponding to all nodes. This includes: in the pre-prepare stage of the consensus process in the wireless blockchain network, updating the competition window parameters of the block corresponding to the second consensus round according to the competition window parameters of the block corresponding to the first consensus round, and... Based on the redundant data counted by the counter array of the block corresponding to the first consensus round, the forwarding probability of the pre-prepare message broadcast by all nodes for the block corresponding to the second consensus round is adjusted to obtain the prepare message. The block corresponding to the first consensus round executes the consensus process before the block corresponding to the second consensus round. The pre-prepare message includes the consensus view number corresponding to the second consensus round, the number of the block corresponding to the second consensus round, the block's digest information, the contention window parameters, the key signature information, and the block content. If the prepare message is broadcast and verified sequentially through the prepare and commit phases of the consensus process, it is determined that an honest node has successfully reached consensus in the second consensus round, and the block corresponding to the second consensus round is uploaded to the wireless blockchain network. Honest nodes belong to all nodes.

[0101] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon. When executed by a processor, the computer program implements a consensus method for a wireless blockchain network provided by the methods described above. This method is applied to a wireless blockchain network, which includes a master node and multiple replica nodes. The nodes communicate with each other using broadcast. Different nodes set up counter arrays for different blocks in the wireless blockchain network. The counter arrays are used to count the redundancy between the consensus information corresponding to all nodes. The method includes: in the pre-prepare stage of the consensus process in the wireless blockchain network, updating the competition window parameters of the block corresponding to the second consensus round according to the competition window parameters of the block corresponding to the first consensus round, and updating the competition window parameters of the block corresponding to the first consensus round according to the competition window parameters of the block corresponding to the first consensus round. The redundant data counted by the counter array is used to adjust the forwarding probability of the pre-prepare message broadcast by all nodes for the block corresponding to the second consensus round, thus obtaining the prepare message. The block corresponding to the first consensus round executes the consensus process before the block corresponding to the second consensus round. The pre-prepare message includes the consensus view number corresponding to the second consensus round, the block number corresponding to the second consensus round, the block's digest information, the contention window parameters, the key signature information, and the block content. If the prepare message is broadcast and verified sequentially through the prepare and commit phases of the consensus process, it is determined that the honest node has successfully reached consensus in the second consensus round, and the block corresponding to the second consensus round is uploaded to the wireless blockchain network. The honest node belongs to all nodes.

[0102] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0103] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0104] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A consensus method for a wireless blockchain network, characterized in that, The method is applied to a wireless blockchain network, which includes a master node and multiple replica nodes. The nodes communicate using broadcasting. Different nodes set up counter arrays for different blocks in the wireless blockchain network. These counter arrays are used to calculate the redundancy between the consensus information of all nodes. In the pre-prepare phase of the consensus process executed in the wireless blockchain network, the competition window parameters of the block corresponding to the second consensus round are updated according to the competition window parameters of the block corresponding to the first consensus round. Furthermore, the forwarding probability of the pre-prepare message broadcast by all nodes in the block corresponding to the second consensus round is adjusted based on the redundant data collected from the counter array of the block corresponding to the first consensus round, thus obtaining a prepare message. The block corresponding to the first consensus round executes the consensus process before the block corresponding to the second consensus round. The pre-prepare message includes the consensus view number corresponding to the second consensus round, the number of the block corresponding to the second consensus round, the block's digest information, the competition window parameters, the key signature information, and the block content. If the prepare message is broadcast and verified sequentially through the prepare and commit phases of the consensus process, it is determined that the honest node has successfully reached consensus in the second consensus round, and the block corresponding to the second consensus round is uploaded to the wireless blockchain network. The honest node belongs to all nodes.

2. The consensus method for a wireless blockchain network according to claim 1, characterized in that, The blocks corresponding to the first consensus round include blocks where the master node consensus is successful or blocks where the master node consensus fails; The step of updating the competition window parameters of the block corresponding to the second consensus round based on the competition window parameters of the block corresponding to the first consensus round includes: In the case where the block corresponding to the first consensus round is a block in which the master node has achieved consensus, the size of the competition window corresponding to the block in the first consensus round is reduced by a first ratio to obtain the competition window of the block corresponding to the second consensus round. In the case where the block corresponding to the first consensus round is a block in which the master node consensus fails, the size of the competition window corresponding to the block corresponding to the first consensus round is expanded according to the second ratio to obtain the competition window corresponding to the block corresponding to the second consensus round.

3. The consensus method for a wireless blockchain network according to claim 2, characterized in that, The step of reducing the size of the competition window corresponding to the block of the first consensus round according to a first ratio to obtain the competition window for the block corresponding to the second consensus round includes: ; in, This represents the competition window size for the block corresponding to the second consensus round. This is the minimum value among the competing window sizes of each block. M It is a positive integer; The step of enlarging the competition window size corresponding to the block corresponding to the first consensus round according to a second ratio to obtain the competition window for the block corresponding to the second consensus round includes: ; in, This represents the competition window size for the block corresponding to the second consensus round. This represents the maximum value among the competing window sizes of each block. Is a positive integer.

4. The consensus method for a wireless blockchain network according to claim 1, characterized in that, The step of adjusting the forwarding probability when all nodes broadcast the pre-prepare message for the second consensus round based on the redundant data counted by the counter array of the block corresponding to the first consensus round includes: If the average value of the redundant data is greater than the redundancy threshold, the forwarding probability is adjusted according to the following formula: ; in, p The forwarding probability is... Adjust the step size for probability; If the average value of the redundant data is less than or equal to the redundancy threshold, the forwarding probability is adjusted according to the following formula: 。 5. The consensus method for a wireless blockchain network according to claim 1, characterized in that, Determining that an honest node has successfully achieved consensus in the second consensus round, assuming the prepare message has been broadcast and verified sequentially through the prepare and commit phases of the consensus process, includes: During the prepare phase of the consensus process executed in the wireless blockchain network, and when the honest node of the block corresponding to the second consensus round receives and verifies the prepare message sent by the first number of replica nodes, a commit message is generated and forwarded according to the forwarding probability corresponding to the second consensus round; wherein, the first number is determined based on the number of multiple nodes; During the commit phase of the consensus process executed on the wireless blockchain network, and if the honest node of the block corresponding to the second consensus round receives and verifies the commit message sent by the second number of replica nodes, it is determined that the honest node has successfully reached consensus in the second consensus round; wherein the second number is greater than the first number.

6. The consensus method for a wireless blockchain network according to claim 1, characterized in that, After receiving the prepare message, the method further includes: If the prepare message fails to be broadcast and verified in either the prepare or commit phase of the consensus process, the master node consensus for the block corresponding to the second consensus round is determined to have failed.

7. A consensus device for a wireless blockchain network, characterized in that, include: The configuration module is used to update the competition window parameters of the block corresponding to the second consensus round according to the competition window parameters of the block corresponding to the first consensus round during the pre-prepare phase of the consensus process in the wireless blockchain network, and adjust the forwarding probability of all nodes broadcasting the pre-prepare message in the block corresponding to the second consensus round according to the redundant data counted by the counter array of the block corresponding to the first consensus round, so as to obtain the prepare message. The consensus process is executed before that of the block corresponding to the first consensus round; the pre-prepare message includes the consensus view number corresponding to the second consensus round, the number of the block corresponding to the second consensus round, the block summary information, the contention window parameter, the key signature information, and the block content; the wireless blockchain network includes one master node and multiple replica nodes, which communicate with each other using broadcast, and different nodes set up counter arrays for different blocks in the wireless blockchain network, which are used to count the redundancy between the consensus information of all nodes; The consensus module is used to determine that an honest node has successfully reached consensus in the second consensus round when the prepare message is broadcast and verified sequentially through the prepare and commit phases of the consensus process, and to upload the block corresponding to the second consensus round to the wireless blockchain network. The honest node belongs to all nodes.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the consensus method of the wireless blockchain network as described in any one of claims 1 to 6.

9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the consensus method of the wireless blockchain network as described in any one of claims 1 to 6.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the consensus method of the wireless blockchain network as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Block chain consensus method

    CN115278604A

  • Double auction method for wireless block chain transaction forwarding and verification in complex network

    CN117217879A