CN114090694A - PoA consensus method, device, equipment and storage medium - Google Patents

PoA consensus method, device, equipment and storage medium Download PDF

Info

Publication number
CN114090694A
CN114090694A CN202210057962.5A CN202210057962A CN114090694A CN 114090694 A CN114090694 A CN 114090694A CN 202210057962 A CN202210057962 A CN 202210057962A CN 114090694 A CN114090694 A CN 114090694A
Authority
CN
China
Prior art keywords
node
packing
round
candidate
packer
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202210057962.5A
Other languages
Chinese (zh)
Other versions
CN114090694B (en
Inventor
李晓风
许金林
赵赫
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Anhui Zhongke Lattice Technology Co ltd
Original Assignee
Anhui Zhongke Lattice Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Anhui Zhongke Lattice Technology Co ltd filed Critical Anhui Zhongke Lattice Technology Co ltd
Priority to CN202210057962.5A priority Critical patent/CN114090694B/en
Publication of CN114090694A publication Critical patent/CN114090694A/en
Application granted granted Critical
Publication of CN114090694B publication Critical patent/CN114090694B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor

Abstract

The invention relates to the technical field of a block chain consensus mechanism, and discloses a PoA consensus method, a device, equipment and a storage medium, wherein when round packing is unsuccessful, a first node which is a round packing producer is added to the end of a candidate packing set, and is determined to be a second node in the candidate packing set so as to pack a block; adding the second node to the end of the latest packing set, and adding the first node in the latest packing set to the end of the candidate packing set; determining a node serving as a next round of packer from the to-be-packed set, and adding a first node in the candidate packing set into the to-be-packed set; when the success is achieved, adding the first node to the end of the latest packing set, and adding the first node in the latest packing set to the candidate packing set; and adding the first node in the candidate packing set into the to-be-packed set, and determining the node serving as the next round of packing from the to-be-packed set. The invention can quickly determine each round of packers, improve the ordered block output probability of the nodes and reduce the block bifurcation condition.

Description

PoA consensus method, device, equipment and storage medium
Technical Field
The present invention relates to the technical field of a block chain consensus mechanism, and in particular, to a PoA consensus method, apparatus, device, and storage medium.
Background
The consensus mechanism is the root of the blockchain, and there are many consensus mechanisms on the blockchain, and the common consensus mechanisms include Proof of workload (PoW), Proof of rights and interests (PoS), Proof of rights and rights of stocks (DPoS), and common algorithms of the alliance chain (PoA). The PoA consensus mechanism is fast in election speed and consumes no extra computational power, and thus, the PoA protocol provides a balance between miners and general network members.
In the existing PoA consensus mechanism, if a round packer cannot perform packing for some reason, a subsequent packer cannot be quickly determined, so that alternative packers compete out blocks, and the defects of time waste and block bifurcation exist.
The above is only for the purpose of assisting understanding of the technical aspects of the present invention, and does not represent an admission that the above is prior art.
Disclosure of Invention
The invention mainly aims to provide a PoA consensus method, a PoA consensus device, PoA consensus equipment and a storage medium, and aims to solve the technical problem that a subsequent packer cannot be determined quickly in the prior art when a round packer cannot perform packing.
To achieve the above object, the present invention provides a PoA consensus method, which includes the following steps when a round packer does not pack a block successfully in the current round:
adding a first node as the current round packer to the end of a candidate packing set, and determining a second node as the current round packer in the candidate packing set to pack the block;
adding the second node to the end of the latest packing set, and adding the first node in the latest packing set to the end of the candidate packing set;
and determining a node serving as a next round of packer in the to-be-packed set, and adding a first node in the candidate packing set into the to-be-packed set, wherein the node of the next round of packer is a node numbered as (n + 1)% m.
Optionally, the first node is an nth% m node in the block, n is a height of the block, m is a total number of nodes in the block, and% is a remainder operator, and the method further includes:
when the height of the block is 0, arranging m nodes in the block according to a preset sequencing rule, and taking a first node as the current round packer;
and uniformly dividing the remaining m-1 nodes into the to-be-packaged set, the candidate packaged set and the latest packaged set according to the sequence.
Optionally, the determining a node from the set to be packed as a packer of a next round includes:
judging whether the node with the number of (n + 1)% m exists in the set to be packaged;
if yes, determining the node with the number of (n + 1)% m as the node of the next round of packagers;
if not, adding the node with the number of (n + 1)% m in the candidate packing set into the to-be-packed set, adding the tail node of the to-be-packed set into the candidate packing set, and taking the node with the number of (n + 1)% m as the node of the next round of packing;
and deleting the node with the number of (n + 1)% m from the set to be packaged, and adding the first node in the candidate packaging set to the tail of the set to be packaged.
Optionally, the determining a second node in the candidate packing set as the current round packer to pack the block includes:
sequentially starting to pack the blocks at intervals of time t of nodes in the candidate packing set;
and taking the node which is packaged successfully at first in the candidate packaging set as the second node, and packaging the block.
Optionally, when the round packager successfully packages the block in the current round, the method further comprises:
adding the first node as the current round packer to the end of the latest packing set, and adding the first node in the latest packing set to the candidate packing set;
and determining a node as a next round packer in the to-be-packed set, and adding a first node in the candidate packing set into the to-be-packed set.
Optionally, if the current round packer does not pack the block, adding the first node as the current round packer to the end of the latest packing set.
In addition, to achieve the above object, the present invention further provides a PoA consensus apparatus, which includes, when a round packer does not pack an area successfully in the current round:
the round packing person determining module is used for adding a first node serving as the round packing person into the tail end of a candidate packing set and determining a second node serving as the round packing person in the candidate packing set so as to pack the block;
a first node dynamic adjustment module, configured to add the second node to the end of a latest packing set, and add a first node in the latest packing set to the end of the candidate packing set;
and the first next round packager determining module is used for determining a node serving as a next round packager in the to-be-packaged set, and adding a first node in the candidate packaging set into the to-be-packaged set, wherein the node of the next round packager is a node numbered as (n + 1)% m.
Optionally, when the round packer packs the block successfully in the current round, the apparatus further comprises:
a second node dynamic adjustment module, configured to add the first node as the current round of packer to the end of the latest packing set, and add a first node in the latest packing set to the candidate packing set;
and the second next round packager determining module is used for determining a node serving as a next round packager in the to-be-packaged set, and adding a first node in the candidate packaging set into the to-be-packaged set.
In addition, to achieve the above object, the present invention further provides a PoA consensus apparatus, including: a memory, a processor, and a PoA consensus program stored on the memory and executable on the processor, the PoA consensus program configured to implement a PoA consensus method as described above.
In addition, to achieve the above object, the present invention further provides a storage medium, where a PoA consensus program is stored, and the PoA consensus program, when executed by a processor, implements the PoA consensus method as described above.
According to the PoA consensus method provided by the invention, when a round packager does not package a block successfully in the current round, a first node serving as the round packager is added to the end of a candidate packaging set, and a second node serving as the round packager is determined in the candidate packaging set so as to package the block; adding the second node to the end of the latest packing set, and adding the first node in the latest packing set to the end of the candidate packing set; determining a node as a next round of packer in the to-be-packed set, and adding a first node in the candidate packing set into the to-be-packed set, wherein the node of the next round of packer is a node numbered as (n + 1)% m; when the current round packager successfully packages the block in the current round, adding the first node as the current round packager to the end of the latest packaging set, and adding the first node in the latest packaging set to the candidate packaging set; and adding the first node in the candidate packing set into the to-be-packed set, and determining the node as a next round of packing from the to-be-packed set. The invention optimizes the PoA consensus mechanism, and divides a certain node into three sets after determining that the node is a current round packer: when a round packager does not successfully package a block in the current round, adding a node serving as the round packager into the candidate packaging set, re-determining a node for packaging the block in the candidate packaging set, and quickly determining the packager in each round by optimizing a block consensus rule, so that the probability of orderly block output of the node is improved, competition resources are relieved, and the condition of block bifurcation is reduced.
Drawings
Fig. 1 is a schematic structural diagram of a PoA consensus device in a hardware operating environment according to an embodiment of the present invention;
FIG. 2 is a schematic flow chart of a PoA consensus method according to a first embodiment of the present invention;
FIG. 3 is a schematic diagram of a candidate packing set according to the present invention;
FIG. 4 is a schematic diagram of a q-th round packing process according to the present invention;
FIG. 5 is a schematic flow chart of a PoA consensus method according to a second embodiment of the present invention;
fig. 6 is a functional block diagram of a PoA consensus apparatus according to a first embodiment of the present invention;
fig. 7 is a functional block diagram of a PoA consensus apparatus according to a second embodiment of the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Referring to fig. 1, fig. 1 is a schematic structural diagram of a PoA consensus device in a hardware operating environment according to an embodiment of the present invention.
As shown in fig. 1, the PoA consensus apparatus may include: a processor 1001, such as a Central Processing Unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Wherein a communication bus 1002 is used to enable connective communication between these components. The user interface 1003 may include a Display screen (Display), an input unit such as a Keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a Wireless interface (e.g., a Wireless-Fidelity (Wi-Fi) interface). The Memory 1005 may be a Random Access Memory (RAM) Memory, or may be a Non-Volatile Memory (NVM), such as a disk Memory. The memory 1005 may alternatively be a storage device separate from the processor 1001.
Those skilled in the art will appreciate that the configuration shown in fig. 1 does not constitute a limitation of a PoA consensus device, and may include more or fewer components than those shown, or some components in combination, or a different arrangement of components.
As shown in fig. 1, a memory 1005, which is a storage medium, may include therein an operating system, a network communication module, a user interface module, and a PoA consensus program.
In the PoA consensus device shown in fig. 1, the network interface 1004 is primarily used for data communication with a network node packaging device; the user interface 1003 is mainly used for data interaction with a user; the processor 1001 and the memory 1005 in the PoA consensus device of the present invention may be disposed in the PoA consensus device, and the PoA consensus device calls the PoA consensus program stored in the memory 1005 through the processor 1001 and executes the PoA consensus method provided in the embodiment of the present invention.
Based on the hardware structure, the embodiment of the PoA consensus method is provided.
Referring to fig. 2, fig. 2 is a schematic flow chart of a PoA consensus method according to a first embodiment of the present invention.
In a first embodiment, when a round packer does not pack a tile successfully in the current round, the PoA consensus method comprises the following steps:
step S10, adding the first node as the current round packer to the end of the candidate packing set, and determining the second node as the current round packer in the candidate packing set to pack the block.
It should be noted that, the execution subject of the present embodiment is a PoA consensus device, and may also be other devices that can achieve the same or similar functions.
If a new packer is generated from the candidate packing set and a new packer is generated in a certain round when the round packer cannot pack successfully, the node as the new packer is deleted from the candidate packing set.
Step S20, adding the second node to the end of the latest packing set, and adding the first node in the latest packing set to the end of the candidate packing set;
and step S30, determining a node as a next round packer in the to-be-packed set, and adding a first node in the candidate packing set into the to-be-packed set, wherein the node of the next round packer is a node numbered as (n + 1)% m.
After the packing is completed, the node as a new packer is added to the end of the latest packing set, the first node in the latest packing set is added to the end of the candidate packing set, and the first node in the candidate packing set is added to the end of the set to be packed, so that the dynamic balance among the sizes of the set to be packed, the candidate packing set and the latest packing set is realized.
It should be noted that, in this embodiment, the first node of the round packer is added to the end of the candidate packing set, and the first node of the candidate packing set is added to the end of the to-be-packed set, so as to ensure that each node is ordered as much as possible, all nodes are continuously in the nearest packing set, the candidate packing set, and the to-be-packed set, and when the round packer circulates among the four roles, and the order of the nodes in the set is ordered according to the order of the nodes entering the set, so the order in the set is relatively stable and is not disordered as much as possible.
When a round packager does not successfully package the block in the current round, adding a first node as the current round packager to the end of a candidate packaging set, and determining a second node as the current round packager in the candidate packaging set to package the block; adding the second node to the end of the latest packing set, and adding the first node in the latest packing set to the end of the candidate packing set; and adding the first node in the candidate packing set to the end of the to-be-packed set, and determining the node serving as the next round of packer from the to-be-packed set. The invention optimizes the PoA consensus mechanism, and divides a certain node into three sets after determining that the node is a current round packer: when a round packager does not successfully package a block in the current round, adding a node serving as the round packager into the candidate packaging set, and re-determining a node for packaging the block in the candidate packaging set to package the block.
Further, the first node is the nth m nodes in the block, n is the height of the block, m is the total number of nodes in the block, and% is a remainder operator, and the method further includes:
when the height of the block is 0, arranging m nodes in the block according to a preset sequencing rule, and taking a first node as the current round packer;
and uniformly dividing the remaining m-1 nodes into the to-be-packaged set, the candidate packaged set and the latest packaged set according to the sequence.
It should be noted that, in this embodiment, the preset ordering rule may be that the nodes are ordered according to the node IDs, and corresponding numbers are sequentially obtained according to n% m as the sequence of the packed blocks.
It should be understood that in the first round, the node with the number 0 is taken as the first packing block of the current packer, and the remaining other nodes are allocated as the to-be-packed set, the candidate packing set and the latest packing set in the order of numbers, and the size is (m-1)/3. And generating current round packers of each round according to the consensus rule in the subsequent round, and updating the to-be-packed set, the candidate packed set and the latest packed set.
As shown in fig. 4, taking the q-th round as an example, when the round packager can not successfully package in the current round, the current round packager in the q-th round enters the end of the candidate packaging set, as shown by a dotted line (r) in fig. 4; a packager of the q-th round is generated in the candidate packaging set, and after the packaging is finished, the node enters the end of the latest packaging set, such as a dotted line II in the figure 4; then the first node of the latest packing set enters the end of the candidate packing set, as shown by the dotted line (c) in fig. 4; then the first node of the candidate packing set enters the end of the set to be packed, as shown by a dotted line (r) in fig. 4; the sizes of both the most recent packed set and the candidate packed set are dynamically maintained at (m-1)/3. And determining the current packer as the q +1 round from the q round to-be-packed set by the q +1 round, and deleting the current packer from the to-be-packed set, so that the size of the to-be-packed set is still (m-1)/3 by the q +1 round.
Further, the step S10 includes:
step S101, adding a first node as the current round packager into the end of a candidate packaging set;
step S102, packing the blocks by sequentially starting the node interval time t in the candidate packing set;
step S103, using the node that is successfully packed first in the candidate packing set as the second node, and packing the block.
It should be noted that, as shown in fig. 3, the candidate nodes in the candidate packing set are sequentially packed by starting packing blocks at intervals t in order to compete for the packer, and assuming that the candidate node 1 starts packing from time k, and after the interval t, the candidate node 2 starts packing at time k + t, and so on, until the last candidate node starts packing at time k + [ (m-1)/3] × t; when a certain candidate node is successfully packed, other candidate nodes immediately stop without continuing packing, the successfully packed candidate node is the new packer of the current round, the uncompleted packed data of other candidate nodes are discarded, and the packed data of the new packer is used as the standard.
It should be noted that the present embodiment sets an interval time t to select a packer from the candidate nodes as soon as possible, otherwise, the packing of multiple candidate nodes at the same time would aggravate the competition for resources, resulting in more branches.
Further, the step S30 includes:
s301, judging whether the node with the number of (n + 1)% m exists in the set to be packaged, if so, executing a step S303, and if not, executing a step S302;
s302, adding the node with the number of (n + 1)% m in the candidate packing set into the to-be-packed set, adding the tail node of the to-be-packed set into the candidate packing set, and then executing the step S303;
s303, taking the node with the number of (n + 1)% m as the node of the next round of packager;
s304, deleting the nodes numbered as (n + 1)% m from the set to be packaged.
Further, if the current round packer does not pack the block, adding the first node as the current round packer to the end of the latest packed set.
It should be noted that, in order to prevent the formation of empty blocks, if there is no transaction in this round, when the round packer does not pack, but the consensus rule is still executed in the next round, the round determines that when the round packer ends even if it does not pack, the node as the round packer also joins the latest packed set.
In an embodiment, as shown in fig. 5, the second embodiment of the PoA consensus method according to the present invention is proposed based on the first embodiment, and when the round packer successfully packs the block in the current round, the method includes:
step S40, adding the first node as the current round packer to the end of the latest packing set, and adding the first node in the latest packing set to the candidate packing set.
And step S50, determining a node as a next round packer in the to-be-packed set, and adding the first node in the candidate packing set into the to-be-packed set.
After the packing is completed, the first node which is the current round of packing is added to the end of the latest packing set, the first node in the latest packing set is added to the end of the candidate packing set, and the first node in the candidate packing set is added to the end of the to-be-packed set, so that the dynamic balance among the sizes of the to-be-packed set, the candidate packing set and the latest packing set is realized.
Further, the first node is the nth% m nodes in the block, n is the height of the block, m is the total number of nodes in the block, and% is a remainder operator.
It should be noted that, when the height of the block is 0, m nodes in the block are arranged according to a preset ordering rule, and the first node is taken as the current round packer, and when a packing operation is performed in the current round, the remaining m-1 nodes are uniformly divided into three sets except the node as the current packer.
Further, the node determined from the set to be packed as the next round of packer is the (n + 1)% m nodes.
As shown in fig. 4, taking the q-th round as an example, when the round packager successfully packages in the current round, after the round packager in the q-th round completes packaging, the node enters the end of the latest packaging set, as shown by a solid line (r) in fig. 4; then adding the first node in the latest packing set to the end of the candidate packing set, as shown by a solid line II in FIG. 4; then adding the first node of the candidate packing set to the end of the set to be packed, as shown by a solid line (c) in FIG. 4; the sizes of both the most recent packed set and the candidate packed set are dynamically maintained at (m-1)/3. By round q +1, the first node of the q-th round to-be-packed set, that is, (n + 1)% m nodes, is taken as the current packer of round q +1, and the node is deleted from the to-be-packed set, so by round q +1, the size of the to-be-packed set is still (m-1)/3.
Further, if the current round packer does not pack the block, adding the first node as the current round packer to the end of the latest packed set.
It should be noted that, in order to prevent the formation of empty blocks, if there is no transaction in this round, when the round packer does not pack, but the consensus rule is still executed in the next round, the round determines that when the round packer ends even if it does not pack, the node as the round packer also joins the latest packed set.
It should be noted that, in this embodiment, when the round packer does not pack the block successfully in the current round, the first node as the round packer is added to the end of the candidate packing set, and the second node as the round packer is determined in the candidate packing set to pack the block; adding the second node to the end of the latest packing set, and adding the first node in the latest packing set to the end of the candidate packing set; adding a first node in the candidate packing set to the tail of the set to be packed, and determining a node as a next round of packing person from the set to be packed; when the current round packager successfully packages the block in the current round, adding a first node which is the current round packager into the tail end of the latest packaging set, and adding a first node in the latest packaging set into a candidate packaging set; adding a first node in the candidate packing set into a to-be-packed set, and determining a node serving as a next round of packer from the to-be-packed set; and after each round is finished, realizing dynamic balance of the sizes of the to-be-packed set, the candidate packed set and the latest packed set. The embodiment can quickly confirm the packer of each round, improves the probability of orderly block output, can always normally select the packer for packing in each round by the consensus mechanism under the condition that the downtime of the 1/3 nodes is not exceeded, has strong robustness, can avoid continuous packing of a certain node, avoids the possibility of node monopoly culture and dislike, and has strong safety.
In addition, an embodiment of the present invention further provides a storage medium, where a PoA consensus program is stored on the storage medium, and the PoA consensus program implements the steps of the PoA consensus method described above when executed by a processor.
Since the storage medium adopts all technical solutions of all the embodiments, at least all the beneficial effects brought by the technical solutions of the embodiments are achieved, and no further description is given here.
In addition, referring to fig. 6, an embodiment of the present invention further provides a PoA consensus apparatus, where when a round packer does not pack a tile successfully in the current round, the PoA consensus apparatus includes:
a round-of-packing-person determining module 10, configured to add a first node as the round-of-packing person to the end of a candidate packing set, and determine a second node as the round-of-packing person in the candidate packing set to pack the block;
if a new packer is generated from the candidate packing set and a new packer is generated in a certain round when the round packer cannot pack successfully, the node as the new packer is deleted from the candidate packing set.
A first node dynamic adjustment module 20, configured to add the second node to the end of the latest packing set, and add the first node in the latest packing set to the end of the candidate packing set;
a first next round packer determining module 30, configured to determine a node in the to-be-packed set as a next round packer, and add a first node in the candidate packing set to the to-be-packed set, where the node of the next round packer is a node numbered (n + 1)% m.
After the packing is completed, the node as a new packer is added to the end of the latest packing set, the first node in the latest packing set is added to the end of the candidate packing set, and the first node in the candidate packing set is added to the end of the set to be packed, so that the dynamic balance among the sizes of the set to be packed, the candidate packing set and the latest packing set is realized.
When a round packager does not successfully package the block in the current round, adding a first node as the current round packager to the end of a candidate packaging set, and determining a second node as the current round packager in the candidate packaging set to package the block; adding the second node to the end of the latest packing set, and adding the first node in the latest packing set to the end of the candidate packing set; adding a first node in the candidate packing set to the tail of the set to be packed, and determining a node as a next round of packing person from the set to be packed; the invention optimizes the PoA consensus mechanism, and divides a certain node into three sets after determining that the node is a current round packer: when a round packager does not successfully package a block in the current round, adding a node serving as the round packager into the candidate packaging set, and re-determining a node for packaging the block in the candidate packaging set to package the block.
Further, the first node is the nth% m nodes in the block, n is the height of the block, m is the total number of nodes in the block, and% is a remainder operator.
Further, when the height of the block is 0, arranging m nodes in the block according to a preset sorting rule, and taking a first node as the current round packer;
and uniformly dividing the rest m-1 nodes into the to-be-packed set, the candidate packed set and the latest packed set according to the sequence, wherein the size of each set is (m-1)/3.
Further, the current round baler determining module 10 comprises:
the node adding unit is used for adding a first node which is the current round packager into the tail end of the candidate packaging set;
a competition unit, configured to sequentially start packing the blocks by node interval time t in the candidate packing set;
and a packing node determining unit configured to pack the block, with a node that is successfully packed first in the candidate packing set as the second node.
It should be noted that, as shown in fig. 3, the candidate nodes in the candidate packing set are sequentially packed by starting packing blocks at intervals t in order to compete for the packer, and assuming that the candidate node 1 starts packing from time k, and after the interval t, the candidate node 2 starts packing at time k + t, and so on, until the last candidate node starts packing at time k + [ (m-1)/3] × t; when a certain candidate node is successfully packed, other candidate nodes immediately stop without continuing packing, the successfully packed candidate node is the new packer of the current round, the uncompleted packed data of other candidate nodes are discarded, and the packed data of the new packer is used as the standard.
It should be noted that the present embodiment sets an interval time t to select a packer from the candidate nodes as soon as possible, otherwise, the packing of multiple candidate nodes at the same time would aggravate the competition for resources, resulting in more branches.
Further, the first next round baler determination module 30 comprises:
a judging unit, configured to judge whether the node with the number of (n + 1)% m exists in the set to be packed;
a first determining unit configured to determine the node numbered (n + 1)% m as a node of the packer of the next round;
a second determining unit, configured to add the node with the number of (n + 1)% m in the candidate packing set to the to-be-packed set, add the last node of the to-be-packed set to the candidate packing set, and use the node with the number of (n + 1)% m as the node of the next round of packing;
and the deleting unit is used for deleting the node with the number of (n + 1)% m from the set to be packaged and adding the first node in the candidate packaging set to the tail of the set to be packaged.
Further, if the current round packer does not pack the block, adding the first node as the current round packer to the end of the latest packed set.
It should be noted that, in order to prevent the formation of empty blocks, if there is no transaction in this round, when the round packer does not pack, but the consensus rule is still executed in the next round, the round determines that when the round packer ends even if it does not pack, the node as the round packer also joins the latest packed set.
In an embodiment, as shown in fig. 7, the second embodiment of the PoA consensus apparatus according to the present invention is proposed based on the first embodiment, and when the round packer successfully packs the block in the current round, the method includes:
a second node dynamic adjustment module 40, configured to add the first node as the current round of packing into the end of the latest packing set, and add the first node in the latest packing set into the candidate packing set;
and a second next round packer determining module 50, configured to determine a node in the set to be packed as a next round packer, and add a first node in the candidate packing set to the set to be packed.
After the packing is completed, the first node which is the current round of packing is added to the end of the latest packing set, the first node in the latest packing set is added to the end of the candidate packing set, and the first node in the candidate packing set is added to the end of the to-be-packed set, so that the dynamic balance among the sizes of the to-be-packed set, the candidate packing set and the latest packing set is realized.
Further, the first node is the nth% m nodes in the block, n is the height of the block, m is the total number of nodes in the block,% is a remainder operator;
when the height of the block is 0, arranging m nodes in the block according to a preset sequencing rule, and taking a first node as the current round packer;
and uniformly dividing the remaining m-1 nodes into the to-be-packed set, the candidate packed set and the latest packed set according to the sequence, wherein the sizes of the to-be-packed set, the candidate packed set and the latest packed set are (m-1)/3.
Further, the node determined from the set to be packed as the next round of packer is the (n + 1)% m nodes.
Further, if the current round packer does not pack the block, adding the first node as the current round packer to the end of the latest packed set.
It should be noted that, in order to prevent the formation of empty blocks, if there is no transaction in this round, when the round packer does not pack, but the consensus rule is still executed in the next round, the round determines that when the round packer ends even if it does not pack, the node as the round packer also joins the latest packed set.
It should be noted that the above-described work flows are only exemplary, and do not limit the scope of the present invention, and in practical applications, a person skilled in the art may select some or all of them to achieve the purpose of the solution of the embodiment according to actual needs, and the present invention is not limited herein.
In addition, the technical details that are not described in detail in this embodiment may refer to the PoA consensus method provided in any embodiment of the present invention, and are not described herein again.
Further, it is to be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solution of the present invention or portions thereof that contribute to the prior art may be embodied in the form of a software product, where the computer software product is stored in a storage medium (e.g., Read Only Memory (ROM)/RAM, a magnetic disk, an optical disk), and includes several instructions for enabling a terminal device (e.g., a mobile phone, a computer, a node packaging device, or a network device) to execute the method according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (10)

1. A PoA consensus method, wherein when a round packer does not pack a block successfully in the current round, the PoA consensus method comprises the following steps:
adding a first node as the current round packer to the end of a candidate packing set, and determining a second node as the current round packer in the candidate packing set to pack the block;
adding the second node to the end of the latest packing set, and adding the first node in the latest packing set to the end of the candidate packing set;
and determining a node serving as a next round of packer in the to-be-packed set, and adding a first node in the candidate packing set into the to-be-packed set, wherein the node of the next round of packer is a node numbered as (n + 1)% m.
2. The PoA consensus method of claim 1, wherein the first node is an nth% m nodes in the block, n being a height of the block, m being a total number of nodes in the block,% being a remainder operator, the method further comprising:
when the height of the block is 0, arranging m nodes in the block according to a preset sequencing rule, and taking a first node as the current round packer;
and uniformly dividing the remaining m-1 nodes into the to-be-packaged set, the candidate packaged set and the latest packaged set according to the sequence.
3. The PoA consensus method of claim 1, wherein the determining a node from the set to be packaged that is a packer of a next round comprises:
judging whether the node with the number of (n + 1)% m exists in the set to be packaged;
if yes, determining the node with the number of (n + 1)% m as the node of the next round of packagers;
if not, adding the node with the number of (n + 1)% m in the candidate packing set into the to-be-packed set, adding the tail node of the to-be-packed set into the candidate packing set, and taking the node with the number of (n + 1)% m as the node of the next round of packing;
and deleting the node with the number of (n + 1)% m from the set to be packaged, and adding the first node in the candidate packaging set to the tail of the set to be packaged.
4. The PoA consensus method of claim 1, wherein the determining a second node in the candidate packing set to be the current round of packer to pack the block comprises:
sequentially starting to pack the blocks at intervals of time t of nodes in the candidate packing set;
and taking the node which is packaged successfully at first in the candidate packaging set as the second node, and packaging the block.
5. The PoA consensus method of claim 1, wherein, when the round packager successfully packages the block in the current round, the method further comprises:
adding the first node as the current round packer to the end of the latest packing set, and adding the first node in the latest packing set to the candidate packing set;
and determining a node as a next round packer in the to-be-packed set, and adding a first node in the candidate packing set into the to-be-packed set.
6. The PoA consensus method of claim 5, wherein the first node that is the current round packer is added to the end of the latest packing set if the current round packer does not pack the block.
7. A PoA consensus apparatus, wherein when a round packer does not successfully pack a block in the current round, the PoA consensus apparatus comprises:
the round packing person determining module is used for adding a first node serving as the round packing person into the tail end of a candidate packing set and determining a second node serving as the round packing person in the candidate packing set so as to pack the block;
a first node dynamic adjustment module, configured to add the second node to the end of a latest packing set, and add a first node in the latest packing set to the end of the candidate packing set;
and the first next round packager determining module is used for determining a node serving as a next round packager in the to-be-packaged set, and adding a first node in the candidate packaging set into the to-be-packaged set, wherein the node of the next round packager is a node numbered as (n + 1)% m.
8. The PoA consensus apparatus of claim 7, wherein upon the time that a round packager successfully packages the block in a current round, the apparatus further comprises:
a second node dynamic adjustment module, configured to add the first node as the current round of packer to the end of the latest packing set, and add a first node in the latest packing set to the candidate packing set;
and the second next round packager determining module is used for determining a node serving as a next round packager in the to-be-packaged set, and adding a first node in the candidate packaging set into the to-be-packaged set.
9. A PoA consensus device, comprising: a memory, a processor, and a PoA consensus program stored on the memory and executable on the processor, the PoA consensus program configured to implement the PoA consensus method of any one of claims 1-6.
10. A storage medium having stored thereon a PoA consensus program, which when executed by a processor implements the PoA consensus method of any one of claims 1 to 6.
CN202210057962.5A 2022-01-19 2022-01-19 PoA consensus method, device, equipment and storage medium Active CN114090694B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210057962.5A CN114090694B (en) 2022-01-19 2022-01-19 PoA consensus method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210057962.5A CN114090694B (en) 2022-01-19 2022-01-19 PoA consensus method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN114090694A true CN114090694A (en) 2022-02-25
CN114090694B CN114090694B (en) 2022-04-15

Family

ID=80308513

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210057962.5A Active CN114090694B (en) 2022-01-19 2022-01-19 PoA consensus method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114090694B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108182635A (en) * 2017-12-18 2018-06-19 深圳前海微众银行股份有限公司 Block chain common recognition method, system and computer readable storage medium
CN111369358A (en) * 2020-02-10 2020-07-03 杭州溪塔科技有限公司 Block chain consensus method and device and electronic equipment
US20210056081A1 (en) * 2018-05-29 2021-02-25 Oracle International Corporation Securing Access to Confidential Data Using a Blockchain Ledger

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108182635A (en) * 2017-12-18 2018-06-19 深圳前海微众银行股份有限公司 Block chain common recognition method, system and computer readable storage medium
US20210056081A1 (en) * 2018-05-29 2021-02-25 Oracle International Corporation Securing Access to Confidential Data Using a Blockchain Ledger
CN111369358A (en) * 2020-02-10 2020-07-03 杭州溪塔科技有限公司 Block chain consensus method and device and electronic equipment

Also Published As

Publication number Publication date
CN114090694B (en) 2022-04-15

Similar Documents

Publication Publication Date Title
CN107992356B (en) Block chain transaction block processing method, electronic device and readable storage medium
CN110619582A (en) Block chain transaction method, device, equipment and computer storage medium
CN106570097A (en) Sequence generating method and device
CN107832143A (en) A kind for the treatment of method and apparatus of physical machine resource
CN108520077A (en) A kind of method and apparatus avoiding repeated downloads
CN113703951B (en) Method and device for processing DMA (direct memory Access) and computer readable storage medium
CN112037061A (en) Processing method and device for transactions in block chain, electronic equipment and storage medium
CN110109748A (en) A kind of hybrid language task executing method, device and cluster
CN114090694B (en) PoA consensus method, device, equipment and storage medium
CN111061735A (en) Capacity expansion method and device based on single-chain block chain
CN110020383A (en) A kind of page data request processing method and processing device
CN106850707A (en) Method, apparatus and system that material batch is uploaded
CN110689114B (en) Network node processing method and device, storage medium and electronic equipment
CN112817748A (en) Task processing method based on android virtual machine and computer equipment
CN108614697A (en) Backstage Dex compiles the method and device of management and control
CN108124021A (en) Internet protocol IP address obtains, the method, apparatus and system of website visiting
JP2008250838A (en) Software generation device, method and program
CN113781214A (en) Packaging method, device and equipment for promoting transaction TPS (transaction transfer protocol) based on PoW (PoW)
WO2020211358A1 (en) Database scheduling method and apparatus, and computer device and storage medium
CN112905223A (en) Method, device and equipment for generating upgrade package
CN108345470B (en) Data processing and storing method and device and electronic equipment
CN111245893A (en) Performance-optimized mobile terminal operation and maintenance inspection task downloading method
CN114237868A (en) Resource subpackage method, device, equipment and storage medium
CN106254909B (en) Distribution, operation method and the device of interaction content
CN112559115A (en) Method, device and equipment for deleting container mirror image

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant