Summary of the invention
Preposition transaction is carried out by the way of recurrence retrospect since the block chain based on DAG currently on the market is substantially
Retrospect obtain, therefore, for the node completely new for one, recoverys of account book is related to round trip messages much more very, expends greatly
The time of amount.
In view of the above-mentioned problems, the account book that the first aspect of present disclosure proposes a kind of block chain based on DAG is synchronous
Method, wherein the block chain based on DAG includes multiple transaction blocks and one or more sequencing blocks, and each is handed over
Easy block directly quotes other transaction blocks or sequencing block, each sequencing block directly quotes transaction block or other sequencing blocks, each
The transaction block that a sequencing block directly quotes it and a part transaction being determined of block of indirect referencing, the sequencing block is extremely
It less include sequencing block ID, the sequencing block ID of each sequencing block is the serial number incremented by successively according to generation time sequencing, described
Method includes:
Receive the sequencing block ID for the first sequencing block that the first block chain node is stored, wherein the first sequencing block is
The highest sequencing block of sequence number value for the sequencing block ID that the first block chain node is stored;
Determine whether the sequencing block ID for the second sequencing block being locally stored is less than the sequencing block ID of the first sequencing block,
In, the second sequencing block is the highest sequencing block of sequence number value for the sequencing block ID being locally stored;
In the case where determining that the sequencing block ID of the second sequencing block is less than the sequencing block ID of the first sequencing block, to
The first block chain node sends the first synchronization request, wherein first synchronization request includes at least request and stored
All sequencing blocks in the first block chain node, bigger than the sequencing block ID of the second sequencing block and its determined
The All Activity block of change;
Receive sequencing block corresponding with first synchronization request and transaction block.
According to present disclosure in a first aspect, receiving sequencing block corresponding with first synchronization request and friendship
After easy block, the method further includes:
Determine whether received highest sequencing block ID is equal to the sequencing block ID of the first sequencing block;
In the case where determining that received highest sequencing block ID is less than the sequencing block ID of the first sequencing block, to
The first block chain node sends the second synchronization request, wherein second synchronization request, which includes at least request and obtains, compares institute
Receive the big all sequencing blocks of highest sequencing block ID and the All Activity block of its determinization;
Receive sequencing block corresponding with second synchronization request and transaction block.
According to present disclosure in a first aspect, the sequencing of the first sequencing block stored in the first block chain node
In the case that block ID changes, the method further includes:
After receiving sequencing block corresponding with first synchronization request and transaction block, determination is received most
Whether high sequencing block ID is equal to the sequencing block ID of newest first sequencing block;
Determining feelings of the received highest sequencing block ID less than the sequencing block ID of the newest first sequencing block
Under condition, Xiang Suoshu the first block chain node sends the second synchronization request, wherein second synchronization request includes at least request and obtains
Obtain the All Activity block of all sequencing blocks and its determinization bigger than received highest sequencing block ID;
Receive sequencing block corresponding with second synchronization request and transaction block.
According to present disclosure in a first aspect, the second sequencing block sequencing block ID and the first sequencing block
In the identical situation of sequencing block ID, the method further includes:
It trades block for all first kind for being locally stored, generates the first bit array that length is m, wherein described the
One kind transaction block is the transaction block for not being sequenced block determinization also, 10000≤m≤100000 and m is integer;
Receive the second bit array that the length from the first block chain node is m, wherein second bit number
Group is for all first kind transaction block bit array generated stored in the first block chain node;
Determine whether first bit array is identical as second bit array;
In the case where determining that first bit array is different from second bit array, first block is determined
The storage of chain node but local not stored one or more first kind transaction block;
Third synchronization request is sent to the first block chain node, wherein the third synchronization request is included at least and asked
It asks and obtains not stored one or more first kind transaction block store in the first block chain node but local;
Receive transaction block corresponding with the third synchronization request.
According to present disclosure in a first aspect, for all first kind transaction block, the first bit number that length is m is generated
Group or the second bit array further comprise:
It trades block for each first kind of the first block chain node be locally stored or described storage, utilizes described the
One kind transaction block carries out k hash function operation, to obtain k cryptographic Hash: H1(x)、H2(x),…,Hk(x), wherein 5≤k≤
10 and k is integer, and x is perhaps block Hash, and 0≤H in the block of the transaction blocky(x)≤m (y=1,2 ..., k and Hy
It (x) is integer);
It generates length and is the source bit array of m, and each position of the source bit array is compiled in sequence
Number to form position serial number;
The determining institute rheme serial number equal with each first kind transaction each cryptographic Hash of block;
The value of position corresponding with identified position serial number in the source bit array is set as 1, to generate length as m
The first bit array or the second bit array.
According to present disclosure in a first aspect, determining that first bit array is different from second bit array
In the case where, determine that not stored transaction block that the first block chain node stores but local further comprises:
The value of corresponding positions in the value of each and second bit array in first bit array is carried out
Compare, using position serial number corresponding to the existing position with different value between as difference position serial number;
Based on difference position serial number, determine it is being stored in the first block chain node but it is local not stored one or
Multiple cryptographic Hash;
It is handed over based on each first kind stored in one or more of cryptographic Hash and the first block chain node
All cryptographic Hash of easy block determine not stored first kind transaction block store in the first block chain node but local.
According to directly drawing in a first aspect, not finding it in local in any transaction block being locally stored for present disclosure
With or indirect referencing transaction block or sequencing block, or any sequencing block for being locally stored do not quote directly locally finding its
Or in the case where the transaction block or sequencing block of indirect referencing, the method further includes:
Based on the header information of the transaction block or sequencing block that are locally stored, its directly reference or indirect not found is determined
The transaction block of reference or the block Hash of sequencing block;
The 4th synchronization request is generated based on described piece of Hash;
The 4th synchronization request is sent to the first block chain node;
In the feelings of the first block chain node storage transaction block corresponding with the 4th synchronization request or sequencing block
Under condition, corresponding transaction block or sequencing block from the first block chain node are received.
In view of the above-mentioned problems, the account book that the first aspect of present disclosure proposes a kind of block chain based on DAG is synchronous
Equipment, wherein the block chain based on DAG includes multiple transaction blocks and one or more sequencing blocks, and each is handed over
Easy block directly quotes other transaction blocks or sequencing block, each sequencing block directly quotes transaction block or other sequencing blocks, each
The transaction block that a sequencing block directly quotes it and a part transaction being determined of block of indirect referencing, the sequencing block is extremely
It less include sequencing block ID, the sequencing block ID of each sequencing block is the serial number incremented by successively according to generation time sequencing, described
Equipment includes:
Processor;And
Memory makes the processor execute following operation when described instruction executes for storing instruction:
Receive the sequencing block ID for the first sequencing block that the first block chain node is stored, wherein the first sequencing block is
The highest sequencing block of sequence number value for the sequencing block ID that the first block chain node is stored;
Determine whether the sequencing block ID for the second sequencing block being locally stored is less than the sequencing block ID of the first sequencing block,
In, the second sequencing block is the highest sequencing block of sequence number value for the sequencing block ID being locally stored;
In the case where determining that the sequencing block ID of the second sequencing block is less than the sequencing block ID of the first sequencing block, to
The first block chain node sends the first synchronization request, wherein first synchronization request includes at least request and stored
All sequencing blocks in the first block chain node, bigger than the sequencing block ID of the second sequencing block and its determined
The All Activity block of change;
Receive sequencing block corresponding with first synchronization request and transaction block.
According to the second aspect of the present disclosure, sequencing block corresponding with first synchronization request and friendship are being received
After easy block, the processor is made further to execute following operation when described instruction executes:
Determine whether received highest sequencing block ID is equal to the sequencing block ID of the first sequencing block;
In the case where determining that received highest sequencing block ID is less than the sequencing block ID of the first sequencing block, to
The first block chain node sends the second synchronization request, wherein second synchronization request, which includes at least request and obtains, compares institute
Receive the big all sequencing blocks of highest sequencing block ID and the All Activity block of its determinization;And
Receive sequencing block corresponding with second synchronization request and transaction block.
According to the second aspect of the present disclosure, the sequencing of the first sequencing block stored in the first block chain node
In the case that block ID changes, the processor is made further to execute following operation when described instruction executes:
After receiving sequencing block corresponding with first synchronization request and transaction block, determination is received most
Whether high sequencing block ID is equal to the sequencing block ID of newest first sequencing block;
Determining feelings of the received highest sequencing block ID less than the sequencing block ID of the newest first sequencing block
Under condition, Xiang Suoshu the first block chain node sends the second synchronization request, wherein second synchronization request includes at least request and obtains
Obtain the All Activity block of all sequencing blocks and its determinization bigger than received highest sequencing block ID;And
Receive sequencing block corresponding with second synchronization request and transaction block.
According to the second aspect of the present disclosure, in the sequencing block ID of the second sequencing block and the first sequencing block
In the identical situation of sequencing block ID, the processor is made further to execute following operation when described instruction executes:
It trades block for all first kind for being locally stored, generates the first bit array that length is m, wherein described the
One kind transaction block is the transaction block for not being sequenced block determinization also, 10000≤m≤100000 and m is integer;
Receive the second bit array that the length from the first block chain node is m, wherein second bit number
Group is for all first kind transaction block bit array generated stored in the first block chain node;
Determine whether first bit array is identical as second bit array;
In the case where determining that first bit array is different from second bit array, first block is determined
The storage of chain node but local not stored one or more first kind transaction block;
Third synchronization request is sent to the first block chain node, wherein the third synchronization request is included at least and asked
It asks and obtains not stored one or more transaction blocks store in the first block chain node but local;
Receive transaction block corresponding with the third synchronization request.
According to the second aspect of the present disclosure, for all first kind transaction block, the first bit number that length is m is generated
Group or the second bit array further comprise:
It trades block for each first kind of the first block chain node be locally stored or described storage, utilizes described the
One kind transaction block carries out k hash function operation, to obtain k cryptographic Hash: H1(x)、H2(x),…,Hk(x), wherein 5≤k≤
10 and k is integer, and x is perhaps block Hash, and 0≤H in the block of the transaction blocky(x)≤m (y=1,2 ..., k and Hy
It (x) is integer);
It generates length and is the source bit array of m, and each position of the source bit array is compiled in sequence
Number to form position serial number;
The determining institute rheme serial number equal with each first kind transaction each cryptographic Hash of block;
The value of position corresponding with identified position serial number in the source bit array is set as 1, to generate length as m
The first bit array or the second bit array.
According to the second aspect of the present disclosure, determining that first bit array is different from second bit array
In the case where, determine that not stored transaction block that the first block chain node stores but local further comprises:
The value of corresponding positions in the value of each and second bit array in first bit array is carried out
Compare, using position serial number corresponding to the existing position with different value between as difference position serial number;
Based on difference position serial number, determine it is being stored in the first block chain node but it is local not stored one or
Multiple cryptographic Hash;
It is handed over based on each first kind stored in one or more of cryptographic Hash and the first block chain node
All cryptographic Hash of easy block determine not stored transaction block store in the first block chain node but local.
According to the second aspect of the present disclosure, it is not found in local in any transaction block being locally stored directly to draw
With or indirect referencing transaction block or sequencing block, or any sequencing block for being locally stored do not quote directly locally finding its
Or in the case where the transaction block or sequencing block of indirect referencing, when described instruction execute when the processor is further executed with
Lower operation:
Based on the header information of the transaction block or sequencing block that are locally stored, its directly reference or indirect not found is determined
The transaction block of reference or the block Hash of sequencing block;
The 4th synchronization request is generated based on described piece of Hash;
The 4th synchronization request is sent to the first block chain node;And
In the feelings of the first block chain node storage transaction block corresponding with the 4th synchronization request or sequencing block
Under condition, corresponding transaction block or sequencing block from the first block chain node are received.
The account book synchronous method and equipment of the block chain based on DAG according to present disclosure can be by based on DAG
Block chain in the sequencing block periodically generated is added, enable be located at different sequencing blocks section in block be defined sequence,
The transaction of same sequence can be by batch synchronization;In addition, present disclosure proposes for the block after newest sequencing block
Account book increment synchronization mode based on Bloom filter avoids great number time and communications cost that recurrence obtains transaction, pole
The earth improves the synchronous performance of block.
Specific embodiment
Below with reference to each exemplary embodiment of the attached drawing detailed description disclosure.Flow chart and block diagram in attached drawing are shown
The architecture, function and operation in the cards of method and system according to various embodiments of the present disclosure.It should be noted that
Each box in flowchart or block diagram can represent a part of a module, program segment or code, the module, program
Section or a part of code may include one or more holding for realizing the logic function of defined in each embodiment
Row instruction.It should also be noted that in some alternative implementations, function marked in the box can also be attached according to being different from
The sequence marked in figure occurs.For example, two boxes succeedingly indicated can actually be basically executed in parallel or it
Can also execute in a reverse order sometimes, this depend on related function.It should also be noted that flow chart
And/or the combination of each box in block diagram and the box in flowchart and or block diagram, function as defined in execution can be used
Can or the dedicated hardware based system of operation realize, or specialized hardware can be used and the combination of computer instruction comes
It realizes.
Term as used herein "include", "comprise" and similar terms are understood to open term, i.e.,
" including/including but not limited to ", expression can also include other content.Term "based" is " being based at least partially on ".Term
" one embodiment " expression " at least one embodiment ";Term " another embodiment " expression " at least one other embodiment ",
Etc..
Technology, method and apparatus known to person of ordinary skill in the relevant may be not discussed in detail, but suitable
In the case of, the technology, method and apparatus should be considered as part of specification.For between each unit in attached drawing
Line, it is only for convenient for explanation, indicate that the unit at least line both ends is in communication with each other, it is not intended that limitation does not connect
It can not be communicated between the unit of line.
The embodiment of present disclosure is primarily upon following technical problem: all fortune in the block chain network based on DAG
Capable node is owned by the complete copy of the DAG account book, so as to reach the common recognition in account book structure.A node not
When having complete copy, need to be restored from adjacent node with it is synchronous.Since DAG is a kind of unidirectional graph structure, according to
Its mode generated, latter block (for example, transaction block or sequencing block) record previous block (for example, transaction block or sequencing block)
Cryptographic Hash, but previous block does not record the cryptographic Hash of latter block, and whole network is not stringent orderly, so that for DAG account
This recovery operation is relatively difficult.
To solve the above-mentioned problems, present disclosure is by being added the sequencing block periodically generated in the block chain based on DAG,
Enable being determined of transaction block (that is, transaction having the same highly) being located in different sequencing blocks region, and makes
Transaction block with same transaction height can be by batch synchronization.For the block after newest sequencing block (for example, transaction
Block), present disclosure also proposed a kind of account book increment synchronization mode based on Bloom filter, avoids recurrence and obtains transaction
The great number time and communications cost, significantly improve block (or account book) synchronous performance.
Fig. 1 shows the exemplary process diagram of the account book synchronous method of the block chain based on DAG.
In this disclosure, the block chain based on DAG includes multiple transaction blocks and one or more sequencing block,
And each transaction block directly quotes other transaction blocks or sequencing block, each sequencing block directly quotes transaction block or other
A part transaction being determined of block of sequencing block, the transaction block that each sequencing block directly quotes it and indirect referencing,
The sequencing block includes at least sequencing block ID, and the sequencing block ID of each sequencing block is incremented by successively according to time sequencing is generated
Serial number.
As shown in figure 3, the latter block (for example, transaction block or sequencing block) is producing in the structure of the block chain based on DAG
It needs to link in raw process preposition block known to one or more (for example, transaction block, sequencing block and/or wound generation block), one
As block header information in contain the cryptographic Hash of two preposition blocks so that entire account book shows a kind of netted knot
Structure.In this disclosure, it trades in the header information of block and at least further includes other than the cryptographic Hash of two preposition block
Transaction height, type of transaction, source account information, purpose account information etc..
In this disclosure, network is periodically by way of common common recognition (for example, proof of work (Power of
Working, abbreviation PoW), equity proves (Power of Stake, abbreviation PoS), acts on behalf of equity and prove (Delegated
Proof of Stake, abbreviation DPoS), practical Byzantine failure tolerance (Practical Byzantine Fault Tolerance,
Abbreviation PBFT) etc.) generate and broadcast a sequencing block;In addition to the cryptographic Hash of two preposition block in the header information of sequencing block
Except at least further include the information such as transaction height, stringent orderly incremental sequencing block ID, trading order.In this disclosure,
First block in block chain based on DAG, which is referred to as, creates generation block, is the sequencing block of the serial number 0 of sequencing block ID.
It can be seen that the sequencing block (that is, wound generation block) and sequencing block Seq1, Seq2, Seq3 of serial number 0 in Fig. 3
(its sequencing block ID is 1,2,3 respectively), and each sequencing block can be to a part transaction being determined of block operation, example
Such as, as shown in figure 3, multiple transaction blocks in sequencing block Seq1 determinization region (1), so that the transaction height of sequencing block Seq1
(namely sequencing block ID) is identical as by each transaction transaction height of block of its determinization;Sequencing block Seq2 determinization region
(2) multiple transaction blocks in, so that the transaction height (namely sequencing block ID) of sequencing block Seq2 and each by its determinization
The transaction height of transaction block is identical;Multiple transaction blocks in sequencing block Seq3 determinization region (3), so that sequencing block Seq3
Transaction height (namely sequencing block ID) is identical as by each transaction transaction height of block of its determinization.
In the present embodiment, any block chain node (being properly termed as " local block chain link point " in this disclosure) can
It is specific as follows to implement method shown in FIG. 1:
Step 110: receiving the sequencing block ID for the first sequencing block that the first block chain node is stored.Wherein, described first
Sequencing block is the highest sequencing block of sequence number value for the sequencing block ID that the first block chain node is stored.
For example, when storing sequencing block ID in the first block chain node and being respectively equal to 0,1,2,3,4,5 sequencing block, institute
State the sequencing block that the first sequencing block is sequencing block ID=5.
Step 120: determine the sequencing block ID of the second sequencing block that is locally stored whether less than the first sequencing block sequencing block
ID.Wherein, the second sequencing block is the highest sequencing block of sequence number value for the sequencing block ID being locally stored.
For example, when storing sequencing block ID in local block chain link point and being respectively equal to 0,1,2,3 sequencing block, described the
Two sequencing blocks are the sequencing blocks of sequencing block ID=3.
Step 130: in the case where determining the sequencing block ID of the sequencing block ID of the second sequencing block less than the first sequencing block, to
First block chain node sends the first synchronization request.Wherein, first synchronization request includes at least request acquisition and is stored in institute
State all of all sequencing blocks in the first block chain node, bigger than the sequencing block ID of the second sequencing block and its determinization
Transaction block.
For example, in the above-described embodiments, the first synchronization request that local block chain link o'clock is sent to the first block chain node
In include request obtain sequencing block ID=4 and 5 sequencing block and these sequencing block institute determinizations All Activity block.
Step 140: receiving sequencing block corresponding with first synchronization request and transaction block.
In this disclosure, it is same can successively to issue multiple first according to the sequence of sequencing block ID for local block chain link point
Step request.For example, in the above-described embodiments, the first synchronization request that local block chain link point issues first only includes that request obtains
The sequencing block of sequencing block ID=4 and its transaction block of institute's determinization;In the friendship for receiving corresponding sequencing block and its institute's determinization
In the case where easy block, the first synchronization request that local block chain link point issues again only includes that request obtains determining for sequencing block ID=5
The transaction block of sequence block and its institute's determinization then receives corresponding sequencing block and its institute's determinization from the first block chain node
Transaction block.
After step 140, block chain node also proceeds as follows:
First, determine whether received highest sequencing block ID is equal to the sequencing block ID of the first sequencing block.
Second, determining the case where received highest sequencing block ID is less than the sequencing block ID of the first sequencing block
Under, Xiang Suoshu the first block chain node sends the second synchronization request, wherein second synchronization request includes at least request and obtains
Big all sequencing blocks and the All Activity block of its determinization than received highest sequencing block ID.
Third receives sequencing block corresponding with second synchronization request and transaction block.
Above-mentioned steps are for ensuring that local block chain link point can be in synchronization gain the first block chain in this disclosure
Not stored all sequencing blocks and block of trading accordingly in storage but local block chain link point.
In addition, the case where the sequencing block ID for the first sequencing block that the first block chain node is stored changes
Under, following steps can also be performed in block chain node:
Firstly, determination is received after receiving sequencing block corresponding with first synchronization request and transaction block
To highest sequencing block ID whether be equal to the sequencing block ID of newest first sequencing block.
Secondly, determining sequencing block ID of the received highest sequencing block ID less than the newest first sequencing block
In the case where, Xiang Suoshu the first block chain node sends the second synchronization request, wherein second synchronization request is included at least and asked
Seek the All Activity block for obtaining all sequencing blocks and its determinization bigger than received highest sequencing block ID.
For example, then passing through step 140 as the sequencing block ID=7 for the first sequencing block that the first block chain node is stored
Highest sequencing block ID=5 received by local block chain link point later, then local block chain link point is needed to the firstth area
Block chain node sends the second synchronization request, obtains sequencing block ID=6,7 sequencing block and its transaction block of institute's determinization with request.
Finally, receiving sequencing block corresponding with second synchronization request and transaction block.
Fig. 1 the disclosed embodiments are that there are sequencing block ID sequences between local block chain link point and the first block chain node
The case where number difference, so that the process of the respective block of local block chain link point full dose synchronization gain the first block chain node.Institute
Disclosed embodiment can be avoided great number time and the communications cost that block is obtained using recursive fashion.
In addition, as shown in Fig. 2, the sequencing block ID phase of sequencing block ID and the first sequencing block in the second sequencing block
With in the case where, it is also necessary to realize that increment synchronization block, local block chain link point specifically execute such as using Bloom filter technology
Lower step:
Step 210: for all first kind transaction block being locally stored, generating the first bit array that length is m.Its
In, first kind transaction block is the transaction block for not being sequenced block determinization also, 10000≤m≤100000 and m is integer.
In this disclosure, for all first kind transaction block, the first bit array or the second ratio that length is m are generated
Special array further comprises:
First, for each first kind transaction block of the first block chain node be locally stored or described storage, utilize
The k hash function operation that the first kind transaction block is arranged in advance, to obtain k cryptographic Hash: H1(x)、H2(x),…,
Hk(x), wherein 5≤k≤10 and k are integers, and x is perhaps block Hash, and 0≤H in the block of the transaction blocky(x)≤m(y
=1,2 ... k and HyIt (x) is integer).
Second, generate length be m source bit array, and by each position of the source bit array in sequence into
Row number is to form a serial number.
In the present embodiment, each initial set value in source bit array generated is set to 0.
Third, the determining institute rheme serial number equal with each first kind transaction each cryptographic Hash of block.
4th, the value of position corresponding with identified position serial number in the source bit array is set as 1, to generate length
Degree is the first bit array or the second bit array of m.
For example, the cryptographic Hash difference 0,3,5,7,300 of some first kind transaction block in some block chain node, another
The cryptographic Hash of first kind transaction block distinguishes 1,25,100,107,300, then the 0th of bit array generated, the 3rd, the 5th
Position, the 7th, the 300th, the 1st, the 25th, the 100th, the 107th value be 1.
The disclosure uses the combination of hash function and Bloom filter technology, realizes determining either block chain node (example
Such as, the first block chain node or local block chain link point) each specific first kind transaction block for being stored.
Step 220: receiving the second bit array that the length from the first block chain node is m.Wherein, described
Two bit arrays are for all first kind transaction block bit array generated stored in the first block chain node.
Step 230: determining whether first bit array is identical as second bit array.
Step 240: in the case where determining that first bit array is different from second bit array, described in determination
The storage of first block chain node but local not stored one or more first kind transaction block.
This step specifically includes:
Firstly, by the value of the corresponding positions in the value of each and second bit array in first bit array
It is compared, using position serial number corresponding to the existing position with different value between as difference position serial number.
Secondly, based on each first kind transaction stored in difference position serial number and the first block chain node
All cryptographic Hash of block determine not stored one or more cryptographic Hash store in the first block chain node but local.
Finally, based on stored in one or more of cryptographic Hash and the first block chain node each first
All cryptographic Hash of class transaction block determine not stored first kind transaction store in the first block chain node but local
Block.
For example, the 0th, 1,3,5,7,25,100,107 and 300 respectively equal to 1 in the first bit array, the second ratio
The the 0th, 1,3,5,7,25,100,107,251,295 and 300 respectively equal to 1 in special array;It can then determine the first bit
The difference position serial number of array and the second bit array is the 251st and 295.Then which stored in the first block chain node is checked
The cryptographic Hash of one or more first kind transaction blocks is equal to 251 or 295;Finding one or more corresponding first kind transaction blocks
In the case where, determine that these first kind transaction block is the not stored first kind transaction block of local block chain link point.
Step 250: Xiang Suoshu the first block chain node sends third synchronization request.Wherein, the third synchronization request is extremely
Few includes that request obtains not stored one or more first kind transaction block store in the first block chain node but local.
Step 260: receiving transaction block corresponding with the third synchronization request.
First block chain node obtains it from local block chain link point by the way of similar with step 220-260 and does not deposit
Stored transaction block in storage but local block chain link point.
Block chain block techniques disclosed in present disclosure based on Bloom filter increment synchronization based on DAG, can
The message back reduced during increment synchronization significantly comes number and size.For example, when needing synchronous 10000 local block chains
When the not stored block of node (n=10000), if k=8 hash function of selection, only needs to transmit 558,962 bits
The information whether the first block chain node possesses each block can be transferred to local block chain link point by (68KB), and
False positive rate (that is, itself not stored but be considered the probability of stored block) is less than 0.00001%, and specific algorithm is such as
Under:
P=pow (1-exp (- k/ (m/n)), k);
Wherein, p --- false positive rate;N --- need synchronous number of blocks;The length of m --- bit array.
Also, false negative rate (that is, the probability for itself having stored but being considered not stored block) is 0.With it is existing
Common synchronization strategy is compared, and according to (for example, block chain based on DAG) the case where network structure, needs round trip message at least
Log2 (10000) -1=12 times, most 9999 times;And the disclosure only needs to carry out 1 round trip message and can get
99.99999% missing transaction.
In addition, in this disclosure, when any transaction block being locally stored not locally find its directly reference or
The transaction block or sequencing block of indirect referencing, or any sequencing block for being locally stored not locally find its directly reference or
When connecing the transaction block or sequencing block of reference, block chain node executes following steps:
Firstly, the header information based on the transaction block or sequencing block that are locally stored, determines that its not found is directly quoted
Or the block Hash of trade block or the sequencing block of indirect referencing.
Secondly, generating the 4th synchronization request based on described piece of Hash.
Again, the first block of Xiang Suoshu chain node sends the 4th synchronization request.
4th, transaction block corresponding with the 4th synchronization request or sequencing block are stored in the first block chain node
In the case where, receive corresponding transaction block or sequencing block from the first block chain node.
Above-described embodiment is that local block chain link point is still failed to after synchronous, increment synchronization by above-mentioned full dose
The block enough synchronized continues using the synchronization gain from the first block chain node of traditional recurrence tracing mode.
Fig. 4 shows the schematic block diagram of the account book synchronizer 400 of the block chain based on DAG.The account book synchronizer
400 include at least processor 410 and memory 420, wherein instruction are stored in memory 420, the instruction is by processor
410 make processor 410 execute following movement when executing:
Receive the sequencing block ID for the first sequencing block that the first block chain node is stored, wherein the first sequencing block is
The highest sequencing block of sequence number value for the sequencing block ID that the first block chain node is stored;
Determine whether the sequencing block ID for the second sequencing block being locally stored is less than the sequencing block ID of the first sequencing block,
In, the second sequencing block is the highest sequencing block of sequence number value for the sequencing block ID being locally stored;
In the case where determining that the sequencing block ID of the second sequencing block is less than the sequencing block ID of the first sequencing block, to
The first block chain node sends the first synchronization request, wherein first synchronization request includes at least request and stored
All sequencing blocks in the first block chain node, bigger than the sequencing block ID of the second sequencing block and its determined
The All Activity block of change;
Receive sequencing block corresponding with first synchronization request and transaction block.
In one embodiment according to present disclosure, sequencing block corresponding with first synchronization request is being received
And after transaction block, the processor 410 is made further to execute following operation when described instruction executes:
Determine whether received highest sequencing block ID is equal to the sequencing block ID of the first sequencing block;
In the case where determining that received highest sequencing block ID is less than the sequencing block ID of the first sequencing block, to
The first block chain node sends the second synchronization request, wherein second synchronization request, which includes at least request and obtains, compares institute
Receive the big all sequencing blocks of highest sequencing block ID and the All Activity block of its determinization;And
Receive sequencing block corresponding with second synchronization request and transaction block.
In one embodiment according to present disclosure, in the first sequencing block that the first block chain node is stored
Sequencing block ID change in the case where, make the processor 410 further execute following behaviour when described instruction executes
Make:
After receiving sequencing block corresponding with first synchronization request and transaction block, determination is received most
Whether high sequencing block ID is equal to the sequencing block ID of newest first sequencing block;
Determining feelings of the received highest sequencing block ID less than the sequencing block ID of the newest first sequencing block
Under condition, Xiang Suoshu the first block chain node sends the second synchronization request, wherein second synchronization request includes at least request and obtains
Obtain the All Activity block of all sequencing blocks and its determinization bigger than received highest sequencing block ID;And
Receive sequencing block corresponding with second synchronization request and transaction block.
It is fixed in the sequencing block ID of the second sequencing block and described first in one embodiment according to present disclosure
In the identical situation of sequencing block ID of sequence block, the processor is made further to execute following operation when described instruction executes:
It trades block for all first kind for being locally stored, generates the first bit array that length is m, wherein described the
One kind transaction block is the transaction block for not being sequenced block determinization also, 10000≤m≤100000 and m is integer;
Receive the second bit array that the length from the first block chain node is m, wherein second bit number
Group is for all first kind transaction block bit array generated stored in the first block chain node;
Determine whether first bit array is identical as second bit array;
In the case where determining that first bit array is different from second bit array, first block is determined
The storage of chain node but local not stored one or more transaction blocks;
Third synchronization request is sent to the first block chain node, wherein the third synchronization request is included at least and asked
It asks and obtains not stored one or more first kind transaction block store in the first block chain node but local;
Receive transaction block corresponding with the third synchronization request.
In one embodiment according to present disclosure, for all first kind transaction block, first that length is m is generated
Bit array or the second bit array further comprise:
It trades block for each first kind of the first block chain node be locally stored or described storage, utilizes described the
One kind transaction block carries out k hash function operation, to obtain k cryptographic Hash: H1(x)、H2(x),…,Hk(x), wherein 5≤k≤
10 and k is integer, and x is perhaps block Hash, and 0≤H in the block of the transaction blocky(x)≤m, y=1,2 ... k and Hy
It (x) is integer;
It generates length and is the source bit array of m, and each position of the source bit array is compiled in sequence
Number to form position serial number;
The determining institute rheme serial number equal with each first kind transaction each cryptographic Hash of block;
The value of position corresponding with identified position serial number in the source bit array is set as 1, to generate length as m
The first bit array or the second bit array.
In one embodiment according to present disclosure, first bit array and second bit number are being determined
In the case that group is different, determine that not stored transaction block that the first block chain node stores but local further comprises:
The value of corresponding positions in the value of each and second bit array in first bit array is carried out
Compare, using position serial number corresponding to the existing position with different value between as difference position serial number;
Based on difference position serial number, determine it is being stored in the first block chain node but it is local not stored one or
Multiple cryptographic Hash;
It is handed over based on each first kind stored in one or more of cryptographic Hash and the first block chain node
All cryptographic Hash of easy block determine not stored transaction block store in the first block chain node but local.
In one embodiment according to present disclosure, locally it is not being found in any transaction block being locally stored
The directly transaction block or sequencing block of reference or indirect referencing, or any sequencing block being locally stored are not finding it locally directly
In the case where the transaction block or sequencing block that connect reference or indirect referencing, make the processor further when described instruction executes
Execute following operation:
Based on the header information of the transaction block or sequencing block that are locally stored, its directly reference or indirect not found is determined
The transaction block of reference or the block Hash of sequencing block;
The 4th synchronization request is generated based on described piece of Hash;
The 4th synchronization request is sent to the first block chain node;And
In the feelings of the first block chain node storage transaction block corresponding with the 4th synchronization request or sequencing block
Under condition, corresponding transaction block or sequencing block from the first block chain node are received.
The account book synchronous method and equipment of block chain disclosed herein based on DAG add in the block chain based on DAG
Enter multiple sequencing blocks, in order to which the block chain to be carried out to the orderly cutting in topology (that is, some sequencing block directly quoted
The part of transaction block and indirect referencing transaction block determinization).For the different transaction blocks stored in different blocks chain node, determine
Sequence block carries out full dose synchronization or carries out mutual increment synchronization using Bloom filter technology, so that it is synchronous to significantly improve block
Performance.
Alternatively, above-mentioned account book synchronous method can be realized by computer program product.Computer program product
It may include computer readable storage medium, refer to containing the computer-readable program for executing various aspects of the disclosure
It enables.Computer readable storage medium can be the tangible device that can keep and store the instruction used by instruction execution equipment.
Computer readable storage medium can for example be but not limited to storage device electric, magnetic storage apparatus, light storage device, electromagnetism storage
Equipment, semiconductor memory apparatus or above-mentioned any appropriate combination.The more specific example of computer readable storage medium
(non exhaustive list) include: portable computer diskette, hard disk, random access memory (RAM), read-only memory (ROM), can
Erasing programmable read only memory (EPROM or flash memory), static random access memory (SRAM), Portable compressed disk is read-only deposits
Reservoir (CD-ROM), memory stick, floppy disk, mechanical coding equipment, is for example stored thereon with instruction at digital versatile disc (DVD)
Punch card or groove internal projection structure and above-mentioned any appropriate combination.Computer-readable storage medium used herein above
Matter is not interpreted instantaneous signal itself, the electromagnetic wave of such as radio wave or other Free propagations, by waveguide or other
The electromagnetic wave (for example, the light pulse for passing through fiber optic cables) that transmission medium is propagated or the electric signal transmitted by electric wire.
The foregoing is merely embodiment of the disclosure alternative embodiments, are not limited to embodiment of the disclosure, for
For those skilled in the art, embodiment of the disclosure can have various modifications and variations.It is all in embodiment of the disclosure
Within spirit and principle, made any modification, equivalence replacement, improvement etc. should be included in the protection of embodiment of the disclosure
Within the scope of.
Although describing embodiment of the disclosure by reference to several specific embodiments, it should be appreciated that, the disclosure
Embodiment is not limited to disclosed specific embodiment.Embodiment of the disclosure be intended to cover appended claims spirit and
Included various modifications and equivalent arrangements in range.Scope of the following claims is to be accorded the broadest interpretation, thus comprising
All such modifications and equivalent structure and function.