Detailed Description
It should be noted that, without conflict, the embodiments of the present application and features of the embodiments may be combined with each other. The application will be described in detail below with reference to the drawings in connection with embodiments.
In order that those skilled in the art will better understand the present application, a technical solution in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present application without making any inventive effort, shall fall within the scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present application and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate in order to describe the embodiments of the application herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It should be noted that, the user information (including, but not limited to, user equipment information, user personal information, etc.) and the data (including, but not limited to, data for presentation, analyzed data, etc.) related to the present disclosure are information and data authorized by the user or sufficiently authorized by each party.
The present application is described below in connection with preferred implementation steps, and fig. 1 is a flowchart of a method for networking equipment based on a blockchain, according to an embodiment of the present application, as shown in fig. 1, and the method includes the following steps:
In step S101, in the blockchain network, calculating target information corresponding to each equipment node, wherein the target information comprises at least one of capacity information of each equipment node and a target value corresponding to each equipment node, and the blockchain network at least comprises a plurality of equipment nodes.
Specifically, the capacity information is at least one of CPU running speed corresponding to each equipment node, storage rate corresponding to each equipment node, bandwidth delay rate corresponding to each equipment node and energy value corresponding to each equipment node.
That is, the present application can obtain the capacity information of each device node by calculating the target information corresponding to each device node, and can also obtain the target value corresponding to each device node.
In order to improve networking efficiency of a plurality of devices, in the device networking method based on the blockchain, which is provided by the embodiment of the application, capacity information in target information corresponding to each device node is calculated as one of the application points, so that the specific step of calculating CPU running speed of at least one of the capacity information comprises the steps of calculating CPU clock frequency of terminal devices corresponding to each device node, determining the CPU running speed according to each CPU clock frequency, and taking the CPU running speed as the target information.
For example, E CPU (i) is the CPU clock frequency of the terminal device, and is used to represent a unified count index of the extreme capability of the node, and if MF (i) represents the main frequency of the node, the calculation formula is:
E CPU(i)=MF(i)/MFmax, wherein MF max is the node dominant frequency maximum.
In order to further improve networking efficiency of a plurality of devices, in the blockchain-based device networking method provided by the embodiment of the application, capacity information in target information is calculated as one of the application points, so that the specific step of calculating the storage rate of at least one of the capacity information comprises the steps of calculating the storage capacity of terminal devices corresponding to each device node, determining the storage rate according to each storage capacity, and taking the storage rate as the target information.
For example, E storage (i) is a unified count index of storage capacity of a node, which is used to identify a storage rate in the present application, where the storage capacity of the node includes two parameters, namely, a storage rate of the current node and a storage capacity of the current node. The calculation formulas are S (i) =α×s speed(i)+β*Cdelay(i),Estorage(i)=S(i)/Smax, where Smax is the maximum value of the node storage capacity.
In order to further improve networking efficiency of a plurality of devices, in the device networking method based on the blockchain, which is provided by the embodiment of the application, capacity information in target information is calculated to serve as one of the application points, so that the specific step of calculating bandwidth information of at least one of the capacity information comprises the steps of calculating bandwidth information of terminal devices corresponding to each device node, determining bandwidth delay rate according to each bandwidth information, and taking the bandwidth delay rate as the target information.
For example, E cumm (i) represents a unified count index of node communication capabilities, including the transmissible bit rate (bandwidth) per second amount of the node transmit delay rate. Specifically, the calculation formula is C (i) =α×s bandw(i)+β*Cdelay(i),Ecumm(i)=C(i)/Cmax, where C max is the maximum value of the node bandwidth amount.
In order to further improve networking efficiency of a plurality of devices, in the blockchain-based device networking method provided by the embodiment of the application, capacity information in target information is calculated to serve as one of the application points, so that the specific step of calculating the energy value of at least one of the capacity information comprises the steps of calculating a current input value of terminal equipment corresponding to each device node, calculating an energy loss value corresponding to each device node according to the current input value, determining the energy value corresponding to each device node according to each energy loss value, and taking the energy value as the target information.
For example, E power (i) represents a node energy value. Without taking into account energy losses. Assuming that the energy losses per second are the same for the nodes, the loss of the cluster head node must be greater than the energy loss of the cluster member node at a current input value i. The calculation formula is as follows:
Epower(i)=Eremain(i)/Emax*100%, Wherein, the description of the above formula is:
α, β are weight factors, i.e. α+β=1, Representing the weights of different energy values alpha, beta, mu,ω,θ∈[0,1]。
In order to further improve networking efficiency of a plurality of devices, in the device networking method based on the blockchain, which is provided by the embodiment of the application, a target value in target information is calculated to be one of the application points.
Specifically, the target value in the application is node trust, the larger the value is, the higher the security of the terminal equipment corresponding to the node equipment is, and the calculation logic algorithm of the node trust according to the ID information value can be expressed as follows:
ai=0;// Ai is the sender ID
When id= =idi and T stamps–T>Tthreshold;// Tstamps is the time to send HELLO and T threshold is the timeout time set in advance.
Then do: ai=ai+1;
node Repu (IDi) =0;// trust of node i
AveRepu (ID) =0;// average confidence of node i
Then j=1, j < a i, j++;
If (helloj.status= =id)// cluster head node
Node Repu (ID) =node Repu (IDj) +ratio ij*ratiohj*RepuValueij;
Otherwise// cluster member node
Node Repu (ID) =node Repu (IDj) +ratio ij*RepuValueij;
and calculating the average trust degree of the nodes according to the trust degree of each node.
Step S102, determining a target equipment node in a plurality of equipment nodes according to the target information.
For example, as shown in fig. 2, the cluster head node (corresponding to the target device node in the present application) may be determined according to the largest target value (i.e., the trust value in the figure) among the target values.
Optionally, in the equipment networking method based on the blockchain, determining the target equipment node in the plurality of equipment nodes according to the target information comprises determining the largest target value in the plurality of target values, acquiring target terminal equipment corresponding to the largest target value, acquiring target capacity information corresponding to the target terminal equipment, and determining the target equipment node in the plurality of equipment nodes according to the target terminal equipment and/or the target capacity information.
For example, as shown in fig. 2, when the intranet structure is not a cluster, all nodes (corresponding to the device nodes in the present application, and the same applies hereinafter) in the internet of things do not determine their own cluster states, that is, cannot determine whether a condition for becoming a cluster head is provided. At this time, each node broadcasts a HELLO message to the network, the current state of each node x is set to be pending (state=null), and after receiving the HELLO message, the node divides the message into a message which can be found by the adjacent node and a cluster head value message of itself. After a period of time, each node can establish a complete trust database, and then compare the obtained target values (i.e. trust values) of the plurality of nodes, if the node can become a cluster head node independently, the trust degree of the adjacent node is smaller than that of the node itself, the state of the node itself is unchanged, and the state of the adjacent node is set as its own ID (state=id).
For example, if a node with the highest trust degree exists in the adjacent nodes, the state value of the node is set as the state value of the adjacent nodes, and the node is elected as a cluster head. In the comparison and change state of one time, when more than half of the nodes have become the same ID value, according to the principle of the trust degree of the block chain, the cluster head node in the network is determined to be the node ID after the current node is selected autonomously, and HELLO information is sent to broadcast, so that all the nodes in the network cluster set own ID as the cluster head node ID (state=cluster head node ID).
Optionally, the application can also acquire the terminal equipment corresponding to the maximum target value and acquire the target capacity information corresponding to the target terminal equipment, and determine the target equipment node in the plurality of equipment nodes according to the target terminal equipment and/or the target capacity information, thereby further improving the networking efficiency of the equipment.
Step S103, the IP networking resources are distributed to other equipment nodes except the target equipment node in the plurality of equipment nodes according to the target equipment node.
Step S104, determining networking strategies of a plurality of terminal devices according to the distributed IP networking resources, wherein the device nodes are in one-to-one correspondence with the terminal devices.
Specifically, IP networking resources are distributed to other equipment nodes except the target equipment node in the plurality of equipment nodes through the target equipment node, and each node is connected with a router, so that networking operation of all equipment in the whole network networking can be completed, networking strategies of a plurality of terminal equipment are further determined, power of the router is prevented from being influenced to the greatest extent, and meanwhile risks of network attack of the router and clients are reduced.
In summary, the equipment networking method based on the blockchain provided by the embodiment of the application calculates the target information corresponding to each equipment node in the blockchain network, wherein the target information comprises at least one of capacity information of each equipment node and target numerical values corresponding to each equipment node, the blockchain network at least comprises a plurality of equipment nodes, the target equipment nodes in the plurality of equipment nodes are determined according to the target information, IP networking resources are distributed to other equipment nodes except the target equipment nodes in the plurality of equipment nodes according to the target equipment nodes, and networking strategies of a plurality of terminal equipment are determined according to the distributed IP networking resources, wherein the equipment nodes are in one-to-one correspondence with the terminal equipment. The application solves the problem of lower resource allocation efficiency in the networking of the equipment in the related technology. In the block chain network, IP networking resources are distributed to other equipment nodes except the target equipment node in the plurality of equipment nodes according to the target equipment node, so that the effect of improving the resource distribution efficiency in equipment networking is achieved.
It should be noted that the steps illustrated in the flowcharts of the figures may be performed in a computer system such as a set of computer executable instructions, and that although a logical order is illustrated in the flowcharts, in some cases the steps illustrated or described may be performed in an order other than that illustrated herein.
The embodiment of the application also provides a device networking device based on the block chain, and the device networking device based on the block chain can be used for executing the device networking method based on the block chain. The following describes a device networking apparatus based on a blockchain provided by the embodiment of the present application.
Fig. 3 is a schematic diagram of a blockchain-based device networking apparatus in accordance with an embodiment of the application. As shown in fig. 3, the apparatus comprises a calculation unit 301, a first determination unit 302, an allocation unit 303, a second determination unit 304.
Specifically, the calculating unit 301 is configured to calculate, in a blockchain network, target information corresponding to each device node, where the target information includes at least one of capacity information of each device node and a target value corresponding to each device node, where the blockchain network at least includes a plurality of device nodes;
an allocation unit 303, configured to allocate IP networking resources to other device nodes except for the target device node in the plurality of device nodes according to the target device node;
and a second determining unit 304, configured to determine a networking policy of a plurality of terminal devices according to the allocated IP networking resources, where the device nodes are in one-to-one correspondence with the terminal devices.
In summary, the device networking apparatus based on a blockchain provided by the embodiment of the application calculates, by the calculating unit 301, target information corresponding to each device node in a blockchain network, where the target information includes at least one of capacity information of each device node and a target value corresponding to each device node, the blockchain network at least includes a plurality of device nodes, the first determining unit 302 determines a target device node in the plurality of device nodes according to the target information, the allocating unit 303 allocates IP networking resources to other device nodes except the target device node in the plurality of device nodes according to the target device node, and the second determining unit 304 determines networking policies of a plurality of terminal devices according to the allocated IP networking resources, where the device nodes are in one-to-one correspondence with the terminal devices, so that a problem of low resource allocation efficiency in device networking in related technologies is solved. In the block chain network, IP networking resources are distributed to other equipment nodes except the target equipment node in the plurality of equipment nodes according to the target equipment node, so that the effect of improving the resource distribution efficiency in equipment networking is achieved.
Optionally, in the equipment networking device based on the blockchain, the capacity information is at least one of a CPU running speed corresponding to each equipment node, a storage rate corresponding to each equipment node, a bandwidth delay rate corresponding to each equipment node and an energy value corresponding to each equipment node.
Optionally, in the equipment networking device based on the blockchain, the calculating unit comprises a first calculating module, a first determining module and a second determining module, wherein the first calculating module is used for calculating the CPU clock frequency of the terminal equipment corresponding to each equipment node, the first determining module is used for determining the CPU running speed according to each CPU clock frequency, and the second determining module is used for taking the CPU running speed as target information.
Optionally, in the equipment networking device based on the blockchain, the calculating unit comprises a second calculating module, a third determining module and a fourth determining module, wherein the second calculating module is used for calculating the storage capacity of the terminal equipment corresponding to each equipment node, the third determining module is used for determining the storage rate according to each storage capacity, and the fourth determining module is used for taking the storage rate as target information.
Optionally, in the equipment networking device based on the blockchain, the calculating unit comprises a third calculating module, a fifth determining module and a sixth determining module, wherein the third calculating module is used for calculating bandwidth information of terminal equipment corresponding to each equipment node, the fifth determining module is used for determining bandwidth delay rate according to each piece of bandwidth information, and the sixth determining module is used for taking the bandwidth delay rate as target information.
Optionally, in the equipment networking device based on the blockchain, the calculating unit comprises a fourth calculating module, a fifth calculating module, a seventh determining module and an eighth determining module, wherein the fourth calculating module is used for calculating a current input value of terminal equipment corresponding to each equipment node, the fifth calculating module is used for calculating an energy loss value corresponding to each equipment node according to the current input value, the seventh determining module is used for determining an energy value corresponding to each equipment node according to each energy loss value, and the eighth determining module is used for taking the energy value as target information.
Optionally, in the equipment networking device based on the blockchain, the computing unit comprises a first obtaining module, a ninth determining module and a tenth determining module, wherein the first obtaining module is used for obtaining an ID information value of terminal equipment corresponding to each equipment node, the ninth determining module is used for determining a target value corresponding to each equipment node according to the ID information value, and the tenth determining module is used for taking the target value as target information.
Optionally, in the equipment networking device based on the blockchain, the first determining unit comprises an eleventh determining module, a second acquiring module, an acquiring module and a twelfth determining module, wherein the eleventh determining module is used for determining the largest target value in a plurality of target values, the second acquiring module is used for acquiring target terminal equipment corresponding to the largest target value, the acquiring module is used for acquiring target capacity information corresponding to the target terminal equipment, and the twelfth determining module is used for determining target equipment nodes in a plurality of equipment nodes according to the target terminal equipment and/or the target capacity information.
The blockchain-based device networking apparatus includes a processor and a memory, the above-mentioned computing unit 301, the first determining unit 302, the allocating unit 303, the second determining unit 304, and the like are all stored as program units in the memory, and the processor executes the above-mentioned program units stored in the memory to realize the corresponding functions.
The processor includes a kernel, and the kernel fetches the corresponding program unit from the memory. The kernel may set one or more kernel parameters for blockchain-based device networking.
The memory may include volatile memory, random Access Memory (RAM), and/or nonvolatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM), among other forms in computer readable media, the memory including at least one memory chip.
The embodiment of the invention provides a computer readable storage medium, wherein a program is stored on the computer readable storage medium, and the program is executed by a processor to realize a device networking method based on a block chain.
The embodiment of the invention provides a processor which is used for running a program, wherein the program runs to execute a device networking method based on a block chain.
As shown in FIG. 4, the embodiment of the invention provides an electronic device, which comprises a processor, a memory and a program stored on the memory and capable of running on the processor, wherein the processor executes the program to realize the following steps of calculating target information corresponding to each device node in a blockchain network, wherein the target information comprises at least one of capacity information of each device node and target numerical value corresponding to each device node, the blockchain network at least comprises a plurality of device nodes, determining target device nodes in the plurality of device nodes according to the target information, distributing IP networking resources to other device nodes except the target device nodes in the plurality of device nodes according to the target device nodes, and determining networking strategies of the plurality of terminal devices according to the distributed IP networking resources, wherein the device nodes are in one-to-one correspondence with the terminal devices.
The processor also realizes the following steps of CPU running speed corresponding to each equipment node, storage speed corresponding to each equipment node, bandwidth delay speed corresponding to each equipment node and energy value corresponding to each equipment node when executing the program.
The processor also realizes the following steps of calculating the CPU clock frequency of the terminal equipment corresponding to each equipment node, determining the CPU running speed according to each CPU clock frequency, and taking the CPU running speed as target information.
The processor also performs the steps of calculating a storage capacity of the terminal device corresponding to each device node, determining a storage rate according to each storage capacity, and taking the storage rate as target information when executing the program.
The processor also realizes the following steps of calculating the bandwidth information of the terminal equipment corresponding to each equipment node, determining the bandwidth delay rate according to each bandwidth information, and taking the bandwidth delay rate as target information.
The processor also realizes the following steps of calculating a current input value of the terminal equipment corresponding to each equipment node when executing the program, calculating an energy loss value corresponding to each equipment node according to the current input value, determining an energy value corresponding to each equipment node according to each energy loss value, and taking the energy value as target information.
The processor also realizes the following steps when executing the program, namely, acquiring the ID information value of the terminal equipment corresponding to each equipment node, determining the target numerical value corresponding to each equipment node according to the ID information value, and taking the target numerical value as target information.
The processor further comprises the steps of determining the largest target value in the plurality of target values, acquiring target terminal equipment corresponding to the largest target value, acquiring target capacity information corresponding to the target terminal equipment, and determining target equipment nodes in the plurality of equipment nodes according to the target terminal equipment and/or the target capacity information.
The device herein may be a server, PC, PAD, cell phone, etc.
The application also provides a computer program product which is suitable for executing a program initialized with the following method steps when being executed on data processing equipment, wherein the target information comprises at least one of capacity information of each equipment node and target numerical values corresponding to each equipment node in a blockchain network, the blockchain network at least comprises a plurality of equipment nodes, the target equipment nodes in the plurality of equipment nodes are determined according to the target information, IP networking resources are allocated to other equipment nodes except the target equipment nodes in the plurality of equipment nodes according to the target equipment nodes, and networking strategies of a plurality of terminal equipment are determined according to the allocated IP networking resources, wherein the equipment nodes are in one-to-one correspondence with the terminal equipment.
When executed on a data processing device, is further adapted to execute a program that initializes a CPU running speed corresponding to each device node, a storage rate corresponding to each device node, a corresponding bandwidth delay rate of each device node, an energy value corresponding to each device node.
When executed on a data processing device, is further adapted to execute a program which is initialized with the method steps of calculating a CPU clock frequency of the terminal device corresponding to each device node, determining a CPU running speed from each CPU clock frequency, and taking the CPU running speed as target information.
When executed on a data processing device, is further adapted to execute a program which is initialized with method steps of calculating a storage capacity of a terminal device corresponding to each device node, determining a storage rate from each storage capacity, and regarding the storage rate as target information.
When executed on a data processing device, is further adapted to perform a program for initializing the method steps of calculating bandwidth information of the terminal device corresponding to each device node, determining a bandwidth delay rate from each bandwidth information, and taking the bandwidth delay rate as target information.
When executed on a data processing device, is further adapted to perform a program for initializing the method steps of calculating a current input value of a terminal device corresponding to each device node, calculating an energy loss value corresponding to each device node from the current input value, determining an energy value corresponding to each device node from each energy loss value, and regarding the energy value as target information.
When executed on a data processing device, is further adapted to execute a program initialized with method steps of obtaining an ID information value of a terminal device corresponding to each device node, determining a target value corresponding to each device node based on the ID information value, and taking the target value as target information.
When executed on a data processing device, is further adapted to perform a program for initializing a method step of determining a largest target value of a plurality of target values, obtaining a target terminal device corresponding to the largest target value, collecting target capacity information corresponding to the target terminal device, and determining a target device node of the plurality of device nodes based on the target terminal device and/or the target capacity information.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In one typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include volatile memory in a computer-readable medium, random Access Memory (RAM) and/or nonvolatile memory, etc., such as Read Only Memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
Computer readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. Computer-readable media, as defined herein, does not include transitory computer-readable media (transmission media), such as modulated data signals and carrier waves.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises an element.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The foregoing is merely exemplary of the present application and is not intended to limit the present application. Various modifications and variations of the present application will be apparent to those skilled in the art. Any modification, equivalent replacement, improvement, etc. which come within the spirit and principles of the application are to be included in the scope of the claims of the present application.