Consensus method suitable for wireless block chain network
Technical Field
The invention belongs to the technical field of distributed networks, and particularly relates to a consensus method applicable to a wireless block chain network.
Background
Since the birth of the 2008 bottom bitcoin, cryptocurrency and related blockchain techniques have attracted increasing interest in academia and industry. As the underlying technology behind bitcoin, a blockchain is essentially a distributed database system that tracks all transactions that occur in the network and replicates at each participating complete node in the blockchain network. The core technology of the blockchain is a distributed consensus protocol.
Although the block chain is widely applied in the fields of finance, logistics and the like, the application of the block chain in the field of mobile service is quite limited. This is because two major challenges need to be addressed in a wireless network environment, one being that solving the workload justification problem in a wireless blockchain network requires the mobile device to have high computing power, which is relatively difficult for lightweight mobile devices; secondly, in a wireless network environment, the success rate of information transmission between nodes cannot be determined and the channel cannot be kept stable for a long time, so that the realization of consensus in a blockchain network becomes more difficult.
At present, under the drive of the development of the internet of things, the block chain technology has a considerable application prospect in the field of mobile services, such as smart homes, smart agriculture, automobile communication and the like. Most of the existing research is to solve how to implement or replace the workload proof calculation on the mobile device, and there are few methods to design the consensus protocol of the wireless block-chain network from the wireless network characteristics.
The consensus problem is the core problem of the blockchain technology, and no method for achieving consensus of nodes under the conditions that the transmission information between the miner nodes in the wireless blockchain network is uncertain and the channel is unstable exists in the prior art.
Disclosure of Invention
In order to solve the above technical problems, the present invention provides a consensus method suitable for use in a wireless block chain network, which utilizes the characteristics and technologies of the bottom layer of a wireless channel to achieve consensus and avoids the bifurcation problem in the block chain network to a certain extent.
In order to achieve the purpose, the technical scheme of the invention is as follows:
a consensus method applicable in a wireless block chain network, comprising the steps of:
(1) a leader election stage: the workload of a miner node is used for proving calculation competition and carrying out physical carrier sensing on a channel, and only one leader miner node in a wireless block chain network is selected through an O (log) round;
(2) a block proposing stage: generating and broadcasting a new block by a leader miner node generated in the election stage;
(3) a block verification stage: other miners verify the new block and feed back the verification result to the leader miner node;
(4) block chain updating stage: and the leader miner node determines whether to update the local block chain according to the verification information of other nodes, and informs other miner nodes to finish updating of the corresponding block chain, so as to achieve consensus.
In the above scheme, the step (1) is specifically as follows:
(1.1) initializing State values State of all miners nodes in the wireless block chain network to mining, namely starting workload certification calculation and being in a channel monitoring State;
(1.2) after t rounds, after a part of miner nodes calculate to obtain a solution of a Hash puzzle for the first time, the State values State of the miner nodes are set as candidate, and the candidate miner nodes can send 1-bit non-coding information M according to a random probability p;
(1.3) the node with the State value of minus and other candidate miners nodes which do not send information are in the channel State of interception, if the node in the channel is intercepted to transmit information, the State value State of the node is set as silent, and the State value of the node cannot be changed in the subsequent rounds until the node is reinitialized;
and (1.4) after the O (log) round, the method can ensure that the state value of only one node in all the miner nodes in the network is leader with high probability.
In a further technical scheme, the step (2) is specifically as follows:
(2.1) the leader miner node in the network packs the generated new block B and the position information D thereof and broadcasts the new block B and the position information D to the whole wireless block chain network;
(2.2) the silent miner node in the network receives the position information D of the new block B and the leader node, and verifies the transaction information and the solution of the Hash puzzle in the new block B;
(2.3) if the new block B is verified to be valid, the silent miner node sets the verification value C to 0, and if the new block B is not verified, C is set to 1.
In a further technical scheme, the step (3) is specifically as follows:
(3.1) all silent mineworker nodes in the network will simultaneously have power P ═ k × d (u, v)αSending information M, wherein d (u, v) is the distance from each point to a leader node, k is a constant, the information can be ensured to be detected by the leader node after all the silent miner nodes in the network send messages by power P, the detected signal power value P is attenuated to k, α is a path attenuation index in a wireless network signal-to-noise ratio model, and the miner node with the status value of leader detects the total signal power value of a channel to be S1Then the total number n of the miner nodes in the network can be calculated through a signal-to-noise ratio model1;
(3.2) all silent miners nodes in the network with a verification value C of 1 will again have power P ═ k × d (u, v)αSending 1bit non-coding information M; the leader miner node monitors the total signal power value of the channel as S2Then, the number n of nodes with invalid verification result of the new block B by the miner node in the network can be obtained through calculation2;
(3.3) leader miners node will be according to n2/n1Is compared to a preset threshold η, e.g., n2/n1If the value is less than η, the verification parameter C of the leader node is 0, otherwise, the value is 1.
In a further technical scheme, the step (4) is specifically as follows:
(4.1) if the verification parameter C value of the leader miner node in the network is 0, writing the generated new block B into a local block chain of the leader node and sending 1bit of non-coding information M;
(4.2) if the silent miner node in the network monitors that the node in the channel transmits information, writing the generated new block B into the local block chain of the node, otherwise, discarding the block;
(4.3) all nodes in the network reset their State value State, verification parameter C and running round counter to initial values.
Through the technical scheme, compared with the prior art, the consensus method applicable to the wireless block chain network provided by the invention has the following technical characteristics and effects:
(1) the invention considers the uncertainty of information transmission between nodes and the instability of the channel in the wireless block chain network, namely the information transmission is not always successful every time, and the channel can not ensure that the information can be transmitted efficiently for a long time. The physical bearer interception technology of a Medium Access Control (MAC) layer in the IEEE 802.11 standard is used, and some transmission rules are set, so that the common recognition of all miners in the network at the optimal round number can be realized.
(2) The invention ensures the uniqueness of the account book in the wireless block chain network by the election of the unique leader miner node, thereby avoiding the branching of the link, being very beneficial to expanding to the actual wireless block chain network, saving the computing resource and accelerating the accounting speed.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below.
Fig. 1 is a schematic diagram of a phase of a consensus method applicable in a wireless block chain network according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of a consensus method applied in a wireless block chain network according to an embodiment of the present invention.
Detailed Description
The technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention.
The invention provides a consensus method suitable for a wireless block chain network, which can achieve consensus of all nodes in the whole block chain network in the optimal round number by methods of workload certification calculation, physical carrier sensing, node transmission rule setting and the like under the conditions that the information transmitted between the mining nodes in the wireless block chain network is uncertain and the channel is unstable, as shown in figure 1. The technology solves the problem of node consensus in a wireless block chain network, and avoids the problem of bifurcation in the block chain network to a certain extent.
As shown in fig. 2, the specific embodiment is as follows:
a consensus method applicable in a wireless block chain network, comprising the steps of:
(1) a leader election stage:
(1.1) initializing State values State of all miners nodes in the wireless block chain network to mining, namely starting workload certification calculation and being in a channel monitoring State;
(1.2) after t rounds, after a part of miner nodes calculate to obtain a solution of a Hash puzzle for the first time, the State values State of the miner nodes are set as candidate, and the candidate miner nodes can send 1-bit non-coding information M according to a random probability p;
(1.3) the node with the State value of minus and other candidate miners nodes which do not send information are in the channel State of interception, if the node in the channel is intercepted to transmit information, the State value State of the node is set as silent, and the State value of the node cannot be changed in the subsequent rounds until the node is reinitialized;
and (1.4) after the O (log) round, the method can ensure that the state value of only one node in all the miner nodes in the network is leader with high probability.
(2) A block proposing stage:
(2.1) the leader miner node in the network packs the generated new block B and the position information D thereof and broadcasts the new block B and the position information D to the whole wireless block chain network;
(2.2) the silent miner node in the network receives the position information D of the new block B and the leader node, and verifies the information such as the transaction information, the solution of the Hash puzzle and the like in the new block B;
(2.3) if the new block B is verified to be valid, the silent miner node sets the verification value C to 0, and if the new block B is not verified, C is set to 1.
A block verification stage:
(3.1) all silent mineworker nodes in the network will simultaneously have power P ═ k × d (u, v)αSending information M, wherein d (u, v) is the distance from each point to a leader node, k is a constant large enough to ensure that the information can be listened by the leader node after all the silent miner nodes in the network send the information with power P, the intercepted signal power value P is attenuated to k, α is a path attenuation index in a wireless network signal-to-noise ratio model, and the miner node with the leader intercepts the total signal power value of a channel to be S1Then the total number n of the miner nodes in the network can be calculated through a signal-to-noise ratio model1;
(3.2) all silent miners nodes in the network with a verification value C of 1 will again have power P ═ k × d (u, v)αSending 1bit non-coding information M; the leader miner node monitors the total signal power value of the channel as S2Then, the number n of nodes with invalid verification result of the new block B by the miner node in the network can be obtained through calculation2;
(3.3) leader miners node will be according to n2/n1Is compared to a preset threshold η, e.g., n2/n1If the value is less than η, the verification parameter C of the leader node is 0, otherwise, the value is 1.
(4) Block chain updating stage:
(4.1) if the verification parameter C value of the leader miner node in the network is 0, writing the generated new block B into a local block chain of the leader node and sending 1bit of non-coding information M;
(4.2) if the silent miner node in the network monitors that the node in the channel transmits information, writing the generated new block B into the local block chain of the node, otherwise, discarding the block;
(4.3) all nodes in the network reset their State value State, verification parameter C and running round counter to initial values.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.