Disclosure of Invention
An object of the embodiments of the present specification is to provide a block chain consensus method, apparatus, system, and electronic device, so as to effectively reduce complexity of an interactive message in a consensus process, support a large number of consensus nodes to perform consensus, and ensure that a consensus algorithm operates normally.
In order to solve the above technical problem, the embodiments of the present specification are implemented as follows:
in a first aspect, a block chain consensus method is provided, including:
the method comprises the steps that a first consensus node receives votes sent by a plurality of second consensus nodes aiming at a current proposal, wherein the second consensus nodes comprise part or all of the first consensus nodes in a current block chain network;
if the consensus occupation ratio in the received votes is larger than a threshold value, performing aggregation processing on the votes with the consensus occupation ratio larger than the threshold value to obtain a first aggregated signature, wherein the threshold value is larger than or equal to 2/3 and smaller than or equal to 1;
broadcasting the first aggregated signature to the plurality of second consensus nodes.
In a second aspect, an apparatus for recognizing a blockchain is provided, including:
the receiving module is used for receiving votes sent by a plurality of second consensus nodes aiming at the current proposal, wherein the second consensus nodes comprise part or all of the consensus nodes including the first consensus node in the current block chain network;
the aggregation module is used for aggregating the votes with the consensus ratio larger than a threshold value to obtain a first aggregated signature if the consensus ratio in the received votes is larger than the threshold value, wherein the threshold value is greater than or equal to 2/3 and less than or equal to 1;
a sending module that broadcasts the first aggregated signature to the plurality of second consensus nodes.
In a third aspect, a method for consensus of a block chain is provided, including:
after receiving a proposal initiated by a first consensus node, a second consensus node sends a vote aiming at the current proposal to the first consensus node;
and receiving a first aggregation signature returned by the first consensus node, wherein the first aggregation signature is obtained by aggregating votes with a consensus ratio larger than a threshold value when the consensus ratio of the received votes by the first consensus node is larger than the threshold value, and the threshold value is greater than or equal to 2/3 and less than or equal to 1.
In a fourth aspect, an apparatus for recognizing a blockchain is provided, including:
the system comprises a sending module, a receiving module and a sending module, wherein the sending module is used for sending a vote aiming at a current proposal to a first consensus node after receiving the proposal initiated by the first consensus node;
a receiving module, configured to receive a first aggregated signature returned by the first consensus node, where the first aggregated signature is obtained by aggregating votes with a consensus ratio greater than a threshold when the consensus ratio of the received votes by the first consensus node is greater than the threshold, where the threshold is greater than or equal to 2/3 and less than or equal to 1.
In a fifth aspect, a block chain consensus system is provided, including: a first consensus node and a plurality of second consensus nodes;
the first consensus node receives votes sent by a plurality of second consensus nodes aiming at the current proposal, wherein the plurality of second consensus nodes comprise part or all of the first consensus nodes in the current block chain network;
if the consensus occupation ratio in the received votes is greater than a threshold value, the first consensus node performs aggregation processing on the votes with the consensus occupation ratio greater than the threshold value to obtain a first aggregated signature, wherein the threshold value is greater than or equal to 2/3 and less than or equal to 1;
the first consensus node broadcasts the first aggregate signature to the plurality of second consensus nodes.
In a sixth aspect, an electronic device is provided, including:
a processor; and
a memory arranged to store computer executable instructions that, when executed, cause the processor to:
receiving votes sent by a plurality of second consensus nodes for the current proposal, wherein the plurality of second consensus nodes comprise part or all of the first consensus nodes in the current block chain network;
if the consensus occupation ratio in the received votes is larger than a threshold value, performing aggregation processing on the votes with the consensus occupation ratio larger than the threshold value to obtain a first aggregated signature, wherein the threshold value is larger than or equal to 2/3 and smaller than or equal to 1;
broadcasting the first aggregated signature to the plurality of second consensus nodes.
In a seventh aspect, an electronic device is provided, including:
a processor; and
a memory arranged to store computer executable instructions that, when executed, cause the processor to:
after receiving a proposal initiated by a first consensus node, sending a vote aiming at the current proposal to the first consensus node;
and receiving a first aggregation signature returned by the first consensus node, wherein the first aggregation signature is obtained by aggregating votes with a consensus ratio larger than a threshold value when the consensus ratio of the received votes by the first consensus node is larger than the threshold value, and the threshold value is greater than or equal to 2/3 and less than or equal to 1.
In an eighth aspect, a computer-readable storage medium is presented, the computer-readable storage medium storing one or more programs that, when executed by an electronic device that includes a plurality of application programs, cause the electronic device to:
receiving votes sent by a plurality of second consensus nodes for the current proposal, wherein the plurality of second consensus nodes comprise part or all of the first consensus nodes in the current block chain network;
if the consensus occupation ratio in the received votes is larger than a threshold value, performing aggregation processing on the votes with the consensus occupation ratio larger than the threshold value to obtain a first aggregated signature, wherein the threshold value is larger than or equal to 2/3 and smaller than or equal to 1;
broadcasting the first aggregated signature to the plurality of second consensus nodes.
In a ninth aspect, a computer-readable storage medium is presented, storing one or more programs that, when executed by an electronic device comprising a plurality of application programs, cause the electronic device to:
after receiving a proposal initiated by a first consensus node, sending a vote aiming at the current proposal to the first consensus node;
and receiving a first aggregation signature returned by the first consensus node, wherein the first aggregation signature is obtained by aggregating votes with a consensus ratio larger than a threshold value when the consensus ratio of the received votes by the first consensus node is larger than the threshold value, and the threshold value is greater than or equal to 2/3 and less than or equal to 1.
The specification can achieve at least the following technical effects:
through the technical scheme, when voting is carried out on the initiated proposal, only the consensus node initiating the proposal receives the voting, and other consensus nodes do not receive the voting, so that the consensus node initiating the proposal aggregates the received votes with the consensus or invalid ratio larger than the threshold value to obtain the special aggregated signature, and broadcasts the special aggregated signature to other consensus nodes. Therefore, only the consensus node initiating the proposal carries out message interaction with other consensus nodes, but the message interaction between other consensus nodes is omitted, the number of message interactions is reduced, and the complexity of the message interaction is reduced.
Detailed Description
In order to make those skilled in the art better understand the technical solutions in the present specification, the technical solutions in the embodiments of the present specification will be clearly and completely described below with reference to the drawings in the embodiments of the present specification, and it is obvious that the described embodiments are only a part of the embodiments of the present specification, and not all of the embodiments. All other embodiments obtained by a person skilled in the art based on the embodiments in the present specification without any inventive step should fall within the scope of protection of the present specification.
Example one
Referring to fig. 1, a schematic step diagram of a block chain consensus method provided in an embodiment of the present specification is shown, where an execution subject of the consensus method may be a consensus node initiating a proposal, which is defined as a first consensus node in the present specification; the first common node may specifically be an electronic device such as a terminal and a server. The consensus method may comprise the steps of:
step 102: receiving votes sent by a plurality of second consensus nodes for the current proposal, wherein the plurality of second consensus nodes comprise part or all of the consensus nodes including the first consensus node in the current block chain network.
It should be understood that the votes generated by each second consensus node for the current proposal may not be consistent, and therefore, the votes received by the first consensus node include votes indicating approval (i.e., so-called consensus in this specification) for the current proposal and may also include votes indicating objection to the current proposal.
In this specification, only the first consensus node receives votes returned by the second consensus nodes, and the second consensus nodes do not receive votes from each other, so that the number of message interactions between the consensus nodes is reduced, and the message interaction complexity is reduced.
Step 104: and if the consensus occupation ratio in the received votes is greater than a threshold value, aggregating the votes with the consensus occupation ratio greater than the threshold value to obtain a first aggregated signature, wherein the threshold value is greater than or equal to 2/3 and less than or equal to 1.
It should be noted that the votes aggregated in step 104 are votes for the same proposal, and when performing aggregation processing, the votes whose consensus ratio is greater than the threshold may be aggregated into the first aggregated signature by using a BLS aggregated signature algorithm or a Schnorr aggregated signature algorithm.
It will be appreciated that in determining that the consensus occupancy is greater than the threshold in the received votes, one achievable way is to: determining whether the ratio of the voting number corresponding to the consensus signature in the received votes to the total voting number is larger than the threshold value;
another way that can be achieved is: and determining whether the sum of the voting weights of the second consensus nodes corresponding to the consensus signatures in the received votes is greater than the threshold value.
Step 106: broadcasting the first aggregated signature to the plurality of second consensus nodes.
Through the technical scheme, when voting is carried out on the initiated proposal, only the consensus node initiating the proposal receives the voting, and other consensus nodes do not receive the voting, so that the consensus node initiating the proposal aggregates the votes with the received consensus ratio larger than the threshold value to obtain the first aggregated signature, and broadcasts the first aggregated signature to other consensus nodes. Therefore, only the consensus node initiating the proposal carries out message interaction with other consensus nodes, but the message interaction between other consensus nodes is saved, the number of message interactions is reduced, the complexity of the message interaction is reduced, a large number of consensus nodes are supported to carry out consensus, and the normal operation of the consensus algorithm is ensured.
Especially for a large number of common nodes (for example, the number is N), the complexity of message interaction can be reduced from O (N ^2) to O (N), so that hundreds of common nodes can be supported for common identification in production.
Optionally, the vote is a prevote for the current proposal or a precommit vote for the current proposal. In other words, the above steps 102-106 can be applied to the previous stage of the same proposal, or the previous stage of the same proposal.
In this embodiment of the present specification, based on the foregoing steps 102 to 106, referring to fig. 2, if the vote is a vote of a vote reservation, after broadcasting the first aggregated signature to the plurality of second consensus nodes, the method further includes:
step 108: the first consensus node receives presimit votes for a current proposal sent by a plurality of second consensus nodes, wherein the plurality of second consensus nodes comprise part or all of the consensus nodes except the first consensus node initiating the current proposal in a current block chain network.
Step 110: and if the consensus ratio in the received presimit votes is larger than the threshold, performing aggregation processing on the presimit votes with the consensus ratio larger than the threshold to obtain a second aggregated signature.
Step 112: broadcasting the second aggregate signature to the plurality of second consensus nodes.
Therefore, in the whole consensus process, the vote stage and the commit stage can both adopt a mode of sending the vote to the consensus node initiating the proposal, carrying out aggregation processing by the consensus node to obtain an aggregated signature, and broadcasting the aggregated signature to other consensus nodes again, so that the message interaction between other consensus nodes can be omitted, the number of message interaction is reduced, and the message interaction complexity is reduced.
Considering that the first consensus node initiating the proposal may be malicious or fail, and the second consensus node cannot receive the proposal, the first aggregate signature or the second aggregate signature, and the like, the consensus process cannot be advanced. Therefore, in this embodiment of the present disclosure, a timer may be set in the second consensus node, so that after the timer expires (the second consensus node fails to receive the proposal or the aggregated signature for a long time; or the second consensus node receives the proposal or the aggregated signature after the timeout), the second consensus node is triggered to send a special vote (also referred to as a cast vote).
It should be understood that the timer set in the second common node may be understood as a timing logic, and may set timing for three phases of the second common node respectively. A timer may also be set for each phase.
Optionally, in an embodiment of the present specification, the voting comprises a special vote; the special vote is an invalid vote sent by a second consensus node after a timer arranged in the second consensus node is overtime;
correspondingly, referring to fig. 3, based on the above scheme, the method further includes:
step 114: and if the invalid ratio in the received votes is larger than the threshold, performing aggregation processing on the special votes with the invalid ratio larger than the threshold to obtain a first special aggregation signature.
It should be understood that when the invalid occupancy ratio in the received vote is determined to be greater than the threshold, the manner is similar to the manner adopted when the consensus occupancy ratio in the received vote is determined to be greater than the threshold, and details are not repeated here.
Step 116: broadcasting the first special aggregate signature to the plurality of second consensus nodes.
It should be understood that the scenario shown in fig. 3 may be applicable to the prevote phase of the same proposal, or, the presommit phase of the same proposal.
Optionally, when the vote is a special presommit vote for a current proposal, the first special aggregated signature is a special presommit aggregated signature;
broadcasting the first special aggregation signature to the plurality of second consensus nodes, specifically including:
broadcasting a special presimit aggregate signature to the second consensus nodes so that the second consensus nodes reselect a consensus node initiating a next proposal after receiving the special presimit aggregate signature.
In fact, the special vote may be an invalid vote sent by the second consensus node after a timer set in the second consensus node expires, or may be an invalid vote sent by the second consensus node after receiving the first special aggregated signature.
Specifically, the votes include special votes, which are invalid votes sent by the second consensus node after receiving the first special aggregated signature;
when the vote is a special vote for the current proposal, the method further comprises:
if the invalid ratio in the received presimit votes is larger than the threshold, carrying out aggregation processing on the special presimit votes with the invalid ratio larger than the threshold to obtain a special presimit aggregation signature;
broadcasting a special presimit aggregate signature to the second consensus nodes so that the second consensus nodes reselect a consensus node initiating a next proposal after receiving the special presimit aggregate signature.
Through the technical scheme, when voting is carried out on the initiated proposal, only the consensus node initiating the proposal receives the voting, and other consensus nodes do not receive the voting, so that the consensus node initiating the proposal aggregates the received votes with invalid ratios larger than a threshold value to obtain a special aggregated signature, and broadcasts the special aggregated signature to other consensus nodes. Therefore, only the consensus node initiating the proposal carries out message interaction with other consensus nodes, but the message interaction between other consensus nodes is omitted, the number of message interactions is reduced, and the complexity of the message interaction is reduced.
Referring to fig. 4, a schematic diagram of a consensus method for a block chain provided in an embodiment of this specification is shown, where an execution subject of the consensus method may be a consensus node initiating a vote on a proposal, which is defined as a second consensus node in this specification; the second consensus node may specifically be an electronic device such as a terminal and a server. The consensus method may comprise the steps of:
step 202: after receiving a proposal initiated by a first consensus node, a second consensus node sends a vote aiming at the current proposal to the first consensus node.
Step 204: and receiving a first aggregation signature returned by the first consensus node, wherein the first aggregation signature is obtained by aggregating votes with a consensus ratio larger than a threshold value when the consensus ratio of the received votes by the first consensus node is larger than the threshold value, and the threshold value is greater than or equal to 2/3 and less than or equal to 1.
Optionally, the vote is a prevote for the current proposal or a precommit vote for the current proposal. In other words, the above steps 202-204 can be applied to the previous stage of the same proposal, or the previous stage of the same proposal.
Optionally, in an embodiment of this specification, a timer is locally disposed in the second consensus node; the vote comprises a special vote;
accordingly, step 202, when sending the vote for the current proposal to the first consensus node, may specifically perform as: sending a special vote for a current proposal to the first consensus node, wherein the special vote is an invalid vote; the method further comprises the following steps:
receiving a first special aggregation signature returned by the first common node; and the first special aggregation signature is obtained by aggregating the special votes with the invalid occupation ratio larger than the threshold value when the invalid occupation ratio of the first common node in the received special votes is larger than the threshold value.
Optionally, the special vote is a special vote generated after a locally set timer expires; referring to fig. 5, based on the scheme of steps 202 to 204, after receiving the special revote aggregation signature returned by the first common identity node, the method further includes:
step 206: sending a special presimit vote for a current proposal to the first consensus node, wherein the special presimit vote is an invalid vote generated based on the special prevote aggregate signature;
step 208: receiving a special presommit aggregated signature returned by the first consensus node, and reselecting the consensus node initiating the next proposal; and the special presimit aggregation signature is obtained by aggregating the special presimit votes with the invalid occupation ratio larger than the threshold value when the invalid occupation ratio of the first consensus node in the received special presimit votes is larger than the threshold value.
The consensus scheme referred to in the present specification is detailed below by specific examples.
Referring to fig. 6, there are a consensus node (denoted as leader in fig. 6) initiating the current proposal and a consensus node (assumed to be 3, and denoted as node0, node1, and node2 in fig. 6) receiving the current proposal in the blockchain network.
An implementable scheme:
in the stage of promotion, leader packs blocks in the proposal and broadcasts to node0, node1, and node2, respectively.
In the prevote stage, node0, node1 and node2 generate prevote votes for the proposal respectively, sign the votes and send the votes to the leader, the leader collects votes from node0, node1, node2 and the leader, and if the received votes have the consensus ratio larger than 2/3, the votes are aggregated to be a prevote aggregated signature. At the same time, the prevote aggregate signature is broadcast to node0, node1, node 2.
In the presimit stage, after node0, node1 and node2 receive the prevote aggregate signature, presimit votes for the proposal are respectively generated and sent to the leader after signing, the leader collects votes from node0, node1, node2 and the leader, and if the received voting consensus ratio is more than 2/3, the votes are aggregated into a presimit aggregate signature. Meanwhile, the presommit aggregate signature is broadcast to node0, node1, node 2.
Another implementation scheme is as follows:
in the stage of promotion, leader packs blocks in the proposal and broadcasts to node0, node1, and node2, respectively.
In the period of prevote, if the timer of node0, node1 and node2 is overtime, special prevote votes for the proposal are generated respectively and sent to the leader after signature, the leader collects votes from node0, node1, node2 and the leader, and if the invalid ratio of the received votes is more than 2/3, the votes are aggregated to be a special prevote aggregated signature. Meanwhile, a special prevote aggregate signature is broadcast to node0, node1, node 2.
In the presommit stage, when the node0, node1 and node2 receive special presote aggregate signatures or the timers of the node0, node1 and node2 are overtime, special presommit votes for the proposal are respectively generated and sent to the leader after the signatures are generated, the leader collects votes from the node0, node1, node2 and the leader, and if the received votes have invalid ratio larger than 2/3, the votes are aggregated to be a special presommit aggregate signature. Meanwhile, a special presommit aggregated signature is broadcast to node0, node1, node2 to facilitate reselection of the consensus node to initiate a new proposal.
Example two
Fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present specification. Referring to fig. 7, at a hardware level, the electronic device includes a processor, and optionally further includes an internal bus, a network interface, and a memory. The Memory may include a Memory, such as a Random-Access Memory (RAM), and may further include a non-volatile Memory, such as at least 1 disk Memory. Of course, the electronic device may also include hardware required for other services.
The processor, the network interface, and the memory may be connected to each other via an internal bus, which may be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, an EISA (Extended Industry Standard Architecture) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one double-headed arrow is shown in FIG. 7, but this does not indicate only one bus or one type of bus.
And the memory is used for storing programs. In particular, the program may include program code comprising computer operating instructions. The memory may include both memory and non-volatile storage and provides instructions and data to the processor.
The processor reads the corresponding computer program from the nonvolatile memory into the memory and then runs the computer program to form the shared resource access control device on the logic level. The processor is used for executing the program stored in the memory and is specifically used for executing the following operations:
receiving votes sent by a plurality of second consensus nodes for the current proposal, wherein the plurality of second consensus nodes comprise part or all of the first consensus nodes in the current block link network;
if the consensus occupation ratio in the received votes is larger than a threshold value, performing aggregation processing on the votes with the consensus occupation ratio larger than the threshold value to obtain a first aggregated signature, wherein the threshold value is larger than or equal to 2/3 and smaller than or equal to 1;
broadcasting the first aggregate signature to the plurality of second consensus nodes.
Alternatively, the first and second liquid crystal display panels may be,
after receiving a proposal initiated by a first consensus node, sending a vote aiming at the current proposal to the first consensus node;
and receiving a first aggregation signature returned by the first consensus node, wherein the first aggregation signature is obtained by aggregating votes with a consensus ratio larger than a threshold value when the consensus ratio of the received votes by the first consensus node is larger than the threshold value, and the threshold value is greater than or equal to 2/3 and less than or equal to 1.
The method performed by the block chain consensus device as disclosed in the embodiments of fig. 1-5 of the present specification can be implemented in or by a processor. The processor may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware in a processor or instructions in the form of software. The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components. The various methods, steps and logic blocks disclosed in the embodiments of the present specification may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of a method disclosed in connection with the embodiments of the present specification may be embodied directly in a hardware decoding processor, or in a combination of hardware and software modules in the decoding processor. The software module may be located in ram, flash memory, rom, prom, or eprom, registers, etc. storage media as is well known in the art. The storage medium is located in a memory, and a processor reads information in the memory and combines hardware thereof to complete the steps of the method.
The electronic device may further execute the method shown in fig. 1 or fig. 4, and implement the functions of the block chain consensus device in the embodiments shown in fig. 1 and fig. 4, which are not described herein again in this specification.
Of course, besides the software implementation, the electronic device of the embodiment of the present disclosure does not exclude other implementations, such as a logic device or a combination of software and hardware, and the like, that is, the execution subject of the following processing flow is not limited to each logic unit, and may also be hardware or a logic device.
Through the technical scheme, when voting is carried out on the initiated proposal, only the consensus node initiating the proposal receives the voting, and other consensus nodes do not receive the voting, so that the consensus node initiating the proposal aggregates the received votes with the consensus or invalid ratio larger than the threshold value to obtain the special aggregated signature, and broadcasts the special aggregated signature to other consensus nodes. Therefore, only the consensus node initiating the proposal carries out message interaction with other consensus nodes, but the message interaction between other consensus nodes is omitted, the number of message interactions is reduced, and the complexity of the message interaction is reduced.
EXAMPLE III
Embodiments of the present specification also propose a computer-readable storage medium storing one or more programs, the one or more programs comprising instructions, which when executed by a portable electronic device comprising a plurality of application programs, are capable of causing the portable electronic device to perform the method of the embodiment shown in fig. 1, and in particular for performing the method of:
receiving votes sent by a plurality of second consensus nodes for the current proposal, wherein the plurality of second consensus nodes comprise part or all of the first consensus nodes in the current block chain network;
if the consensus occupation ratio in the received votes is larger than a threshold value, aggregating the votes with the consensus occupation ratio larger than the threshold value to obtain a first aggregated signature, wherein the threshold value is greater than or equal to 2/3 and less than or equal to 1;
broadcasting the first aggregate signature to the plurality of second consensus nodes.
Alternatively, the first and second electrodes may be,
after receiving a proposal initiated by a first consensus node, sending a vote aiming at the current proposal to the first consensus node;
and receiving a first aggregation signature returned by the first consensus node, wherein the first aggregation signature is obtained by aggregating votes with a consensus ratio larger than a threshold value when the consensus ratio of the received votes by the first consensus node is larger than the threshold value, and the threshold value is greater than or equal to 2/3 and less than or equal to 1.
Through the technical scheme, when voting is carried out on the initiated proposal, only the consensus node initiating the proposal receives the voting, and other consensus nodes do not receive the voting, so that the consensus node initiating the proposal aggregates the received votes with the consensus or invalid ratio larger than the threshold value to obtain the special aggregated signature, and broadcasts the special aggregated signature to other consensus nodes. Therefore, only the consensus node initiating the proposal carries out message interaction with other consensus nodes, but the message interaction between other consensus nodes is omitted, the number of message interactions is reduced, and the complexity of the message interaction is reduced.
Example four
Fig. 8 is a schematic structural diagram of a consensus device 800 of a block chain according to an embodiment of the present disclosure. Referring to fig. 8, in a software implementation, the block chain consensus apparatus includes:
a receiving module 802, configured to receive votes sent by a plurality of second consensus nodes for a current proposal, where the plurality of second consensus nodes include some or all of the first consensus nodes in a current block chain network;
an aggregation module 804, configured to aggregate votes with a consensus ratio greater than a threshold to obtain a first aggregated signature if the consensus ratio in the received votes is greater than the threshold, where the threshold is greater than or equal to 2/3 and less than or equal to 1;
a sending module 806 that broadcasts the first aggregated signature to the plurality of second consensus nodes.
In a specific implementation of the embodiments of the present specification, the vote is a prevote for the current proposal or a presommit vote for the current proposal.
In another specific implementation manner of this embodiment of this specification, if the vote is a vote, after the sending module 806 broadcasts the first aggregated signature to the plurality of second consensus nodes, the receiving module 802 is further configured to:
receiving presommit votes for a current proposal sent by a plurality of second consensus nodes, wherein the plurality of second consensus nodes comprise part or all of the consensus nodes except the first consensus node initiating the current proposal in a current block chain network;
the aggregating module 804 is further configured to, if the consensus ratio in the received presimit votes is greater than the threshold, aggregate the presimit votes whose consensus ratio is greater than the threshold to obtain a second aggregated signature;
the sending module 806 is further configured to broadcast the second aggregate signature to the plurality of second consensus nodes.
In another particular implementation of the embodiments of the present description, the voting includes special voting; the special vote is an invalid vote sent by a second consensus node after a timer arranged in the second consensus node is overtime;
the aggregation module 804 is further configured to aggregate the special votes with the invalid occupancy ratio larger than the threshold value to obtain a first special aggregated signature if the invalid occupancy ratio in the received votes is larger than the threshold value;
the sending module 806 is further configured to broadcast the first special aggregated signature to the plurality of second consensus nodes.
In another particular implementation of an embodiment of the present specification, when the vote is a special presimit vote for a current proposal, the first special aggregated signature is a special presimit aggregated signature;
the sending module 806, when broadcasting the first special aggregated signature to the plurality of second common node, is specifically configured to:
broadcasting a special presimit aggregate signature to the second consensus nodes so that the second consensus nodes reselect a consensus node initiating a next proposal after receiving the special presimit aggregate signature.
In another specific implementation manner of the embodiment of the present specification, the votes include special votes, where the special votes are invalid votes sent by the second consensus node after receiving the first special aggregated signature;
when the vote is a special prevote for the current proposal, the aggregation module 804 is further configured to aggregate the special precommit votes with invalid occupation ratios larger than a threshold value to obtain a special precommit aggregate signature if the invalid occupation ratios in the received precommit votes are larger than the threshold value;
the sending module 806 is further configured to broadcast a special presmit aggregate signature to the second consensus nodes, so that the second consensus nodes reselect the consensus node initiating the next proposal after receiving the special presmit aggregate signature.
In another specific implementation manner of the embodiment of this specification, an aggregation algorithm used in aggregating the votes includes at least one or a combination of the following:
BLS aggregate signature algorithm, Schnorr aggregate signature algorithm.
In another specific implementation manner of the embodiment of the present specification, when it is determined that the consensus percentage in the received votes is greater than the threshold, determining according to whether the ratio of the number of votes corresponding to the consensus signature in the received votes to the total number of votes is greater than the threshold; or, the determination is made according to whether the sum of the voting weights of the second consensus nodes corresponding to the consensus signatures in the received votes is greater than the threshold.
Through the technical scheme, when voting is carried out on the initiated proposal, only the consensus node initiating the proposal receives the voting, and other consensus nodes do not receive the voting, so that the consensus node initiating the proposal aggregates the received votes with the consensus or invalid ratio larger than the threshold value to obtain the special aggregated signature, and broadcasts the special aggregated signature to other consensus nodes. Therefore, only the consensus node initiating the proposal carries out message interaction with other consensus nodes, but the message interaction between other consensus nodes is omitted, the number of message interactions is reduced, and the complexity of the message interaction is reduced.
Fig. 9 is a schematic structural diagram of a block chain consensus device 900 according to an embodiment of the present disclosure. Referring to fig. 9, in a software implementation, the block chain consensus apparatus includes:
a sending module 902, configured to send, after receiving a proposal initiated by a first consensus node, a vote for a current proposal to the first consensus node;
a receiving module 904, configured to receive a first aggregation signature returned by the first consensus node, where the first aggregation signature is obtained by aggregating, by the first consensus node, votes whose consensus ratio is greater than a threshold when the consensus ratio in the received votes is greater than the threshold, where the threshold is greater than or equal to 2/3 and less than or equal to 1.
In a specific implementation manner of the embodiment of the present specification, a timer is locally disposed in the second consensus node; the vote comprises a special vote;
when the sending module 902 sends the vote for the current proposal to the first consensus node, it is specifically configured to: sending a special vote for a current proposal to the first consensus node, wherein the special vote is an invalid vote;
the receiving module 904 is further configured to receive a first special aggregation signature returned by the first common node; and the first special aggregation signature is obtained by aggregating the special votes with the invalid occupation ratio larger than the threshold value when the invalid occupation ratio of the first common node in the received special votes is larger than the threshold value.
In another specific implementation manner of the embodiment of the present specification, the special vote is a special vote generated after a locally set timer expires;
after the receiving module 904 receives the special prevote aggregation signature returned by the first common identification node, the sending module 902 is further configured to send a special precommit vote for the current proposal to the first common identification node, where the special precommit vote is an invalid vote generated based on the special prevote aggregation signature;
the receiving module 904 is further configured to receive a special presommit aggregated signature returned by the first consensus node, and reselect a consensus node initiating a next proposal; and the special presimit aggregation signature is obtained by aggregating the special presimit votes with the invalid occupation ratio larger than the threshold value when the invalid occupation ratio of the first consensus node in the received special presimit votes is larger than the threshold value.
In another specific implementation manner of the embodiment of the present specification, the special vote is a special presimit vote generated based on the special prevote aggregate signature;
before the sending module 902 sends the special precommit vote for the current proposal to the first common node, the sending module 902 is further configured to send the special prevote for the current proposal to the first common node, where the special prevote is an invalid vote generated after a locally set timer expires;
the receiving module 904 is further configured to receive a special revote aggregation signature returned by the first common identity node; and the special prevote aggregation signature is obtained by aggregating the special prevote with the invalid occupation ratio being greater than the threshold value when the invalid occupation ratio of the first common identification node in the received special prevote is greater than the threshold value.
Through the technical scheme, when voting is carried out on the initiated proposal, only the consensus node initiating the proposal receives the voting, and other consensus nodes do not receive the voting, so that the consensus node initiating the proposal aggregates the received votes with the consensus or invalid ratio larger than the threshold value to obtain the special aggregated signature, and broadcasts the special aggregated signature to other consensus nodes. Therefore, only the consensus node initiating the proposal carries out message interaction with other consensus nodes, but the message interaction between other consensus nodes is omitted, the number of message interactions is reduced, and the complexity of the message interaction is reduced.
It should be understood that the block chain consensus device in this specification may also perform the method performed by the block chain consensus device (or apparatus) in fig. 1-5, and implement the functions of the block chain consensus device (or apparatus) in the embodiments shown in fig. 1-5, which are not described herein again.
In short, the above description is only a preferred embodiment of the present disclosure, and is not intended to limit the scope of the present disclosure. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present specification shall be included in the protection scope of the present specification.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. One typical implementation device is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus 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 apparatus. 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 apparatus that comprises the element.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.