The block generation method issued based on permission
Technical field
The present invention relates to block chain technical field, in particular to a kind of block generation method issued based on permission.
Background technique
Block chain technology is decentralization as a kind of anonymous, decentralization technology, essence, however in reality such as
Bit coin, the calculation power for digging mine are excessively concentrated, and the mine factory of ranking several former has concentrated the one third or so of whole calculation power, this existing
Shape has violated the original idea of block chain technology.
Also, in block chain generating process, early stage number of blocks is more not enough, and decentralization degree is not also high
In the case of, block is obtained there is also not scientific according to calculating power and dig pit completely, so that the block that early stage generates is tested in block chain
The safety of card is not high.
Summary of the invention
In view of this, the present invention provides a kind of block generation method issued based on permission.
A kind of block generation method issued based on permission comprising following steps:
The initial permission of S1, configuration wound generation block server;And configure block network protocol;
S2, receiving node for the first time block generate request when, judge node block generate request whether meet block
Network protocol generates candidate block according to block create-rule when meeting;And jump to step S3;
S3, candidate block is authenticated according to permission by wound generation block server, step is jumped to after certification passes through
Rapid S4;
S4, wound generation block server send authentication information to requesting node;Requesting node is according to authentication information to candidate regions
Block, which calculate, obtains block, and jumps to step S5;
S5, according to authority distribution rule to wound generation block server permission be adjusted, and to block corresponding node into
Row authority distribution.
In the block generation method of the present invention issued based on permission,
After the step S5 further include:
S6, receiving node again block generate request when, judge node block generate request whether meet block
Network protocol generates candidate block according to block create-rule when meeting;And jump to step S7;
S7, the node requested again send candidate block information in block network by block network protocol, obtain
The authentication information of generation block server, all block corresponding nodes is created in block network;Meet in the authentication information received pre-
Step S8 is jumped to when setting authentication condition;
S8, judge whether permission wound generation block server adjusted meets escape mechanism;The jump when meeting escape mechanism
Go to step S10;Otherwise it is adjusted according to permission of the authority distribution rule to wound generation block server, and jumps to step
S9;
S9, wound generation block server send authentication information to requesting node;Requesting node is according to authentication information to candidate regions
Block, which calculate, obtains block, and the corresponding node of block generated to this carries out authority distribution, terminates;
Candidate block calculate to candidate block by S10, requesting node according to default authentication information obtains block, and right
This corresponding node of block generated carries out authority distribution, terminates.
In the block generation method of the present invention issued based on permission,
Generating candidate block according to block create-rule in the step S6 includes:
Block generates allocation rule, calculates power recognition rule in S01, configuration candidate block generating process;
S02, block sum in allocation rule generation block chain is generated by block, and by block sum according to network address
Section is allocated each network address section of acquisition and corresponds to block pond;
Network address section where the node that S03, judgement are requested, and judge that corresponding to block pond in the network address section of place is
It is no to reach the upper limit, step S06 is jumped to when reaching the upper limit, otherwise jumps to step S04;
S04, judge whether the node of request occurs calculating power exception by calculating power recognition rule, jumped when occurring and calculating power exception
Step S06 is gone to, step S05 is otherwise jumped to;
S05, candidate block is generated according to default block create-rule information, and executes the step of jumping to step S7;
S06, the block for refusing node generate request, and terminate.
In the block generation method of the present invention issued based on permission,
Judge whether the node of request occurs calculating power including: extremely by calculating power recognition rule in the step S04
S41, it is sent to node and calculates power test program, and the calculation power test result of receiving node feedback;
S42, judge whether the node of request occurs calculating power exception according to calculation power test result.
In the block generation method of the present invention issued based on permission,
Before the step S41 further include:
The mutual exclusion rule that each network address section interior nodes generate block chain is configured according to network address section;
Corresponding node, which is configured, according to mutual exclusion rule calculates power adjustment rule;
Correspondingly, the step S42 includes:
S421, judge whether the node of request meets mutual exclusion rule, when meeting mutual exclusion rule, jump to step S5;It is no
Then jump to step S422;
S422, the calculation power that the node entry that power adjustment rule adjustment is requested is calculated according to node influence coefficient;
S423, the calculation power that coefficient obtains the node of request adjusted is influenced by calculating power, and judges request adjusted
Node calculation power whether calculate power exception.
In the block generation method of the present invention issued based on permission,
Block sum is allocated each network address section of acquisition according to network address section in the step S02 and corresponds to area
Block pond includes:
Network address is divided into the network address section of different levels;
It is corresponding that each hierarchical network address field of division acquisition is carried out to block sum according to the network address section of different levels
Block pond.
In the block generation method of the present invention issued based on permission,
It is described according to network address section configure each network address section interior nodes and generate the mutual exclusion rule of block chain include:
According to the network address section configuration node of different levels different levels network address section standard request rate;
The mutual exclusion rule of block chain is generated according to standard request rate.
In the block generation method of the present invention issued based on permission,
The step S41 includes:
S411, it is sent to node and calculates power test program, the calculation power test program includes floating-point operation, node unique identification
Code obtains program;
The calculation power test result of the feedback of S422, receiving node, the calculation power test result include floating-point operation result, section
Point unique identifier.
In the block generation method of the present invention issued based on permission,
The step S05 includes:
Using the calculation power of the node of request adjusted as contribution margin according to generation candidate block.
Advantageous effects: the block generation method of the invention issued based on permission compared with the existing technology, Neng Goushi
It is existing: candidate block to be authenticated according to permission by wound generation block server, and according to authority distribution rule to wound generation block
The permission of server is adjusted, and carries out authority distribution to block corresponding node, so that the block that early stage generates is in block chain
The safety of middle verifying is higher;And allocation rule is generated by block and generates block sum in block chain, and block sum is pressed
The each network address section of acquisition is allocated according to network address section and corresponds to block pond, and block can be carried out forcing to divide according to region
Cloth distribution avoids because the calculation power for digging mine is excessively concentrated, and the mine factory of ranking several former monopolizes the generation of most of block.
Detailed description of the invention
Fig. 1 is the block generation method flow chart provided in an embodiment of the present invention issued based on permission.
Specific embodiment
As shown in Figure 1, in embodiments of the present invention, a kind of block generation method issued based on permission comprising as follows
Step:
The initial permission of S1, configuration wound generation block server;And configure block network protocol;
By setting create generation block server so that early stage generate candidate block need by wound generation block server into
Row certification, so that the safety that the block of early stage generation is verified in block chain is higher.The block network protocol of configuration is
Wound generation block server, block corresponding node, request node between communicated required for satisfaction condition.The present invention for
The concrete form of block network protocol and with no restrictions.
S2, receiving node for the first time block generate request when, judge node block generate request whether meet block
Network protocol generates candidate block according to block create-rule when meeting;And jump to step S3;
Solve specific mathematical problem
It can be with.
S3, candidate block is authenticated according to permission by wound generation block server, step is jumped to after certification passes through
Rapid S4;
This step is the significant difference that the present embodiment is different from the prior art, in the prior art, as long as being suitble to meet pre-
If condition can generate corresponding block.But in the present embodiment, generation is candidate block, and candidate block has to
By the certification for creating generation block server.Specific, the present embodiment and without limitation of certification.
S4, wound generation block server send authentication information to requesting node;Requesting node is according to authentication information to candidate regions
Block, which calculate, obtains block, and jumps to step S5;
Optionally, requesting node carries out calculating acquisition block being certification letter according to authentication information to candidate block
The random number sent in breath comprising wound generation block server carries out candidate block by parsing the random number in authentication information
SHA512 is calculated.
S5, according to authority distribution rule to wound generation block server permission be adjusted, and to block corresponding node into
Row authority distribution.
The permission of wound generation block server is adjusted in step s 5, specially reduces the power of wound generation block server
The weighted value of limit, and authority distribution, the weighted value of the object of distribution to permission are carried out to the corresponding node of the block of generation.Adjustment
The weighted value of the permission of wound generation block server afterwards and the object of distribution are wound generation block clothes to the sum of weighted value of permission
The weighted value for the initial permission of device of being engaged in.
Optionally, successively decrease to the weighted value of the permission of wound generation block server, and can be according to the block of generation
The total amount of quantity the amplitude that weighted value successively decreases is set.
The purpose of this step is in the permission accounting for gradually decreasing wound generation block server, and the power that will create generation block server
Limit is gradually issued among the block of generation.
Through this embodiment, the block for enabling to early stage to generate passes through the certification of wound generation block server, in block chain
The safety of middle verifying is higher.
In the present embodiment, wound generation block server can be common server, its object is to according to permission to time
Constituency block is authenticated, and sends authentication information to requesting node.
In the block generation method of the present invention issued based on permission,
After the step S5 further include:
S6, receiving node again block generate request when, judge node block generate request whether meet block
Network protocol generates candidate block according to block create-rule when meeting;And jump to step S7;
S7, the node requested again send candidate block information in block network by block network protocol, obtain
The authentication information of generation block server, all block corresponding nodes is created in block network;Meet in the authentication information received pre-
Step S8 is jumped to when setting authentication condition;
Default authentication condition herein can create generation block server, Suo Youqu in the block network to send authentication information
The sum of weighted value of the corresponding permission of block corresponding node is more than or equal to default weight threshold.
S8, judge whether permission wound generation block server adjusted meets escape mechanism;The jump when meeting escape mechanism
Go to step S10;Otherwise it is adjusted according to permission of the authority distribution rule to wound generation block server, and jumps to step
S9;
By the way that escape mechanism is arranged, may be implemented when the block of generation reaches certain quantity, so that wound generation block clothes
Business device exits certification, so that balancing the safety guarantee when decentralization and very little early stage number of blocks of block chain.
Optionally, the escape mechanism is the weighted value of the weight of permission wound generation block server adjusted less than default
Threshold value.
S9, wound generation block server send authentication information to requesting node;Requesting node is according to authentication information to candidate regions
Block, which calculate, obtains block, and the corresponding node of block generated to this carries out authority distribution, terminates;
Candidate block calculate to candidate block by S10, requesting node according to default authentication information obtains block, and right
This corresponding node of block generated carries out authority distribution, terminates.
Optionally default authentication information is timestamp numerical value when candidate block generates, by default authentication information to candidate
Block carries out SHA512 calculating.
In the block generation method of the present invention issued based on permission,
Generating candidate block according to block create-rule in the step S6 includes:
Block generates allocation rule, calculates power recognition rule in S01, configuration candidate block generating process;
In the prior art, the allocation rule generated without block is gone yuan often by power size is calculated to determine generation
Node contribution margin, although the determination of contribution margin there are many mode, does not have distribution mechanism;And simple passes through calculation power
Size determines contribution margin, so that large-scale mortar businesses concentrate a large amount of high-performance computers or server to be far longer than
The calculation power of common computer is to obtain more blocks.This step, can be right by generating allocation rule, calculating power recognition rule
It distinguishes to generate and be allocated, and the mine factory running that profession digs mine can be limited to a certain extent, improve its operating cost.
S02, block sum in allocation rule generation block chain is generated by block, and by block sum according to network address
Section is allocated each network address section of acquisition and corresponds to block pond;
Optionally, block sum is allocated according to network address section and can carries out segmentation division by IP address with 1.,
Can also in such a way that 2. are combined by IP address with MAC Address or 3. by backbone network, IP Address in LAN distribution rule
Then determine.
Optionally,
Block sum is allocated each network address section of acquisition according to network address section in the step S02 and corresponds to area
Block pond includes:
Network address is divided into the network address section of different levels;
It is corresponding that each hierarchical network address field of division acquisition is carried out to block sum according to the network address section of different levels
Block pond.
In a preferred embodiment of the invention, by the way that network address to be divided into the network address section of different levels, and it is final
Divide and obtain each hierarchical network address field and correspond to block pond, for example allocation rule is as follows:
First level network address section A, B, C, and limit the upper limit of the number that A, B, C correspond to block in block pond.
Further, in the second level network address section, A is divided into a1, a2, a3, and it is corresponding to limit a1, a2, a3
The upper limit of the number of block in block pond, and can connect and be finely divided.
Preferred embodiment through the invention not only needs to meet the requirement in block pond in this hierarchical network address field, also needs
The hierarchical network address field for meeting this hierarchical network address field or more corresponds to the requirement in block pond so that block generate when pair
In limitation more the having levels property of quantity.
Optionally,
It is described according to network address section configure each network address section interior nodes and generate the mutual exclusion rule of block chain include:
According to the network address section configuration node of different levels different levels network address section standard request rate;
The mutual exclusion rule of block chain is generated according to standard request rate.
In a preferred embodiment of the invention, standard request rate is that the node requested in the hierarchical network address field accounts for all sections
The ratio value of point, standard request rate are the mutual exclusion rule for generating block chain.
Network address section where the node that S03, judgement are requested, and judge that corresponding to block pond in the network address section of place is
It is no to reach the upper limit, step S06 is jumped to when reaching the upper limit, otherwise jumps to step S04;
S04, judge whether the node of request occurs calculating power exception by calculating power recognition rule, jumped when occurring and calculating power exception
Step S06 is gone to, step S05 is otherwise jumped to;
S05, candidate block is generated according to default block create-rule information, and executes the step of jumping to step S7;
S06, the block for refusing node generate request, and terminate.
In the block generation method of the present invention issued based on permission,
Judge whether the node of request occurs calculating power including: extremely by calculating power recognition rule in the step S04
S41, it is sent to node and calculates power test program, and the calculation power test result of receiving node feedback;
S42, judge whether the node of request occurs calculating power exception according to calculation power test result.
Optionally,
Before the step S41 further include:
The mutual exclusion rule that each network address section interior nodes generate block chain is configured according to network address section;
Corresponding node, which is configured, according to mutual exclusion rule calculates power adjustment rule.
Optionally, configuring corresponding node calculation power adjustment rule according to mutual exclusion rule includes:
θ=δ1*δ2*...δn, wherein θ is that node calculates power Tuning function, δ1For node this level network address section
Standard request rate, δ2For node the network address section of a upper level standard request rate, and so on, n be node where
Total level of network address section.
In the block generation method of the present invention issued based on permission,
Before the step S41 further include:
The mutual exclusion rule that each network address section interior nodes generate block chain is configured according to network address section;
Corresponding node, which is configured, according to mutual exclusion rule calculates power adjustment rule;
Correspondingly, the step S42 includes:
S421, judge whether the node of request meets mutual exclusion rule, when meeting mutual exclusion rule, jump to step S5;It is no
Then jump to step S422;
S422, the calculation power that the node entry that power adjustment rule adjustment is requested is calculated according to node influence coefficient;
Optionally, the value of θ is that the calculation power for the node entry requested influences coefficient.
S423, the calculation power that coefficient obtains the node of request adjusted is influenced by calculating power, and judges request adjusted
Node calculation power whether calculate power exception.
Calculation power of the product of the calculation power of calculation power influence coefficient and the node of request as the node of request adjusted.
Optionally, power outlier threshold is calculated in setting, by the calculation power of the node of request adjusted and calculates the progress of power outlier threshold
Comparison then confirms that the calculation power of the node of request adjusted is abnormal if it is greater than power outlier threshold is calculated.
In the block generation method of the present invention issued based on permission,
The step S41 includes:
S411, it is sent to node and calculates power test program, the calculation power test program includes floating-point operation, node unique identification
Code obtains program;
The calculation power test result of the feedback of S422, receiving node, the calculation power test result include floating-point operation result, section
Point unique identifier.
In the block generation method of the present invention issued based on permission,
The step S05 includes:
Using the calculation power of the node of request adjusted as contribution margin according to generation candidate block.
Advantageous effects: the block generation method of the invention issued based on permission compared with the existing technology, Neng Goushi
It is existing: by being authenticated according to permission to candidate block by wound generation block server, and according to authority distribution rule to wound generation
The permission of block server is adjusted, and carries out authority distribution to block corresponding node, so that the block that early stage generates is in area
The safety verified in block chain is higher;And allocation rule is generated by block and generates block sum in block chain, and block is total
Number is allocated each network address section of acquisition according to network address section and corresponds to block pond, can carry out to block according to region strong
System distribution distribution avoids because the calculation power for digging mine is excessively concentrated, and the mine factory of ranking several former monopolizes the generation of most of block.
It is understood that for those of ordinary skill in the art, can do in accordance with the technical idea of the present invention
Various other changes and modifications out, and all these changes and deformation all should belong to the protection model of the claims in the present invention
It encloses.