Invention content
The purpose of the disclosure is in view of the deficiencies of the prior art, to provide a kind of wireless sensor network based on block chain technologyNetwork method for routing makes each block of selected leader cluster node dispersion in a network using block chain technology decentralization so thatThere are leader cluster node, the energy of load balancing leader cluster node consumption around all nodes at any time.
To achieve the goals above, the disclosure proposes a kind of wireless sensor network routing side based on block chain technologyMethod specifically includes following steps:
Step 1, wireless sensor network is disposed, with LEACH algorithms by Wireless sensor network clustering;
Step 2, block catenary system is disposed on aggregation node, the leader cluster node of each sub-clustering corresponds to a distributed account book,In, record multiple blocks for representing sub-clustering in each distribution account book;
Step 3, the leader cluster node of each block broadcasts ID number and dump energy information in the whole network;
Step 4, ID number, relative position information and the dump energy information of leader cluster node are obtained and by relative position apart from descendingIt is recorded in each distributed account book;
Step 5, successively to the leader cluster node in each distributed account book send out proof of work ask and receive proof of work withDump energy information;
Step 6, each distributed account book should to know together mechanism verification with dump energy information according to the proof of work of leader cluster nodeWhether leader cluster node is in available mode;
Step 7, which synchronous recording and is executed in each distributed account book by the leader cluster node of the available mode of proofThe selected operation of node, and the distributed account book of more new block;
Step 8, operation greedy algorithm the leader cluster node structure routed path in account book and creates road with routed path in a distributed mannerBy table;
Step 9, each distributed account book synchronizes the leader cluster node delete operation for executing the leader cluster node less than energy threshold, and executesLeader cluster node update operation.
Further, in step 1, the mode of the deployment wireless sensor network is random placement, described with LEACHThe method of network cluster dividing is the random random number generated between one 0,1 of sensor node by algorithm, and is done with threshold value T (n)Compare, if it is less than the threshold value, then the node will be elected as cluster head,
In formula:P is the percentage that node becomes leader cluster node, and r is when front-wheel number, and G is not to be elected to cluster in nearest 1/P wheelsThe node set of head, mod functions are MOD function, and after leader cluster node is selected, broadcasting oneself becomes the message of cluster head, node according toThe intensity of the message received determines which cluster is added, and informs corresponding cluster head, and that completes cluster establishes process.Then, cluster headNode is the time slot that member distributes transmission data in cluster, there are one the sub-clusterings or multiple cluster heads by the way of TDMA.
Further, in step 2, the block catenary system includes decentralization and goes multiple distributed accounts of trustThis, multiple blocks for representing sub-clustering are recorded in each distribution account book;The block is a kind of to record leader cluster node in each sub-clusteringElection, rotation process data structure, reflect the variation of leader cluster node.Leader cluster node area has been elected in systemBlock has been joined together to form a main chain, and all nodes for participating in calculating all have recorded a part for main chain or main chain, oneBlock includes following three parts:The Hash hash that leader cluster node information, previous block are formed.Leader cluster node information is block instituteThe task data of carrying specifically includes ID number, leader cluster node energy residual value, the workload of the leader cluster node card of leader cluster nodeIt is bright;The Hash hash that previous block is formed is used for connecting block, realizes the sequence of passing leader cluster node election, rotationArrangement;When the dump energy of leader cluster node is less than energy threshold, all the sensors node is according to energy residual in the cluster area of placeValue campaigns for leader cluster node with the relative distance apart from aggregation node, two sensings that energy residual value is most and relative distance is minimumDevice node is elected as new leader cluster node, and two leader cluster nodes in cluster area generate one with the sensor node in other areas Yuan CuA new block, and be broadcast to all leader cluster nodes and be updated, complete leader cluster node election, a rotation.
Further, in step 4, the relative position information gets leader cluster node broadcast according to each distributed account bookThe duration of transmission delay when information obtains.
Further, in steps of 5, the proof of work include consumption sensor node data transmission period withThe energy of sensor consumption, the data are the increment value character string by SHA256 Hash operations.
Further, in step 6, it is described with the mechanism of knowing together verify the leader cluster node whether be in available mode methodTo confirm the leader cluster node by proving and placing it in when the distributed account book total quantity by verifying is more than 3/4thsAvailable mode, the verification method be when the energy expenditure of data transmission period and sensor simultaneously be less than three/ second pass throughVerification, does not otherwise pass through verification.
Further, in step 7, it is as follows to select the step of operation:
Step 7.1, pass through the leader cluster node information for the available mode verified to all distributed account book publications;
Step 7.2, it when 3/4ths or more leader cluster nodes are verified, is handled by common recognition;
Step 7.3, newly selected leader cluster node and additional information are recorded in block chain;
Step 7.4, which is recorded in block chain, which selectes successfully;
The leader cluster node information includes the ID number of leader cluster node, leader cluster node energy residual value, the workload of leader cluster node cardIt is bright.
Further, in step 8, the method for the update routing table is:
Step 8.1, greedy algorithm is run, judges whether routed path arrived aggregation node or local minimum points;
Step 8.2, if arrived aggregation node, termination algorithm;If local minimum points are only reached, in local minimum pointsPlace sends detection packet to leader cluster node in the distributed account book of next-hop to search for transmission by the block border of distributed account bookPath, until jumping out local minimum points;
Step 8.3, after jumping out local minimum points, continue greedy routing method, if encountering local minimum points again, according to stepStep processing in 8.2.
Further, in step 9,
The method of leader cluster node delete operation is that the removal request of leader cluster node is issued to block chain whole node, by blockThe common recognition of chain whole leader cluster node is handled, by the way that leader cluster node removal request is recorded in block chain after common recognition, leader cluster nodeDelete operation terminates, and the common recognition processing passes through common recognition to be verified when 3/4ths or more leader cluster nodes.
Leader cluster node updates the method operated:When the dump energy of leader cluster node is less than energy threshold, place cluster areaInterior all the sensors node campaigns for leader cluster node, energy residual value according to energy residual value and the relative distance apart from aggregation nodeAt most and two sensor nodes of relative distance minimum are elected as new leader cluster node, two leader cluster nodes in cluster area and originalRemaining sensor node in cluster area generates a new block, and is broadcast to all leader cluster nodes and is updated, and completes cluster headNode election, rotation, wherein the energy threshold is the one third of sensor primary power.
The disclosure additionally provides a kind of wireless sensor network route device based on block chain technology, described device packetIt includes:
Sub-clustering unit is disposed, for disposing wireless sensor network, with LEACH algorithms by Wireless sensor network clustering;
Block chain deployment unit, for disposing block catenary system on aggregation node, the leader cluster node of each sub-clustering corresponds to oneDistributed account book, wherein record multiple blocks for representing sub-clustering in each distribution account book;
Cluster head radio unit, the leader cluster node for each block broadcast ID number and dump energy information in the whole network;
Cluster head acquiring unit, ID number, relative position information and dump energy information for obtaining leader cluster node and by opposite positionThat sets is recorded apart from descending in each distributed account book;
Workload request unit is asked and is received for sending out proof of work to the leader cluster node in each distributed account book successivelyProof of work and dump energy information;
Know together authentication unit, for each distributed account book according to the proof of work of leader cluster node with dump energy information to know togetherMechanism verifies whether the leader cluster node is in available mode;
Selected unit, leader cluster node for the available mode by proof synchronous recording and execute in each distributed account bookThe selected operation of the leader cluster node, and the distributed account book of more new block;
Establishing route unit, for running leader cluster node structure routed path of the greedy algorithm in a distributed manner in account book and with routingRouting update routing table;
Updating unit synchronizes execution for each distributed account book and deletes behaviour less than the leader cluster node of the leader cluster node of energy thresholdMake, and executes leader cluster node update operation.
The disclosure has the beneficial effect that:The disclosure uses block chain technology decentralization, is avoided in terms of repeatedly by common recognition mechanismIt calculates, reduces the traffic and communication distance, make each block of selected leader cluster node dispersion in a network so that all nodesAround have leader cluster node at any time, the energy of load balancing leader cluster node consumption can effectively extend wireless sensor networkThe service life of network improves efficiency of transmission, greatly reduced the load of routing table, simplify routing table, routing of the inventionMethod advantage is that replacing cluster head only needs to carry out in subrange with greedy algorithm, as where leader cluster node to be replacedBlock voluntarily initiates update operation, is reconfigured without whole so that replacement cost is smaller, and the energy consumption of cluster interior nodes is more equalWeighing apparatus.
Specific implementation mode
The technique effect of the design of the disclosure, concrete structure and generation is carried out below with reference to embodiment and attached drawing clearChu, complete description, to be completely understood by the purpose, scheme and effect of the disclosure.It should be noted that the case where not conflictingUnder, the features in the embodiments and the embodiments of the present application can be combined with each other.The identical attached drawing mark used everywhere in attached drawingNote indicates same or analogous part.
As shown in Figure 1 for according to a kind of stream of wireless sensor network routing method based on block chain technology of the disclosureCheng Tu illustrates the wireless sensor network road based on block chain technology according to embodiment of the present disclosure with reference to Fig. 1By method.
The disclosure proposes a kind of wireless sensor network routing method based on block chain technology, specifically includes following stepSuddenly:
Step 1, wireless sensor network is disposed, with LEACH algorithms by Wireless sensor network clustering;
Step 2, block catenary system is disposed on aggregation node, the leader cluster node of each sub-clustering corresponds to a distributed account book,In, record multiple blocks for representing sub-clustering in each distribution account book;
Step 3, the leader cluster node of each block broadcasts ID number and dump energy information in the whole network;
Step 4, ID number, relative position information and the dump energy information of leader cluster node are obtained and by relative position apart from descendingIt is recorded in each distributed account book;
Step 5, successively to the leader cluster node in each distributed account book send out proof of work ask and receive proof of work withDump energy information;
Step 6, each distributed account book should to know together mechanism verification with dump energy information according to the proof of work of leader cluster nodeWhether leader cluster node is in available mode;
Step 7, which synchronous recording and is executed in each distributed account book by the leader cluster node of the available mode of proofThe selected operation of node, and the distributed account book of more new block;
Step 8, operation greedy algorithm the leader cluster node structure routed path in account book and creates road with routed path in a distributed mannerBy table, leader cluster node starts transmission data;
Step 9, each distributed account book synchronizes the leader cluster node delete operation for executing the leader cluster node less than energy threshold, and executesLeader cluster node update operation.
Further, in step 1, the mode of the deployment wireless sensor network is random placement, described with LEACHThe method of network cluster dividing is the random random number generated between one 0,1 of sensor node by algorithm, and is done with threshold value T (n)Compare, if it is less than the threshold value, then the node will be elected as cluster head,
In formula:P is the percentage that node becomes leader cluster node, and r is when front-wheel number, and G is not to be elected to cluster head in nearest 1/P wheelsNode set, mod functions are MOD function, and after leader cluster node is selected, broadcasting oneself becomes the message of cluster head, and node is according to connecingThe intensity of the message received determines which cluster is added, and informs corresponding cluster head, and that completes cluster establishes process.Then, cluster head sectionPoint is the time slot that member distributes transmission data in cluster, there are one the sub-clusterings or multiple cluster heads by the way of TDMA.
Further, in step 2, the block catenary system includes decentralization and goes multiple distributed accounts of trustThis, multiple blocks for representing sub-clustering are recorded in each distribution account book;The block is a kind of to record leader cluster node in each sub-clusteringElection, rotation process data structure, reflect the variation of leader cluster node.Leader cluster node area has been elected in systemBlock has been joined together to form a main chain, and all nodes for participating in calculating all have recorded a part for main chain or main chain, oneBlock includes following three parts:The Hash hash that leader cluster node information, previous block are formed.Leader cluster node information is block instituteThe task data of carrying specifically includes ID number, leader cluster node energy residual value, the workload of the leader cluster node card of leader cluster nodeIt is bright;The Hash hash that previous block is formed is used for connecting block, with all the sensors node in cluster area according to energyRemaining value realizes passing leader cluster node election with the relative distance election contest leader cluster node apart from aggregation node, the sequence of rotation is arrangedRow;When the dump energy of leader cluster node is less than energy threshold, all the sensors node is according to energy residual value in the cluster area of placeWith apart from aggregation node relative distance campaign for leader cluster node, energy residual value at most and relative distance minimum two sensorsNode is elected as new leader cluster node, and two leader cluster nodes in cluster area generate one with the sensor node in other areas Yuan CuNew block, and be broadcast to all leader cluster nodes and be updated, so complete leader cluster node election, a rotation.
Further, in step 4, the relative position information gets leader cluster node broadcast according to each distributed account bookThe duration of transmission delay when information obtains, using the time order and function that receives as according to the length for judging relative distance, specificallyForm for example, the time that the data packet A that leader cluster node A is sent is received is 2018011112230032, what leader cluster node B was sentThe time that data packet B is received is 2018011112230018, then the relative position of data packet B is 2018011112230018,The relative position for being less than data packet A is 2018011112230032.
Further, in steps of 5, the proof of work include consumption sensor node data transmission period withThe energy of sensor consumption, the data are the increment value character string by SHA256 Hash operations, and concrete form is for example, cluster head sectionThe proof of work of point A<125.234S-9.82J>, wherein S is the second, and J is joule, the increment value character of SHA256 Hash operationsString is:8b1bd43dda27f3eb51580d291065d48a368744455bfde181589f0fe175942b06946fb5fdacf8bdd7a8ad7a658cdaee71f196543446cb62596fa4bdb48d19db93。
Further, in step 6, it is described with the mechanism of knowing together verify the leader cluster node whether be in available mode methodTo confirm the leader cluster node by proving and placing it in when the distributed account book total quantity by verifying is more than 3/4thsAvailable mode, the verification method be when the energy expenditure of data transmission period and sensor simultaneously be less than three/ second pass throughVerification, does not otherwise pass through verification.
Further, in step 7, it is as follows to select the step of operation:
Step 7.1, pass through the leader cluster node information for the available mode verified to all distributed account book publications;
Step 7.2, it when 3/4ths or more leader cluster nodes are verified, is handled by common recognition;
Step 7.3, newly selected leader cluster node and additional information are recorded in block chain;
Step 7.4, which is recorded in block chain, which selectes successfully;
The leader cluster node information includes the ID number of leader cluster node, leader cluster node energy residual value, the workload of leader cluster node cardIt is bright.
Further, in step 8, the method for the update routing table is:
Step 8.1, greedy algorithm is run, judges whether routed path arrived aggregation node or local minimum points;
Step 8.2, if arrived aggregation node, termination algorithm;If local minimum points are only reached, in local minimum pointsPlace sends detection packet to leader cluster node in the distributed account book of next-hop to search for transmission by the block border of distributed account bookPath, until jumping out local minimum points;
Step 8.3, after jumping out local minimum points, continue greedy routing method, if encountering local minimum points again, according to stepStep processing in 8.2.
Further, the step of leader cluster node transmission data is:
(1)Leader cluster node forwards data packet, detailed process as follows:
(2)Next-hop cluster head node for data forwarding packet of the leader cluster node into routing table;
(3)Next-hop cluster head node receives data packet, and ACK is replied message with regard to sending;
(4)Leader cluster node can not receive ACK whithin a period of time, then retransmission data packet, until leader cluster node data packet is sent successfully,It receives and replies message;
Further, in step 9,
The method of leader cluster node delete operation is that the removal request of leader cluster node is issued to block chain whole node, by blockThe common recognition of chain whole leader cluster node is handled, by the way that leader cluster node removal request is recorded in block chain after common recognition, leader cluster nodeDelete operation terminates, and the common recognition processing passes through common recognition to be verified when 3/4ths or more leader cluster nodes;
Leader cluster node updates the method operated:When the dump energy of leader cluster node is less than energy threshold, institute in the cluster area of placeThere is sensor node to campaign for leader cluster node according to energy residual value and the relative distance apart from aggregation node, energy residual value is mostIt is elected as new leader cluster node with two sensor nodes of relative distance minimum, two leader cluster nodes in cluster area and the areas Yuan CuRemaining interior sensor node generates a new block, and is broadcast to all leader cluster nodes and is updated, and completes leader cluster nodeElection, rotation, wherein the energy threshold is the one third of sensor primary power.
Embodiment of the disclosure also provides a kind of wireless sensor network route device based on block chain technology, such as Fig. 2Shown, a kind of wireless sensor network route device based on block chain technology of the embodiment includes:Processor, memory withAnd it is stored in the computer program that can be run in the memory and on the processor, such as collator.
Described device includes:It memory, processor and is stored in the memory and can transport on the processorCapable computer program, which is characterized in that the processor executes the computer program and includes with the basic device executed:
Sub-clustering unit is disposed, for disposing wireless sensor network, with LEACH algorithms by Wireless sensor network clustering;
Block chain deployment unit, for disposing block catenary system on aggregation node, the leader cluster node of each sub-clustering corresponds to oneDistributed account book, wherein record multiple blocks for representing sub-clustering in each distribution account book;
Cluster head radio unit, the leader cluster node for each block broadcast ID number and dump energy information in the whole network;
Cluster head acquiring unit, ID number, relative position information and dump energy information for obtaining leader cluster node and by opposite positionThat sets is recorded apart from descending in each distributed account book;
Workload request unit is asked and is received for sending out proof of work to the leader cluster node in each distributed account book successivelyProof of work and dump energy information;
Know together authentication unit, for each distributed account book according to the proof of work of leader cluster node with dump energy information to know togetherMechanism verifies whether the leader cluster node is in available mode;
Selected unit, leader cluster node for the available mode by proof synchronous recording and execute in each distributed account bookThe selected operation of the leader cluster node, and the distributed account book of more new block;
Establishing route unit, for running leader cluster node structure routed path of the greedy algorithm in a distributed manner in account book and with routingRouting update routing table;
Updating unit synchronizes execution for each distributed account book and deletes behaviour less than the leader cluster node of the leader cluster node of energy thresholdMake, and executes leader cluster node update operation.
A kind of wireless sensor network route device based on block chain technology can be desktop PC, notesOriginally, the computing devices such as palm PC and cloud server.A kind of wireless sensor network routing based on block chain technologyDevice may include, but be not limited only to, processor, memory.It will be understood by those skilled in the art that the example is only one kindThe example of wireless sensor network route device based on block chain technology is not constituted to a kind of nothing based on block chain technologyThe restriction of line sensor network route device may include component more more or fewer than example, or the certain components of combination, orThe different component of person, such as a kind of wireless sensor network route device based on block chain technology can also include inputOutput equipment, network access equipment, bus etc..
Alleged processor can be central processing unit (Central Processing Unit, CPU), can also be itHis general processor, digital signal processor (Digital Signal Processor, DSP), application-specific integrated circuit(Application Specific Integrated Circuit, ASIC), ready-made programmable gate array (Field-Programmable Gate Array, FPGA) either other programmable logic device, discrete gate or transistor logic devicePart, discrete hardware components etc..General processor can be microprocessor or the processor can also be any conventional processingDevice etc., the processor are a kind of control centres of wireless sensor network route device based on block chain technology, profitWith various interfaces and a kind of entire various pieces of the wireless sensor network route device based on block chain technology of connection.
The memory can be used for storing the computer program and/or module, and the processor is by running or executingComputer program in the memory and/or module are stored, and calls the data being stored in memory, described in realizationA kind of various functions of the wireless sensor network route device based on block chain technology.The memory can include mainly storageProgram area and storage data field, wherein storing program area can store the application program needed for operating device, at least one function(Such as sound-playing function, image player function etc.)Deng;Storage data field can be stored uses created number according to mobile phoneAccording to(Such as audio data, phone directory etc.)Deng.In addition, memory may include high-speed random access memory, can also includeNonvolatile memory, such as hard disk, memory, plug-in type hard disk, intelligent memory card(Smart Media Card, SMC), peaceIt is digital(Secure Digital, SD)Card, flash card(Flash Card), at least one disk memory, flash memoriesPart or other volatile solid-state parts.
Emulation embodiment:
To have assessed a kind of wireless sensor network routing method and device based on block chain technology proposed by the inventionPerformance, by the method for routing in the present invention compared with traditional method for routing LEACH and HEED is by emulation platform NetTopo,Under 300 × 300 square metres of network topology structure, the node that random distribution is 1000 transmits R=10 meters of radius, Mei GejieThe primary power of point is 15 joules.
Simulation result method for routing of the present invention is compared with LEACH and HEED leader cluster node survival rates, in node survival rate sideThe operation middle and later periods in face, network is all better than other two kinds of algorithms, but is slightly poorer than HEED algorithms early period, and in network communication performance sideFace, prometaphase are superior to other two kinds of algorithms.LEACH and HEED due to the threshold condition of hardness, served as the node of cluster head withoutMethod is chosen as candidate cluster head again, to which candidate range is smaller and smaller so that and what energy was getting faster is depleted, all in all,Inventive can on be superior to two kinds of classic algorithms of LEACH and HEED.
Art technology technical staff should be known that the present invention can be implemented as a kind of system, device, equipment, method orComputer program product.Therefore, the disclosure can be with specific implementation is as follows, i.e.,:Complete hardware, complete software(PacketInclude firmware, resident software, microcode etc.)Or the form that hardware and software combines.
Those of ordinary skill in the art may realize that lists described in conjunction with the examples disclosed in the embodiments of the present disclosureMember and algorithm steps can be realized with the combination of electronic hardware or computer software and electronic hardware.These functions are actuallyIt is implemented in hardware or software, depends on the specific application and design constraint of technical solution.Professional technicianEach specific application can be used different methods to achieve the described function, but this realization is it is not considered that exceedThe scope of the present invention.
It is apparent to those skilled in the art that for convenience and simplicity of description, the system of foregoing description,The specific work process of device and unit, can refer to corresponding processes in the foregoing method embodiment, and details are not described herein.
In several embodiments provided herein, it should be understood that disclosed systems, devices and methods, it can be withIt realizes by another way.For example, the apparatus embodiments described above are merely exemplary, for example, the unitIt divides, only a kind of division of logic function, formula that in actual implementation, there may be another division manner, such as multiple units or componentIt can be combined or can be integrated into another system, or some features can be ignored or not executed.Another point, it is shown orThe mutual coupling that discusses or to be directly harmonious or communicate to connect can be indirect coupling by some interfaces, device or unitIt closes or communicates to connect, can be electrical, machinery or other forms.
The unit illustrated as separating component may or may not be physically separated, aobvious as unitThe component shown may or may not be physical unit, you can be located at a place, or may be distributed over multipleIn network element.Some or all of unit therein can be selected according to the actual needs to realize the mesh of this embodiment scheme's.
In addition, each functional unit in each embodiment of the present invention can be integrated in two processing units, it can alsoIt is that each unit physically exists alone, it can also be during two or more units be integrated in one unit.
It, can be with if the function is realized in the form of SFU software functional unit and when sold or used as an independent productIt is stored in two computer read/write memory mediums.Based on this understanding, technical scheme of the present invention is substantially in other wordsThe part of the part that contributes to existing technology or the technical solution can be expressed in the form of software products, the meterCalculation machine software product is stored in a storage medium, including some instructions are used so that a computer equipment(Can bePeople's computer, server or network equipment etc.)It performs all or part of the steps of the method described in the various embodiments of the present invention.And storage medium above-mentioned includes:USB flash disk, mobile hard disk, read-only memory(ROM), random access memory(RAM), magnetic disc orThe various media that can store program code such as person's CD.
The above description is merely a specific embodiment, but scope of protection of the present invention is not limited thereto, anyThose familiar with the art in the technical scope disclosed by the present invention, can easily think of the change or the replacement, and should all containLid is within protection scope of the present invention.Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Although the description of the disclosure is quite detailed and especially several embodiments are described, it is notAny of these details or embodiment or any specific embodiments are intended to be limited to, but it is by reference to appended that should be considered asClaim considers that the prior art provides the possibility explanation of broad sense for these claims, to effectively cover the disclosurePreset range.In addition, the disclosure is described with inventor's foreseeable embodiment above, its purpose is to be provided withDescription, and those equivalent modifications that the disclosure can be still represented to the unsubstantiality change of the disclosure still unforeseen at present.