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.
One block chain transaction can be divided into transaction head information and transaction body, and transaction head information includes purpose actuator name
Claim, type of transaction etc., transaction body can put specific Transaction Information.
Fig. 1 is a kind of flow chart of the parallel chain that provides of one embodiment of the invention from the method for common recognition.As shown in Figure 1, at this
In embodiment, the present invention provides a kind of parallel chain from common recognition method, and the above method is suitable for the common recognition node of parallel chain, from knowing together
Transaction is traded to be known together respectively by the parallel chain that main chain and parallel chain execute, and the above method includes:
S11: each parallel chain transaction of this parallel chain is synchronized from main chain block;
S12: judge to hand over the presence or absence of non-from common recognition in each parallel chain transaction according to the transaction head information that each parallel chain is traded
Easy parallel chain transaction:
It is to then follow the steps S13: judges whether there is several the first common recognition transaction for being buffered in the first local block:
It is to then follow the steps S14: executes each first common recognition transaction and the transaction of each parallel chain sequentially to generate the first parallel chain
Second common recognition transaction of block and the first parallel chain block, and the second common recognition transaction is sent to main chain node;
It is no, it thens follow the steps S15: executing each parallel chain transaction to generate the second parallel chain block and the second parallel chain block
Third know together transaction, and by third common recognition transaction be sent to main chain node;
It is no, it thens follow the steps S16: the transaction of each parallel chain is sequentially cached to local.
Specifically, with the type of transaction of the transaction head information of the non-parallel chain transaction from common recognition transaction for non-commit class
Type, for the type of transaction from the transaction head information of common recognition transaction is commit;Assuming that a, b, c, d are four of parallel chain M flat
Row chain common recognition node, the corresponding main chain node of a are A, and the corresponding main chain node of b is B, and the corresponding main chain node of c is C, and d is corresponding
Main chain node is D;The invasive parallel chain transaction txM for building parallel chain M, the transaction of txM in main chain block 20 (block (20_ master))
The type of transaction of head information is non-commit type;
For this group of main chain node-parallel chain node of A-a:
In step s 11, a synchronizes txM from block (20_ master);
In step s 12, the transaction head information that a trades according to each parallel chain judges in each parallel chain transaction with the presence or absence of non-
It trades from the parallel chain of common recognition transaction:
Since the type of transaction of the transaction head information of the parallel chain transaction txM in main chain block is non-commit type, it is
The non-parallel chain transaction from common recognition transaction, thens follow the steps S13: judging whether there is and several is buffered in local the first block
First common recognition transaction:
It is local there is no the first common recognition transaction of caching since txM is the transaction for creating parallel chain M, it thens follow the steps
S15: txM is executed to generate the third common recognition transaction tx1_a of the second parallel chain block block (1_a) and block (1_a), and will
Tx1_a is sent to A;
The parallel chain of B-b, C-c, D-d are identical as A-a from common recognition method, and details are not described herein again;
At this point, tx1_a to be broadcast to other nodes of main chain after A receives tx1_a;
After B receives tx1_b, tx1_b is broadcast to other nodes of main chain;
After C receives tx1_c, tx1_c is broadcast to other nodes of main chain;
After D receives tx1_d, tx1_d is broadcast to other nodes of main chain;
All nodes of main chain all receive tx1_a, tx1_b, tx1_c, tx1_d.
Assuming that parallel chain related with the parallel chain M transaction in main chain block 21 (block (21_ master)) is tx1_a, tx1_
b,tx1_c,tx1_d;Tx1_a, tx1_b, tx1_c, tx1_d are from common recognition transaction, the friendship of tx1_a, tx1_b, tx1_c, tx1_d
The type of transaction of easy head information is commit;
For this group of main chain node-parallel chain node of A-a:
In step s 11, a synchronizes each parallel chain transaction of this parallel chain from block (21_ master);
In step s 12, the transaction head information that a trades according to each parallel chain judges in each parallel chain transaction with the presence or absence of non-
It trades from the parallel chain of common recognition transaction:
Due to the transaction of the transaction head information of parallel chain transaction tx1_a, tx1_b, tx1_c, tx1_d of block (21_ master)
Head information type of transaction be commit, be it is non-from common recognition transaction, then follow the steps S16: by tx1_a, tx1_b, tx1_c,
Tx1_d is sequentially cached to local.
The parallel chain of B-b, C-c, D-d are identical as A-a from common recognition method, and details are not described herein again;
At this point, the local of a, b, c, d are cached with tx1_a, tx1_b, tx1_c, tx1_d.
Assuming that parallel chain related with the parallel chain M transaction in main chain block 22 (block (22_ master)) is txN, txN is
The non-parallel chain transaction from common recognition transaction, the type of transaction of the transaction head information of txN is non-commit;
In step s 11, a synchronizes each parallel chain transaction txN of this parallel chain from (block (22_ master));
In step s 12, the transaction head information that a trades according to each parallel chain judges in each parallel chain transaction with the presence or absence of non-
It trades from the parallel chain of common recognition transaction:
Since the type of transaction of the transaction head information of txN is non-commit, S13 is thened follow the steps: if judging whether there is
Dry the first common recognition transaction for being buffered in the first local block:
Since the local cache of a has tx1_a, tx1_b, tx1_c, tx1_d, then follow the steps S14: sequentially execute tx1_a,
Tx1_b, tx1_c, tx1_d and txN are handed over the second common recognition for generating the first parallel chain block block (2_a) and block (2_a)
Easy tx2_a, and tx2_a is sent to A.
The parallel chain of B-b, C-c, D-d are identical as A-a from common recognition method, and details are not described herein again.
In parallel chain M, it is likely present e, the non-common recognition node such as f, g, the corresponding main chain node of e is E, the corresponding master of f
Chain node is F, and the corresponding main chain node of g is G, and so on;Non- common recognition node is different from common recognition node, and non-common recognition node executes
Following steps:
Each parallel chain transaction of this parallel chain is synchronized from main chain block;
Judged in each parallel chain transaction with the presence or absence of non-according to the transaction head information that each parallel chain is traded from transaction of knowing together
Parallel chain transaction:
It is then to hold to execute each first common recognition transaction and the transaction of each parallel chain sequentially to generate the first parallel chain block;
It is no, then each parallel chain transaction is executed to generate the second parallel chain block;
It is no, then the transaction of each parallel chain is sequentially cached to local.
In more embodiments, it can also be handed over according to actual needs by the non-parallel chain transaction from common recognition transaction and from common recognition
The type of transaction of easy transaction head information is configured to other different identifiers, it can be achieved that identical technical effect.
Above-described embodiment effectively reduces sky number of blocks.
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 above method further include:
S21: it monitors in the continuous main chain block of the first quantity with the presence or absence of the non-parallel chain transaction from common recognition transaction:
It is no, it thens follow the steps S22: it is parallel to generate third parallel chain block and third sequentially to execute each first common recognition transaction
4th common recognition transaction of chain block, and the 4th common recognition transaction is sent to main chain node.
Assuming that the first quantity is 50;
In the step s 21, a detection is handed in 50 continuous main chain blocks with the presence or absence of the non-parallel chain from common recognition transaction
It is easy:
It is no, it thens follow the steps S22: it is parallel to generate third parallel chain block and third sequentially to execute each first common recognition transaction
4th common recognition transaction of chain block, and the 4th common recognition transaction is sent to main chain node A.
In more embodiments, other numerical value, such as 100 can also be configured by the first quantity according to actual needs
It is a, 200, it can be achieved that identical technical effect.
Above-described embodiment guarantees that parallel chain common recognition node will not the biggish trading group of disposable chain linked to owner node quantity forwarded
And lead to the transaction congestion of main chain node, to guarantee the stable operation of main chain.
Fig. 3 is a kind of flow chart of preferred embodiment of method shown in Fig. 1.As shown in figure 3, in a preferred embodiment
In, the above method further include:
S31: whether the total amount that monitoring is buffered in the first local common recognition transaction is not less than the first threshold of pre-configuration:
It is to then follow the steps S32: executes each first common recognition transaction sequentially to generate the 4th parallel sequence block and the 4th in parallel
5th common recognition transaction of chain block, and the 5th common recognition transaction is sent to main chain node.
Assuming that configuring 8 for first threshold;
In step S31, whether the total amount that a monitoring is buffered in the first local common recognition transaction is not less than 8:
It is to then follow the steps S32, a executes each first common recognition transaction sequentially to generate the 4th parallel sequence block and Siping City
5th common recognition transaction of row chain block, and the 5th common recognition transaction is sent to main chain node A.
Wherein, to guarantee node after delay machine, the total amount of the first common recognition transaction still can be monitored, local by being buffered in
Each first common recognition transaction backups in local data base;When node delay machine and reconnection, obtained from local data base not sent
Common recognition transaction, and execute the above method.
In more embodiments, other numerical value, such as 5,10 can also be configured by first threshold according to actual needs, it can
Realize identical technical effect.
Above-described embodiment guarantees that parallel chain common recognition node will not the biggish trading group of disposable chain linked to owner node quantity forwarded
And lead to the transaction congestion of main chain node, to guarantee the stable operation of main chain.
Fig. 4 is the flow chart of step S11 in a kind of preferred embodiment of method shown in Fig. 1.As shown in figure 4, excellent one
It selects in embodiment, step S11 includes:
S112: the first main chain block corresponding to the 5th parallel chain block being newly generated is inquired;
S114: each parallel chain transaction of this parallel chain is synchronized from the first main chain block.
Assuming that there is following application scenarios, the 5th parallel chain block that a is newly generated is block (5_a), and block (5_a) is right
The the first main chain block answered is block (50_ master);A delay machine before generating block (6_a), after a period of time, a and A reconnection;This
When, a is lost the first common recognition transaction of several first blocks that block (5_a) is cached afterwards due to delay machine;Execute following steps
It can solve the problems, such as that this application scenarios generates;
In step S112, the first main chain corresponding to the 5th parallel chain block block (5_a) that a inquiry is newly generated
Block block (50_ master);
In step S114, a synchronizes each parallel chain transaction of this parallel chain from block (50_ master).
Above-described embodiment guarantees that parallel chain common recognition node delay machine in several first common recognition process of exchange of local cache is restarted
After will not omit the first common recognition transaction.
Fig. 5 is a kind of structural schematic diagram for equipment that one embodiment of the invention provides.
As shown in figure 5, present invention also provides a kind of equipment 500, including one or more centres as on the other hand
Unit (CPU) 501 is managed, can be added according to the program being stored in read-only memory (ROM) 502 or from storage section 508
The program that is downloaded in random access storage device (RAM) 503 and execute various movements appropriate and processing.In RAM503, also deposit
It contains equipment 500 and operates required various programs and data.CPU501, ROM502 and RAM503 pass through the phase each other of bus 504
Even.Input/output (I/O) interface 505 is also connected to bus 504.
I/O interface 505 is connected to lower component: the importation 506 including keyboard, mouse etc.;It is penetrated including such as cathode
The output par, c 507 of spool (CRT), liquid crystal display (LCD) etc. and loudspeaker etc.;Storage section 508 including hard disk etc.;
And the communications portion 509 of the network interface card including LAN card, modem etc..Communications portion 509 via such as because
The network of spy's net executes communication process.Driver 510 is also connected to I/O interface 505 as needed.Detachable media 511, such as
Disk, CD, magneto-optic disk, semiconductor memory etc. are mounted on as needed on driver 510, in order to read from thereon
Computer program be mounted into storage section 508 as needed.
Particularly, in accordance with an embodiment of the present disclosure, the parallel chain of any of the above-described embodiment description can be by from common recognition method
It is embodied as computer software programs.For example, embodiment of the disclosure includes a kind of computer program product comprising visibly wrap
Containing computer program on a machine-readable medium, the computer program includes the journey for executing parallel chain from the method for common recognition
Sequence code.In such embodiments, which can be downloaded and installed from network by communications portion 509,
And/or it is mounted from detachable media 511.
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 by one or more than one processor is described in the parallel chain of the application from common recognition method.
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.