CN110047004B - Block chain accounting node selection method and device - Google Patents
Block chain accounting node selection method and device Download PDFInfo
- Publication number
- CN110047004B CN110047004B CN201910328952.9A CN201910328952A CN110047004B CN 110047004 B CN110047004 B CN 110047004B CN 201910328952 A CN201910328952 A CN 201910328952A CN 110047004 B CN110047004 B CN 110047004B
- Authority
- CN
- China
- Prior art keywords
- node
- group
- block chain
- fitness
- groups
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/60—Protecting data
- G06F21/64—Protecting data integrity, e.g. using checksums, certificates or signatures
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/12—Computing arrangements based on biological models using genetic models
- G06N3/126—Evolutionary algorithms, e.g. genetic algorithms or genetic programming
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q20/00—Payment architectures, schemes or protocols
- G06Q20/38—Payment protocols; Details thereof
- G06Q20/40—Authorisation, e.g. identification of payer or payee, verification of customer or shop credentials; Review and approval of payers, e.g. check credit lines or negative lists
- G06Q20/401—Transaction verification
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q40/00—Finance; Insurance; Tax strategies; Processing of corporate or income taxes
- G06Q40/04—Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Business, Economics & Management (AREA)
- Theoretical Computer Science (AREA)
- Accounting & Taxation (AREA)
- Health & Medical Sciences (AREA)
- General Physics & Mathematics (AREA)
- Life Sciences & Earth Sciences (AREA)
- Finance (AREA)
- Computer Security & Cryptography (AREA)
- Biophysics (AREA)
- Bioinformatics & Cheminformatics (AREA)
- General Engineering & Computer Science (AREA)
- Bioinformatics & Computational Biology (AREA)
- General Business, Economics & Management (AREA)
- Evolutionary Biology (AREA)
- Strategic Management (AREA)
- Software Systems (AREA)
- General Health & Medical Sciences (AREA)
- Computing Systems (AREA)
- Genetics & Genomics (AREA)
- Data Mining & Analysis (AREA)
- Evolutionary Computation (AREA)
- Molecular Biology (AREA)
- Computer Hardware Design (AREA)
- Mathematical Physics (AREA)
- Biomedical Technology (AREA)
- Artificial Intelligence (AREA)
- Computational Linguistics (AREA)
- Development Economics (AREA)
- Economics (AREA)
- Marketing (AREA)
- Physiology (AREA)
- Technology Law (AREA)
- Bioethics (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
The application discloses a block chain accounting node selection method and a block chain accounting node selection device, wherein the method comprises the following steps: determining the longest transmission time and the largest hop count corresponding to each node in a block chain; selecting a plurality of node groups from the block chain, wherein each node group comprises at least one node; expanding the currently existing node groups based on a genetic algorithm to expand a plurality of node groups; aiming at each expanded node group, calculating the fitness of the node group according to the longest transmission time and the largest hop count corresponding to each node in the node group, wherein the fitness is used for representing the degree of the efficiency of transmitting information into a block chain by the nodes in the node group; under the condition of meeting set conditions, determining a node group with the highest current fitness; and selecting the accounting node from the node group with the highest fitness. The selected accounting nodes in the scheme of the application have randomness, and the transmission efficiency of the information transmitted by the accounting nodes is improved.
Description
Technical Field
The present application relates to the field of block chain technologies, and in particular, to a method and an apparatus for selecting a block chain accounting node.
Background
The block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like.
The blockchain system comprises a verification node for verifying the transaction information and an accounting node for recording the transaction information passing the verification and forming blocks in the blockchain. It can be seen that in order to implement recording information into a blockchain, a billing node must be determined in the blockchain. In order to ensure fairness and fairness in the selection of accounting nodes in block chains, random block chain selection is required in some block chains. However, at present, although the selection of the accounting node in the blockchain can satisfy randomness, the delay existing in the information transmission between nodes in the blockchain is not considered, which may cause a problem of low information transmission efficiency.
Disclosure of Invention
In view of the above, the present application provides a block chain accounting node selection method, so as to select an accounting node more reasonably, so that the selected accounting node has randomness, and reduce a time delay of information transmission caused by inappropriate selection of the accounting node, which is beneficial to improving the information transmission efficiency in a block chain.
In order to achieve the above object, in one aspect, the present application provides a method for selecting a block chain accounting node, including:
determining the longest transmission time and the longest hop count corresponding to each node in a block chain, wherein the longest transmission time of the node is the longest time required for the node to broadcast information to all nodes in the block chain; the maximum hop count of the node is the maximum value of the hop counts required by the node for transmitting messages to different nodes in the block chain;
selecting a plurality of node groups from the block chain, wherein each node group comprises at least one node, different node groups comprise different nodes, and the number of the nodes in different node groups is the same;
expanding the currently existing node groups based on a genetic algorithm to expand a plurality of node groups, wherein the number of the node groups is not less than that of the currently existing node groups;
aiming at each expanded node group, calculating the fitness of the node group according to the longest transmission time and the largest hop count corresponding to each node in the node group, wherein the fitness of the node group is used for representing the degree of the efficiency of transmitting information into a block chain by the node in the node group;
under the condition of meeting set conditions, determining a node group with the highest current fitness;
and selecting the accounting node from the node group with the highest fitness.
Preferably, when the selecting the plurality of node groups from the block chain, the method further includes: setting the cycle number to be 1;
the setting conditions include:
the cycle times reach the set times;
or, in a plurality of node groups expanded currently, the node groups with the highest fitness exist in the continuous target number circulation;
after the calculating the fitness of the node group, further comprising:
and if the set condition is not met, returning to execute the operation of expanding the currently existing node group based on the genetic algorithm, and adding 1 to the cycle number.
Preferably, the setting conditions include:
at least one node group with the fitness exceeding a set threshold exists in the plurality of nodes expanded currently.
Preferably, the expanding the currently existing node group based on the genetic algorithm to expand a plurality of node groups includes:
mapping each node group which exists currently into a population respectively, wherein different node groups correspond to different populations, individuals in the populations are the node groups corresponding to the populations, and chromosomes of the individuals in the populations are the nodes in the node groups corresponding to the populations;
and (3) carrying out heredity, crossover and/or variation on the current existing population based on a genetic algorithm to obtain a plurality of populations corresponding to the plurality of node groups.
Preferably, the genetic algorithm-based inheritance, crossover and/or mutation of the currently existing population includes:
the method comprises the steps of (1) carrying out heredity on a population existing at present based on a genetic algorithm;
and when the current meeting of the population crossing condition and/or the population variation condition is determined according to the set crossing probability and the set variation probability, crossing and/or varying the current existing population based on the genetic algorithm.
Preferably, the calculating the fitness of the node group according to the longest transmission time and the largest hop count corresponding to each node in the node group includes:
calculating a first product of the maximum transmission time corresponding to each node and a first coefficient and a second product of the maximum hop count corresponding to each node, and determining the sum of the first product and the second product as the fitness of each node;
and determining the sum of the fitness corresponding to each node in the node group as the fitness of the node group.
In another aspect, the present application further provides a device for selecting a block chain accounting node, including:
the system comprises a characteristic determining unit, a judging unit and a judging unit, wherein the characteristic determining unit is used for determining the longest transmission time and the longest hop count which are respectively corresponding to each node in a block chain, and the longest transmission time of the node is the longest time required for the node to broadcast information to all the nodes in the block chain; the maximum hop count of the node is the maximum value of the hop counts required by the node for transmitting messages to different nodes in the block chain;
the system comprises a group initial selection unit, a group selection unit and a group selection unit, wherein the group initial selection unit is used for selecting a plurality of node groups from a block chain, each node group comprises at least one node, different node groups comprise different nodes, and the number of the nodes in the different node groups is the same;
the group expansion unit is used for expanding the currently existing node groups based on a genetic algorithm to expand a plurality of node groups, and the number of the node groups is not less than the number of the currently existing node groups;
a fitness determining unit, configured to calculate, for each expanded node group, a fitness of the node group according to a longest transmission time and a maximum hop count that correspond to each node in the node group, where the fitness is used to characterize a degree of efficiency of transmitting information to a block chain by a node in the node group;
the group screening unit is used for determining the node group with the highest current fitness under the condition of meeting set conditions;
and the node selection unit is used for selecting the accounting node from the node group with the highest fitness.
Preferably, the method further comprises the following steps: a cycle setting unit, configured to set a cycle number to 1 when the group initial selection unit selects a plurality of node groups from the block chain;
the setting conditions in the group screening unit include:
the cycle times reach the set times;
or, in a plurality of node groups expanded currently, the node groups with the highest fitness exist in the continuous target number circulation;
the device for selecting the block chain accounting node further comprises:
and the cycle triggering unit is used for triggering to return to execute the group extension unit operation and adding 1 to the cycle times under the condition that the set condition is not met.
Preferably, the setting conditions in the group screening unit include:
at least one node group with the fitness exceeding a set threshold exists in the plurality of nodes expanded currently.
Preferably, the group extension unit includes:
a population mapping subunit, configured to map each node group currently existing to a population, where different node groups correspond to different populations, an individual in the population is a node group corresponding to the population, and a chromosome of the individual in the population is a node in the node group corresponding to the population;
and the group expansion subunit is used for carrying out heredity, crossing and/or variation on the current existing population based on a genetic algorithm to obtain a plurality of populations corresponding to the plurality of node groups.
It can be seen that, in the embodiment of the present application, after a plurality of node groups are selected from a block chain, the node groups are expanded, and for each expanded node group, the fitness of the node group is determined according to the maximum transmission time and the maximum hop count required by the broadcast information of each node in the node group, so that a checkout node can be selected from the node group with the highest fitness when a set condition is satisfied. Therefore, the expansion node group based on the selected node group meets the randomness, so that the randomness of the subsequent accounting nodes is ensured. Moreover, the fitness of the node group is related to the maximum transmission time and the maximum hop count of each node in the node group, so that the fitness of the node group can reflect the information transmission performance of each node in the node group, and on the basis, the accounting node is selected from the node group with the highest fitness, so that the accounting node with higher information transmission performance can be selected from the block chain, and the transmission efficiency of the accounting node for transmitting information to the block chain is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on the provided drawings without creative efforts.
Fig. 1 shows a schematic diagram of a component structure in a block chain to which the solution of the present application is applied;
FIG. 2 shows a schematic flow diagram of a block chain accounting node selection method of the present application;
FIG. 3 is a simplified diagram illustrating the relationship between various nodes in a blockchain network in the present application;
FIG. 4 is a schematic flow chart diagram illustrating a block chain accounting node selection method according to the present application;
fig. 5 is a schematic diagram illustrating a block chain accounting node selection apparatus according to the present invention.
Detailed Description
The scheme of the application is suitable for selecting the accounting node for generating the block from the nodes in the block chain.
As shown in fig. 1, it shows a schematic diagram of a block chain structure.
The blockchain is constructed based on a Peer-to-Peer (P2P) network, and thus includes a plurality of nodes 101.
Among the plurality of nodes 101, there may be at least one accounting node 102 and a plurality of verification nodes 103.
The accounting node is a block chain used for recording transaction information in the network and forming a block used for storage.
And the verification node is used for verifying the blocks generated by the multi-accounting node and issuing the blocks into the block chain through a consensus mechanism.
The scheme of the application is described below with reference to a flow chart.
Referring to fig. 2, which shows a schematic flowchart of a method for selecting a block chain accounting node according to the present invention, the solution of this embodiment may be applied to a computer device, where the computer device may be a node in a block chain, or a computer device that is in communication connection with the block chain.
The method of the embodiment may include:
s201, determining the longest transmission time and the largest hop count corresponding to each node in the block chain.
The maximum transmission time of a node is the longest time required for the node to broadcast information to all nodes in the block chain. That is, when a node is used as a source node to broadcast information into a block chain, the time that the information broadcast by the source node is transmitted to a node that has received the information last is the maximum transmission time corresponding to the source node.
For example, if the blockchain includes node 1, node 2, node 3 and node 4, and after the node 1 broadcasts information, the last node in the blockchain that receives the information broadcast by the node 1 is node 3, the time period from when the node 1 sends out the broadcast information to when the node 3 receives the broadcast information is the maximum transmission time of the node 1 broadcasting a message.
The maximum hop count of the node is the maximum value of the hop counts required by the node to transmit messages to different nodes in the block chain. It is to be understood that the maximum value of the required number of hops mentioned herein refers to the maximum value of the number of hops required in accordance with the optimal transmission mode.
As explained in conjunction with fig. 3, the blockchain shown in fig. 3 includes node 1, node 2, node 3, node 4, and node 5. Wherein, node 1 only needs to pass one hop with information transmission to node 2, and node 1 needs two hops with information transmission to node 4: specifically from node 1 to node 2 and then from node 2 to node 4. One hop is also required for node 1 to transmit information to node 3.
And the node 1 transmits information to the node 5 through the node 3 to the node 5, namely two hops are needed. Although the information may also be transmitted from the node 1 to the node 5 via the nodes 2 and 4, according to the optimal transmission mode, after the information sent by the node 1 is transmitted to the node 5 via the node 3, the node 5 does not receive the information any more after receiving the information, and therefore, the hop count from the node 1 to the node 5 is two hops.
Accordingly, the number of hops required from node 1 to the farthest node 6 is 3 hops, i.e., from node 1 to node 6 via node 3 and node 5.
It can be seen that the maximum number of hops required for the node 1 to transmit information to the entire blockchain is 6 hops.
It can be understood that the specific manner of determining the maximum hop count and the maximum transmission time corresponding to each node in the block chain may be determined in any manner, which is not limited in the present application.
S202, a plurality of node groups are selected from the block chain.
Each node group comprises at least one node, wherein different node groups comprise different nodes, and the number of the nodes in the different node groups is the same. For example, each node has a unique node identification, and nodes included in different node groups have different node identifications.
In this step, a plurality of node groups may be randomly selected as needed, as long as the number of each node group is the same, and the same node only belongs to one node group.
It is understood that, in practical applications, the number of randomly selected node groups may be preset, for example, K node groups may be selected, where K is a natural number greater than or equal to one. The value of K may also be different according to the size of the network scale of different block chains. Correspondingly, the number of nodes in the node group may also be set, for example, each node group is set to include x, where x is a natural number greater than or equal to 1.
Optionally, in this embodiment of the present application, the node group selected from the blockchain may be a verification node group, and accordingly, each node in the node group may be considered as a selected verification node.
S203, expanding the currently existing node groups based on the genetic algorithm to obtain a plurality of node groups.
Wherein the number of the plurality of node groups is not less than the number of the currently existing node groups.
The expansion of the node group means that other node groups including partial nodes in the node group are expanded by taking the node group as a reference.
For example, each node group may extend at least one node group, and at least one of the node groups extended by each node group includes at least the node group and may include other node groups different from the node group. Accordingly, since the number of currently existing node groups is plural, the plural node groups can be eventually expanded into plural node groups.
It is understood that, since the step S203 may be executed multiple times, the currently existing node group may be different each time the step S203 is executed. If, after the plurality of node groups are selected in step S202, the step S203 is executed for the first time, and the currently existing node groups are the plurality of node groups selected in step S202.
Wherein expanding the node group based on the genetic algorithm may include: one or more of inheritance, crossover, and mutation are performed on the node group. Wherein, the inheritance of the node group is reserved for the node group, and the poor performance of the node group means that at least one node in the node group is interchanged with nodes in other node groups; mutation to a node group refers to replacing a node in the node group with another node in the blockchain.
In a possible implementation manner, each node group that exists currently may be mapped to a population, where different node groups correspond to different populations, an individual in the population is a node group corresponding to the population, and a chromosome of the individual in the population is a node in the node group corresponding to the population. Accordingly, the currently existing population may be inherited, crossed, and/or mutated based on a genetic algorithm to obtain a plurality of populations corresponding to the plurality of node groups.
It is understood that there are many possibilities that a node group corresponds to a population in this embodiment, and here, the node group is taken as a population and the node group is taken as an individual of the population. In practical applications, each node in the node group may be regarded as an individual in the population corresponding to the node group, and a chromosome of each individual may be regarded as 1.
Wherein, because the genetic algorithm involves heredity, crossover and mutation, in the actual citation, crossover probability and mutation probability can also be set. Accordingly, each population currently present can be inherited based on a genetic algorithm. And meanwhile, when the current meeting of the population crossing condition and/or the population variation condition is determined according to the set crossing probability and the set variation probability, crossing and/or variation is carried out on the current existing population based on the genetic algorithm.
And performing population inheritance on the population corresponding to each node group to reserve the population corresponding to the node group.
And if the population is crossed and varied, whether the population cross condition and the population variation condition are met currently needs to be judged. Wherein, under the condition of meeting the population crossing condition, the existing population is crossed based on the genetic algorithm; in the case of satisfying the population variation condition, the currently existing population is varied based on a genetic algorithm.
The method for judging whether the current population crossing condition is met or not based on the crossing probability can be various, and as an optional method, the method can generate a random number, and if the random number is greater than the crossing probability, the current population crossing condition is determined to be met.
Correspondingly, various modes can be provided for judging whether the population variation condition is met or not at present based on the variation probability. As a selection manner, the generated random number may be obtained, and if the random number is greater than the genetic probability, it is determined that the population variation condition is currently satisfied.
And S204, aiming at each expanded node group, calculating the fitness of the node group according to the longest transmission time and the largest hop count corresponding to each node in the node group.
The fitness of the node group is used for representing the degree of efficiency of the nodes in the node group for transmitting information into the block chain. The fitness of the node group is determined by combining the maximum transmission time and the maximum hop count of each node in the node group, and can reflect the evaluation index of the transmission performance of all nodes in the node group.
Specifically, the smaller the maximum transmission time of all nodes in the node group is, the higher the fitness of the node group is, and the smaller the maximum hop count of each node in the node group is, the higher the fitness of the node group is.
It is understood that the fitness of the node group may be calculated in various ways, for example, a first weight corresponding to the maximum transmission time may be set, and the maximum hop count may be weighted by a second weight, and then a weighted sum of the maximum transmission time and the maximum hop count of all nodes in the node group may be calculated. For another example, the fitness of the population corresponding to the node group may also be calculated according to a fitness function in a genetic algorithm.
In one possible scenario, the fitness of the node group may be obtained as follows:
aiming at each node in the node group, calculating a first product of the maximum transmission time corresponding to the node and a first coefficient and a second product of the maximum hop count corresponding to the node, and determining the sum of the first product and the second product as the fitness of the node;
and determining the sum of the fitness corresponding to each node in the node group as the fitness of the node group.
Wherein, the first coefficient and the second coefficient can be set according to requirements.
E.g., the node group k j Fitness f (k) of j ) Can be calculated by the following formula one:
node group k i Indicating a jth node group of the plurality of node groups currently existing. x is the number of i Representing the ith node in the node group,representing a node x i The maximum transmission time of; />Representing a node x i The maximum number of hops. Omega 1 Representing a first coefficient, ω 2 Representing the second coefficient.
And S205, under the condition that the set conditions are met, determining the node group with the highest current fitness.
Wherein the setting condition can be set as required.
For example, in the case where it is necessary to circulate a plurality of times through steps S203 and S204 as above, the number of circulations may be recorded, and in the case where the number of circulations reaches the set number, it is determined that the set condition is satisfied.
In one possible case, the number of cycles may be set to 1 while the plurality of node groups are selected in step S202. Correspondingly, in step S205, it may be determined whether the number of cycles reaches a set number, and if yes, the node group with the highest current fitness is determined; if the number of cycles does not reach the set number of cycles, the process may return to step S203 and add 1 to the number of cycles to repeat the cycle and count.
In another possible case, when the number of cycles is set to 1 while the plurality of node groups are selected in step S202, the setting condition may be that, among the plurality of node groups currently expanded, there is a node group having the highest fitness among the cycles of the consecutive target number. Specifically, it may be detected whether the fitness of each of the currently expanded multiple node groups is the highest fitness in the continuous target number cycles, and if so, it is determined that a set condition is satisfied, so as to determine the highest fitness. Accordingly, if there is no node group whose fitness is the highest in the successive target number of cycles, it may return to step S203 and add 1 to the number of cycles to continue the repetition and count.
In the second case, the setting condition may also be that the node group with the highest fitness belongs to the node group with the highest fitness in the continuous target number of cycles, and the fitness of the node group remains unchanged, and may specifically be set as needed.
It is to be understood that, in practical applications, the setting condition may be set to any one of the above two cases as needed.
For another example, when the fitness of the node group is high, the information transmission performance of the node group is high, and the information transmission performance of each node in the node group is also relatively high, the setting condition may be: at least one node group with the fitness exceeding a set threshold exists in the plurality of nodes expanded currently. This case applies to the case where steps S202 and S203 are circulated a plurality of times, and also to the case where step S202 is executed a plurality of times alone, or step S202 is executed only once.
S206, selecting the accounting node from the node group with the highest fitness.
It can be understood that, because the information transmission performance of each node in the node group with the highest fitness is relatively high, selecting the accounting node from the node group is beneficial to ensuring the information transmission performance of the accounting node, and further reduces the information transmission delay.
There may be various manners of selecting the accounting node from the node group with the highest fitness, for example, the node with the highest fitness in the node group may be selected as the accounting node, where the fitness of the node may be referred to in the foregoing description. Optionally, considering that the information transmission efficiency of each node in the node group is generally high, in order to reduce consumption of data calculation, a node may be randomly selected from the node group with the highest fitness as the accounting node.
It will be appreciated that in the case where the node group is a verification node group, one node may be selected as an accounting node from the verification node group with the highest fitness, and each node in the verification node group with the highest fitness may be used as a verification node in the block chain.
Therefore, the expansion node group based on the selected node group meets the randomness, so that the randomness of subsequent accounting nodes is ensured. Moreover, the fitness of the node group is related to the maximum transmission time and the maximum hop count of each node in the node group, so that the fitness of the node group can reflect the information transmission performance of each node in the node group, and on the basis, the accounting node is selected from the node group with the highest fitness, so that the accounting node with higher information transmission performance can be selected from the block chain, and the transmission efficiency of the accounting node for transmitting information to the block chain is improved.
In order to facilitate understanding of the scheme of the present application, the following takes the selected node in the node group as an example of a node serving as a verification node, and at the same time, takes the entire process of selecting the accounting node as an example of an iterative process combined with a genetic algorithm.
For example, referring to fig. 4, which shows another flowchart of the block chain accounting node selection method according to the present application, the method of this embodiment may include:
s401, determining the longest transmission time and the largest hop count corresponding to each node in the block chain.
The longest transmission time and the maximum hop count corresponding to the node may refer to the related descriptions above, and are not described herein again.
S402, randomly selecting a first number of verification node groups from the block chain, and setting the cycle number to be 1, wherein each verification node group comprises a second number of nodes serving as verification nodes.
For example, the authentication node group 1 includes node 1, node 2, and node 3 as authentication nodes; and the authentication node group 2 includes a node 4, a node 5, and a node 6 as authentication nodes.
The first number and the second number may be set according to needs, and both the first number and the second number may be different for different blockchains including different numbers of nodes.
In the present embodiment, since the step S402 is executed without performing the corresponding iterative loop based on the genetic algorithm, the number of loops is set to 1 here.
And S403, mapping each verification node group into a population to obtain a first number of populations.
The different verification node groups correspond to different populations, individuals in the populations correspond to the verification node groups corresponding to the populations, and chromosomes of the individuals in the populations correspond to the verification nodes in the verification node groups corresponding to the populations.
And S404, aiming at each population, carrying out inheritance on the population based on a genetic algorithm.
And (3) carrying out inheritance on the population corresponding to each verification node group, wherein the inheritance is to reserve the population corresponding to the verification node group.
S405, a random number is generated.
The purpose of the random number is to determine whether a population crossing condition and a population variation condition are currently satisfied. Wherein, the random number generated randomly will be different in different cycles.
S406, if the random number is larger than the set cross probability p 1 The currently existing population is crossed based on a genetic algorithm.
S407, if the random number is larger than the set mutation probability p 2 And carrying out variation on the currently existing population according to the nodes in the block chain and based on a genetic algorithm.
If the random number generated in the current cycle is greater than the crossover probability and the mutation probability, carrying out crossover and mutation of the population respectively; and if the random number is not larger than the variation probability, the population is not varied. Correspondingly, if the random number is not larger than the cross probability, the population will not be crossed.
The process of crossing and mutating the population based on the genetic algorithm can be similar to the crossing and mutating process in the existing genetic algorithm, and is not limited.
It is understood that the sequence of steps S404, S406, and S407 is not limited to that shown in fig. 4, and in practical applications, step S404 may be executed while steps S406 and S407 are executed; alternatively, steps S406 and S407 are executed first, and then step S406 is executed.
S408, calculating the fitness of the population corresponding to each verification node group based on the fitness function of the genetic algorithm aiming at the population corresponding to each verification node group.
The fitness function may refer to the above formula one, but may be other possible fitness functions.
S409, detecting whether the current continuous target number cycles all belong to the population with the highest fitness, and if yes, executing the step S411; if not, step S410 is executed.
Wherein, the target number of times can be set according to requirements.
S410, detecting that the current cycle number reaches a set number, if so, executing the step S411; if not, 1 is added to the number of cycles, and the process returns to step S404.
If there is no population (i.e., verification node group) with the highest fitness and unchanged fitness for a plurality of consecutive times, the process returns to step S404 to perform a loop, and since the next loop based on the genetic algorithm is to be entered, the loop count needs to be increased by 1.
S411, selecting the verification node group with the highest fitness from the plurality of node groups, and randomly selecting the accounting node from the verification node group with the highest fitness.
The verification node group with the highest fitness is the population with the highest fitness.
Optionally, when the accounting node is randomly selected, the verification node with the highest fitness and online may be selected as the accounting node, and online may refer to a login state currently maintained in the block chain, and the like.
It can be understood that after the online node is randomly selected as the accounting node generated by the block for one time, the accounting node generated by the block for the next time can be randomly selected again by using the scheme of the present application.
For the convenience of understanding the benefits of the embodiments of the present application, the following description is made in conjunction with the simulation results.
The first row is the total number of nodes in the different block chains, as in table 1 below.
The second row in table 1 is to determine the average maximum hop count of the accounting node required for transmitting information by using a "one-dimensional random method" for the block chain containing different total numbers of nodes, where the "one-dimensional random method" is a conventional method for only randomly selecting the accounting node.
And the third line is the average maximum hop count required by the accounting node for transmitting information after the accounting node is selected by combining the genetic algorithm for the block chain containing different node total numbers.
TABLE 1
Comparing the average maximum hop count under the two methods, by adopting the block chain accounting node selection method, the average maximum hop count required by the selected accounting node to transmit information to the whole block chain network under the condition of different node total numbers is smaller than the average maximum hop count corresponding to the accounting node determined by adopting the traditional one-dimensional random number method.
Meanwhile, the larger the node hop count, the larger the probability of transmission error (if the error probability of each hop transmission is P, the transmission error probability of n hops is 1- (1-P) n ) It can be known that the accounting node determined based on the scheme of the present application is superior to the one-dimensional random number method for transmission in the block chain network transmission performance.
In addition, the second row in table 2 shows the average maximum delay of the transmission information of the accounting node determined by the conventional "one-dimensional random method" for the block chains of different total numbers of nodes, and the third row in table 2 shows the average maximum delay of the transmission information of the accounting node selected by the scheme of the present application for different block chains.
TABLE 2
Total number of nodes | 50 | 100 | 200 | 300 | 400 | 500 | 600 |
One-dimensional random method | 17.0 | 17.5 | 22.7 | 23.5 | 24.6 | 24.95 | 26.0 |
Genetic algorithm | 14.307 | 15.0 | 19.2 | 20.37 | 21.1 | 22.1 | 22.74 |
By combining the second row and the third row in table 2, the average maximum delay number under the two methods can be compared, and thus, by adopting the scheme of the present application, the average maximum delay required by the selected accounting node under the condition of different total numbers of nodes for transmitting information to the whole block chain network is less than the average maximum delay corresponding to the accounting node selected by the one-dimensional random number method. The transmission delay is a very important index for a block chain network (P2P network), and if the total number of nodes in the network is very large, the network transmission delay is also an important factor affecting the efficiency of the consensus algorithm. Therefore, the transmission delay performance of the accounting node selected based on the scheme of the application is superior to the transmission performance of the accounting node determined by the traditional one-dimensional random number method in the P2P network transmission delay performance.
The application also provides a device for selecting the block chain accounting node.
For example, referring to fig. 5, which shows a schematic structural diagram of a block chain accounting node selection apparatus according to the present application, the apparatus of this embodiment may include:
a feature determining unit 501, configured to determine a longest transmission time and a longest hop count that each node in a block chain corresponds to, where the longest transmission time of a node is a longest time that is required for the node to broadcast information to all nodes in the block chain; the maximum hop count of the node is the maximum value of the hop counts required by the node for transmitting messages to different nodes in the block chain;
a group initial selection unit 502, configured to select multiple node groups from the block chain, where each node group includes at least one node, where different node groups include different nodes, and the number of nodes in different node groups is the same;
a group expansion unit 503, configured to expand a currently existing node group based on a genetic algorithm to expand a plurality of node groups, where the number of the plurality of node groups is not less than the number of the currently existing node groups;
a fitness determining unit 504, configured to calculate, for each expanded node group, a fitness of the node group according to a longest transmission time and a largest hop count that correspond to each node in the node group, where the fitness is used to characterize a degree of efficiency of a node in the node group transmitting information to a block chain;
a group screening unit 505, configured to determine a node group with the highest current fitness when a set condition is met;
a node selecting unit 506, configured to select an accounting node from the node group with the highest fitness.
In one possible implementation, the apparatus further includes: a cycle setting unit, configured to set a cycle number to 1 when the group initial selection unit selects a plurality of node groups from the block chain;
accordingly, the setting conditions in the group screening unit include:
the cycle number reaches the set number;
or, in a plurality of node groups expanded currently, the node groups with the highest fitness exist in the continuous target number circulation;
in addition, the device for selecting the block chain accounting node further comprises:
and the cycle triggering unit is used for triggering to return to execute the group extension unit operation and adding 1 to the cycle times under the condition that the set condition is not met.
In yet another possible implementation manner, the setting conditions in the group screening unit include:
at least one node group with the fitness exceeding a set threshold exists in the plurality of nodes expanded currently.
In one possible implementation manner, the group extension unit includes:
a population mapping subunit, configured to map each node group currently existing to a population, where different node groups correspond to different populations, an individual in the population is a node group corresponding to the population, and a chromosome of the individual in the population is a node in the node group corresponding to the population;
and the group expansion subunit is used for carrying out heredity, crossover and/or variation on the current existing population based on a genetic algorithm to obtain a plurality of populations corresponding to the plurality of node groups.
Optionally, the group extension subunit includes:
a genetic subunit for inheriting a currently existing population based on a genetic algorithm;
and the cross mutation subunit is used for performing cross and/or mutation on the currently existing population based on a genetic algorithm when the current meeting of the population cross condition and/or the population mutation condition is determined according to the set cross probability and the set mutation probability.
In one possible implementation manner, the fitness determining unit includes:
the fitness calculation operator unit is used for calculating a first product of the maximum transmission time corresponding to the node and a first coefficient and a second product of the maximum hop count corresponding to the node aiming at each node in the node group, and determining the sum of the first product and the second product as the fitness of the node;
and the fitness summing subunit is used for determining the sum of the fitness corresponding to each node in the node group as the fitness of the node group.
It should be noted that, in this specification, each embodiment is described in a progressive manner, and each embodiment focuses on differences from other embodiments, and portions that are the same as and similar to each other in each embodiment may be referred to. For the device-like embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
Finally, it should also be noted that, in this document, relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, 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 a … …" does not exclude the presence of another identical element in a process, method, article, or apparatus that comprises the element.
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.
The above is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, a plurality of modifications and embellishments can be made without departing from the principle of the present invention, and these modifications and embellishments should also be regarded as the protection scope of the present invention.
Claims (10)
1. A method for selecting a block chain accounting node, comprising:
determining the longest transmission time and the largest hop count corresponding to each node in a block chain, wherein the longest transmission time of the node is the longest time required for the node to broadcast information to all nodes in the block chain; the maximum hop count of the node is the maximum value of the hop counts required by the node for transmitting messages to different nodes in the block chain;
selecting a plurality of node groups from the block chain, wherein each node group comprises at least one node, different node groups comprise different nodes, and the number of the nodes in the different node groups is the same;
expanding the currently existing node groups based on a genetic algorithm to obtain a plurality of node groups, wherein the number of the node groups is not less than the number of the currently existing node groups;
aiming at each expanded node group, calculating the fitness of the node group according to the longest transmission time and the largest hop count corresponding to each node in the node group, wherein the fitness of the node group is used for representing the degree of efficiency of the nodes in the node group for transmitting information into a block chain;
under the condition of meeting set conditions, determining a node group with the highest current fitness;
and selecting the accounting node from the node group with the highest fitness.
2. The method of block chain accounting node selection as claimed in claim 1, wherein while said selecting a plurality of node groups from the block chain, further comprising: setting the cycle number to be 1;
the setting conditions include:
the cycle times reach the set times;
or in a plurality of node groups expanded currently, the node groups with the highest fitness belong to the node groups with the highest fitness in the continuous target number circulation;
after the calculating the fitness of the node group, the method further includes:
and if the set condition is not met, returning to execute the operation of expanding the currently existing node group based on the genetic algorithm, and adding 1 to the cycle number.
3. The method of block chain accounting node selection according to claim 1, wherein the setting conditions comprise:
at least one node group with the fitness exceeding a set threshold exists in the plurality of nodes expanded currently.
4. The method for block chain accounting node selection according to claim 1, wherein the expanding a currently existing node group based on a genetic algorithm to a plurality of node groups comprises:
mapping each node group which exists currently into a population respectively, wherein different node groups correspond to different populations, individuals in the populations are the node groups corresponding to the populations, and chromosomes of the individuals in the populations are the nodes in the node groups corresponding to the populations;
and (3) carrying out heredity, crossing and/or variation on the currently existing population based on a genetic algorithm to obtain a plurality of populations corresponding to the plurality of node groups.
5. The method for block chain accounting node selection according to claim 4, wherein the heredity-based algorithm is used for heredity, crossover and/or mutation of the currently existing population, and comprises the following steps:
the method comprises the steps of (1) carrying out heredity on a population existing at present based on a genetic algorithm;
and when the current meeting of the population crossing condition and/or the population variation condition is determined according to the set crossing probability and the set variation probability, crossing and/or varying the current existing population based on the genetic algorithm.
6. The method as claimed in claim 1, wherein said calculating the fitness of the node group according to the longest transmission time and the largest hop count corresponding to each node in the node group comprises:
for each node in the node group, calculating a first product of the maximum transmission time corresponding to the node and a first coefficient, and a second product of the maximum hop count corresponding to the node and a second coefficient, and determining the sum of the first product and the second product as the fitness of the node;
and determining the sum of the fitness corresponding to each node in the node group as the fitness of the node group.
7. A block chain accounting node selection apparatus, comprising:
the system comprises a characteristic determining unit, a judging unit and a processing unit, wherein the characteristic determining unit is used for determining the longest transmission time and the longest hop count corresponding to each node in a block chain, and the longest transmission time of the node is the longest time required for the node to broadcast information to all the nodes in the block chain; the maximum hop count of the node is the maximum value of the hop counts required by the node for transmitting messages to different nodes in the block chain;
the system comprises a group initial selection unit, a group selection unit and a group selection unit, wherein the group initial selection unit is used for selecting a plurality of node groups from a block chain, each node group comprises at least one node, different node groups comprise different nodes, and the number of the nodes in the different node groups is the same;
the group expansion unit is used for expanding the currently existing node group based on a genetic algorithm to expand a plurality of node groups, and the number of the node groups is not less than that of the currently existing node groups;
a fitness determining unit, configured to calculate, for each expanded node group, a fitness of the node group according to a longest transmission time and a maximum hop count that correspond to each node in the node group, where the fitness is used to characterize a degree of efficiency of transmitting information to a block chain by a node in the node group;
the group screening unit is used for determining the node group with the highest current fitness under the condition of meeting set conditions;
and the node selection unit is used for selecting the accounting node from the node group with the highest fitness.
8. The block chain accounting node selection apparatus of claim 7, further comprising: a cycle setting unit, configured to set a cycle number to 1 when the group initial selection unit selects a plurality of node groups from the block chain;
the setting conditions in the group screening unit include:
the cycle times reach the set times;
or in a plurality of node groups expanded currently, the node groups with the highest fitness belong to the node groups with the highest fitness in the continuous target number circulation;
the block chain accounting node selection device further comprises:
and the cycle triggering unit is used for triggering to return to execute the group extension unit operation and adding 1 to the cycle times under the condition that the set condition is not met.
9. The block chain accounting node selection device of claim 7, wherein the set condition in the group filtering unit comprises:
at least one node group with the fitness exceeding a set threshold exists in the currently expanded nodes.
10. The block chain accounting node selection device of claim 7, wherein the group extension unit comprises:
a population mapping subunit, configured to map each node group currently existing to a population, where different node groups correspond to different populations, an individual in the population is a node group corresponding to the population, and a chromosome of the individual in the population is a node in the node group corresponding to the population;
and the group expansion subunit is used for carrying out heredity, crossing and/or variation on the current existing population based on a genetic algorithm to obtain a plurality of populations corresponding to the plurality of node groups.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910328952.9A CN110047004B (en) | 2019-04-23 | 2019-04-23 | Block chain accounting node selection method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910328952.9A CN110047004B (en) | 2019-04-23 | 2019-04-23 | Block chain accounting node selection method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110047004A CN110047004A (en) | 2019-07-23 |
CN110047004B true CN110047004B (en) | 2023-04-18 |
Family
ID=67278758
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910328952.9A Active CN110047004B (en) | 2019-04-23 | 2019-04-23 | Block chain accounting node selection method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110047004B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110458291A (en) * | 2019-08-09 | 2019-11-15 | 成都理工大学 | A kind of best common recognition node selecting method based on genetic algorithm |
CN112671732B (en) * | 2020-12-15 | 2022-11-22 | 中国联合网络通信集团有限公司 | Consensus method, device and system |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107580022A (en) * | 2017-08-02 | 2018-01-12 | 国家计算机网络与信息安全管理中心 | A kind of data-sharing systems and method |
CN109107166A (en) * | 2018-08-24 | 2019-01-01 | 腾讯科技(深圳)有限公司 | Mating system, device, equipment and the storage medium of virtual pet |
CN109508295A (en) * | 2018-11-14 | 2019-03-22 | 联动优势科技有限公司 | Block chain common recognition test of heuristics method, apparatus, computing device and storage medium |
CN109543075A (en) * | 2018-11-14 | 2019-03-29 | 全链通有限公司 | Block generation method and system |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20180294047A1 (en) * | 2017-03-01 | 2018-10-11 | Seqster Pdm, Inc. | Personal data marketplace for genetic, fitness, and medical information including health trust management |
-
2019
- 2019-04-23 CN CN201910328952.9A patent/CN110047004B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107580022A (en) * | 2017-08-02 | 2018-01-12 | 国家计算机网络与信息安全管理中心 | A kind of data-sharing systems and method |
CN109107166A (en) * | 2018-08-24 | 2019-01-01 | 腾讯科技(深圳)有限公司 | Mating system, device, equipment and the storage medium of virtual pet |
CN109508295A (en) * | 2018-11-14 | 2019-03-22 | 联动优势科技有限公司 | Block chain common recognition test of heuristics method, apparatus, computing device and storage medium |
CN109543075A (en) * | 2018-11-14 | 2019-03-29 | 全链通有限公司 | Block generation method and system |
Also Published As
Publication number | Publication date |
---|---|
CN110047004A (en) | 2019-07-23 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN104994021B (en) | Determine the method and device of optimal path | |
CN110047004B (en) | Block chain accounting node selection method and device | |
Chen et al. | Multicent: A multifunctional incentive scheme adaptive to diverse performance objectives for DTN routing | |
CN108882256B (en) | Method and device for optimizing coverage of wireless sensor network node | |
CN107404541B (en) | Method and system for selecting neighbor node in peer-to-peer network transmission | |
CN108287666A (en) | Date storage method and device for cloud storage environment | |
CN111431802B (en) | Block chain node communication optimization system and method | |
CN111130790A (en) | Block co-recognition method based on block chain node network | |
Wu et al. | An ant colony optimization algorithm for multi-objective clustering in mobile ad hoc networks | |
Tang et al. | Modeling gossip-based content dissemination and search in distributed networking | |
CN114330715A (en) | Intelligent ammunition co-evolution task allocation method | |
CN110049474A (en) | A kind of wireless resource allocation methods, device and base station | |
CN115018646B (en) | IP distinguishing method and system based on virtual currency public network transaction originating node | |
Bettstetter et al. | An inhomogeneous spatial node distribution and its stochastic properties | |
CN111178678B (en) | Network node importance evaluation method based on community influence | |
CN115526634A (en) | Intelligent cross-chain interaction method and system based on block chain and storage medium | |
CN111669267A (en) | Consensus mechanism configuration and endorsement strategy configuration method of block chain | |
Kim et al. | An Energy-Efficient and Scalable Routing Protocol for Distributed Wireless Sensor Networks. | |
Mohanty et al. | SATPAS: SINR-based adaptive transmission power assignment with scheduling in wireless sensor network | |
CN113438255B (en) | Multi-level Internet of things operation method and system and readable storage medium | |
Choi et al. | Energy-optimal distributed algorithms for minimum spanning trees | |
CN111768196B (en) | Transaction information confirmation method and device | |
Hajian et al. | Increasing WSN lifetime by using learning automata for optimal route selection | |
CN114997877A (en) | Network topology data analysis method of IP of virtual currency public link network transaction node, storage medium and electronic equipment | |
Hassan et al. | Performance evaluation of broadcasting strategies in cognitive radio networks |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |