Blockchain consensus method and blockchain replica apparatus
AssigneesTsinghua University, Digital Currency Institute, the People's Bank of China
InventorsSisi Duan, Xiaoyun Wang, Changchun Mu, Gang Di
Life of this patent
Estimating the term…
Abstract
The present disclosure discloses a blockchain consensus method and a blockchain replica apparatus, and provides a cBFT protocol with a plurality of different voting thresholds, which may reduce a communication complexity of the protocol, reduce a consensus agreement time, improve a throughput of a consensus system, and simultaneously reduce sensitivity of the protocol to a timer.
Claims10
A blockchain consensus method, which is applied to a replica in a blockchain, wherein the method comprises:
- receiving a block message broadcasted by a leader, wherein the block message is packaged by the leader based on a preset message structure after receiving a user instruction, and the block message comprises a new block prepared by the leader in response to the user instruction and a first voting result of a parent block of the new block, wherein the new block is packaged by the leader based on a preset block structure, the new block comprises a parent block voting result type of the new block, and the voting result type comprises f+1, 2f+1, and 3f+1;
- determining validity of the new block based on a local variable currently saved and a preset voting rule, transmitting a second vote of the new block to the leader when it is determined that the new block is valid, and simultaneously updating the local variable based on the block message, wherein the local variable comprises a latest voting block of blocks, a latest voting evidence and a latest weak voting evidence, and updating the latest voting block of blocks to a new block comprised in the block message;
- when the first voting result comprises votes of 2f+1 replicas or 3f+1 replicas, updating the latest vote evidence to the first voting result;
- when the first voting result comprises votes of f+1 replicas, updating the latest weak voting evidence to the first voting result;
- and collecting, by the leader, the second vote of the new block as transmitted by each replica, and taking all second votes obtained by collecting as the first voting result included in a block message of a next new block in which a current block is a parent block;
- determining a consensus rule based on the first voting result and a pre-designated consensus protocol type;
- and
- tracing voting results of a designated number of parent blocks of the new block based on the consensus rule, and if the voting results of the designated number of parent blocks meet the consensus rule, determining that an earliest prepared parent block in the designated number of parent blocks agrees on a consensus, executing a block commit protocol, and adding the earliest prepared parent block and a block that is on the same branched chain as the earliest prepared parent block and is earlier than the earliest prepared parent block into a blockchain.
A blockchain replica apparatus, wherein comprises:
- a communication module, configured to receive a block message broadcasted by a leader, wherein the block message is packaged by the leader based on a preset message structure after receiving a user instruction, and the block message comprises a new block prepared by the leader in response to the user instruction and a first voting result of a parent block of the new block, wherein the new block is packaged by the leader based on a preset block structure, the new block comprises a parent block voting result type of the new block, and the voting result type comprises f+1, 2f+1, and 3f+1;
- a process module, configured to determine validity of the new block based on a local variable currently saved and a preset voting rule, transmit a second vote of the new block to the leader when it is determined that the new block is valid, and simultaneously update the local variable based on the block message, wherein the local variable comprises a latest voting block of blocks, a latest voting evidence and a latest weak voting evidence, and update the latest voting block of blocks to a new block comprised in the block message;
- when the first voting result comprises votes of 2f+1 replicas or 3f+1 replicas, update the latest vote evidence to the first voting result;
- when the first voting result comprises votes of f+1 replicas, update the latest weak voting evidence to the first voting result;
- and collect, by the leader, the second vote of the new block as transmitted by each replica, and take all second votes obtained by collecting as the first voting result included in a block message of a next new block in which a current block is a parent block;
- a determination module, configured to determine a consensus rule based on the first voting result and a pre-designated consensus protocol type;
- and
- a consensus module, configured to trace voting results of a designated number of parent blocks for the new block based on the consensus rule, and if the voting results of the designated number of parent blocks meet the consensus rule, determine that an earliest prepared parent block in the designated number of parent blocks agrees on a consensus, execute a block commit protocol, and add the earliest prepared parent block and a block that is on the same branched chain as the earliest prepared parent block and is earlier than the earliest prepared parent block into a blockchain.
A computer device, comprising a memory, a processor and a computer program that is stored on the memory and capable of running on the processor, wherein the processor implements the following blockchain consensus method when executing the computer program:
- receiving a block message broadcasted by a leader, wherein the block message is packaged by the leader based on a preset message structure after receiving a user instruction, and the block message comprises a new block prepared by the leader in response to the user instruction and a first voting result of a parent block of the new block, wherein the new block is packaged by the leader based on a preset block structure, the new block comprises a parent block voting result type of the new block, and the voting result type comprises f+1, 2f+1, and 3f+1;
- determining validity of the new block based on a local variable currently saved and a preset voting rule, transmitting a second vote of the new block to the leader when it is determined that the new block is valid, and simultaneously updating the local variable based on the block message, wherein the local variable comprises a latest voting block of blocks, a latest voting evidence and a latest weak voting evidence, and updating the latest voting block of blocks to a new block comprised in the block message;
- when the first voting result comprises votes of 2f+1 replicas or 3f+1 replicas, updating the latest vote evidence to the first voting result;
- when the first voting result comprises votes of f+1 replicas, updating the latest weak voting evidence to the first voting result;
- and collecting, by the leader, the second vote of the new block as transmitted by each replica, and taking all second votes obtained by collecting as the first voting result included in a block message of a next new block in which a current block is a parent block;
- determining a consensus rule based on the first voting result and a pre-designated consensus protocol type;
- and
- tracing voting results of a designated number of parent blocks of the new block based on the consensus rule, and if the voting results of the designated number of parent blocks meet the consensus rule, determining that an earliest prepared parent block in the designated number of parent blocks agrees on a consensus, executing a block commit protocol, and adding the earliest prepared parent block and a block that is on the same branched chain as the earliest prepared parent block and is earlier than the earliest prepared parent block into a blockchain.
(canceled)
Dependencies are inferred from the claim text.