Specific embodiment
The application is described in further detail with reference to the accompanying drawings and examples.It is understood that this place is retouched
The specific embodiment stated is used only for explaining related invention, rather than the restriction to the invention.It also should be noted that in order to
Convenient for description, part relevant to invention is illustrated only in attached drawing.
It should be noted that in the absence of conflict, the features in the embodiments and the embodiments of the present application can phase
Mutually combination.The application is described in detail below with reference to the accompanying drawings and in conjunction with the embodiments.
Fig. 1 is a kind of flow chart for parallel chain block method for pushing that one embodiment of the invention provides.As shown in Figure 1, In
In the present embodiment, the present invention provides a kind of parallel chain block method for pushing, comprising:
S12: the second parallel chain node is asked to the first registration that the first parallel chain node sends parallel chain data push service
Information is sought, after receiving the first registration information for the first parallel chain node, stores the push address of the second parallel chain node;
S13: the second parallel chain node receives the first blocks operation information of the first parallel chain node push;Wherein, first
Blocks operation information includes the block information of several parallel chain blocks;
S14: the second parallel chain node is according to the data of the first blocks operation information update local.
Specifically, it is assumed that the second parallel chain node is b, and the first parallel chain node is a, by the block of several parallel chain blocks
Information configuration is the block information of a parallel chain block, and the first blocks operation information is block1;
In step s 12, b sends the first registration information of parallel chain data push service to a, and a receives the first note
After volume solicited message, the push address of b is stored;
In step s 13, b receives the first blocks operation information block1 of a push;
In step S14, b updates local data according to block1.
After b receives the parallel chain block of several a push, b generates parallel sequence using current main chain-parallel chain mechanism
Block, i.e. the b synchronous parallel chain relevant to this parallel chain from the main chain block of corresponding main chain node B are traded to generate parallel chain
Block.
In more embodiments, parallel chain block method for pushing provided by the invention is not exemplified as limiting with above-mentioned, can be with
According to actual needs the block information of several blocks is configured to the block information of different numerical value, for example, being configurable to 2
The block information of block, the block information of 5 blocks, it might even be possible to if being configured to be configured to different number every some cycles
The block information of dry block, for example, the block information of 5 blocks is configured to for preceding 100 blocks, for preceding 100 blocks
All blocks afterwards are each configured to the block information of 1 block, it can be achieved that identical technical effect.
In current main chain-parallel chain mechanism, the node of parallel chain needs to obtain institute by traversing each main chain block
There is the parallel chain of this parallel chain to trade;And it is not actually the parallel chain friendship that each main chain block is owned by this parallel chain
Easily;Method through the foregoing embodiment, the less parallel chain node of block is first from the more parallel chain of i.e. block of normal operation
Several parallel chain blocks are received at node, then parallel chain block is generated using current main chain-parallel chain mechanism, save parallel chain
Node synchronizes the bandwidth of existing parallel chain block, and reduces the time-consuming duration that parallel chain node synchronizes existing parallel chain block.
In a preferred embodiment, the first blocks operation information further includes action type, action type be addition block or
Rollback block.
Specifically, the first blocks operation information includes the block information of several blocks, action type, it is assumed that the first block behaviour
Making information is (block1:add;block2:add;block2:delete;block2':add);
B receives the first blocks operation information of a push;
B judges whether the action type of each parallel chain block in the first blocks operation information is addition block:
For block1:add: since action type is addition block, then generating the data of block1 and store to local
Database;
For block2:add: since action type is addition block, then generating the data of block2 and store to local
Database;
For block2:delete: since action type is to delete block, then generating the data of block2, and from local
The data of block2 are deleted in database;
For block2':add: since action type is addition block, then generating the data of block2' and store to this
Ground database;
Block on final b are as follows: block1 and block2'.
In more embodiments, the first blocks operation information can not include action type, it is assumed that a certain block chain is matched
Be set to one can not rollback block chain, for can not rollback block chain, the first blocks operation information pushed can not
Action type (i.e. action type is only to add block) is configured, it can be achieved that identical technical effect.
Fig. 2 is a kind of flow chart of preferred embodiment of method shown in Fig. 1.As shown in Fig. 2, in a preferred embodiment
In, the first blocks operation information further includes the first operation serial number of the second parallel chain node, and the second parallel chain node is according to first
After the data of blocks operation information update local further include:
S15: the second parallel chain node returns to the first confirmation message of the first blocks operation information to the first parallel chain node,
After receiving the first confirmation message for the first parallel chain node, the first operation serial number is updated according to the first confirmation message.
Specifically, it is assumed that the first blocks operation information includes the block information, action type and the first operation of several blocks
Serial number (block1:add:1;block2:add:2;block2:delete:3;block2':add:4);
In step S131, b receives the first blocks operation information (block1:add:1 of a node push;block2:
add:2;block2:delete:3;block2':add:4);
In step S14, b is according to (block1:add:1;block2:add:2;block2:delete:3;block2':
Add:4 the data of local relevant database) are updated;The implementation principle of step S14 can be found in above-described embodiment, herein no longer
It repeats;
In step S15, b returns to the first confirmation message of the first blocks operation information to a;
For (block1:add:1), after a receives the first confirmation message that b is returned, update b's according to the first confirmation message
First operation serial number (updating from 0 to 1);
For (block2:add:2), after a receives the first confirmation message that b is returned, update b's according to the first confirmation message
First operation serial number (updating from 1 to 2);
For (block2:delete:3), after a receives the first confirmation message that b is returned, updated according to the first confirmation message
The first operation serial number (updating from 2 to 3) of b;
For (block2':add:4), after a receives the first confirmation message that b is returned, b is updated according to the first confirmation message
The first operation serial number (updating from 3 to 4).
In more embodiments, the first blocks operation information can not include action type, it is assumed that a certain block chain is matched
Be set to one can not rollback block chain, for can not rollback block chain, the first blocks operation information pushed can not
Configure action type, i.e., action type be only add block, the first blocks operation information include several blocks block information and
First operation serial number, for example, the first blocks operation information is (block5:5;Block6:6), it can be achieved that identical technical effect.
Above-described embodiment carries out the second parallel chain node to the parallel chain block received according to the first operation serial number
Operation, to improve the efficiency that the second parallel chain node receives parallel chain block, further saving parallel chain node is synchronized existing
The bandwidth of parallel chain block, and reduce the time-consuming duration that parallel chain node synchronizes existing parallel chain block.
Fig. 3 is the flow chart of another preferred embodiment of method shown in Fig. 1.As shown in figure 3, in a preferred embodiment
In, the first blocks operation information further includes that the second parallel chain node has synchronized block height, and the second parallel chain node is according to
After the data of one blocks operation information update local further include:
S16: the second parallel chain node returns to the second confirmation message of the first blocks operation information to the first parallel chain node,
After receiving the second confirmation message for the first parallel chain node, block height has been synchronized according to the update of the second confirmation message.
Specifically, it is assumed that block information that the first blocks operation information includes several blocks and the second parallel chain node are
Synchronous block height, current block height are 50, and the block height that synchronized of centralization database server is 49;
What a judged the second parallel chain node has synchronized whether block height is less than current block height, due to synchronization zone
Block height is 49, and being less than current block height is 50, then generates the first blocks operation information (block50:49) and push.
In step S132, b receives the first blocks operation information (block50:49) of a push;
In step S14, b updates local data according to (block50:49);
In step s 16, b returns to second confirmation message of (block50:49) to a.
After a receives the second confirmation message, according to the second confirmation message update b synchronize block height (from 49 updates to
50)。
In more embodiments, the first blocks operation information is also configured as removing the block information of several blocks, go back
Including at least one of following or multinomial: action type, First ray number have synchronized block height, it can be achieved that identical technology is imitated
Fruit.
Above-described embodiment provides that the first parallel chain node has synchronized block height less than this section in the second parallel chain node
When point current block height, the parallel chain block that the second parallel chain node was not pushed is pushed to the second parallel chain node, the
After two parallel chain nodes receive the parallel chain block of the first parallel chain node push, without whether being had received to local search
The block, improve the second parallel chain node receive parallel chain block efficiency, further save parallel chain node synchronize have it is flat
The bandwidth of row chain block, and reduce the time-consuming duration that parallel chain node synchronizes existing parallel chain block.
Fig. 4 is a kind of flow chart of preferred embodiment of method shown in Fig. 3.As shown in figure 4, in a preferred embodiment
In, the first parallel chain node stores the first block height at that time when receiving the first registration information, and the above method also wraps
It includes:
S17: the second parallel chain node receives the push that the first parallel chain node returns and completes information;Wherein, push is completed
Information is generated by the first parallel chain node when having synchronized block height equal to the first block height.
Specifically, it is assumed that the first parallel chain node a stores the first block at that time when receiving the first registration information
After height is 500, and current second parallel chain node b receives the second confirmation message of the first parallel chain node a transmission, according to the
Two confirmation messages update b's has synchronized block height (updating from 499 to 500);
In step S17, since a the first block height that block height is 500, a that synchronized for having updated b is 500,
Synchronous block height is equal to the first block height, and a generates push and completes information and return to b;B receives the push that a is returned and completes
Information.
Fig. 5 is a kind of flow chart of preferred embodiment of method shown in Fig. 4.As shown in figure 4, in a preferred embodiment
In, the above method further include:
S18: terminating in response to push, and the second parallel chain node sends the first checking solicited message to the first main chain node,
So that whether the parallel chain block of first main chain node verification the first parallel chain node push is correct;Wherein, checking solicited message
Block Hash including the newest parallel chain block that the first parallel chain node is pushed.
Specifically, the corresponding first main chain node of the second parallel chain node b is B, it is assumed that newest parallel chain block is
Block500, checking solicited message include the block Hash hash (500) of block500;
In step S18, terminate in response to push, b sends the first checking solicited message, the first checking solicited message to B
Including hash (500), whether the parallel chain block that B verifies a push is correct.
It include the block Hash of parallel chain block, main chain in the common recognition transaction that parallel chain authorization node chain linked to owner node is sent
The block Hash of parallel chain block is recorded in main chain block after executing common recognition transaction for node, therefore there is record in main chain node
hash(500)'。
After B receives hash (500), search it is local whether have with hash (500) identical hash (500) ', have, then test
Card passes through;Nothing is then verified and is not passed through, and verification result is returned to b;
When being verified, b uses current main chain-parallel chain mechanism, there is that hash's (500) ' is next from the record of B
Main chain block starts, and generates parallel chain block by the parallel chain transaction in synchronous main chain block;
Obstructed out-of-date when verifying, b sends the first checking solicited message to B, and the first checking solicited message includes hash
(499), whether correct B verifies the parallel chain block that a is pushed, if verifying does not still pass through, b sends the first checking request to B
Information, the first checking solicited message include (498) hash, recycle above-mentioned steps, until being verified;
Assuming that b sends the first checking solicited message to B, the first checking solicited message is verified when including (490) hash,
Then b uses current main chain-parallel chain mechanism, since the record of B has next main chain block of hash (490) ', by same
The parallel chain transaction walked in main chain block generates parallel chain block.
In more embodiments, checking solicited message be also configured as include the first parallel chain node pushed it is newest
The parameters such as the Mei Keergen of parallel chain block can be real as long as the parameter can be used for identifying the newest parallel chain block pushed
Existing identical technical effect.
In more institute's embodiment, checking solicited message is also configured as any one that the first parallel chain node is pushed
The block Hash of parallel chain block is, it can be achieved that identical technical effect.
Above mentioned embodiment provide a kind of authentication mechanisms of parallel chain block.
Fig. 6 is the flow chart of step S12 in a kind of preferred embodiment of method shown in Fig. 1.As shown in fig. 6, excellent one
It selects in embodiment, step S12 includes:
S122: the second parallel chain node sends the second checking solicited message to the first main chain node, for the first master link
Whether the first block that point generates the second block height specified by the first main chain node of verifying is corresponding with the first parallel chain node
The second main chain node on the identical verification result information of the second block of the identical block height of the second block height and return
It returns;
S123: verification result information is received, judges whether verification result is identical:
It is to then follow the steps the S124: the second parallel chain node to send parallel chain data-pushing clothes to the first parallel chain node
First registration information of business;
It is no, it thens follow the steps the S125: the second parallel chain node and reassigns the first parallel chain node, and it is parallel to return to second
Chain node sends the first checking solicited message step to the first main chain node.
The corresponding first main chain node of second parallel chain node b is B, corresponding second master link of the first parallel chain node a
Point is A;
Assuming that there is following application scenarios: B and A is two main chain nodes of bifurcated, main chain of the b from corresponding main chain node B
When synchronous parallel chain transaction relevant to this parallel chain is in block to generate parallel chain block, several parallel sequences of rollback are first had to
Block, until it is identical to roll back to the block Hash recorded in the block Hash and B of some parallel chain block, then b could be from right
Synchronous parallel chain transaction relevant to this parallel chain is in the main chain block of the main chain node B answered to generate parallel chain block;It is above-mentioned
Mechanism wastes the bandwidth that b synchronizes existing parallel chain block;The above problem can be overcome using method provided in this embodiment;
Specifically, it is assumed that the second block height is 450, the firstth area of the second block height specified by the first main chain node
Block is block450_B, and block identical with the second block height is high on the second main chain node corresponding with the first parallel chain node
Second block of degree is block450_A;
In step S122, b to B send the second checking solicited message, B generate verifying block450_B whether on A
Verification result information identical with the second block block450_A of block height 450 simultaneously returns;
In step S123, b receives verification result information, judges whether verification result is identical:
It is the first registration information for thening follow the steps S124:b and sending parallel chain data push service to a;
It is no, it thens follow the steps S125:b and reassigns the first parallel chain node (such as specified parallel chain node c is first flat
Row chain node), and return to S121 step.
After b has received the parallel chain block of a push, since bifurcated, b can be from the masters of corresponding main chain node B with A by B
Synchronous parallel chain transaction relevant to this parallel chain is in chain block to generate parallel chain block.
It, can also be according to actual needs by the first block arrangement of the second specified block height in more embodiments
It is received newest parallel chain block, it can be achieved that identical technical effect.
Above-described embodiment makes the second received parallel chain block of parallel chain node institute be required received parallel chain block,
It further saves parallel chain node and synchronizes the bandwidth of existing parallel chain block, and reduce parallel chain node and synchronize existing parallel chain
The time-consuming duration of block.
Fig. 7 is the flow chart of another preferred embodiment of method shown in Fig. 1.As shown in fig. 7, in a preferred embodiment
In, after data of the second parallel chain node according to the first blocks operation information update local further include:
S19: the second parallel chain node sends the second note for stopping parallel chain data push service to the first parallel chain node
Volume solicited message after receiving the second registration information for the first parallel chain node, deletes the push of the second parallel chain node
Address.
Fig. 8 is a kind of structural schematic diagram for equipment that one embodiment of the invention provides.
As shown in figure 8, present invention also provides a kind of equipment 800, including one or more centres as on the other hand
Unit (CPU) 801 is managed, can be added according to the program being stored in read-only memory (ROM) 802 or from storage section 808
The program that is downloaded in random access storage device (RAM) 803 and execute various movements appropriate and processing.In RAM803, also deposit
It contains equipment 800 and operates required various programs and data.CPU801, ROM802 and RAM803 pass through the phase each other of bus 804
Even.Input/output (I/O) interface 805 is also connected to bus 804.
I/O interface 805 is connected to lower component: the importation 806 including keyboard, mouse etc.;It is penetrated including such as cathode
The output par, c 807 of spool (CRT), liquid crystal display (LCD) etc. and loudspeaker etc.;Storage section 808 including hard disk etc.;
And the communications portion 809 of the network interface card including LAN card, modem etc..Communications portion 809 via such as because
The network of spy's net executes communication process.Driver 810 is also connected to I/O interface 805 as needed.Detachable media 811, such as
Disk, CD, magneto-optic disk, semiconductor memory etc. are mounted on as needed on driver 810, in order to read from thereon
Computer program be mounted into storage section 808 as needed.
Particularly, in accordance with an embodiment of the present disclosure, the parallel chain block method for pushing of any of the above-described embodiment description can be with
It is implemented as computer software programs.For example, embodiment of the disclosure includes a kind of computer program product comprising visibly
Comprising computer program on a machine-readable medium, the computer program includes for executing parallel chain block method for pushing
Program code.In such embodiments, which can be downloaded and be pacified from network by communications portion 809
Dress, and/or be mounted from detachable media 811.
As another aspect, present invention also provides a kind of computer readable storage medium, the computer-readable storage mediums
Matter can be computer readable storage medium included in the device of above-described embodiment;It is also possible to individualism, it is unassembled
Enter the computer readable storage medium in equipment.Computer-readable recording medium storage has one or more than one program, should
Program is used to execute the parallel chain block method for pushing for being described in the application by one or more than one processor.
Flow chart and block diagram in attached drawing are illustrated according to the system of various embodiments of the invention, method and computer journey
The architecture, function and operation in the cards of sequence product.In this regard, each box in flowchart or block diagram can generation
A part of one module, program segment or code of table, a part of the module, program segment or code include one or more use
The executable instruction of the logic function as defined in realizing.It should also be noted that in some implementations as replacements, being marked in box
The function of note can also occur in a different order than that indicated in the drawings.For example, two boxes succeedingly indicated are actually
It can be basically executed in parallel, they can also be executed in the opposite order sometimes, this is depending on related function.Also it wants
It is noted that the combination of each box in block diagram and or flow chart and the box in block diagram and or flow chart, Ke Yitong
The dedicated hardware based system of functions or operations as defined in executing is crossed to realize, or by specialized hardware and can be calculated
The combination of machine instruction is realized.
Being described in the embodiment of the present application involved unit or module can be realized by way of software, can also be with
It is realized by way of hardware.Described unit or module also can be set in the processor, for example, each unit can
To be the software program being arranged in computer or intelligent movable equipment, it is also possible to the hardware device being separately configured.Wherein, this
The title of a little units or module does not constitute the restriction to the unit or module itself under certain conditions.
Above description is only the preferred embodiment of the application and the explanation to institute's application technology principle.Those skilled in the art
Member is it should be appreciated that invention scope involved in the application, however it is not limited to technology made of the specific combination of above-mentioned technical characteristic
Scheme, while should also cover in the case where not departing from the application design, appointed by above-mentioned technical characteristic or its equivalent feature
Other technical solutions of meaning combination and formation.Such as features described above and (but being not limited to) disclosed herein have similar functions
Technical characteristic replaced mutually and the technical solution that is formed.