CN110309366A - A kind of asynchronous sort method and device based on micro- real number - Google Patents

A kind of asynchronous sort method and device based on micro- real number Download PDF

Info

Publication number
CN110309366A
CN110309366A CN201810171314.6A CN201810171314A CN110309366A CN 110309366 A CN110309366 A CN 110309366A CN 201810171314 A CN201810171314 A CN 201810171314A CN 110309366 A CN110309366 A CN 110309366A
Authority
CN
China
Prior art keywords
stored
data
target data
target
value
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.)
Granted
Application number
CN201810171314.6A
Other languages
Chinese (zh)
Other versions
CN110309366B (en
Inventor
毕伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhong Si Bo An Technology (beijing) Co Ltd
Original Assignee
Zhong Si Bo An Technology (beijing) Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Zhong Si Bo An Technology (beijing) Co Ltd filed Critical Zhong Si Bo An Technology (beijing) Co Ltd
Priority to CN201810171314.6A priority Critical patent/CN110309366B/en
Publication of CN110309366A publication Critical patent/CN110309366A/en
Application granted granted Critical
Publication of CN110309366B publication Critical patent/CN110309366B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/901Indexing; Data structures therefor; Storage structures
    • G06F16/9024Graphs; Linked lists
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)
  • Time Recorders, Dirve Recorders, Access Control (AREA)

Abstract

This application discloses a kind of asynchronous sort methods and device based on micro- real number, each node carries out independent common recognition to the sequence of each data to be stored in the data to be stored for the system that continuously enters in block chain, guarantees that each node reaches consistent in the voting process of sequence common recognition using default convergent function.Different results is generated for the common recognition of different data to be stored, when obtaining the voting results of the multiple data to be stored of batch, the each data to be stored of present lot is ranked up according to the voting results of each data to be stored of present lot, obtains the ranking results of present lot data to be stored;After nodes all in block chain reach common understanding to the ranking results of present lot data to be stored, present lot data to be stored is stored according to the ranking results of present lot data to be stored, and then during taking turns concurrent common recognition more, it synchronizes to synchronize each wheel and be ranked up, realize in the asynchronous system of high concurrent and data to be stored is stored.

Description

A kind of asynchronous sort method and device based on micro- real number
Technical field
The present invention relates to block chain technical field, more particularly to a kind of asynchronous sort method based on micro- real number and Device.
Background technique
For asynchronous system, because each node is there are the received otherness of information, the generation time of data can not The final sequence of unique determination data.Current block catenary system is comprised the concrete steps that what multiple data were ranked up: by any One node takes several data to be packaged into block and synchronizes between node, guarantees each section by consistency algorithm (also referred to as knowing together) Point receives and confirms that the data are effective, and each node is logged into local block chain copy.After completing epicycle operation, with Machine removes one group of data and knows together, until data are all taken out, completes sequence.Since it is desired that guaranteeing that the stabilization of data-link has Sequence, the initial rules of block catenary system require the latter block to need abstract (such as Hash comprising previous block before common recognition Value).
It follows that the actual sequence of data is to be determined the time for completing to know together to it according to each node.It is each A block must include the abstract of previous block, and the chain data structure to guarantee block catenary system is stable and unique.For Any to disclose block catenary system, when previous block does not generate, the latter block can not be handled and be generated, this just makes Total system can only handle a block within the unit time.Therefore, the above method can not be applied to the asynchronous system of high concurrent In.
Summary of the invention
In view of this, solving asynchronous system the present invention provides a kind of asynchronous sort method and device based on micro- real number The processing of middle large-scale concurrent request, and the sequencing problem of data in such circumstances.
In order to achieve the above-mentioned object of the invention, specific technical solution provided by the invention is as follows:
A kind of asynchronous sort method based on micro- real number is applied to any one node in block chain, which comprises
The basic data for the target data to be stored that any node is sent in block chain is received, generation carries the target The first round of voting data of the target data to be stored of the first round recommended value of data to be stored, and the target is waited depositing The first round of voting data communication of data is stored up to other nodes, the target data to be stored is any number to be stored in block chain According to;
The r for receiving the target data to be stored that any node is sent in block chain takes turns polled data, 1 < r≤R, R Number is taken turns for default highest ballot, when in the quantity and block chain of the target data to be stored r wheel polled data received The ratio of whole number of nodes reaches when presetting minimum ballot ratio, obtains the target data to be stored r wheel polled data Set;
Take turns whether the judgement of polled data set currently meets end to the target according to the target data to be stored r The condition of data to be stored ballot;
If so, calculating the mesh according to default convergent function and target data to be stored r wheel polled data set The common recognition final value of data to be stored is marked, the common recognition final value for carrying the target data to be stored is generated and the target waits storing Data r takes turns the voting results of the target data to be stored of polled data set, and by the target data to be stored Voting results are communicated to other nodes;
If it is not, taking turns polled data set and the default convergent function according to the target data to be stored r, institute is calculated (r+1) wheel recommended value for stating target data to be stored generates (r+1) wheel suggestion for carrying the target data to be stored (r+1) of the target data to be stored of value and target data to be stored r wheel polled data set takes turns votes According to, and (r+1) of target data to be stored wheel polled data is communicated to other nodes;
When obtaining the voting results of the multiple data to be stored of batch, according to each data to be stored of present lot Ballot final value is ranked up each data to be stored of present lot, obtains the ranking results of present lot data to be stored;
After nodes all in block chain reach common understanding to the ranking results of present lot data to be stored, according to current batch The ranking results of secondary data to be stored store present lot data to be stored.
Preferably, the method also includes:
The target data to be stored is encrypted according to own private key, obtains the label to the target data to be stored Name, and the signature to the target data to be stored, own public key and the target data to be stored are packaged, and are obtained described The basic data of data to be stored.
Optionally, the target for generating the first round recommended value for carrying the target data to be stored waits storing The first round of voting data of data, wherein generate the first round recommended value of the target data to be stored, comprising:
The timestamp of the target data to be stored is determined as to the first round recommended value of the target data to be stored, institute State the time that the timestamp of target data to be stored receives the target data to be stored for respective nodes.
Optionally, the target for generating the first round recommended value for carrying the target data to be stored waits storing The first round of voting data of data, wherein generate the first round recommended value of the target data to be stored, comprising:
A random integers are generated according to random function, the random integers are determined as the target data to be stored First round recommended value.
Optionally, the target for generating the first round recommended value for carrying the target data to be stored waits storing The first round of voting data of data, wherein generate the first round recommended value of the target data to be stored, comprising:
It generates a random integers with random function to the total amount of data that current time saves to sum, be expanded number According to number, growth data number is determined as to the first round recommended value of the target data to be stored.
Preferably, the target for generating the first round recommended value for carrying the target data to be stored waits storing The first round of voting data of data, comprising:
To the first round recommended value of own public key, the target data to be stored, the target data to be stored first The signature and the target data to be stored information for taking turns recommended value are packaged, and obtain encapsulation package;
The encapsulation package is encrypted according to own private key, obtains the signature of the encapsulation package;
According to the signature of the encapsulation package and the encapsulation package, the first round of voting number of the target data to be stored is generated According to.
Optionally, take turns whether the judgement of polled data set currently meets end pair according to the target data to be stored r The condition of the target data to be stored ballot:
Each recommended value in the target data to be stored r wheel polled data set is extracted, the target is formed and waits depositing It stores up data r wheel and suggests value set;
The difference that the target data to be stored r wheel suggests maximum recommended value and minimum recommended value in value set is calculated, Obtain the first difference;
It extracts the target data to be stored and respectively takes turns each recommended value in polled data set, form the target and wait storing Data, which are respectively taken turns, suggests value set;
The target data to be stored being calculated, which is respectively taken turns, suggests maximum recommended value and minimum recommended value in value set Difference obtains the second difference;
Calculate the ratio of first difference Yu second difference;
Judge whether first difference and the ratio of second difference are greater than default convergency value;
If so, determining the condition for being currently unsatisfactory for terminating to vote to the target data to be stored;
If it is not, determining the current condition for meeting and terminating to vote the target data to be stored.
Optionally, take turns whether the judgement of polled data set currently meets end pair according to the target data to be stored r The condition of the target data to be stored ballot:
Each recommended value in the target data to be stored r wheel polled data set is extracted, the target is formed and waits depositing It stores up data r wheel and suggests value set;
The 1- α confidence area that the target data to be stored r wheel suggests value set is calculated according to default convergent function Between, and the difference of the 1- α confidence interval upper limit and 1- α lower limit of confidence interval is calculated, obtain third difference;
It extracts the target data to be stored and respectively takes turns each recommended value in polled data set, form the target and wait storing Data, which are respectively taken turns, suggests value set;
The target data to be stored being calculated according to default convergent function respectively takes turns the 1- α confidence area for suggesting value set Between, and the difference that each wheel suggests the 1- α confidence interval upper and lower bound of value set is calculated, obtain the 4th difference;
Calculate the ratio of the third difference Yu the 4th difference;
Judge whether the third difference and the ratio of the 4th difference are greater than default convergency value;
If so, determining the condition for being currently unsatisfactory for terminating to vote to the target data to be stored;
If it is not, determining the current condition for meeting and terminating to vote the target data to be stored.
A kind of asynchronous collator based on micro- real number, comprising:
First round of voting data generating unit, for receiving the target data to be stored of any node transmission in block chain Basic data generates the first of the target data to be stored for the first round recommended value for carrying the target data to be stored Polled data is taken turns, and by the first round of voting data communication of the target data to be stored to other nodes, the target waits depositing Storing up data is any data to be stored in block chain;
R takes turns polled data generation unit, for receiving the target number to be stored that any node is sent in block chain According to r take turns polled data, 1 < r≤R, R are default highest ballot wheel number, as the target data to be stored r received The ratio for taking turns whole number of nodes in the quantity and block chain of polled data reaches when presetting minimum ballot ratio, obtains the mesh It marks data to be stored r and takes turns polled data set;
Judging unit, for taking turns whether the judgement of polled data set currently meets according to the target data to be stored r Terminate the condition voted the target data to be stored;If so, triggering voting results computing unit, if it is not, triggering (r+1) Take turns polled data generation unit;
The voting results computing unit, for being thrown according to default convergent function and target data to be stored r wheel Ticket data set calculates the common recognition final value of the target data to be stored, generates the common recognition for carrying the target data to be stored The voting results of the target data to be stored of final value and target data to be stored r wheel polled data set, and will The voting results of the target data to be stored are communicated to other nodes;
(r+1) takes turns polled data generation unit, for taking turns polled data according to the target data to be stored r Set and the default convergent function calculate (r+1) wheel recommended value of the target data to be stored, and generation carries described (r+1) wheel recommended value of target data to be stored and the mesh of target data to be stored r wheel polled data set (r+1) for marking data to be stored takes turns polled data, and (r+1) of target data to be stored wheel polled data is communicated To other nodes;
Sequencing unit, for when obtaining the voting results of the multiple data to be stored of batch, according to each institute of present lot The ballot final value for stating data to be stored is ranked up each data to be stored of present lot, obtains present lot data to be stored Ranking results;
Storage unit reaches common understanding to the ranking results of present lot data to be stored for working as all nodes in block chain Afterwards, present lot data to be stored is stored according to the ranking results of present lot data to be stored.
Optionally, described device further include:
Basic data generation unit obtains pair for being encrypted according to own private key to the target data to be stored The signature of the target data to be stored, and the signature, own public key and the target of the target data to be stored are waited depositing Storage data are packaged, and obtain the basic data of the data to be stored.
Optionally, the first round of voting data generating unit includes:
First recommended value generates subelement, waits for for the timestamp of the target data to be stored to be determined as the target The first round recommended value of storing data, the timestamp of the target data to be stored receive the target for respective nodes and wait depositing Store up the time of data.
Optionally, the first round of voting data generating unit includes:
Second recommended value generates subelement, for generating a random integers according to random function, by the random integers It is determined as the first round recommended value of the target data to be stored.
Optionally, the first round of voting data generating unit includes:
Third recommended value generates subelement, total amount of data for being saved to current time and random function generate one with Machine integer is summed, and be expanded data number, and growth data number is determined as the target data to be stored First round recommended value.
Preferably, the first round of voting data generating unit includes:
Subelement is encapsulated, is waited for for first round recommended value, the target to own public key, the target data to be stored The signature of the first round recommended value of storing data and the target data to be stored information are packaged, and obtain encapsulation package;
Encryption sub-unit operable obtains the signature of the encapsulation package for encrypting according to own private key to the encapsulation package;
Polled data generates subelement and generates the target for the signature according to the encapsulation package and the encapsulation package The first round of voting data of data to be stored.
Optionally, the judging unit includes:
First extracts subelement, for extracting each suggestion in the target data to be stored r wheel polled data set Value forms the target data to be stored r wheel and suggests value set;
First computation subunit suggests maximum recommended value in value set for calculating the target data to be stored r wheel With the difference of minimum recommended value, the first difference is obtained;
Second extracts subelement, respectively takes turns each suggestion in polled data set for extracting the target data to be stored Value forms the target data to be stored and respectively takes turns and suggests value set;
Second computation subunit, the target data to be stored for being calculated, which is respectively taken turns, to be suggested most building in large scale in value set The difference of view value and minimum recommended value, obtains the second difference;
Third computation subunit, for calculating the ratio of first difference Yu second difference;
First judgment sub-unit, for judging whether first difference and the ratio of second difference are greater than default receipts Hold back value;If so, triggering first determines subelement, if it is not, triggering second determines subelement;
Described first determines subelement, the item for determining currently to be unsatisfactory for terminating voting to the target data to be stored Part;
Described second determines subelement, currently meets the item for terminating to vote the target data to be stored for determining Part.
Optionally, the judging unit includes:
First extracts subelement, for extracting each suggestion in the target data to be stored r wheel polled data set Value forms the target data to be stored r wheel and suggests value set;
4th computation subunit is built for the target data to be stored r wheel to be calculated according to default convergent function The 1- α confidence interval of value set is discussed, and calculates the difference of the 1- α confidence interval upper limit and 1- α lower limit of confidence interval, it is poor to obtain third Value;
Second extracts subelement, respectively takes turns each suggestion in polled data set for extracting the target data to be stored Value forms the target data to be stored and respectively takes turns and suggests value set;
5th computation subunit, the target data to be stored for being calculated according to default convergent function, which is respectively taken turns, builds The 1- α confidence interval of value set is discussed, and calculates the difference that each wheel suggests the 1- α confidence interval upper and lower bound of value set, is obtained 4th difference;
6th computation subunit, for calculating the ratio of the third difference Yu the 4th difference;
Second judgment sub-unit, for judging whether the third difference and the ratio of the 4th difference are greater than default receipts Hold back value;If so, triggering first determines subelement, if it is not, triggering second determines subelement;
Described first determines subelement, the item for determining currently to be unsatisfactory for terminating voting to the target data to be stored Part;
Described second determines subelement, currently meets the item for terminating to vote the target data to be stored for determining Part.
Compared with the existing technology, beneficial effects of the present invention are as follows:
A kind of asynchronous sort method and device based on micro- real number provided by the invention, each node is to continuous in block chain Sequence into each data to be stored in the data to be stored of system carries out independent common recognition, is guaranteed using default convergent function every A node reaches consistent in the voting process of sequence common recognition.For different data to be stored common recognition generate it is different as a result, When obtaining the voting results of the multiple data to be stored of batch, according to the voting results of each data to be stored of present lot The each data to be stored of present lot is ranked up, the ranking results of present lot data to be stored are obtained;When in block chain After all nodes reach common understanding to the ranking results of present lot data to be stored, according to the sequence of present lot data to be stored As a result present lot data to be stored is stored, and then during taking turns concurrent common recognition more, is synchronized to each same stepping of wheel Row sequence, realizes in the asynchronous system of high concurrent and stores to data to be stored.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this The embodiment of invention for those of ordinary skill in the art without creative efforts, can also basis The attached drawing of offer obtains other attached drawings.
Fig. 1 is a kind of asynchronous sort method flow chart based on micro- real number disclosed by the embodiments of the present invention;
Fig. 2 is whether a kind of judgement disclosed by the embodiments of the present invention currently meets end to target data to be stored throwing The method flow diagram of the condition of ticket;
Fig. 3 is whether another judgement disclosed by the embodiments of the present invention currently meets end to the target data to be stored The method flow diagram of the condition of ballot;
Fig. 4 is { V in scene embodiment of the present inventionj(r+1) } with { Ci(r) } relation schematic diagram between;
Fig. 5 is flow diagram of knowing together in scene embodiment of the present invention;
Fig. 6 is that each node shows the ranking results of same batch data to be stored in cluster in scene embodiment of the present invention It is intended to;
Fig. 7 is that minimum ballot ratio s illustrates the influence (malfunctioning node accounting 10%) of common recognition number in A scene of the present invention Figure;
Fig. 8 is that minimum ballot ratio s illustrates the influence (malfunctioning node accounting 33%) of common recognition number in B scene of the present invention Figure;
Fig. 9 is that minimum ballot ratio s illustrates the influence (malfunctioning node accounting 40%) of common recognition number in C scene of the present invention Figure;
Figure 10 is that minimum ballot ratio s shows the influence (malfunctioning node accounting 49%) of common recognition number in D scene of the present invention It is intended to;
Figure 11 is 2 transaction sorting in parallel initial data distribution schematic diagram of E scene of the present invention;
Figure 12 is data distribution schematic diagram after the 2 transaction sorting in parallel first round of voting of E scene of the present invention;
Figure 13 is that 2 transaction sorting in parallel of E scene of the present invention completes data distribution schematic diagram after common recognition;
Figure 14 is a kind of asynchronous collator structural schematic diagram based on micro- real number disclosed by the embodiments of the present invention.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete Site preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other Embodiment shall fall within the protection scope of the present invention.
Referring to Fig. 1, being applied to appoint in block chain present embodiment discloses a kind of asynchronous sort method based on micro- real number Anticipate a node, the method specifically includes the following steps:
S101: receiving the basic data for the target data to be stored that any node is sent in block chain, generates and carries State the first round of voting data of the target data to be stored of the first round recommended value of target data to be stored, and by the mesh The first round of voting data communication of data to be stored is marked to other nodes;
The target data to be stored is any data to be stored in block chain;
Communication can be multiple communication modes, and such as unicast (1 node is to 1 node), (1 node is to multiple sections for multicast Point) and broadcast (1 node is to whole nodes).
It should be noted that in S101 foregoing description method further include:
The target data to be stored is encrypted according to own private key, obtains the label to the target data to be stored Name, and the signature to the target data to be stored, own public key and the target data to be stored are packaged, and are obtained described The basic data of data to be stored.
Each node includes corresponding public key and private key, and the public key of each node is different, and the private key of each node is not yet Together.
Generate the first round recommended value of the target data to be stored method can there are many, present embodiments provide with Lower three kinds of methods:
Mode one
The timestamp of the target data to be stored is determined as to the first round recommended value of the target data to be stored, institute State the time that the timestamp of target data to be stored receives the target data to be stored for respective nodes.
Mode two
A random integers are generated according to random function, the random integers are determined as the target data to be stored First round recommended value.
Mode three
It generates a random integers with random function to the total amount of data that current time saves to sum, be expanded number According to number, growth data number is determined as to the first round recommended value of the target data to be stored.
The number etc. for the maximum data block that the total amount of data that current time saves can save for the node, the present invention It is not limited thereto.
The target data to be stored for generating the first round recommended value for carrying the target data to be stored First round of voting data, comprising:
To the first round recommended value of own public key, the target data to be stored, the target data to be stored first The signature and the target data to be stored information for taking turns recommended value are packaged, and obtain encapsulation package;
The encapsulation package is encrypted according to own private key, obtains the signature of the encapsulation package;
According to the signature of the encapsulation package and the encapsulation package, the first round of voting number of the target data to be stored is generated According to.
It should be noted that target data to be stored information can be complete target data to be stored, it is more in order to reduce The consumption that node is voted to network bandwidth, target data to be stored information may be the abstract of target data to be stored, that is, count The cryptographic Hash for calculating target data to be stored, obtains the abstract of target data to be stored, achievees the purpose that compressed data.
S102: the r for receiving the target data to be stored that any node is sent in block chain takes turns polled data, when connecing The quantity of the target data to be stored r wheel polled data received and the ratio of number of nodes whole in block chain reach pre- If when minimum ballot ratio, obtaining the target data to be stored r wheel polled data set;
1 < r≤R, R is default highest ballot wheel number.
When system starts, need to preset minimum ballot ratio, for example, presetting minimum ballot ratio can be 40%.It is being It unites in operational process, can be required according to actual efficiency, after 50% or more node common recognition, adjust the minimum ballot ratio.
S103: take turns whether the judgement of polled data set currently meets end to institute according to the target data to be stored r State the condition of target data to be stored ballot;If so, S104 is executed, if it is not, executing S105;
Wherein, referring to Fig. 2, a kind of preferred embodiment of S103 the following steps are included:
S201: each recommended value in the target data to be stored r wheel polled data set is extracted, the target is formed Data to be stored r wheel suggests value set;
S202: it calculates the target data to be stored r wheel and suggests maximum recommended value and minimum recommended value in value set Difference obtains the first difference;
S203: it extracts the target data to be stored and respectively takes turns each recommended value in polled data set, form the target Data to be stored, which is respectively taken turns, suggests value set;
S204: the target data to be stored being calculated, which is respectively taken turns, suggests maximum recommended value and minimum suggestion in value set The difference of value obtains the second difference;
S205: the ratio of first difference and second difference is calculated;
S206: judge whether first difference and the ratio of second difference are greater than default convergency value;
If so, executing S207, S207: determining the condition for being currently unsatisfactory for terminating to vote to the target data to be stored;
If it is not, executing S208, S208: determining the current condition for meeting and terminating to vote the target data to be stored.
Wherein, referring to Fig. 3, a kind of preferred embodiment of S103 the following steps are included:
S301: each recommended value in the target data to be stored r wheel polled data set is extracted, the target is formed Data to be stored r wheel suggests value set;
S302: the target data to be stored r wheel is calculated according to default convergent function and suggests that the 1- α of value set is set Believe section, and calculate the difference of the 1- α confidence interval upper limit and 1- α lower limit of confidence interval, obtains third difference;
S303: it extracts the target data to be stored and respectively takes turns each recommended value in polled data set, form the target Data to be stored, which is respectively taken turns, suggests value set;
S304: the target data to be stored being calculated according to default convergent function respectively takes turns the 1- α for suggesting value set Confidence interval, and the difference that each wheel suggests the 1- α confidence interval upper and lower bound of value set is calculated, obtain the 4th difference;
S305 calculates the ratio of the third difference Yu the 4th difference;
S306: judge whether the third difference and the ratio of the 4th difference are greater than default convergency value;
If so, executing S307, S307: determining the condition for being currently unsatisfactory for terminating to vote to the target data to be stored;
If it is not, executing S308, S308: determining the current condition for meeting and terminating to vote the target data to be stored.
Wherein, 1- α is determined according to practical application, and general 1- α value is 95% or 99.7%;
Wherein, the upper and lower bound of 1- α confidence interval is obtained according to the specific confidence interval calculation formula of default convergent function It arrives, can not such as determine upper and lower bound, the methods of bootstrap can be used and estimated.
Each node can carry out primary sampling in each round to get the ballot value for arriving a part of node previous round.Definition The ballot value that r-1 takes turns whole nodes is that totally, it is sample that some node, which obtains ballot value in r wheel sampling,.Then in sample Whole ballot values are overall a part, i.e., overall to completely include sample, are calculated on this basis according to default convergent function The target data to be stored arrived respectively takes turns the confidence interval for suggesting value set.
It should also be noted that, when ballot wheel number has reached default highest ballot wheel number R, then it is assumed that currently meeting terminates To the condition of target data to be stored ballot.
S104: the mesh is calculated according to default convergent function and target data to be stored r wheel polled data set The common recognition final value of data to be stored is marked, the common recognition final value for carrying the target data to be stored is generated and the target waits storing Data r takes turns the voting results of the target data to be stored of polled data set, and by the target data to be stored Voting results are communicated to other nodes;
Default convergent function has convergence, can be median function, average function, n times evolution function etc..
The input data of default convergent function is specially combined into target data to be stored r wheel polled data collection, Export the common recognition final value of the target data to be stored.
S105: polled data set and the default convergent function are taken turns according to the target data to be stored r, calculate institute (r+1) wheel recommended value for stating target data to be stored generates (r+1) wheel suggestion for carrying the target data to be stored (r+1) of the target data to be stored of value and target data to be stored r wheel polled data set takes turns votes According to, and (r+1) of target data to be stored wheel polled data is communicated to other nodes;
The input data for suggesting that value set is default convergent function is specially taken turns with the target data to be stored r, it is defeated (r+1) of the target data to be stored takes turns recommended value out.
It is described to generate (r+1) the wheel recommended value and the target data to be stored for carrying the target data to be stored (r+1) that r takes turns the target data to be stored of polled data set takes turns polled data, packet
Recommended value, the target data to be stored r are taken turns to (r+1) of own public key, the target data to be stored Take turns polled data set, the signature of (r+1) wheel recommended value of the target data to be stored and the target data to be stored Information is packaged, and obtains encapsulation package;
The encapsulation package is encrypted according to own private key, obtains the signature of the encapsulation package;
According to the signature of the encapsulation package and the encapsulation package, (r+1) wheel for generating the target data to be stored is thrown Ticket data.
S106: each described wait store according to present lot when obtaining the voting results of the multiple data to be stored of batch The ballot final value of data is ranked up each data to be stored of present lot, obtains the sequence knot of present lot data to be stored Fruit;
S107: after nodes all in block chain reach common understanding to the ranking results of present lot data to be stored, according to The ranking results of present lot data to be stored store present lot data to be stored.
A kind of asynchronous sort method based on micro- real number disclosed in the present embodiment, each node is to continuously entering in block chain The sequence of each data to be stored carries out independent common recognition in the data to be stored of system, guarantees each section using default convergent function Point reaches consistent in the voting process of sequence common recognition.The common recognition of different data to be stored is generated different as a result, working as To the multiple data to be stored of batch voting results when, according to the voting results of each data to be stored of present lot to working as The preceding each data to be stored of batch is ranked up, and obtains the ranking results of present lot data to be stored;When all in block chain After node reaches common understanding to the ranking results of present lot data to be stored, according to the ranking results of present lot data to be stored Present lot data to be stored is stored, and then during taking turns concurrent common recognition more, is synchronized to each wheel row of synchronization Sequence is realized in the asynchronous system of high concurrent and is stored to data to be stored.
By the invention it is possible to account for total number in improper node (containing malicious node and malfunctioning node) quantity and be no more than In 50% system, effective common recognition of normal node is completed.Meanwhile because its with preposition node without direct correlation, may be implemented Parallel processing, and then achieve the purpose that improve block catenary system handling capacity.
In order to which a kind of asynchronous sort method based on micro- real number disclosed in the present embodiment is further described, below by way of one Specific scene embodiment is illustrated.
Scene embodiment
1. the preparation stage
This stage is mainly used for for transaction data Tx being changed into the basic data for being used for the subsequent ballot stage.Specific implementation side Method is as follows:
As any node N in block chainaIt, should be by transaction data after initiating transaction or receiving the transaction of client submission Tx, node NaPublic key PbaAnd node NaTo the ciphering signature S of transactiona=S (Tx, Pva) transaction packing, basis of formation data Ra=[Pba,Sa, Tx], and by RaIt communicates to other nodes, wherein PvaFor node NaPrivate key.
2. the initially ballot stage
This stage generates the initial data for ballot.In order to reduce the consumption that multinode is voted to network bandwidth, here Target data to be stored information is H (Tx), that is, the abstract of target data to be stored Tx achievees the purpose that compressed data.It is initial to throw Ticket concrete methods of realizing is as follows:
As any node N in block chaini(public key Pbi, private key Pvi) receive communication data Ra, and verify RaIt is node NaAfter the valid data of sending, the first round recommended value V of oneself should be launchedi(1)。Vi(1) it can be generated by the first round recommended value One of method determines that the method should be selected before system building, if midway is changed, needs to know together by whole nodes and approve After carry out.This example is in mode two as an example.ViIt (1) is that a random integers are generated by random function, then by Vi(1), itself is public Key PbiIt is packaged and is signed, form first round of voting data Ti(1)=[Pbi,Si(1),Vi(1), H (Tx)] wherein, Si(1) =(Vi(1),Pbi), then by Ti(1), and to Ti(1) signature is communicated to other nodes.
3. recycling the ticket checking stage
Each node will vote to the sequence of block in block chain, to determine the serial number of the block.This stage is multiple Circulation, until terminating after meeting condition.Concrete methods of realizing is as follows:
For the arbitrary node N in systemj, it is assumed that its r wheel polled data for receiving other nodes is { Ti(r)},(i =1,2 ..., n;n≤Nmax) wherein, NmaxFor maximum node quantity in block chain.Then corresponding recommended value array is { Vi (r) }, (i=1,2 ..., n;n≤Nmax).Reach s (such as s=in whole number of nodes accountings when receiving ballot number of nodes 40%) when, that is, it can produce the next round recommended value V of the nodej(r+1)=U { Vi(r) }, (i=1,2 ..., n;n≥s*Nmax).This example is by taking default convergent function is median function as an example, U { Vi(r) } recommended value array { V is indicatedi(r)} Median.When i is even number, { CiIt (r) } is { Vi(r) } data set sequentially formed again according to size, then { Vj(r+1) } with {Ci(r) } relationship between is as shown in Figure 5.
Second ballot data set { T is generated according to identical method lateri(r+1) }, (i=1,2 ..., n;n≤ Nmax), and communicate to other nodes, so recycle.
For any one node, maximum value Max { V such as is taken turns in riAnd minimum M in { V (r) }i(r) } difference Range (r) and the node receive this whole round transaction ballot maximum value Max { Vi(k) }, (k=1,2 ..., r) and most Small value Min { Vi(k) }, (ratio of k=1,2 ..., difference Range (all) r) are less than setting value ε, i.e., Then think for this transaction, whole nodes have been reached an agreement in system, and by final value Result=U { Vi(r) } it communicates to other Node.
3. cluster is known together the stage
For a transaction (data to be stored), each node can trade to this and generate a voting results, it is assumed that this The target value of a voting results is N.
For node in cluster after micro- real number sequence common recognition, the voting results that each node finally obtains may not be equal to N, But it can fall within this section [(1-E/2) * N, (1+E/2) * N].
This section is considered as a point, then each nonoverlapping point will generate sequence for repeatedly trading.This Sequence is consistent between each node.
Referring to Fig. 6, Fig. 6 is each node in cluster to the ranking results schematic diagram of same batch data to be stored.Its In, intermediate number is exactly the ballot final value of each node.As a result may not be completely the same, but by control error E, it can make to collect Within the scope of result in group converges to centainly.In this way the sequence of Tx1Tx2Tx3Tx4 actually between each node just Reach an agreement.Ranking results as Tx2Tx1Tx3Tx4 are that each node is approved.
Based on above-mentioned scene embodiment, the asynchronous sort method based on micro- real number disclosed in the present embodiment has following excellent Point:
Extending up property: such as default convergent function uses average average function, then the node for participating in operation is got over More, Data Convergence is better.Number of nodes is more, then the scalability of distributed system is stronger, solves the common recognition of large scale network Problem.
Strong fault tolerance: such as default convergent function uses median Median function, then participates in the numerical value large and small two of operation End edge edge value will not influence final result, so that the pernicious ballot of a small number of nodes is easily foreclosed by common recognition mechanism
Be changed into continuous type by traditional discrete type ballot: in traditional common recognition algorithm ballot, each node is to data Ballot be " agreements " or " refusal ", i.e., it is non-zero be 1 discrete data.This method under particular circumstances, can generate " same Meaning " the ticket opposition situation equal with " refusal " ticket, cause node can not definitive result, vote process be blocked.It is arranged in micro- real number Sequence is known together in algorithm, and ballot is innovatively changed to the ballot of continuous type real number by us, makes the feelings being blocked in traditional algorithm Condition has obtained effective solution.
Performance is adjustable: micro- real number sequence common recognition agreement provides default convergency value ε, minimum ballot ratio s, highest ballot The parameters such as wheel number R are for controlling the efficiency of agreement.For different application environments, different parameter configurations can be used, And the parameter adjusts in common recognition agreement operational process in combination with system operation situation in due course.Such as, node size is small, concurrent journey It spends under low environment, when convergence range ε=1, S=100%, R=2 are set, according to algorithm principle, micro- real number sequence common recognition agreement Degenerating is tradition PBFT, and performance is consistent with PBFT, and serious forgiveness is no more than 33%.Node size is larger, degree of concurrence is high Under environment, if transmitted data on network amount rises exponentially grade using PBFT algorithm, performance decline even network is ultimately caused Blocking.And use micro- real number sequence common recognition agreement that parameter ε=0.1%, S=60%, R=20, micro- real number sequence then can be set Agreement of knowing together can stable operation in environment of the malfunctioning node no more than 50%, that is, provide it is maximum be no more than 50% serious forgiveness, Network bandwidth consumption is more saved simultaneously.The performance of common recognition can be flexibly conditioned, and reached while being met (or compromise) section Points, safety and performance requirement.
It is energy-saving: it is extremely low to joint behavior requirement, social economy's cost can be further decreased.Low transmission expense reduces Dependence of the node to system network architecture.
Using PBFT as reference, it is assumed that system interior joint quantity is 2000.Under four kinds of different scenes, to PBFT and micro- reality The sequence effect of number sequence common recognition two schemes compares:
It is 10% that A scene malfunctioning node quantity, which accounts for population proportion, i.e., malfunctioning node is 200;
It is 33% that B scene malfunctioning node quantity, which accounts for population proportion, i.e., malfunctioning node is 660;
It is 40% that C scene malfunctioning node quantity, which accounts for population proportion, i.e., malfunctioning node quantity is 800.
It is 49% that D scene malfunctioning node quantity, which accounts for population proportion, i.e., malfunctioning node quantity is 980.
It is 10% that E scene malfunctioning node quantity, which accounts for population proportion, i.e., malfunctioning node is 200, is showed with visual means Sorting in parallel ability;
According to PBFT principle, when malfunctioning node (containing malicious node and failure node) it is overall more than 33% when, system is by nothing Method operation.I.e. in C scene and D scene, PBFT scheme is unable to run.Micro- real number sequence common recognition scheme can be by using not The effect of same minimum ballot ratio s (rising 10% every time, each s value is tested 500 times) proof scheme.
Contrasting foundation:
For degree of transitivity, in the ballot and 1 original for carrying out needing to carry out in common recognition system 2 full nodes using PBFT The transmission of beginning message.PBFT votes, and quantity is related with number of nodes n, and specific formula for calculation is 2*n* (n-1).It is arranged using micro- real number In the system of sequence common recognition, need to carry out the transmission of part of nodes ballot and 1 origination message several times, micro- real number sequence common recognition ballot Quantity wheel number r and number of nodes n needed for minimum ballot ratio s (i.e. above-mentioned to preset minimum ballot ratio), completion common recognition has It closes, specific formula for calculation r*s*n2.As 2*n* (n-1) < r*s*n2When, it is believed that micro- real number sequence common recognition is more outstanding.The formula can To be converted intoAccording to limit theorem, with the rising of number of nodes n,Institute As r*s < 2, it is believed that micro- real number sequence common recognition is more outstanding.
For common recognition as a result, being carried out in common recognition system using PBFT, population proportion is accounted in malfunctioning node quantity and is no more than When 33%, all normal nodes can be made to obtain consistent information.When malfunctioning node quantity accounts for population proportion and is more than 33%, It is consistent that PBFT not can guarantee all normal node information, it is believed that the common recognition of PBFT is failure under this condition.Using micro- In the system of real number sequence common recognition, each node can obtain a common recognition final value after common recognition, when normal node in system The difference of maxima and minima is zero (error zero) in obtained final value set, i.e. the common recognition final value of normal node is consistent, Think to reach absolute common recognition;When the difference of maxima and minima in the final value set that normal node obtains in system is less than regulation Numerical value (this number is determined that such as at most parallel 100 common recognitions, then difference is 1/100=1% by the degree of parallelism of system), this example In for 1%, i.e., error is less than 1%, it is believed that reaches opposite common recognition, is as a result similarly effective.Accordingly, micro- real number sequence common recognition System in analyze in result, error less than 1%, i.e., it is believed that micro- real number sequence common recognition effect with respect to PBFT there is no disadvantage.
Time-consuming for common recognition, no matter absolutely common recognition or opposite common recognition, micro- real number sequence common recognition can use the final value to simultaneously Row data are ranked up.And PBFT can not be ranked up, it is necessary to supplement subsequent step.Such as 100 data are ranked up, are adopted 1% the time required to being about PBFT with micro- real number sequence common recognition required time, that is, 99% time cost is saved, identification is adopted It is better than PBFT always with micro- real number sequence common recognition.
A scene
Control errors parameter E=0.01 is set, during minimum ballot ratio s gradually rises, the maximum needed is thrown Ticket round gradually declines, such as Fig. 7.As shown in Figure 7, it at most needs 5 ballots to complete to know together, determines sequence.In this feelings Under condition, for degree of transitivity, r*s=5*10%=0.5 < 2 is more preferable using micro- real number sequence common recognition effect, r*s=3*70% =2.1 > 2 are more preferable using PBFT effect;For all final results, error is much smaller than 1%.Accordingly, in minimum ballot ratio s Under setting less than 70%, PBFT is better than using micro- real number sequence common recognition;And under minimum setting of the ballot ratio s greater than 70%, Micro- real number sequence common recognition saves 99% time cost relative to PBFT.
B scene
Control errors parameter E=0.01 is set, during minimum ballot ratio s gradually rises, the maximum needed is thrown Ticket round gradually declines, such as Fig. 8, as shown in Figure 8, at most needs 4 ballots to complete to know together, determines sequence.Conclusion is in A The conclusion of scene is identical.
C scene
Control errors parameter E=0.01 is set, during minimum ballot ratio s gradually rises, the maximum needed is thrown Ticket round gradually declines, such as Fig. 8, as shown in Figure 9, at most needs 4 ballots to complete to know together, determines sequence.And for PBFT, because malfunctioning node quantity is higher than basic demand, in this environment, PBFT is unable to complete common recognition.
D scene
Because of malfunctioning node enormous amount in this scene, for the sequence effect that guarantees to know together, control errors parameter E=is set 0.00001, during minimum ballot ratio s gradually rises, the maximum ballot round needed gradually declines, such as Figure 10, by Figure 10 at most needs 6 ballots it is found that when minimum ballot ratio s is not less than 40%, it can completes common recognition, error is less than 0.5%, determine sequence.And for PBFT, because malfunctioning node quantity is higher than basic demand, in this environment, PBFT can not be complete At common recognition.
E scene
Control errors parameter E=0.01 is set, is voted parallel 2 transactions simultaneously by 2000 nodes, the first stroke The numerical value that each node is voted of trading is marked with symbol " ", and each node ballot numerical value of the second transaction is marked with symbol " x " Note.Because actually active number of nodes is 1800 containing 10% malfunctioning node.Each node is carrying out micro- real number sequence altogether Data such as Figure 11 before knowledge, data distribution such as Figure 12 after the node first round of voting, node data after third round completes ballot Distribution such as Figure 13.It can be seen from the figure that the parallel common recognition ability of micro- real number sequence common recognition makes each node to two different friendships Synchronous sequence is easily sequentially completed, final result is that the second transaction is recorded prior to the first transaction, two transactions It is effective.
By adjusting minimum ballot ratio s and control errors parameter E, it is no more than 50% for malfunctioning node accounting System, can be realized the convergence of total system.And s value is about high, number required for restraining is fewer, and effect is better.
Disclosed a kind of asynchronous sort method based on micro- real number based on the above embodiment, please refers to Figure 14, the present embodiment Correspondence discloses a kind of asynchronous collator based on micro- real number, comprising:
First round of voting data generating unit 401, for receiving the target number to be stored that any node is sent in block chain According to basic data, generate the target data to be stored for carrying the first round recommended value of the target data to be stored First round of voting data, and by the first round of voting data communication of the target data to be stored to other nodes, the target Data to be stored is any data to be stored in block chain;
R takes turns polled data generation unit 402, waits storing for receiving the target that any node is sent in block chain The r of data takes turns polled data, and 1 < r≤R, R is default highest ballot wheel number, when the target data to be stored received The ratio of whole number of nodes reaches in the quantity and block chain of r wheel polled data when presetting minimum ballot ratio, obtains institute State target data to be stored r wheel polled data set;
Whether judging unit 403 is current full for taking turns the judgement of polled data set according to the target data to be stored r Foot terminates the condition voted the target data to be stored;If so, triggering voting results computing unit 405, if it is not, triggering the (r+1) polled data generation unit 404 is taken turns;
The voting results computing unit 405, for according to default convergent function and target data to be stored r wheel Polled data set calculates the common recognition final value of the target data to be stored, and generation carries being total to for the target data to be stored Know the voting results of the target data to be stored of final value and target data to be stored r wheel polled data set, and The voting results of the target data to be stored are communicated to other nodes;
(r+1) takes turns polled data generation unit 404, votes for being taken turns according to the target data to be stored r Data acquisition system and the default convergent function, calculate (r+1) wheel recommended value of the target data to be stored, and generation carries (r+1) wheel recommended value of the target data to be stored and the institute of target data to be stored r wheel polled data set (r+1) wheel polled data of target data to be stored is stated, and (r+1) of the target data to be stored is taken turns into polled data It communicates to other nodes;
Sequencing unit 406, it is each according to present lot for when obtaining the voting results of the multiple data to be stored of batch The ballot final value of the data to be stored is ranked up each data to be stored of present lot, obtains present lot number to be stored According to ranking results;
Storage unit 407 reaches the ranking results of present lot data to be stored for working as all nodes in block chain After common recognition, present lot data to be stored is stored according to the ranking results of present lot data to be stored.
Preferably, described device further include:
Basic data generation unit obtains pair for being encrypted according to own private key to the target data to be stored The signature of the target data to be stored, and the signature, own public key and the target of the target data to be stored are waited depositing Storage data are packaged, and obtain the basic data of the data to be stored.
Preferably, the first round of voting data generating unit 401 includes:
First recommended value generates subelement, waits for for the timestamp of the target data to be stored to be determined as the target The first round recommended value of storing data, the timestamp of the target data to be stored receive the target for respective nodes and wait depositing Store up the time of data.
Preferably, the first round of voting data generating unit 401 includes:
Second recommended value generates subelement, for generating a random integers according to random function, by the random integers It is determined as the first round recommended value of the target data to be stored.
Preferably, the first round of voting data generating unit 401 includes:
Third recommended value generates subelement, total amount of data for being saved to current time and random function generate one with Machine integer is summed, and be expanded data number, and growth data number is determined as the target data to be stored First round recommended value.
Preferably, the first round of voting data generating unit 401 includes:
Subelement is encapsulated, is waited for for first round recommended value, the target to own public key, the target data to be stored The signature of the first round recommended value of storing data and the target data to be stored information are packaged, and obtain encapsulation package;
Encryption sub-unit operable obtains the signature of the encapsulation package for encrypting according to own private key to the encapsulation package;
Polled data generates subelement and generates the target for the signature according to the encapsulation package and the encapsulation package The first round of voting data of data to be stored.
Optionally, the judging unit 403 includes:
First extracts subelement, for extracting each suggestion in the target data to be stored r wheel polled data set Value forms the target data to be stored r wheel and suggests value set;
First computation subunit suggests maximum recommended value in value set for calculating the target data to be stored r wheel With the difference of minimum recommended value, the first difference is obtained;
Second extracts subelement, respectively takes turns each suggestion in polled data set for extracting the target data to be stored Value forms the target data to be stored and respectively takes turns and suggests value set;
Second computation subunit, the target data to be stored for being calculated, which is respectively taken turns, to be suggested most building in large scale in value set The difference of view value and minimum recommended value, obtains the second difference;
Third computation subunit, for calculating the ratio of first difference Yu second difference;
First judgment sub-unit, for judging whether first difference and the ratio of second difference are greater than default receipts Hold back value;If so, triggering first determines subelement, if it is not, triggering second determines subelement;
Described first determines subelement, the item for determining currently to be unsatisfactory for terminating voting to the target data to be stored Part;
Described second determines subelement, currently meets the item for terminating to vote the target data to be stored for determining Part.
Optionally, the judging unit 403 includes:
First extracts subelement, for extracting each suggestion in the target data to be stored r wheel polled data set Value forms the target data to be stored r wheel and suggests value set;
4th computation subunit is built for the target data to be stored r wheel to be calculated according to default convergent function The 1- α confidence interval of value set is discussed, and calculates the difference of the 1- α confidence interval upper limit and 1- α lower limit of confidence interval, it is poor to obtain third Value;
Second extracts subelement, respectively takes turns each suggestion in polled data set for extracting the target data to be stored Value forms the target data to be stored and respectively takes turns and suggests value set;
5th computation subunit, the target data to be stored for being calculated according to default convergent function, which is respectively taken turns, builds The 1- α confidence interval of value set is discussed, and calculates the difference that each wheel suggests the 1- α confidence interval upper and lower bound of value set, is obtained 4th difference;
6th computation subunit, for calculating the ratio of the third difference Yu the 4th difference;
Second judgment sub-unit, for judging whether the third difference and the ratio of the 4th difference are greater than default receipts Hold back value;If so, triggering first determines subelement, if it is not, triggering second determines subelement;
Described first determines subelement, the item for determining currently to be unsatisfactory for terminating voting to the target data to be stored Part;
Described second determines subelement, currently meets the item for terminating to vote the target data to be stored for determining Part.
A kind of asynchronous collator based on micro- real number disclosed in the present embodiment, each node is to continuously entering in block chain The sequence of each data to be stored carries out independent common recognition in system data to be stored, guarantees each node using default convergent function Reach consistent in the voting process of sequence common recognition.The common recognition of different data to be stored is generated different as a result, when obtaining In batches when the voting results of multiple data to be stored, according to the voting results of each data to be stored of present lot to current The each data to be stored of batch is ranked up, and obtains the ranking results of present lot data to be stored;When sections all in block chain After point reaches common understanding to the ranking results of present lot data to be stored, according to the ranking results pair of present lot data to be stored Present lot data to be stored is stored, and then during taking turns concurrent common recognition more, synchronizes and each wheel is synchronized and is ranked up, It realizes in the asynchronous system of high concurrent and data to be stored is stored.
The foregoing description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, as defined herein General Principle can be realized in other embodiments without departing from the spirit or scope of the present invention.Therefore, of the invention It is not intended to be limited to the embodiments shown herein, and is to fit to and the principles and novel features disclosed herein phase one The widest scope of cause.

Claims (16)

1. a kind of asynchronous sort method based on micro- real number, which is characterized in that it is applied to any one node in block chain, it is described Method includes:
The basic data for the target data to be stored that any node is sent in block chain is received, generation carries the target and waits depositing The first round of voting data of the target data to be stored of the first round recommended value of data are stored up, and by target number to be stored According to first round of voting data communication to other nodes, the target data to be stored is any data to be stored in block chain;
The r for receiving the target data to be stored that any node is sent in block chain takes turns polled data, and 1 < r≤R, R is pre- If highest ballot wheel number, when whole in the quantity of the target data to be stored r wheel polled data received and block chain The ratio of number of nodes reaches when presetting minimum ballot ratio, obtains the target data to be stored r wheel polled data set;
Polled data set, which is taken turns, according to the target data to be stored r judges that currently whether meet end waits depositing to the target Store up the condition of data ballot;
If so, calculating the target according to default convergent function and target data to be stored r wheel polled data set and waiting for The common recognition final value of storing data generates the common recognition final value and the target data to be stored for carrying the target data to be stored R takes turns the voting results of the target data to be stored of polled data set, and by the ballot of the target data to be stored As a result it communicates to other nodes;
If it is not, taking turns polled data set and the default convergent function according to the target data to be stored r, the mesh is calculated Mark data to be stored (r+1) take turns recommended value, generate carry the target data to be stored (r+1) wheel recommended value and (r+1) of the target data to be stored of the target data to be stored r wheel polled data set takes turns polled data, and (r+1) wheel polled data of the target data to be stored is communicated to other nodes;
When obtaining the voting results of the multiple data to be stored of batch, according to the ballot of each data to be stored of present lot Final value is ranked up each data to be stored of present lot, obtains the ranking results of present lot data to be stored;
After nodes all in block chain reach common understanding to the ranking results of present lot data to be stored, waited for according to present lot The ranking results of storing data store present lot data to be stored.
2. the method according to claim 1, wherein the method also includes:
The target data to be stored is encrypted according to own private key, obtains the signature to the target data to be stored, And the signature to the target data to be stored, own public key and the target data to be stored are packaged, obtain it is described to The basic data of storing data.
3. the method according to claim 1, wherein described generate carries the of the target data to be stored The first round of voting data of the target data to be stored of one wheel recommended value, wherein generate the target data to be stored First round recommended value, comprising:
The timestamp of the target data to be stored is determined as to the first round recommended value of the target data to be stored, the mesh The timestamp of mark data to be stored is the time that respective nodes receive the target data to be stored.
4. the method according to claim 1, wherein described generate carries the of the target data to be stored The first round of voting data of the target data to be stored of one wheel recommended value, wherein generate the target data to be stored First round recommended value, comprising:
A random integers are generated according to random function, the random integers are determined as the first of the target data to be stored Take turns recommended value.
5. the method according to claim 1, wherein described generate carries the of the target data to be stored The first round of voting data of the target data to be stored of one wheel recommended value, wherein generate the target data to be stored First round recommended value, comprising:
It generates a random integers with random function to the total amount of data that current time saves to sum, the data that are expanded are compiled Number, growth data number is determined as to the first round recommended value of the target data to be stored.
6. the method according to claim 1, wherein described generate carries the of the target data to be stored The first round of voting data of the target data to be stored of one wheel recommended value, comprising:
The first round recommended value of own public key, the target data to be stored, the first round of the target data to be stored are built The signature of view value and the target data to be stored information are packaged, and obtain encapsulation package;
The encapsulation package is encrypted according to own private key, obtains the signature of the encapsulation package;
According to the signature of the encapsulation package and the encapsulation package, the first round of voting data of the target data to be stored are generated.
7. the method according to claim 1, wherein taking turns polled data according to the target data to be stored r Whether set judgement currently meets the condition for terminating to vote the target data to be stored:
Each recommended value in the target data to be stored r wheel polled data set is extracted, target number to be stored is formed It is taken turns according to r and suggests value set;
The difference that the target data to be stored r wheel suggests maximum recommended value and minimum recommended value in value set is calculated, is obtained First difference;
It extracts the target data to be stored and respectively takes turns each recommended value in polled data set, form the target data to be stored Each wheel suggests value set;
The target data to be stored being calculated respectively takes turns the difference for suggesting maximum recommended value and minimum recommended value in value set, Obtain the second difference;
Calculate the ratio of first difference Yu second difference;
Judge whether first difference and the ratio of second difference are greater than default convergency value;
If so, determining the condition for being currently unsatisfactory for terminating to vote to the target data to be stored;
If it is not, determining the current condition for meeting and terminating to vote the target data to be stored.
8. the method according to claim 1, wherein taking turns polled data according to the target data to be stored r Whether set judgement currently meets the condition for terminating to vote the target data to be stored:
Each recommended value in the target data to be stored r wheel polled data set is extracted, target number to be stored is formed It is taken turns according to r and suggests value set;
The 1- α confidence interval that the target data to be stored r wheel suggests value set is calculated according to default convergent function, and The difference for calculating the 1- α confidence interval upper limit and 1- α lower limit of confidence interval, obtains third difference;
It extracts the target data to be stored and respectively takes turns each recommended value in polled data set, form the target data to be stored Each wheel suggests value set;
The target data to be stored being calculated according to default convergent function respectively takes turns the 1- α confidence interval for suggesting value set, And the difference that each wheel suggests the 1- α confidence interval upper and lower bound of value set is calculated, obtain the 4th difference;
Calculate the ratio of the third difference Yu the 4th difference;
Judge whether the third difference and the ratio of the 4th difference are greater than default convergency value;
If so, determining the condition for being currently unsatisfactory for terminating to vote to the target data to be stored;
If it is not, determining the current condition for meeting and terminating to vote the target data to be stored.
9. a kind of asynchronous collator based on micro- real number characterized by comprising
First round of voting data generating unit, for receiving the basis for the target data to be stored that any node is sent in block chain Data, the first round for generating the target data to be stored of first round recommended value for carrying the target data to be stored throw Ticket data, and by the first round of voting data communication of the target data to be stored to other nodes, the target number to be stored According to for any data to be stored in block chain;
R takes turns polled data generation unit, for receiving the target data to be stored of any node transmission in block chain R takes turns polled data, and 1 < r≤R, R is default highest ballot wheel number, when the target data to be stored r wheel received is thrown The ratio of whole number of nodes reaches in the quantity of ticket data and block chain when presetting minimum ballot ratio, obtains the target and waits for Storing data r takes turns polled data set;
Judging unit, for terminating according to whether target data to be stored r wheel polled data set judgement currently meets To the condition of target data to be stored ballot;If so, triggering voting results computing unit, if it is not, triggering (r+1) wheel is thrown Ticket data generation unit;
The voting results computing unit, for taking turns votes according to default convergent function and the target data to be stored r The common recognition final value of the target data to be stored is calculated according to set, generates the common recognition final value for carrying the target data to be stored The voting results of the target data to be stored of polled data set are taken turns with the target data to be stored r, and will be described The voting results of target data to be stored are communicated to other nodes;
(r+1) takes turns polled data generation unit, for taking turns polled data set according to the target data to be stored r With the default convergent function, (r+1) wheel recommended value of the target data to be stored is calculated, generation carries the target (r+1) wheel recommended value of data to be stored and the target of target data to be stored r wheel polled data set wait for (r+1) of storing data takes turns polled data, and (r+1) of target data to be stored wheel polled data is communicated to it His node;
Sequencing unit, for when obtaining the voting results of the multiple data to be stored of batch, according to present lot it is each it is described to The ballot final value of storing data is ranked up each data to be stored of present lot, obtains the row of present lot data to be stored Sequence result;
Storage unit, for after nodes all in block chain reach common understanding to the ranking results of present lot data to be stored, Present lot data to be stored is stored according to the ranking results of present lot data to be stored.
10. device according to claim 9, which is characterized in that described device further include:
Basic data generation unit is obtained for being encrypted according to own private key to the target data to be stored to described The signature of target data to be stored, and the signature to the target data to be stored, own public key and target number to be stored According to being packaged, the basic data of the data to be stored is obtained.
11. device according to claim 9, which is characterized in that the first round of voting data generating unit includes:
First recommended value generates subelement, waits storing for the timestamp of the target data to be stored to be determined as the target The first round recommended value of data, the timestamp of the target data to be stored are that respective nodes receive target number to be stored According to time.
12. device according to claim 9, which is characterized in that the first round of voting data generating unit includes:
Second recommended value generates subelement, and for generating a random integers according to random function, the random integers are determined For the first round recommended value of the target data to be stored.
13. device according to claim 9, which is characterized in that the first round of voting data generating unit includes:
Third recommended value generates subelement, and the total amount of data and random function generation one for saving to current time are whole at random Number is summed, and be expanded data number, and growth data number is determined as the first of the target data to be stored Take turns recommended value.
14. device according to claim 9, which is characterized in that the first round of voting data generating unit includes:
Subelement is encapsulated, waits storing for first round recommended value, the target to own public key, the target data to be stored The signature of the first round recommended value of data and the target data to be stored information are packaged, and obtain encapsulation package;
Encryption sub-unit operable obtains the signature of the encapsulation package for encrypting according to own private key to the encapsulation package;
Polled data generates subelement and generates the target for the signature according to the encapsulation package and the encapsulation package and wait depositing Store up the first round of voting data of data.
15. device according to claim 9, which is characterized in that the judging unit includes:
First extracts subelement, for extracting each recommended value in the target data to be stored r wheel polled data set, group It is taken turns at the target data to be stored r and suggests value set;
First computation subunit, for calculate target data to be stored r wheel suggest in value set maximum recommended value with most The difference of small recommended value obtains the first difference;
Second extracts subelement, respectively takes turns each recommended value, group in polled data set for extracting the target data to be stored It is respectively taken turns at the target data to be stored and suggests value set;
Second computation subunit, the target data to be stored for being calculated, which is respectively taken turns, suggests maximum recommended value in value set With the difference of minimum recommended value, the second difference is obtained;
Third computation subunit, for calculating the ratio of first difference Yu second difference;
First judgment sub-unit, for judging whether first difference and the ratio of second difference are greater than default convergence Value;If so, triggering first determines subelement, if it is not, triggering second determines subelement;
Described first determines subelement, the condition for determining currently to be unsatisfactory for terminating voting to the target data to be stored;
Described second determines subelement, currently meets the condition for terminating to vote the target data to be stored for determining.
16. device according to claim 9, which is characterized in that the judging unit includes:
First extracts subelement, for extracting each recommended value in the target data to be stored r wheel polled data set, group It is taken turns at the target data to be stored r and suggests value set;
4th computation subunit, for the target data to be stored r wheel recommended value to be calculated according to default convergent function The 1- α confidence interval of set, and the difference of the 1- α confidence interval upper limit and 1- α lower limit of confidence interval is calculated, obtain third difference;
Second extracts subelement, respectively takes turns each recommended value, group in polled data set for extracting the target data to be stored It is respectively taken turns at the target data to be stored and suggests value set;
5th computation subunit, the target data to be stored for being calculated according to default convergent function respectively take turns recommended value The 1- α confidence interval of set, and the difference that each wheel suggests the 1- α confidence interval upper and lower bound of value set is calculated, obtain the 4th Difference;
6th computation subunit, for calculating the ratio of the third difference Yu the 4th difference;
Second judgment sub-unit, for judging whether the third difference and the ratio of the 4th difference are greater than default convergence Value;If so, triggering first determines subelement, if it is not, triggering second determines subelement;
Described first determines subelement, the condition for determining currently to be unsatisfactory for terminating voting to the target data to be stored;
Described second determines subelement, currently meets the condition for terminating to vote the target data to be stored for determining.
CN201810171314.6A 2018-03-01 2018-03-01 Asynchronous sorting method and device based on micro real numbers Active CN110309366B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810171314.6A CN110309366B (en) 2018-03-01 2018-03-01 Asynchronous sorting method and device based on micro real numbers

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810171314.6A CN110309366B (en) 2018-03-01 2018-03-01 Asynchronous sorting method and device based on micro real numbers

Publications (2)

Publication Number Publication Date
CN110309366A true CN110309366A (en) 2019-10-08
CN110309366B CN110309366B (en) 2021-04-30

Family

ID=68073293

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810171314.6A Active CN110309366B (en) 2018-03-01 2018-03-01 Asynchronous sorting method and device based on micro real numbers

Country Status (1)

Country Link
CN (1) CN110309366B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116846916A (en) * 2023-09-01 2023-10-03 武汉趣链数字科技有限公司 Data synchronization method, device, electronic equipment and computer readable storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106228446A (en) * 2016-05-12 2016-12-14 北京众享比特科技有限公司 Transaction in assets plateform system based on privately owned block chain and method
CN106445711A (en) * 2016-08-28 2017-02-22 杭州云象网络技术有限公司 Byzantine-fault-tolerant consensus method applied to block chain
CN107294727A (en) * 2017-05-22 2017-10-24 联动优势科技有限公司 A kind of electronic voting method, terminal device and block chain network
CN107590738A (en) * 2017-08-24 2018-01-16 阿里巴巴集团控股有限公司 Processing method, device and the server of selection common recognition node

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106228446A (en) * 2016-05-12 2016-12-14 北京众享比特科技有限公司 Transaction in assets plateform system based on privately owned block chain and method
CN106445711A (en) * 2016-08-28 2017-02-22 杭州云象网络技术有限公司 Byzantine-fault-tolerant consensus method applied to block chain
CN107294727A (en) * 2017-05-22 2017-10-24 联动优势科技有限公司 A kind of electronic voting method, terminal device and block chain network
CN107590738A (en) * 2017-08-24 2018-01-16 阿里巴巴集团控股有限公司 Processing method, device and the server of selection common recognition node

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116846916A (en) * 2023-09-01 2023-10-03 武汉趣链数字科技有限公司 Data synchronization method, device, electronic equipment and computer readable storage medium
CN116846916B (en) * 2023-09-01 2023-12-08 武汉趣链数字科技有限公司 Data synchronization method, device, electronic equipment and computer readable storage medium

Also Published As

Publication number Publication date
CN110309366B (en) 2021-04-30

Similar Documents

Publication Publication Date Title
Kogias et al. Enhancing bitcoin security and performance with strong consistency via collective signing
CN109767199B (en) PBFT consensus system and method based on reputation and blockchain data processing system
CN108847925B (en) Fragment block chain generation method based on tree structure
US20200059369A1 (en) Determining consensus by parallel proof of voting in consortium blockchain
CN107688945B (en) Design method of efficient permission chain based on delay state consensus
US8667288B2 (en) System and method for message verification in broadcast and multicast networks
CN110855432B (en) Asynchronous BFT &amp; DPOS consensus mechanism for assigning verifier rewards based on verifiable random functions
CN110113388A (en) A kind of method and apparatus of the block catenary system common recognition based on improved clustering algorithm
CN106878071A (en) A kind of block chain common recognition mechanism based on Raft algorithms
CN110474986A (en) A kind of common recognition method, apparatus and system based on block catenary system
CN110380847A (en) A kind of block chain common recognition method and apparatus
CN113612604B (en) Asynchronous network-oriented safe distributed random number generation method and device
CN111416708B (en) Block chain Byzantine fault-tolerant consensus method and system
CN108764966A (en) Advertisement placement method, block chain node device and relevant device
Esfahani et al. Secure blockchain-based energy transaction framework in smart power systems
CN111553795A (en) Multi-path scheduling method for system information of different block chains
CN109919760A (en) Byzantine failure tolerance common recognition algorithm based on voting mechanism
CN114817949A (en) Consensus method and block chain system
Chen et al. Half-aggregation of Schnorr signatures with tight reductions
CN110472970A (en) A kind of pre-generated block method and system based on block chain
CN110309366A (en) A kind of asynchronous sort method and device based on micro- real number
CN114422146A (en) Anonymous sorting method for block chain main nodes
Alp et al. Rethinking general-purpose decentralized computing
US20220278854A1 (en) Unity Protocol Consensus
CN110555764B (en) Method and system for block chain consistency under decentralized environment

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