WO2023045574A1 - 联盟链中的共识 - Google Patents
联盟链中的共识 Download PDFInfo
- Publication number
- WO2023045574A1 WO2023045574A1 PCT/CN2022/109829 CN2022109829W WO2023045574A1 WO 2023045574 A1 WO2023045574 A1 WO 2023045574A1 CN 2022109829 W CN2022109829 W CN 2022109829W WO 2023045574 A1 WO2023045574 A1 WO 2023045574A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- consensus node
- consensus
- checkpoint
- chain
- message
- 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.)
- Ceased
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/27—Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/542—Event management; Broadcasting; Multicasting; Notifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q40/00—Finance; Insurance; Tax strategies; Processing of corporate or income taxes
- G06Q40/04—Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
Definitions
- This document relates to the field of computer technology, especially to a consensus method and system in an alliance chain.
- PBFT Practical Byzantine Fault Tolerance
- the Normal Case Phase part includes request (request phase), pre-prepare (pre-preparation phase), prepare (preparation phase), commit (submission phase) and reply (response phase) to complete the consensus.
- request and reply respectively correspond to the transaction request initiated by the client (client) and the transaction execution result returned to the client.
- the consensus node usually starts the timer after receiving the request sent by the client. If the client does not receive f+1 replies to the request sent by it within the preset time period, the view switch can be triggered operate. However, since the request is sent by the client, it is a behavior of the client. If the client sends a large number of requests to the consensus node in a short period of time, the consensus node will not be able to complete the consensus on the request within the preset time period. The action in turn triggers a view switch action.
- the embodiment of this specification provides a consensus method and system in the alliance chain to solve the problem that if the client sends a large number of requests to the consensus node in a short period of time in the existing alliance chain, it will also cause the consensus node to fail at the preset time. The problem of completing the consensus operation on the request within the segment and then triggering the view switching operation.
- a consensus method in the alliance chain including: when the first consensus node in the alliance chain generates a specified number of blocks, it broadcasts a checkpoint message in the alliance chain, and the checkpoint message is used for Indicate that the first consensus node has generated the specified number of blocks; the second consensus node in the consortium chain receives the checkpoint message sent by the first consensus node; if the second consensus node is within the preset time If the checkpoint message sent by other 2f consensus nodes in the alliance chain is not received within the segment, then the second consensus node determines that the stable checkpoint state of the second consensus node has timed out; the second consensus node is based on the The stable checkpoint state of the second consensus node times out, and a view switching operation is initiated in the alliance chain, and f is the maximum number of abnormal consensus nodes allowed in the alliance chain.
- a consortium chain system including: a first consensus node, when generating a specified number of blocks, broadcasts a checkpoint message in the consortium chain, and the checkpoint message is used to indicate that the first consensus The node has generated the specified number of blocks; the second consensus node receives the checkpoint message sent by the first consensus node, if it does not receive the checkpoint message sent by other 2f consensus nodes in the alliance chain within the preset time checkpoint message, it is determined that the stable checkpoint state of the second consensus node has timed out; and based on the timeout of the stable checkpoint state of the second consensus node, a view switching operation is initiated in the alliance chain, and f is in the alliance chain The maximum number of abnormal consensus nodes allowed.
- a consensus node in the consortium chain including: a broadcast module, when a specified number of blocks is generated, a checkpoint message is broadcast in the consortium chain, and the checkpoint message is used to indicate that the specified number has been generated block; the receiving module receives checkpoint messages sent by other consensus nodes in the consortium chain; the status determination module, if the checkpoint message sent by other 2f consensus nodes in the consortium chain is not received within the preset time period message, then determine that the stable checkpoint state is overtime; the view switching module, based on the timeout of the stable checkpoint state, initiates a view switching operation in the alliance chain, and f is the maximum number of abnormal consensus nodes allowed in the alliance chain.
- an electronic device comprising a processor and a memory arranged to store computer-executable instructions that, when executed, cause the processor to perform the following operations: block, broadcast a checkpoint message in the consortium chain, the checkpoint message is used to indicate that the specified number of blocks have been generated; receive checkpoint messages sent by other consensus nodes in the consortium chain; if within a preset time period If the checkpoint message sent by the other 2f consensus nodes in the alliance chain is not received, it is determined that the stable checkpoint state has timed out; based on the timeout of the stable checkpoint state, a view switching operation is initiated in the alliance chain, and f is the alliance The maximum number of abnormal consensus nodes allowed in the chain.
- a computer-readable storage medium stores one or more programs, and when the one or more programs are executed by an electronic device including multiple application programs, the The electronic device performs the following operations: when a specified number of blocks is generated, a checkpoint message is broadcast in the consortium chain, and the checkpoint message is used to indicate that the specified number of blocks has been generated; receiving other consensus in the consortium chain The checkpoint message sent by the node; if the checkpoint message sent by the other 2f consensus nodes in the alliance chain is not received within the preset time period, it is determined that the stable checkpoint state has timed out; based on the timeout of the stable checkpoint state, in the A view switching operation is initiated in the consortium chain, and f is the maximum number of abnormal consensus nodes allowed in the consortium chain.
- the embodiment of this specification uses the above technical solution to at least achieve the following technical effects: using the consensus method provided by the embodiment of this specification, the first consensus node in the consortium chain broadcasts a checkpoint message in the consortium chain when generating a specified number of blocks , the checkpoint message is used to indicate that the first consensus node has generated a specified number of blocks; the second consensus node in the consortium chain receives the checkpoint message sent by the first consensus node; if the second consensus node does not receive the checkpoint message within the preset time period To the checkpoint message sent by other 2f consensus nodes in the alliance chain, the second consensus node determines that the stable checkpoint state of the second consensus node has timed out; and the second consensus node is based on the stable checkpoint state of the second consensus node.
- f is the maximum number of abnormal consensus nodes allowed in the alliance chain. Since the consensus node counts the checkpoint messages received from other consensus nodes in the consortium chain, one thread can be used alone, which can avoid causing great pressure on the consensus node at a certain moment, and thus enable the consensus node to be more accurate in the consortium chain. Trigger a view switch operation.
- Fig. 1 is a schematic diagram of the implementation flow of a consensus method in a consortium chain provided by an embodiment of this specification.
- Fig. 2 is a schematic diagram of the implementation flow of an application of the consensus method in the consortium chain provided by an embodiment of this specification.
- Fig. 3 is a schematic structural diagram of an alliance chain system provided by an embodiment of this specification.
- Fig. 4 is a schematic structural diagram of a consensus node in a consortium chain provided by an embodiment of this specification.
- Fig. 5 is a schematic structural diagram of an electronic device provided by an embodiment of this specification.
- each Replica (copy, that is, all consensus nodes participating in the consensus in the alliance chain) sends a message or receives messages from other consensus nodes (including pre-prepare, prepare, commit messages) will be recorded in the message log (Message Log) of the memory of the consensus node.
- Message Log message log
- the Message Log of each consensus node in the alliance chain will take up more and more memory space. Therefore, in order to save the memory space of each consensus node in the alliance chain, garbage collection is required, that is, When each consensus node executes the proposal, the Message Log of each consensus node is cleared, and the memory space of each consensus node is released.
- One way of garbage collection is that every time a consensus node in the consortium chain executes a proposal (that is, every time a block is generated), it can send a broadcast to other consensus nodes in the consortium chain, aiming at whether the consensus node can be cleared The message log of the consensus node is reached in the whole network. After receiving such broadcasts, each consensus node in the alliance chain can also send broadcasts to other consensus nodes in the alliance chain. unanimous. If the consensus nodes in the consortium chain receive confirmations from consensus nodes with different numbers of Quorum (2f+1), these consensus nodes can delete the proposal corresponding to one proposal (that is, the latest generated block) in the consensus node Message Log. message log.
- Another way to deal with garbage is that every time a certain consensus node in the alliance chain executes k proposals (that is, each new k blocks are generated), it can send a broadcast to other consensus nodes in the alliance chain. Clearing the Message Log of this consensus node reaches a consensus in the entire network. After receiving such broadcasts, each consensus node in the alliance chain can also broadcast to other consensus nodes in the alliance chain. It is also aimed at whether the Message Log of this consensus node can be cleared. consensus across the network. If the consensus nodes in the consortium chain receive confirmations from consensus nodes with different numbers of Quorum (2f+1), these consensus nodes can delete the k proposals (that is, the latest generated k blocks) in the consensus node Message Log. message log.
- k is the message record corresponding to the k proposals (that is, the newly generated k blocks) indicated by the checkpoint message in the embodiment of this specification
- the Message Log that clears the consensus node above is the checkpoint message in the embodiment of this specification
- the format is ⁇ CHECKPOINT, n, d, i>, where n is the sequence number of the smallest block that the consensus node currently expects to keep, d is the message digest that is expected to be kept, and i is the number of the consensus node that sent the checkpoint message .
- the checkpoint message broadcast by the consensus node in the alliance chain and the summary of the checkpoint message received in the alliance chain are recorded in the Message Log of the consensus node. If the consensus node i in the consortium chain receives Quorum-1 legitimate checkpoint messages sent by other different consensus nodes, plus the checkpoint message sent by consensus node i itself, then the checkpoint message of consensus node i for ⁇ n, d> will be When the number of Quorum(2f+1) is reached, the consensus node i can clear the message records corresponding to all blocks before the block number n in the consensus node Message Log (including the corresponding pre-prepare, prepare, commit messages, and checkpoint messages).
- the above block number n is the current stable checkpoint of the consensus node i, which means that the consensus node i has reached a consensus on the execution result of the block before the block number n, and the message record corresponding to the block with the block number n is still Retained in the Message Log of consensus node i. Since the processing of each consensus node in the consortium chain system is asynchronous, the consensus node with fast consensus message processing may gradually distance itself from the consensus node with slow consensus message processing.
- the first consensus node in the alliance chain broadcasts a checkpoint message in the alliance chain when generating a specified number of blocks.
- the checkpoint message is used to indicate that the first consensus node has generated a specified number of blocks. block;
- the second consensus node in the alliance chain receives the checkpoint message sent by the first consensus node; if the second consensus node does not receive the checkpoint message sent by other 2f consensus nodes in the alliance chain within the preset time period, Then the second consensus node determines that the stable checkpoint state of the second consensus node has timed out; and the second consensus node initiates a view switching operation in the alliance chain based on the timeout of the stable checkpoint state of the second consensus node, and f is the maximum exception allowed in the alliance chain
- the number of consensus nodes Since the consensus node in the alliance chain can trigger the view switching operation in time after the stable checkpoint state times out, to replace the consensus master node in the alliance chain and restart the consensus operation, thereby avoiding stagnation of each consensus node in the first
- any request sent by the client to the consensus node in the consortium chain can successfully reach a consensus, it will eventually reach a consensus in the consortium chain and broadcast a commit message throughout the network, while the consensus node in the consortium chain targets a certain After the request reaches a consensus, it will send a checkpoint message to other nodes, so that 2f+1 nodes in the consortium chain can perform garbage collection operations after reaching a consensus on the same request, and change the state of the consensus node to a stable checkpoint state, so , if the stable checkpoint state of a certain consensus node in the alliance chain has timed out, it can also reflect that the request sent by the client to the consensus node has timed out.
- the embodiment of this specification is based on this, and considering that each consensus node in the consortium chain can process the checkpoint message as a separate thread, it is proposed to trigger the view switching operation in the consortium chain based on the timeout of the stable checkpoint state of the consensus node.
- FIG. 1 a schematic diagram of the implementation flow of a consensus method in a consortium chain provided by one or more embodiments of this specification is shown in Figure 1 , including the following steps.
- Step 110 when the first consensus node in the consortium chain generates a specified number of blocks, it broadcasts a checkpoint message in the consortium chain, and the checkpoint message is used to indicate that the first consensus node has generated a specified number of blocks.
- the purpose of broadcasting the checkpoint message in the alliance chain is to reach a consensus on whether the Message Log can be cleared in the entire network.
- the first consensus node broadcasts a checkpoint message in the consortium chain, including: The block number n broadcasts the checkpoint message in the consortium chain, and the checkpoint message carries the block number n of the block with the largest sequence number among the specified number of blocks.
- the purpose of carrying the block number n of the block with the largest sequence number among the specified number of blocks in the checkpoint message is to check whether the message corresponding to the block before the block number n in the Message Log can be cleared and recorded in the entire network agree.
- the consensus node receives Quorum-1 legal checkpoint messages sent by different nodes, plus the checkpoint message sent by itself, it means that the consensus node has collected checkpoint messages of Quorum quantity, and a stable checkpoint can be achieved, and then It is possible to clean up the message records corresponding to the blocks before the block number n in the Message Log.
- the method provided by the embodiment of this specification further includes: when the second consensus node generates a specified number of blocks, the second consensus node broadcasts the checkpoint message in the alliance chain to carry There is a checkpoint message of the block number n of the block with the largest serial number among the specified number of blocks, and the checkpoint message broadcast by the second consensus node is used to indicate that the second consensus node has generated the specified number of blocks; the first consensus node receives the The checkpoint message sent by the second consensus node; when the first consensus node receives the checkpoint message of 2f consensus nodes in the alliance chain within the preset time period, the first consensus node clears the specified number of blocks in the first consensus node The message record corresponding to the block before the block with the largest sequence number; the first consensus node modifies the state of the first consensus node to stable checkpoint based on the block number n of the block with the largest sequence number among the specified number of blocks.
- the above specified number is a positive integer greater than or equal to 1.
- a way of triggering the view switching operation is that when the specified number is 1, after the first consensus node modifies the state of the first consensus node to stable checkpoint, the method provided by the embodiment of this specification The method also includes: the first consensus node starts the timer; if the first consensus node does not receive the block numbers of n+ 1 checkpoint message, the first consensus node determines that the stable checkpoint state of the first consensus node has timed out; the first consensus node triggers a view switching operation in the alliance chain based on the timeout of the stable checkpoint state of the first consensus node.
- the first consensus node in the consortium chain Every time the first consensus node in the consortium chain executes a proposal (that is, every time a block is generated), it can broadcast checkpoint messages to other consensus nodes in the consortium chain to reach an agreement on whether the message log of this consensus node can be cleared in the entire network. Consistent, other consensus nodes in the consortium chain can also broadcast checkpoint messages to other consensus nodes in the consortium chain after receiving the checkpoint message, and also reach a consensus on whether the Message Log of this consensus node can be cleared in the entire network. If the first consensus node in the consortium chain receives confirmations from consensus nodes with different numbers of Quorum (2f+1) within the set preset time period, the first consensus node can modify the status of the consensus node to stable checkpoint.
- the first consensus node in the consortium chain can restart the timer. If the first consensus node does not receive the zone data of other 2f consensus nodes in the consortium chain within the preset time period after starting the timer For the checkpoint message with block number n+1, the first consensus node determines that its stable checkpoint status has timed out, and can trigger a view switching operation in the consortium chain based on the stable checkpoint status timeout.
- another way of triggering the view switching operation is that when the specified number is a positive integer k greater than 1, after the first consensus node modifies the state of the first consensus node to stable checkpoint,
- the method also includes: the first consensus node starts the timer; if the first consensus node does not receive the other 2f consensus nodes in the consortium chain within the preset time period after starting the timer, the block number is n+k checkpoint messages, the first consensus node determines that the stable checkpoint state of the first consensus node has timed out; the first consensus node triggers a view switching operation in the alliance chain based on the timeout of the stable checkpoint state of the first consensus node.
- the first consensus node in the alliance chain executes k proposals (that is, every time k blocks are generated), it can broadcast checkpoint messages to other consensus nodes in the alliance chain. After reaching a consensus on the network, other consensus nodes in the consortium chain can also broadcast checkpoint messages to other consensus nodes in the consortium chain after receiving the checkpoint message. It is also a consensus on whether the Message Log of this consensus node can be cleared in the entire network. If the first consensus node in the consortium chain receives confirmations from consensus nodes with different numbers of Quorum (2f+1) within the set preset time period, the first consensus node can modify the status of the consensus node to stable checkpoint. At this time, the first consensus node in the consortium chain can restart the timer.
- the first consensus node determines that its stable checkpoint status has timed out, and can trigger a view switching operation in the consortium chain based on the stable checkpoint status timeout.
- Step 120 the second consensus node in the consortium chain receives the checkpoint message sent by the first consensus node.
- the second consensus node in the consortium chain When the second consensus node in the consortium chain generates a specified number of blocks, it can also broadcast a checkpoint message in the consortium chain.
- the checkpoint message is used to indicate that the second consensus node has generated a specified number of blocks. While the second consensus node broadcasts the checkpoint message in the alliance chain, it will also receive the checkpoint message sent by other consensus nodes in the alliance chain such as the first consensus node.
- Step 130 if the second consensus node does not receive checkpoint messages sent by other 2f consensus nodes in the consortium chain within the preset time period, the second consensus node determines that the stable checkpoint state of the second consensus node has timed out.
- the duration of the preset time period is the duration of the timer set locally by the second consensus node to trigger timeout. If the second consensus node does not receive the checkpoint messages sent by other 2f consensus nodes in the consortium chain within the preset time period, the second consensus node cannot collect the checkpoint messages of Quorum quantity, and cannot achieve stable checkpoint, and thus cannot Perform garbage cleaning operations on the Message Log in this consensus node. In the embodiment of this specification, the state that the consensus node cannot reach the stable checkpoint is simply referred to as the stable checkpoint state timeout.
- Step 140 the second consensus node initiates a view switching operation in the consortium chain based on the timeout of the stable checkpoint state of the second consensus node, and f is the maximum number of abnormal consensus nodes allowed in the consortium chain.
- the second consensus node can initiate a view switching operation in the consortium chain based on the timeout of its local stable checkpoint state, in an attempt to replace the consensus master node in the consortium chain.
- the consensus algorithm in the embodiment of this specification can also be applied to the RAFT algorithm, and other consensus algorithms that can distinguish between consensus master nodes and consensus backup nodes.
- the embodiment of this specification does not impose specific restrictions on the adopted consensus algorithm, as long as there is a consensus master node in the adopted consensus algorithm.
- C is the client
- consensus node 0 is the consensus master node during this consensus operation
- consensus nodes 1 to 3 are consensus backup nodes during this consensus operation.
- the schematic diagram shown in Figure 2 includes the following situations: In the first case, the consensus node 0 is a malicious node, and the consensus node 0 deceives the consensus node 1 and the consensus node 2 to perform the consensus operation on the message m requesting consensus from the client ( Figure 2 shown in the solid line), while the consensus node 0 itself and the consensus node 3 do not perform the consensus operation on the message m requesting consensus from the client (the dotted line shown in Figure 2).
- the local timer of the consensus node 3 will also time out, thereby initiating a view switching operation in the alliance chain; at the same time, due to the fact that in the first case , Consensus Node 1 and Consensus Node 2 have been unable to reach a stable checkpoint, that is, the stable checkpoint state has timed out. In this way, Consensus Node 1 and Consensus Node 2 will also trigger a view switching operation in the alliance chain, and then can achieve a Quorum number of view switching operations. Complete the master change.
- every time a consensus node generates a block it can broadcast a block message to other consensus nodes through the P2P protocol, and receive the consensus node that broadcasts the block message, as shown in Figure 2 If the consensus node 3 finds that the block height in the block message is higher than its local maximum block height, it will synchronize the latest block from consensus node 1 or consensus node 2 (there are already 2f+1 signatures in the block , can be pushed or pulled from consensus node 1 or consensus node 2, regardless of the height of the block of consensus node 0), so as to maintain synchronization with consensus node 1 or consensus node 2.
- the first consensus node in the consortium chain when the first consensus node in the consortium chain generates a specified number of blocks, it broadcasts a checkpoint message in the consortium chain.
- the checkpoint message is used to indicate that the first consensus node has generated a specified number of blocks.
- the second consensus node in the alliance chain receives the checkpoint message sent by the first consensus node; if the second consensus node does not receive the checkpoint message sent by other 2f consensus nodes in the alliance chain within the preset time period, then The second consensus node determines that the stable checkpoint state of the second consensus node has timed out; and the second consensus node initiates a view switching operation in the alliance chain based on the timeout of the stable checkpoint state of the second consensus node, f is the maximum abnormal consensus allowed in the alliance chain number of nodes.
- the consensus node Since the consensus node counts the checkpoint messages received from other consensus nodes in the consortium chain, one thread can be used alone, which can avoid causing great pressure on the consensus node at a certain moment, and thus enable the consensus node to be more accurate in the consortium chain. Trigger a view switch operation.
- Fig. 3 is a schematic structural diagram of the consortium chain system 300 provided by the embodiment of this specification.
- the consortium chain system 300 may include a first consensus node 310 and a second consensus node 320, wherein: the first consensus node 310, when generating a specified number of blocks, A checkpoint message is broadcast in the consortium chain, and the checkpoint message is used to indicate that the first consensus node has generated the specified number of blocks; the second consensus node 320 receives the checkpoint message sent by the first consensus node, if If the checkpoint message sent by other 2f consensus nodes in the alliance chain is not received within the preset time period, it is determined that the stable checkpoint state of the second consensus node has timed out; and based on the stable checkpoint of the second consensus node When the state is timed out, a view switch operation is initiated in the alliance chain, and f is the maximum number of abnormal consensus nodes allowed in the alliance chain.
- the first consensus node 310 is configured to: broadcast a checkpoint in the consortium chain based on the block number n of the block with the largest sequence number among the specified number of blocks message, the checkpoint message carries the block number n of the block with the largest sequence number among the specified number of blocks.
- the second consensus node broadcasts in the consortium chain a checkpoint message carrying the block number n of the block with the largest sequence number among the specified number of blocks, and the checkpoint message broadcast by the second consensus node is used to indicate that the second The consensus node has generated the specified number of blocks; the first consensus node receives the checkpoint message sent by the second consensus node; when the first consensus node receives the alliance within the preset time period When there are checkpoint messages from 2f consensus nodes in the chain, the first consensus node clears the message record corresponding to the block before the block with the largest sequence number in the specified number of blocks in the first consensus node; The first consensus node modifies the state of the first consensus node to stable checkpoint based on the block number n of the block with the largest sequence number among the specified number of blocks.
- the specified number is a positive integer greater than or equal to 1.
- the method further includes: the first consensus node starts timer; if the first consensus node does not receive the block number n+1 carried by the other 2f consensus nodes in the consortium chain within the preset time period after starting the timer checkpoint message, the first consensus node determines that the stable checkpoint state of the first consensus node has timed out; View switching operation.
- the method further includes: the The first consensus node starts the timer; if the first consensus node does not receive the blocks carried by other 2f consensus nodes in the consortium chain within the preset time period after starting the timer n+k checkpoint message, the first consensus node determines that the stable checkpoint status of the first consensus node has timed out; the first consensus node is based on the stable checkpoint status of the first consensus node. Trigger the view switching operation in the alliance chain mentioned above.
- the first consensus node is any consensus node in the consortium chain; the second consensus node is any consensus node in the consortium chain.
- the consortium chain system 300 can implement the methods in the method embodiments in FIGS. 1-2 .
- Fig. 4 is a schematic structural diagram of a consensus node 400 in a consortium chain provided by an embodiment of this specification, including: a broadcast module 410, which broadcasts a checkpoint message in the consortium chain when a specified number of blocks are generated, the checkpoint message It is used to indicate that the specified number of blocks has been generated; the receiving module 420 receives checkpoint messages sent by other consensus nodes in the alliance chain; the state determination module 430, if the alliance chain is not received within a preset time period The checkpoint message sent by other 2f consensus nodes in the chain determines that the stable checkpoint state is overtime; the view switching module 440 initiates a view switching operation in the alliance chain based on the timeout of the stable checkpoint state, and f is the alliance chain The maximum number of abnormal consensus nodes allowed in .
- the broadcast module 410 is configured to: broadcast a checkpoint message in the consortium chain based on the block number n of the block with the largest sequence number among the specified number of blocks, the checkpoint message carries the block number n of the block with the largest sequence number among the specified number of blocks.
- the status determination module 430 is further configured to: clear the designated node in this consensus node when receiving checkpoint messages from 2f consensus nodes in the consortium chain within the preset time period.
- the specified number is a positive integer greater than or equal to 1.
- the view switching module 440 is also used to: start the timer; if Within the preset time period after starting the timer, if no checkpoint message carrying block number n+1 from other 2f consensus nodes in the consortium chain is received, then the consensus node’s The stable checkpoint state timed out; based on the timeout of the stable checkpoint state of the consensus node, the view switching operation is triggered in the alliance chain.
- the view switching module 440 is further configured to: Start the timer; if within the preset time period after starting the timer, the checkpoint message carrying the block number n+k of the other 2f consensus nodes in the consortium chain is not received, then Determine the timeout of the stable checkpoint state of the consensus node; based on the timeout of the stable checkpoint state of the consensus node, trigger the view switching operation in the alliance chain.
- the consensus node 400 in the consortium chain is any consensus node in the consortium chain.
- the consensus node 400 in the consortium chain can implement the method in the method embodiment in FIG. 1 .
- Fig. 5 is a schematic structural diagram of an electronic device provided by an embodiment of this specification.
- the electronic device includes a processor, and optionally also includes an internal bus, a network interface, and a memory.
- the memory may include a memory, such as a high-speed random-access memory (Random-Access Memory, RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
- RAM random-Access Memory
- non-volatile memory such as at least one disk memory.
- the electronic device may also include hardware required by other services.
- the processor, the network interface and the memory can be connected to each other through an internal bus, which can be an ISA (Industry Standard Architecture, industry standard architecture) bus, a PCI (Peripheral Component Interconnect, peripheral component interconnection standard) bus or an EISA (Extended Industry Standard Architecture, extended industry standard architecture) bus, etc.
- the bus can be divided into address bus, data bus, control bus and so on. For ease of representation, only one double-headed arrow is used in FIG. 5 , but it does not mean that there is only one bus or one type of bus.
- Memory for storing programs.
- the program may include program code, and the program code includes computer operation instructions.
- Storage which can include internal memory and nonvolatile storage, provides instructions and data to the processor.
- the processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it, forming a blockchain system deployed by consensus nodes in the consortium chain on a logical level.
- the processor executes the program stored in the memory, and is specifically used to perform the following operations: when a specified number of blocks is generated, a checkpoint message is broadcast in the consortium chain, and the checkpoint message is used to indicate that the specified number of blocks has been generated block; receive checkpoint messages sent by other consensus nodes in the alliance chain; if the checkpoint messages sent by other 2f consensus nodes in the alliance chain are not received within the preset time period, then determine that the stable checkpoint state is overtime; Based on the timeout of the stable checkpoint state, a view switching operation is initiated in the alliance chain, and f is the maximum number of abnormal consensus nodes allowed in the alliance chain.
- a processor may be an integrated circuit chip with signal processing capabilities.
- each step of the above method can be completed by an integrated logic circuit of hardware in a processor or an instruction in the form of software.
- the above-mentioned processor can be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU), a network processor (Network Processor, NP), etc.; it can also be a digital signal processor (Digital Signal Processor, DSP), a dedicated integrated Circuit (Application Specific Integrated Circuit, ASIC), Field-Programmable Gate Array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
- DSP Digital Signal Processor
- ASIC Application Specific Integrated Circuit
- FPGA Field-Programmable Gate Array
- a general-purpose processor may be a microprocessor, or the processor may be any conventional processor, or the like.
- the steps of the method disclosed in conjunction with one or more embodiments of this specification may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor.
- the software module can be located in a mature storage medium in the field such as random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, register.
- the storage medium is located in the memory, and the processor reads the information in the memory, and completes the steps of the above method in combination with its hardware.
- the electronic device can also execute the consensus method in the consortium chain shown in FIG. 1 , which will not be repeated here in this specification.
- the electronic equipment in this specification does not exclude other implementations, such as logic devices or the combination of software and hardware, etc., that is to say, the execution subject of the following processing flow is not limited to each logic unit, It can also be a hardware or logic device.
- the embodiment of this specification also proposes a computer-readable storage medium, the computer-readable storage medium stores one or more programs, and the one or more programs include instructions, and the instructions are used when a portable electronic device including multiple application programs During execution, the portable electronic device can be made to execute the method of the embodiment shown in FIG.
- a typical implementing device is a computer.
- the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or Combinations of any of these devices.
- Computer-readable media including both permanent and non-permanent, removable and non-removable media, can be implemented by any method or technology for storage of information.
- 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 Disc (DVD) or other optical storage, Magnetic tape cartridge, tape magnetic disk storage or other magnetic storage device or any other non-transmission medium that can be used to store information that can be accessed by a computing device.
- computer-readable media excludes transitory computer-readable media, such as modulated data signals and carrier waves.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Business, Economics & Management (AREA)
- Databases & Information Systems (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Accounting & Taxation (AREA)
- Finance (AREA)
- Development Economics (AREA)
- Economics (AREA)
- Marketing (AREA)
- Strategic Management (AREA)
- Technology Law (AREA)
- General Business, Economics & Management (AREA)
- Computing Systems (AREA)
- Multimedia (AREA)
- Data Mining & Analysis (AREA)
- Retry When Errors Occur (AREA)
Abstract
Description
Claims (11)
- 一种联盟链中的共识方法,包括:联盟链中的第一共识节点在生成指定数量的区块时,在所述联盟链中广播checkpoint消息,所述checkpoint消息用于指示所述第一共识节点已经生成所述指定数量的区块;所述联盟链中的第二共识节点接收所述第一共识节点发送的checkpoint消息;如果所述第二共识节点在预设时间段内未接收到所述联盟链中的其它2f个共识节点发送的checkpoint消息,则所述第二共识节点确定所述第二共识节点的stable checkpoint状态超时;所述第二共识节点基于所述第二共识节点的stable checkpoint状态超时,在所述联盟链中发起视图切换操作,f为所述联盟链中允许的最大异常共识节点数量。
- 如权利要求1所述的方法,第一共识节点在所述联盟链中广播checkpoint消息,包括:所述第一共识节点基于所述指定数量的区块中序号最大的区块的区块号n,在所述联盟链中广播checkpoint消息,所述checkpoint消息中携带有所述指定数量的区块中序号最大的区块的区块号n。
- 如权利要求2所述的方法,当所述第一共识节点在所述联盟链中广播checkpoint消息之后,所述方法还包括:当所述第二共识节点生成所述指定数量的区块时,所述第二共识节点在所述联盟链中广播携带有所述指定数量的区块中序号最大的区块的区块号n的checkpoint消息,所述第二共识节点广播的checkpoint消息用于指示所述第二共识节点已经生成所述指定数量的区块;所述第一共识节点接收所述第二共识节点发送的checkpoint消息;当所述第一共识节点在所述预设时间段内接收到所述联盟链中的2f个共识节点的checkpoint消息时,所述第一共识节点清除所述第一共识节点中所述指定数量的区块中序号最大的区块之前的区块对应的消息记录;所述第一共识节点基于所述指定数量的区块中序号最大的区块的区块号n,将所述第一共识节点的状态修改为stable checkpoint。
- 如权利要求3所述的方法,所述指定数量为大于或等于1的正整数。
- 如权利要求4所述的方法,当所述指定数量为1时,所述第一共识节点将所述第一共识节点的状态修改为stable checkpoint之后,所述方法还包括:所述第一共识节点启动定时器;如果所述第一共识节点在启动所述定时器之后的所述预设时间段内,未接收到所述联盟链中的其它2f个共识节点的携带有区块号为n+1的checkpoint消息,则所述第一共识节点确定所述第一共识节点的stable checkpoint状态超时;所述第一共识节点基于所述第一共识节点的stable checkpoint状态超时,在所述联盟链中触发视图切换操作。
- 如权利要求4所述的方法,当所述指定数量为大于1的正整数k时,所述第一共识节点将所述第一共识节点的状态修改为stable checkpoint之后,所述方法还包括:所述第一共识节点启动定时器;如果所述第一共识节点在启动所述定时器之后的所述预设时间段内,未接收到所述联盟链中的其它2f个共识节点的携带有区块号为n+k的checkpoint消息,则所述第一共识节点确定所述第一共识节点的stable checkpoint状态超时;所述第一共识节点基于所述第一共识节点的stable checkpoint状态超时,在所述联盟链中触发视图切换操作。
- 如权利要求1~6中任一所述的方法,所述第一共识节点为所述联盟链中的任意一个共识节点;所述第二共识节点为所述联盟链中的任意一个共识节点。
- 一种联盟链系统,包括:第一共识节点,在生成指定数量的区块时,在所述联盟链中广播checkpoint消息,所述checkpoint消息用于指示所述第一共识节点已经生成所述指定数量的区块;第二共识节点,接收所述第一共识节点发送的checkpoint消息,如果在预设时间段内未接收到所述联盟链中的其它2f个共识节点发送的checkpoint消息,则确定所述第二共识节点的stable checkpoint状态超时;以及基于所述第二共识节点的stable checkpoint状态超时,在所述联盟链中发起视图切换操作,f为所述联盟链中允许的最大异常共识节点数量。
- 一种联盟链中的共识节点,包括:广播模块,在生成指定数量的区块时,在联盟链中广播checkpoint消息,所述checkpoint消息用于指示已经生成所述指定数量的区块;接收模块,接收所述联盟链中的其它共识节点发送的checkpoint消息;状态确定模块,如果在预设时间段内未接收到所述联盟链中的其它2f个共识节点发送的checkpoint消息,则确定stable checkpoint状态超时;视图切换模块,基于所述stable checkpoint状态超时,在所述联盟链中发起视图切换操作,f为所述联盟链中允许的最大异常共识节点数量。
- 一种电子设备,包括:处理器;以及被安排成存储计算机可执行指令的存储器,所述可执行指令在被执行时使所述处理器执行以下操作:在生成指定数量的区块时,在联盟链中广播checkpoint消息,所述checkpoint消息用于指示已经生成所述指定数量的区块;接收所述联盟链中的其它共识节点发送的checkpoint消息;如果在预设时间段内未接收到所述联盟链中的其它2f个共识节点发送的checkpoint消息,则确定stable checkpoint状态超时;基于所述stable checkpoint状态超时,在所述联盟链中发起视图切换操作,f为所述联盟链中允许的最大异常共识节点数量。
- 一种计算机可读存储介质,所述计算机可读存储介质存储一个或多个程序,所述一个或多个程序当被包括多个应用程序的电子设备执行时,使得所述电子设备执行以下操作:在生成指定数量的区块时,在联盟链中广播checkpoint消息,所述checkpoint消息用于指示已经生成所述指定数量的区块;接收所述联盟链中的其它共识节点发送的checkpoint消息;如果在预设时间段内未接收到所述联盟链中的其它2f个共识节点发送的checkpoint消息,则确定stable checkpoint状态超时;基于所述stable checkpoint状态超时,在所述联盟链中发起视图切换操作,f为所述联盟链中允许的最大异常共识节点数量。
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202111122765.9 | 2021-09-24 | ||
| CN202111122765.9A CN113836232B (zh) | 2021-09-24 | 2021-09-24 | 联盟链中的共识方法和系统 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2023045574A1 true WO2023045574A1 (zh) | 2023-03-30 |
Family
ID=78970015
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2022/109829 Ceased WO2023045574A1 (zh) | 2021-09-24 | 2022-08-03 | 联盟链中的共识 |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN113836232B (zh) |
| WO (1) | WO2023045574A1 (zh) |
Families Citing this family (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN113836232B (zh) * | 2021-09-24 | 2024-11-29 | 蚂蚁区块链科技(上海)有限公司 | 联盟链中的共识方法和系统 |
| CN114529414A (zh) * | 2022-02-24 | 2022-05-24 | 蚂蚁区块链科技(上海)有限公司 | 一种区块链的交易处理方法、区块链节点及电子设备 |
| CN115629896B (zh) * | 2022-10-10 | 2026-02-13 | 福州启元信息科技有限责任公司 | 联盟链中共识超时应对方法、装置 |
Citations (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20180152289A1 (en) * | 2016-11-30 | 2018-05-31 | International Business Machines Corporation | Checkpoints for permissionless blockchains |
| CN109784916A (zh) * | 2018-12-12 | 2019-05-21 | 广东工业大学 | 一种改进pbft的以太坊共识机制应用于联盟链的方法 |
| CN111555858A (zh) * | 2020-03-20 | 2020-08-18 | 北京邮电大学 | 一种基于块链式存储的实用拜占庭容错共识方法 |
| CN111612455A (zh) * | 2020-04-21 | 2020-09-01 | 国网江苏省电力有限公司电力科学研究院 | 一种面向用电信息保护的拜占庭容错联盟链共识方法及其系统、存储介质 |
| CN112988470A (zh) * | 2021-04-27 | 2021-06-18 | 支付宝(杭州)信息技术有限公司 | 联盟链中的共识方法、共识节点和系统 |
| CN113360567A (zh) * | 2021-04-29 | 2021-09-07 | 广西电网有限责任公司 | 基于区块链的电力交易分布式账本的安全存储方法及应用 |
| CN113836232A (zh) * | 2021-09-24 | 2021-12-24 | 支付宝(杭州)信息技术有限公司 | 联盟链中的共识方法和系统 |
Family Cites Families (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN114401150B (zh) * | 2019-09-05 | 2023-10-20 | 创新先进技术有限公司 | 区块链网络中加入节点的方法和区块链系统 |
| CN113657898B (zh) * | 2020-06-05 | 2024-07-09 | 支付宝(杭州)信息技术有限公司 | 联盟链中的共识方法和系统 |
| CN111865608B (zh) * | 2020-07-02 | 2022-08-26 | 南京邮电大学 | 一种应用于联盟链的共识机制运行方法 |
| CN111526216B (zh) * | 2020-07-03 | 2020-09-22 | 支付宝(杭州)信息技术有限公司 | 联盟链中的共识方法和系统 |
| CN111526219B (zh) * | 2020-07-03 | 2021-02-09 | 支付宝(杭州)信息技术有限公司 | 一种联盟链的共识方法及联盟链系统 |
| CN112929186B (zh) * | 2021-02-22 | 2022-02-22 | 北京航空航天大学 | 一种基于通信模式结构的联盟链共识优化方法 |
-
2021
- 2021-09-24 CN CN202111122765.9A patent/CN113836232B/zh active Active
-
2022
- 2022-08-03 WO PCT/CN2022/109829 patent/WO2023045574A1/zh not_active Ceased
Patent Citations (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20180152289A1 (en) * | 2016-11-30 | 2018-05-31 | International Business Machines Corporation | Checkpoints for permissionless blockchains |
| CN109784916A (zh) * | 2018-12-12 | 2019-05-21 | 广东工业大学 | 一种改进pbft的以太坊共识机制应用于联盟链的方法 |
| CN111555858A (zh) * | 2020-03-20 | 2020-08-18 | 北京邮电大学 | 一种基于块链式存储的实用拜占庭容错共识方法 |
| CN111612455A (zh) * | 2020-04-21 | 2020-09-01 | 国网江苏省电力有限公司电力科学研究院 | 一种面向用电信息保护的拜占庭容错联盟链共识方法及其系统、存储介质 |
| CN112988470A (zh) * | 2021-04-27 | 2021-06-18 | 支付宝(杭州)信息技术有限公司 | 联盟链中的共识方法、共识节点和系统 |
| CN113360567A (zh) * | 2021-04-29 | 2021-09-07 | 广西电网有限责任公司 | 基于区块链的电力交易分布式账本的安全存储方法及应用 |
| CN113836232A (zh) * | 2021-09-24 | 2021-12-24 | 支付宝(杭州)信息技术有限公司 | 联盟链中的共识方法和系统 |
Also Published As
| Publication number | Publication date |
|---|---|
| CN113836232A (zh) | 2021-12-24 |
| CN113836232B (zh) | 2024-11-29 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| EP3547648B1 (en) | Service processing and consensus method and device | |
| JP6876806B2 (ja) | ブロックチェーンコンセンサス形成の方法およびデバイス | |
| CN108648078B (zh) | 一种交易预处理方法、装置及电子设备 | |
| CN110888889B (zh) | 一种数据信息更新方法、装置及设备 | |
| CN113836232B (zh) | 联盟链中的共识方法和系统 | |
| CN113783935B (zh) | 一种拜占庭容错方法及装置 | |
| CN107368507A (zh) | 一种基于区块链的共识方法及装置 | |
| CN111600965A (zh) | 区块链中的共识方法和系统 | |
| WO2019153490A1 (zh) | 房产交易方法、装置、计算机可读存储介质及终端设备 | |
| CN110162270B (zh) | 基于分布式存储系统的数据存储方法、存储节点及介质 | |
| CN110648136B (zh) | 共识与交易同步的并行处理方法、装置和电子设备 | |
| CN113810465B (zh) | 一种异步二元共识方法及装置 | |
| CN111401904A (zh) | 联盟链中的共识方法和系统 | |
| CN108829498B (zh) | 业务数据访问方法和装置 | |
| CN115687420A (zh) | 一种镜像仓库分布式缓存方法和装置 | |
| CN107920101B (zh) | 一种文件访问方法、装置、系统及电子设备 | |
| CN113760519B (zh) | 分布式事务处理方法、装置、系统和电子设备 | |
| CN115955504B (zh) | 一种用于有状态服务的状态同步中间件实现方法和装置 | |
| US20250392486A1 (en) | Transaction proposal methods and consensus nodes in blockchain systems, and blockchain systems | |
| CN112988470B (zh) | 联盟链中的共识方法、共识节点和系统 | |
| CN113794576B (zh) | 一种可再投票的二元共识方法及装置 | |
| CN112988469B (zh) | 联盟链中的状态备份方法、装置和电子设备 | |
| CN116846907A (zh) | 一种共识方法、区块链节点 | |
| CN107491264B (zh) | 一种分布式系统中的数据写入方法及装置 | |
| CN113961639B (zh) | 一种分布式事务处理方法、终端及计算机可读存储介质 |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 22871632 Country of ref document: EP Kind code of ref document: A1 |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 22871632 Country of ref document: EP Kind code of ref document: A1 |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 22871632 Country of ref document: EP Kind code of ref document: A1 |
|
| 32PN | Ep: public notification in the ep bulletin as address of the adressee cannot be established |
Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 25.11.2024) |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 22871632 Country of ref document: EP Kind code of ref document: A1 |