WO2021184877A1 - 用于区块链系统的节点管理的方法、节点和计算设备 - Google Patents
用于区块链系统的节点管理的方法、节点和计算设备 Download PDFInfo
- Publication number
- WO2021184877A1 WO2021184877A1 PCT/CN2020/139711 CN2020139711W WO2021184877A1 WO 2021184877 A1 WO2021184877 A1 WO 2021184877A1 CN 2020139711 W CN2020139711 W CN 2020139711W WO 2021184877 A1 WO2021184877 A1 WO 2021184877A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- node
- blockchain system
- voting
- transaction
- joined
- Prior art date
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR 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
Definitions
- the embodiments of this specification relate to the field of blockchain technology, and more specifically, to a method, node, and computing device for node management of a blockchain system.
- Blockchain technology also known as distributed ledger technology, is a kind of emerging that several computing devices (also called nodes in this article) participate in “bookkeeping” and jointly maintain a complete distributed database. technology. Due to the various characteristics of blockchain technology such as decentralization, openness, transparency, and non-tamperability, blockchain technology has been widely used in many fields.
- the embodiments of the present specification provide a method, a node, and a computing device for node management of a blockchain system.
- the embodiment of this specification provides a method for node management of a blockchain system, including: a node to be added performs pre-voting interaction with a node in the blockchain system to determine the blockchain system Whether it is in the master node election process; in the case that the blockchain system is not in the master node election process, the node to be joined joins the blockchain system; when the blockchain system is in the master node election In the case of the process, the node to be joined determines that it cannot join the blockchain system.
- the embodiment of this specification provides a method for node management of a blockchain system, including: the first node in the blockchain system performs pre-voting interaction with the node to be added to assist the node to be added.
- the joining node determines whether the blockchain system is in the master node election process; if the node to be joined requests to join the blockchain system when the blockchain system is not in the master node election process, then The first node performs an operation for the node to join to join the blockchain system; if the node to join requests to join the block when the blockchain system is in the master node election process Chain system, the first node rejects the node to be joined to join the blockchain system.
- the embodiment of this specification provides a node, wherein the node is a node to be added to the blockchain system, and the node includes: an interaction unit for communicating with the node in the blockchain system Perform pre-voting interaction to determine whether the blockchain system is in the master node election process; the joining unit is used to join the blockchain when the blockchain system is not in the master node election process System; a determining unit, configured to determine that the blockchain system cannot be added to the blockchain system when the blockchain system is in the master node election process.
- the embodiment of the present specification provides a node, wherein the node is a member in the blockchain system, and the node includes: an interaction unit for performing pre-voting interaction with the node to be added, To assist the node to be joined to determine whether the blockchain system is in the process of master node election; the execution unit is used to: if the node to be joined is not in the process of master node election in the blockchain system Request to join the blockchain system, then execute the operation to make the node to join join the blockchain system; if the node to join is in the process of master node election in the blockchain system When requesting to join the blockchain system, the node to be joined is rejected to join the blockchain system.
- the embodiment of this specification provides a computing device, including: at least one processor; When the at least one processor is executed, the at least one processor implements the foregoing method executed by the node to be added.
- the embodiment of this specification provides a computing device, including: at least one processor; When the at least one processor is executed, the at least one processor implements the foregoing method executed by the first node.
- the node to be added can normally join the blockchain system when the blockchain system is not in the process of master node election, but cannot when the blockchain system is in the process of master node election. Joining the blockchain system can effectively ensure the stability and reliability of the blockchain system in the master node election process.
- Fig. 1A is a schematic flowchart of a method for node management of a blockchain system according to an embodiment.
- Fig. 1B is a schematic flowchart of a method for node management of a blockchain system according to an embodiment.
- Figure 2 is an interactive schematic diagram of a scenario for node management in a blockchain system.
- Figure 3A is a schematic block diagram of a node according to an embodiment.
- Figure 3B is a schematic block diagram of a node according to an embodiment.
- Fig. 4A is a hardware structure diagram of a computing device for node management of a blockchain system according to an embodiment.
- Fig. 4B is a hardware structure diagram of a computing device for node management of a blockchain system according to an embodiment.
- a blockchain system based on blockchain technology can include multiple nodes. Among these multiple nodes, one node can be elected as the master node, and the other nodes can be the slave nodes.
- the master node can be responsible for initiating transaction consensus, and can be responsible for creating the latest block for the blockchain based on the transaction data passed by the consensus.
- the master node can be dynamically generated according to different situations. For example, before the blockchain system performs consensus processing, the master node can be elected from each node first. For another example, when the master node and the slave node cannot communicate due to network delays, failure of the master node, etc., a new master node can be re-elected. For another example, when most nodes think that the master node is a malicious node (for example, sending fake data or wrong data, etc.), a new master node can be re-elected.
- a malicious node for example, sending fake data or wrong data, etc.
- the mechanism for electing the master node can be different.
- the blockchain system can adopt various applicable consensus algorithms such as the RAFT algorithm and the Practical Byzantine Fault Tolerance (PBFT) algorithm.
- RAFT RAFT
- PBFT Practical Byzantine Fault Tolerance
- the master node election process takes a certain amount of time to complete. During this process, if other operations are performed at the same time, bandwidth may be occupied and timeout may be caused, which may affect the stability of the entire blockchain system. For example, if a new node joins the blockchain system during the master node election process, and the new node needs to perform data synchronization and other operations, this will occupy a large amount of system bandwidth, which may cause the master node election process to time out or prolong, etc. Nodes may not be able to return to the normal state in time to process transactions, which will seriously affect the stability of the entire blockchain system.
- the node to be added can determine whether the blockchain system is in the process of master node election through pre-voting interaction with each node in the blockchain system. In the case that the blockchain system is in the process of master node election, the nodes to be added will not be allowed to join the blockchain system. In the case that the blockchain system is not in the master node election process, the nodes to be added can normally join the blockchain system. It is understandable that the node to be added may refer to a node that expects to join the blockchain system.
- the node to be added can normally join the blockchain system when the blockchain system is not in the process of master node election, but cannot when the blockchain system is in the process of master node election. Joining the blockchain system can effectively ensure the stability and reliability of the blockchain system in the master node election process.
- the blockchain system can include a public chain system, a private chain system, or a consortium chain system.
- the blockchain system can be a consortium chain system composed of a third-party payment platform server, a domestic bank server, an overseas bank server, and several user nodes as members.
- the operator of the alliance chain can rely on the alliance chain to deploy online services such as cross-border transfers and asset transfers based on the alliance chain.
- Fig. 1A is a schematic flowchart of a method for node management of a blockchain system according to an embodiment. The method in FIG. 1A can be executed by a node to be added that desires to join the blockchain system.
- step 102A the node to be added performs pre-voting interaction with nodes in the blockchain system to determine whether the blockchain system is in the process of master node election.
- step 104A in the case that the blockchain system is not in the master node election process, the node to be added joins the blockchain system.
- step 106A when the blockchain system is in the process of master node election, the node to be added determines that it cannot join the blockchain system.
- the node to be added can normally join the blockchain system when the blockchain system is not in the process of master node election, but cannot when the blockchain system is in the process of master node election. Joining the blockchain system can effectively ensure the stability and reliability of the blockchain system in the master node election process.
- the blockchain system may include N nodes, where N is a positive integer greater than 1.
- the node to be joined may send a pre-vote message to N nodes.
- the pre-voting message may include information for identifying the node to be added.
- the node to be joined may use various communication methods to send pre-voting messages to N nodes.
- the node to be joined may broadcast a pre-voting message to N nodes.
- the node to be joined may send a pre-voting message to a neighboring node, and the neighboring node may forward the pre-voting message to other nodes, so that N nodes receive the pre-voting message.
- the neighboring node may forward the pre-voting message to other nodes, so that N nodes receive the pre-voting message.
- the node to be joined can receive a pre-vote-ack message sent by each node for the pre-vote message.
- the node to be joined may receive M pre-voting confirmation messages sent by M nodes, and M is a positive integer.
- the node to be joined may receive N pre-voting messages sent by all N nodes. At this time, M and N are equal.
- the node to be joined may not receive the pre-voting confirmation message sent by all N nodes due to various reasons (for example, network delay, node failure, etc.), for example, only M nodes among them have received the pre-voting confirmation message Of M pre-voting confirmation messages. At this time, M is less than N.
- the pre-voting confirmation message may indicate the consensus state of the node that sent the pre-voting confirmation message.
- the consensus state may include the master node election state, synchronization state, normal processing state, initialization state, and so on.
- the node to be joined can determine whether the blockchain system is in the process of master node election based on the received M pre-voting confirmation messages.
- the pre-voting message may include the identification and network address of the node to be added.
- the format of the pre-voting message may be as follows: pre-vote ⁇ i,address>, where i represents the identification of the node to be added, and address represents the network address of the node to be added.
- the network address may include a domain name, Internet Protocol (IP) port, and so on.
- the pre-voting confirmation message may include the consensus state information and identification of the node that sent the pre-voting confirmation message, and the current master node identification.
- the format of the pre-vote confirmation message may be as follows: pre-vote-ack ⁇ consensus_status, leader_id, j>, where consensus_status may indicate the consensus status of the corresponding node, j may indicate the identity of the corresponding node, and leader_id may indicate the identity of the master node.
- the node to be joined can determine that the blockchain system is in the master node election process.
- the majority of pre-voting confirmation messages here can be at least a quorum of pre-voting confirmation messages.
- the quorum can be referred to as the quorum quantity.
- K the quorum K can be associated with the consensus algorithm used by the blockchain system. For example, in the RAFT algorithm, assuming that there are at most f failed nodes among N nodes, the quorum can be f+1. In the PBFT algorithm, assuming that there are at most f problem nodes and f fault nodes in N nodes, the quorum can be 2f+1.
- the node to be added can determine that the blockchain system is in the master node election process; and if the M pre-voting confirmation messages At least K pre-voting confirmation messages in all indicate another consensus state that is different from the election state of the master node, and the node to be joined can determine that the blockchain system is not in the master node election process.
- the node to be added may send a transaction request to the node in the blockchain system.
- the nodes to be joined can send transaction requests to the N nodes through various communication methods.
- the transaction request can be used to request the execution of a transaction that activates the node to be added.
- each node in the blockchain system After the nodes in the blockchain system reach a consensus to execute the transaction, the transaction is executed, so that the node to be added can join the blockchain system. For example, after at least a quorum of nodes in the blockchain system reach a consensus to execute the transaction, these nodes will execute the transaction. For example, each node can update configuration information for the node to be added, for example, add the node information to be added to the configuration information, etc., so that the node to be added can join the blockchain system.
- the node to be added may determine not to send a transaction request to the node in the blockchain system, and the transaction request is used for request Perform a transaction to activate the node to be added.
- the node to be added may not send a transaction request to activate itself, so as to avoid affecting the stability of the blockchain system due to joining the blockchain system.
- step 106A when the blockchain system is in the master node election process, the node to be joined may still send a transaction request, which is used to request execution of a transaction for activating the node to be joined.
- the node to be added may still send a transaction request for some reason (evil or other reasons, etc.).
- the nodes in the blockchain system will reach a consensus not to execute the transaction for the transaction request, so that the transaction will not be executed, so that the node to be added cannot join the blockchain system.
- the stability of the blockchain system in the master node election process can be effectively ensured.
- the nodes to be added will not join the blockchain system when the blockchain system is undergoing master node elections from many aspects, thereby ensuring or improving the stability of the blockchain system.
- Fig. 1B is a schematic flowchart of a method for node management of a blockchain system according to an embodiment.
- the method in FIG. 1B can be executed by any normal node in the blockchain system.
- the node that executes the method in FIG. 1B is referred to as the first node.
- the first node may be a non-Byzantine node.
- step 102B the first node performs a pre-voting interaction with the node to be added to assist the node to be added to determine whether the blockchain system is in the master node election process.
- step 104B if the node to be joined requests to join the blockchain system when the blockchain system is not in the master node election process, the first node may perform an operation for the node to join to join the blockchain system.
- step 106B if the node to be joined requests to join the blockchain system when the blockchain system is in the master node election process, the first node may refuse the node to join to join the blockchain system.
- the node to be added is allowed to join the blockchain system normally when the blockchain system is not in the process of master node election, but rejected when the blockchain system is in the process of master node election
- the nodes to be added join the blockchain system, which can effectively ensure the stability and reliability of the blockchain system in the master node election process.
- the first node may receive a pre-voting message from the node to be joined.
- the pre-voting message may include information for identifying the node to be added.
- the first node may send a pre-voting confirmation message to the node to be joined.
- the pre-voting confirmation message may indicate the consensus status of the first node.
- the pre-voting message may include the identification and network address of the node to be added.
- the pre-voting confirmation message may include the consensus state information, identification, and current master node identification of the first node.
- the pre-voting message and the pre-voting confirmation message have been described in detail in the embodiment of FIG. 1A above, and will not be repeated here.
- the first node may receive a transaction request sent by the node to be added when the blockchain system is not in the master node election process, and the transaction request may be used to request execution to activate the node to be added Transactions.
- the first node can execute the transaction so that the node to be added can join the blockchain system. For example, the first node determines that at least a quorum of nodes reach a consensus to execute the transaction, and the quorum of nodes may include the first node itself. Then, the first node can execute the transaction, such as updating configuration information for the node to be added, so that the node to be added can join the blockchain system.
- the first node may receive a transaction request sent by the node to be added when the blockchain system is in the master node election process, and the transaction request may be used to request execution to activate the node to be added Transactions.
- the first node Since the blockchain system is electing the master node, the first node will reach a consensus with each node in the blockchain system not to execute the transaction. For example, the first node determines that at least a quorum of nodes has reached a consensus not to execute the transaction, and the quorum of nodes may include the first node itself. In this way, the first node will refuse to execute the transaction, so that the node to be added cannot join the blockchain system. As a result, the stability and reliability of the blockchain system in the master node election process can be ensured or improved.
- Figure 2 is an interactive schematic diagram of a scenario for node management in a blockchain system.
- the node R0 to be added can send pre-vote messages to nodes R1, R2, and R3.
- the pre-vote message may have the following format: pre-vote ⁇ identification of R0, network address of R0>.
- nodes R1, R2, and R3 After nodes R1, R2, and R3 receive the pre-vote message, they can return a pre-vote-ack message to the node to be added.
- the pre-vote-ack message may have the following format: pre-vote-ack ⁇ consensus_status, leader_id, j>.
- consensus_status can represent the consensus status of node R1
- leader_id can represent the current master node ID
- j can represent the ID of node R1.
- consensus_status can represent the consensus status of node R2
- leader_id can represent the current master node ID
- j can represent the ID of node R2.
- consensus_status can represent the consensus status of node R3
- leader_id can represent the current master node ID
- j can represent the ID of node R3.
- the node R0 to be added can determine whether the blockchain system is in the process of master node election after receiving three pre-vote-ack messages.
- the node R0 to be added can determine the zone The blockchain system is in the state of election of the master node. At this time, the node R0 to be added may not send a transaction request for requesting execution of the transaction of the activation node R0. In this way, when the blockchain system is in the master node election state, the nodes to be added will not join the blockchain system.
- the node R0 to be added can determine that the blockchain system is not in the master node election state.
- the node R0 to be added can send a transaction request to the nodes R1, R2, and R3, and the transaction request is used to request the execution of the transaction that activates the node R0.
- the nodes R1, R2, and R3 can all execute the transaction after reaching a consensus to execute the transaction, for example, update configuration information for the node R0.
- the node R0 is allowed to join the blockchain system.
- stage For example, if the blockchain system is not in the process of master node election, after the transaction request stage, there is a consensus stage for executing the transaction, a stage for executing the transaction, and so on.
- the node to be joined normally joins the blockchain system when the blockchain system is not in the master node election process, and does not join when the blockchain system is in the master node election process.
- the blockchain system can effectively ensure the stability and reliability of the blockchain system in the master node election process.
- Figure 3A is a schematic block diagram of a node according to an embodiment.
- the node 300A in FIG. 3A may be a node to be added to the blockchain system.
- the node 300A may include an interaction unit 302A, a joining unit 304A, and a determining unit 306A.
- the interaction unit 302A may perform pre-voting interaction with nodes in the blockchain system to determine whether the blockchain system is in the process of master node election.
- the joining unit 304A can join the blockchain system when the blockchain system is not in the master node election process.
- the determining unit 306A may be used to determine that the blockchain system cannot be added to the blockchain system when the blockchain system is in the process of master node election.
- the node to be added can normally join the blockchain system when the blockchain system is not in the process of master node election, but cannot when the blockchain system is in the process of master node election. Joining the blockchain system can effectively ensure the stability and reliability of the blockchain system in the master node election process.
- the blockchain system may include N nodes, and N is a positive integer greater than 1.
- the interaction unit 302A may send a pre-voting message to N nodes, where the pre-voting message includes information for identifying the node to be added.
- the interaction unit 302A can receive M pre-voting confirmation messages sent by M nodes of the N nodes for the pre-voting message, where each pre-voting confirmation message indicates the consensus status of the node that sent the pre-voting confirmation message, and M is positive Integer.
- the interaction unit 302A may determine whether the blockchain system is in the master node election process based on the M pre-voting confirmation messages.
- the interaction unit 302A can determine that the blockchain system is in the master node election process, where K It is a quorum determined based on the consensus algorithm used by the blockchain system.
- the interaction unit 302A can determine that the blockchain system is not in the master node election process.
- the pre-voting message may include the identification and network address of the node to be added.
- each pre-voting confirmation message may include consensus state information, identification, and current master node identification of the node that sent the pre-voting confirmation message.
- the joining unit 304A may send a transaction request to the node in the blockchain system, where the transaction request is used to request the execution of the activation to be added Node transactions.
- the nodes in the blockchain system execute the transaction after reaching a consensus to execute the transaction, so that the node to be added joins the blockchain system.
- the determining unit 306A may determine not to send a transaction request to the node in the blockchain system, where the transaction request is used to request execution of the activation pending Join the transaction of the node.
- the determining unit 306A may send a transaction request to the node in the blockchain system, where the transaction request is used to request execution to activate the node to be added. Transactions. Among them, the nodes in the blockchain system do not execute the transaction after reaching a consensus not to execute the transaction, so that the node to be added is determined to be unable to join the blockchain system.
- the blockchain system may include a consortium chain system.
- Each unit of the device 300A can execute the corresponding steps in the method embodiment of FIG. 1A and FIG.
- the foregoing apparatus 300A may be implemented by hardware, software, or a combination of software and hardware.
- the device 300A when the device 300A is implemented by software, it can be formed by reading the corresponding executable instructions in the memory (such as non-volatile memory) into the memory by the processor of the device where it is located and running it.
- the memory such as non-volatile memory
- Figure 3B is a schematic block diagram of a node according to an embodiment.
- the node 300B in FIG. 3B may be a member node in the blockchain system.
- the node 300B may include an interaction unit 302B and an execution unit 304B.
- the interaction unit 302B may perform pre-voting interaction with the node to be added to assist the node to be added to determine whether the blockchain system is in the process of master node election. If the node to be joined requests to join the blockchain system when the blockchain system is not in the master node election process, the execution unit 304B may perform an operation for the node to join to join the blockchain system. If the node to be joined requests to join the blockchain system when the blockchain system is in the master node election process, the execution unit 304B may refuse the node to join to join the blockchain system.
- the node to be added is allowed to join the blockchain system normally when the blockchain system is not in the process of master node election, but rejected when the blockchain system is in the process of master node election
- the nodes to be added join the blockchain system, which can effectively ensure the stability and reliability of the blockchain system in the master node election process.
- the interaction unit 302B may receive a pre-voting message from the node to be joined, where the pre-voting message includes information for identifying the node to be joined.
- the interaction unit 302B may send a pre-voting confirmation message for the pre-voting message to the node to be joined, where the pre-voting confirmation message indicates the consensus status of the node 300B.
- the pre-voting message may include the identification and network address of the node to be added.
- the pre-voting confirmation message may include the consensus status information, identification, and current master node identification of the node 300B.
- the execution unit 304B may receive a transaction request sent by the node to be added when the blockchain system is not in the master node election process, where the transaction request is used to request execution of a transaction for activating the node to be added.
- the execution unit 304B may execute the transaction after reaching a consensus to execute the transaction with each node in the blockchain system, so that the node to be added can join the blockchain system.
- the execution unit 304B may receive a transaction request sent by the node to be added when the blockchain system is in the master node election process, where the transaction request is used to request execution of a transaction for activating the node to be added.
- the execution unit 304B may refuse to execute the transaction after reaching a consensus not to execute the transaction with each node in the blockchain system, so that the node to be added cannot join the blockchain system.
- the blockchain system may include a consortium chain system.
- Each unit of the device 300B can execute the corresponding steps in the method embodiment of FIG. 1B and FIG.
- the above-mentioned apparatus 300B may be implemented by hardware, software, or a combination of software and hardware.
- the device 300B when the device 300B is implemented by software, it can be formed by reading the corresponding executable instructions in the memory (such as non-volatile memory) into the memory by the processor of the device where it is located and running it.
- the memory such as non-volatile memory
- Fig. 4A is a hardware structure diagram of a computing device for node management of a blockchain system according to an embodiment.
- the computing device 400A may include at least one processor 402A, memory 404A, memory 406A, and communication interface 408A, and at least one processor 402A, memory 404A, memory 406A, and communication interface 408A are connected together via a bus 410A.
- At least one processor 402A executes at least one executable instruction (that is, the above-mentioned element implemented in the form of software) stored or encoded in the memory 404A.
- the executable instructions stored in the memory 404A when executed by the at least one processor 402A, enable the computing device to implement the various processes described above in conjunction with FIGS. 1A and 2.
- the computing device 400A can be implemented in any suitable form in the art, for example, it includes, but is not limited to, a desktop computer, a laptop computer, a smart phone, a tablet computer, a consumer electronic device, a wearable smart device, and so on.
- Fig. 4B is a hardware structure diagram of a computing device for node management of a blockchain system according to an embodiment.
- the computing device 400B may include at least one processor 402B, memory 404B, memory 406B, and communication interface 408B, and at least one processor 402B, memory 404B, memory 406B, and communication interface 408B are connected together via a bus 410B.
- At least one processor 402B executes at least one executable instruction (that is, the above-mentioned element implemented in the form of software) stored or encoded in the memory 404B.
- the executable instructions stored in the memory 404B when executed by the at least one processor 402B, enable the computing device to implement the various processes described above in conjunction with FIGS. 1B and 2.
- the computing device 400B can be implemented in any suitable form in the art, for example, it includes but is not limited to a desktop computer, a laptop computer, a smart phone, a tablet computer, a consumer electronic device, a wearable smart device, and so on.
- the embodiments of this specification also provide a machine-readable storage medium.
- the machine-readable storage medium may store executable instructions, and the executable instructions, when executed by the machine, enable the machine to implement the specific process of the method embodiment for the node to be added described above with reference to FIGS. 1A and 2.
- the embodiments of this specification also provide a machine-readable storage medium.
- the machine-readable storage medium may store executable instructions, and the executable instructions, when executed by the machine, enable the machine to implement the specific process of the method embodiment described above with reference to FIG. 1B and FIG. 2 regarding the first node in the blockchain system. .
- the machine-readable storage medium may include, but is not limited to, random access memory (Random Access Memory, RAM), read-only memory (Read-Only Memory, ROM), and electrically erasable programmable read-only memory (Electrically-Erasable Programmable). Read-Only Memory, EEPROM), Static Random Access Memory (SRAM), hard disk, flash memory, etc.
- RAM Random Access Memory
- ROM read-only memory
- EEPROM Electrically erasable programmable read-only memory
- SRAM Static Random Access Memory
- hard disk hard disk
- flash memory etc.
Landscapes
- Engineering & Computer Science (AREA)
- Databases & Information Systems (AREA)
- Theoretical Computer Science (AREA)
- Computing Systems (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
一种用于区块链系统的节点管理的方法、节点和计算设备,该方法包括:待加入节点与区块链系统中的节点进行预投票交互(102A),以确定区块链系统是否处于主节点选举过程中;在区块链系统没有处于主节点选举过程中的情况下,待加入节点加入区块链系统(104A);在区块链系统处于主节点选举过程中的情况下,待加入节点确定无法加入区块链系统(106A)。
Description
本说明书的实施例涉及区块链技术领域,并且更具体地,涉及用于区块链系统的节点管理的方法、节点和计算设备。
区块链技术,也被称为分布式账本技术,是一种由若干个计算设备(在本文中也可以称为节点)共同参与“记账”,共同维护一份完整的分布式数据库的新兴技术。由于区块链技术具有去中心化,公开透明以及不可篡改等各种特性,使得区块链技术已经在众多的领域中得以广泛应用。
发明内容
考虑到上述问题,本说明书的实施例提供了用于区块链系统的节点管理的方法、节点和计算设备。
一方面,本说明书的实施例提供了一种用于区块链系统的节点管理的方法,包括:待加入节点与区块链系统中的节点进行预投票交互,以确定所述区块链系统是否处于主节点选举过程中;在所述区块链系统没有处于主节点选举过程中的情况下,所述待加入节点加入所述区块链系统;在所述区块链系统处于主节点选举过程中的情况下,所述待加入节点确定无法加入所述区块链系统。
另一方面,本说明书的实施例提供了一种用于区块链系统的节点管理的方法,包括:区块链系统中的第一节点与待加入节点进行预投票交互,以辅助所述待加入节点确定所述区块链系统是否处于主节点选举过程中;如果所述待加入节点在所述区块链系统没有处于主节点选举过程中的情况下请求加入所述区块链系统,则所述第一节点执行使得所述待加入节点加入所述区块链系统的操作;如果所述待加入节点在所述区块链系统处于主节点选举过程中的情况下请求加入所述区块链系统,则所述第一节点拒绝所述待加入节点加入所述区块链系统。
另一方面,本说明书的实施例提供了一种节点,其中,所述节点是待加入区块链系统的待加入节点,所述节点包括:交互单元,用于与区块链系统中的节点进行预投票 交互,以确定所述区块链系统是否处于主节点选举过程中;加入单元,用于在所述区块链系统没有处于主节点选举过程中的情况下,加入所述区块链系统;确定单元,用于在所述区块链系统处于主节点选举过程中的情况下,确定无法加入所述区块链系统。
另一方面,本说明书的实施例提供了一种节点,其中,所述节点是所述区块链系统中的成员,所述节点包括:交互单元,用于与待加入节点进行预投票交互,以辅助所述待加入节点确定所述区块链系统是否处于主节点选举过程中;执行单元,用于:如果所述待加入节点在所述区块链系统没有处于主节点选举过程中的情况下请求加入所述区块链系统,则执行使得所述待加入节点加入所述区块链系统的操作;如果所述待加入节点在所述区块链系统处于主节点选举过程中的情况下请求加入所述区块链系统,则拒绝所述待加入节点加入所述区块链系统。
另一方面,本说明书的实施例提供了一种计算设备,包括:至少一个处理器;与所述至少一个处理器进行通信的存储器,其上存储有可执行指令,所述可执行指令在被所述至少一个处理器执行时使得所述至少一个处理器实现上述由待加入节点执行的方法。
另一方面,本说明书的实施例提供了一种计算设备,包括:至少一个处理器;与所述至少一个处理器进行通信的存储器,其上存储有可执行指令,所述可执行指令在被所述至少一个处理器执行时使得所述至少一个处理器实现上述由第一节点执行的方法。
可见,在该技术方案中,待加入节点在区块链系统没有处于主节点选举过程中的情况下能够正常加入区块链系统,而在区块链系统处于主节点选举过程中的情况下无法加入区块链系统,从而能够有效地确保区块链系统在主节点选举过程中的稳定性和可靠性。
通过结合附图对本说明书的实施例的更详细的描述,本说明书的实施例的上述以及其它目的、特征和优势将变得更加明显,其中,在本说明书的实施例中,相同的附图标记通常代表相同的元素。
图1A是根据一个实施例的用于区块链系统的节点管理的方法的示意性流程图。
图1B是根据一个实施例的用于区块链系统的节点管理的方法的示意性流程图。
图2是用于区块链系统中的节点管理的一种场景的交互示意图。
图3A是根据一个实施例的节点的示意性框图。
图3B是根据一个实施例的节点的示意性框图。
图4A是根据一个实施例的用于区块链系统的节点管理的计算设备的硬件结构图。
图4B是根据一个实施例的用于区块链系统的节点管理的计算设备的硬件结构图。
现在将参考各实施例讨论本文描述的主题。应当理解的是,讨论这些实施例仅是为了使得本领域技术人员能够更好地理解并且实现本文描述的主题,并非是对权利要求书中所阐述的保护范围、适用性或者示例的限制。可以在不脱离权利要求书的保护范围的情况下,对所讨论的元素的功能和排列进行改变。各个实施例可以根据需要,省略、替换或者添加各种过程或组件。
基于区块链技术形成的区块链系统可以包括多个节点。在这多个节点中,一个节点可以被选举为主节点,而其它节点可以作为从节点。主节点可以负责发起交易共识,并且可以负责基于共识通过的交易数据来为区块链创建最新的区块。
主节点可以是根据不同的情况来动态产生的。例如,在区块链系统在进行共识处理之前,可以首先从各个节点中选举产生主节点。再例如,当由于网络延迟、主节点故障等原因而导致主节点和从节点无法进行通信时,可以重新选举出新的主节点。再例如,当大多数节点认为主节点是作恶节点(例如,发送假数据或错误数据等)时,可以重新选举出新的主节点。
基于区块链系统所采用的共识算法,选举主节点的机制可以是不同的。例如,在本说明书中,区块链系统可以采用RAFT算法、实用拜占庭容错(Practical Byzantine Fault Tolerance,PBFT)算法等各种适用的共识算法。
无论基于何种共识算法,主节点选举过程都需要一定的时间来完成。在该过程期间,如果同时进行其它操作,可能会占用带宽,造成超时等,从而可能影响整个区块链系统的稳定性。例如,如果在主节点选举过程中有新节点加入区块链系统,而该新节点需要进行数据同步等操作,这会占用系统的大量带宽,有可能导致主节点选举过程超时、延长等,各个节点可能无法及时地返回到正常状态来处理交易,从而严重影响整个区块链系统的稳定性。
鉴于此,在本说明书的技术方案中,待加入节点可以通过与区块链系统中的各个 节点进行预投票交互,来确定区块链系统是否处于主节点选举过程中。在区块链系统处于主节点选举过程中的情况下,将不允许待加入节点加入区块链系统。而在区块链系统没有处于主节点选举过程的情况下,待加入节点可以正常加入区块链系统中。可以理解的是,待加入节点可以指期望加入区块链系统的节点。
可见,在该技术方案中,待加入节点在区块链系统没有处于主节点选举过程中的情况下能够正常加入区块链系统,而在区块链系统处于主节点选举过程中的情况下无法加入区块链系统,从而能够有效地确保区块链系统在主节点选举过程中的稳定性和可靠性。
在本说明书中,区块链系统可以包括公有链系统、私有链系统或联盟链系统。
例如,在一个场景中,区块链系统可以是由第三方支付平台的服务器、境内银行服务器、境外银行服务器、以及若干用户节点作为成员组成的一个联盟链系统。该联盟链的运营方可以依托于该联盟链,来在线部署诸如基于联盟链的跨境转账、资产转移等在线业务。
然而,考虑到公有链系统、私有链系统和联盟链系统部署的节点规模,本说明书的技术方案将在联盟链系统或私有链系统中产生更佳的效果,但是本说明书的技术方案同样适用于公有链系统。
下面将结合具体实施例来描述本说明书中的技术方案。
图1A是根据一个实施例的用于区块链系统的节点管理的方法的示意性流程图。图1A的方法可以由期望加入区块链系统的待加入节点来执行。
如图1A所示,在步骤102A中,待加入节点与区块链系统中的节点进行预投票交互,与确定区块链系统是否处于主节点选举过程中。
在步骤104A中,在区块链系统没有处于主节点选举过程中的情况下,待加入节点加入区块链系统。
在步骤106A中,在区块链系统处于主节点选举过程中的情况下,待加入节点确定无法加入区块链系统。
可见,在该技术方案中,待加入节点在区块链系统没有处于主节点选举过程中的情况下能够正常加入区块链系统,而在区块链系统处于主节点选举过程中的情况下无法加入区块链系统,从而能够有效地确保区块链系统在主节点选举过程中的稳定性和可靠 性。
在一个实施例中,假设区块链系统可以包括N个节点,其中,N为大于1的正整数。在步骤102A中,待加入节点可以向N个节点发送预投票(pre-vote)消息。该预投票消息可以包括用于识别待加入节点的信息。
此处,待加入节点可以采用各种通信方式向N个节点发送预投票消息。例如,待加入节点可以向N个节点广播预投票消息。再例如,待加入节点可以向相邻的节点发送预投票消息,相邻的节点可以将预投票消息转发至其它节点,使得N个节点接收到预投票消息。本说明书中对此不作限定。
然后,待加入节点可以接收各个节点针对预投票消息发送的预投票确认(pre-vote-ack)消息。例如,待加入节点可以接收M个节点发送的M个预投票确认消息,M为正整数。
在一种情况下,待加入节点可能接收到所有N个节点发送的N个预投票消息,此时,M和N是相等的。
在另一种情况下,待加入节点可能由于各种原因(例如,网络延迟、节点故障等等)而没有接收到所有N个节点发送的预投票确认消息,比如仅接收到其中M个节点发送的M个预投票确认消息。此时,M小于N。
预投票确认消息可以指示发送该预投票确认消息的节点的共识状态。例如,共识状态可以包括主节点选举状态、同步状态、正常处理状态、初始化状态等等。
这样,待加入节点基于接收到的M个预投票确认消息,可以确定区块链系统是否处于主节点选举过程中。
可见,在该实施例中,通过预投票消息和预投票确认消息的交互,可以高效地确定区块链系统是否正在进行主节点选举,从而辅助待加入节点判断是否能够加入区块链系统,从而能够避免影响区块链系统的稳定性。
在一个实施例中,预投票消息可以包括待加入节点的标识和网络地址。例如,预投票消息的格式可以如下:pre-vote<i,address>,其中,i表示待加入节点的标识,address表示待加入节点的网络地址。比如,网络地址可以包括域名、互联网协议(Internet Protocol,IP)端口等。
在一个实施例中,预投票确认消息可以包括发送该预投票确认消息的节点的共识 状态信息、标识以及当前主节点标识。例如,预投票确认消息的格式可以如下:pre-vote-ack<consensus_status,leader_id,j>,其中,consensus_status可以表示对应节点的共识状态,j可以表示对应节点的标识,leader_id可以表示主节点标识。
在一个实施例中,如果大多数预投票确认消息都指示主节点选举状态,则待加入节点可以确定区块链系统处于主节点选举过程中。此处的大多数预投票确认消息可以至少是法定数量的预投票确认消息。在一些场景中,法定数量可以称为quorum数量。在本文中,假设法定数量为K。法定数量K可以与区块链系统所使用的共识算法相关联。例如,在RAFT算法中,假设N个节点中最多存在f个故障节点,则法定数量可以是f+1。在PBFT算法中,假设N个节点中最多存在f个问题节点和f个故障节点,则法定数量可以是2f+1。
这样,如果M个预投票确认消息中的至少K个预投票确认消息都指示主节点选举状态,则待加入节点可以确定区块链系统处于主节点选举过程中;而如果M个预投票确认消息中的至少K个预投票确认消息都指示与主节点选举状态不同的另一共识状态,则待加入节点可以确定区块链系统没有处于主节点选举过程中。
可见,通过基于预投票确认消息,可以高效地确定区块链系统是否正在进行主节点选举。
那么,在一个实施例中,在步骤104A中,在区块链系统没有处于主节点选举过程中的情况下,待加入节点可以向区块链系统中的节点发送交易请求。例如,假设区块链系统可以包括N个节点,则待加入节点可以通过各种通信方式向N个节点发送交易请求。交易请求可以用于请求执行激活待加入节点的交易。
在区块链系统中的节点达成执行该交易的共识之后执行该交易,从而使得待加入节点加入区块链系统。例如,在区块链系统中的至少法定数量的节点达成执行交易的共识之后,这些节点将执行该交易。比如,每个节点可以针对待加入节点来更新配置信息,例如,在配置信息中添加待加入节点信息等等,从而使得待加入节点加入区块链系统。
在一个实施例中,在步骤106A中,在区块链系统处于主节点选举过程中的情况下,待加入节点可以确定不向区块链系统中的节点发送交易请求,该交易请求用于请求执行激活待加入节点的交易。
例如,待加入节点在确定区块链系统处于主节点选举过程中的情况下,可以不发送激活其自身的交易请求,从而避免由于加入区块链系统而影响区块链系统的稳定性。
在一个实施例中,在步骤106A中,在区块链系统处于主节点选举过程中的情况下,待加入节点可能仍然发送交易请求,该交易请求用于请求执行激活待加入节点交易。比如,虽然待加入节点确定区块链系统处于主节点选举过程中,但是可能出于某种原因(作恶或其它原因等)仍然发送了交易请求。在这种情况下,区块链系统中的节点将针对该交易请求达成不执行该交易的共识,从而不执行该交易,使得待加入节点无法加入区块链系统。由此,能够有效地确保区块链系统在主节点选举过程中的稳定性。
可见,通过本说明书中的技术方案,从多个方面使得待加入节点在区块链系统正在进行主节点选举时不会加入区块链系统,从而确保或者提高区块链系统的稳定性。
图1B是根据一个实施例的用于区块链系统的节点管理的方法的示意性流程图。图1B的方法可以由区块链系统中的任何正常节点来执行。为了便于描述,将执行图1B的方法的节点称为第一节点。例如,第一节点可以是非拜占庭节点。
如图1B所示,在步骤102B中,第一节点与待加入节点进行预投票交互,以辅助待加入节点确定区块链系统是否处于主节点选举过程中。
在步骤104B中,如果待加入节点在区块链系统没有处于主节点选举过程中的情况下请求加入区块链系统,则第一节点可以执行使得待加入节点加入区块链系统的操作。
在步骤106B中,如果待加入节点在区块链系统处于主节点选举过程中的情况下请求加入区块链系统,则第一节点可以拒绝待加入节点加入区块链系统。
可见,在该技术方案中,在区块链系统没有处于主节点选举过程中的情况下使得待加入节点正常加入区块链系统,而在区块链系统处于主节点选举过程中的情况下拒绝待加入节点加入区块链系统,从而能够有效地确保区块链系统在主节点选举过程中的稳定性和可靠性。
在一个实施例中,在步骤102B中,第一节点可以从待加入节点接收预投票消息。预投票消息可以包括用于识别待加入节点的信息。
第一节点可以向待加入节点发送预投票确认消息。预投票确认消息可以指示第一节点的共识状态。
在一个实施例中,预投票消息可以包括待加入节点的标识和网络地址。
在一个实施例中,预投票确认消息可以包括第一节点的共识状态信息、标识以及当前主节点标识。
上文已经在图1A的实施例中详细描述了预投票消息和预投票确认消息,此处将不 再赘述。
在一个实施例中,在步骤104B中,第一节点可以接收待加入节点在区块链系统没有处于主节点选举过程的情况下发送的交易请求,该交易请求可以用于请求执行激活待加入节点的交易。
这样,在与区块链系统中的各个节点达成执行该交易的共识之后,第一节点可以执行该交易,使得待加入节点加入区块链系统。例如,第一节点确定至少法定数量的节点达成执行该交易的共识,法定数量的节点可以包括第一节点本身。然后,第一节点可以执行该交易,比如针对待加入节点更新配置信息,从而使得待加入节点加入区块链系统。
在一个实施例中,在步骤106B中,第一节点可以接收待加入节点在区块链系统处于主节点选举过程中的情况下发送的交易请求,该交易请求可以用于请求执行激活待加入节点的交易。
由于区块链系统正在进行主节点选举,因此第一节点将与区块链系统中的各个节点达成不执行该交易的共识。例如,第一节点确定至少法定数量的节点达成不执行该交易的共识,法定数量的节点可以包括第一节点本身。这样,第一节点将拒绝执行该交易,从而使得待加入节点无法加入区块链系统。由此,能够确保或提高区块链系统在主节点选举过程中的稳定性和可靠性。
为了便于理解,下面将结合具体例子进行描述。应当理解的是,以下例子仅是为了帮助本领域技术人员更好地理解本说明书中的技术方案,而并非限制其范围。
图2是用于区块链系统中的节点管理的一种场景的交互示意图。
在图2中,假设区块链系统包括节点R1、R2和R3,而待加入节点为R0。
如图2所示,待加入节点R0可以向节点R1、R2和R3发送pre-vote消息。例如,pre-vote消息可以具有如下格式:pre-vote<R0的标识,R0的网络地址>。
节点R1、R2和R3在接收到pre-vote消息之后,可以向待加入节点返回pre-vote-ack消息。例如,pre-vote-ack消息可以具有如下格式:pre-vote-ack<consensus_status,leader_id,j>。
对于节点R1来说,consensus_status可以表示节点R1的共识状态,leader_id可以表示当前主节点标识,j可以表示节点R1的标识。
对于节点R2来说,consensus_status可以表示节点R2的共识状态,leader_id可以表示当前主节点标识,j可以表示节点R2的标识。
对于节点R3来说,consensus_status可以表示节点R3的共识状态,leader_id可以 表示当前主节点标识,j可以表示节点R3的标识。
待加入节点R0可以在接收到3个pre-vote-ack消息之后,确定区块链系统是否处于主节点选举过程中。
例如,如果3个pre-vote-ack消息中的2个消息或者3个消息都指示主节点选举状态,也就是说,节点R1、R2和R3正在选举主节点,则待加入节点R0可以确定区块链系统处于主节点选举状态。此时,待加入节点R0可以不发送用于请求执行激活节点R0的交易的交易请求。这样,在区块链系统处于主节点选举状态时,待加入节点将不会加入区块链系统。
再例如,如果3个pre-vote-ack消息中的2个消息或者3个消息都指示除了主节点选举状态之外的另一共识状态,也就是说,节点R1、R2和R3没有在选举主节点,则待加入节点R0可以确定区块链系统没有处于主节点选举状态。
此时,如图2所示,待加入节点R0可以向节点R1、R2和R3发送交易请求,该交易请求用于请求执行激活节点R0的交易。
接下来,节点R1、R2和R3可以在达成执行该交易的共识之后,都执行该交易,例如,针对节点R0来更新配置信息。由此,使得节点R0加入区块链系统。
应当理解的是,在图2的例子中,为了简化图示,仅描绘了预投票、预投票确认和交易请求三个阶段,而并未示出其它阶段,但是这并不表明不包括其它相关阶段。例如,如果区块链系统并未处于主节点选举过程中,在交易请求这个阶段之后,还存在对执行交易的共识阶段以及执行交易的阶段等等。
可见,在该技术方案中,待加入节点在区块链系统没有处于主节点选举过程中的情况下正常加入区块链系统,而在区块链系统处于主节点选举过程中的情况下不加入区块链系统,从而能够有效地确保区块链系统在主节点选举过程中的稳定性和可靠性。
图3A是根据一个实施例的节点的示意性框图。图3A的节点300A可以是待加入区块链系统的待加入节点。
节点300A可以包括交互单元302A、加入单元304A和确定单元306A。
交互单元302A可以与区块链系统中的节点进行预投票交互,以确定区块链系统是否处于主节点选举过程中。加入单元304A可以在区块链系统没有处于主节点选举过程中的情况下,加入区块链系统。确定单元306A可以用于在区块链系统处于主节点选举过程中的情况下,确定无法加入区块链系统。
可见,在该技术方案中,待加入节点在区块链系统没有处于主节点选举过程中的情况下能够正常加入区块链系统,而在区块链系统处于主节点选举过程中的情况下无法 加入区块链系统,从而能够有效地确保区块链系统在主节点选举过程中的稳定性和可靠性。
在一个实施例中,区块链系统可以包括N个节点,N为大于1的正整数。
交互单元302A可以向N个节点发送预投票消息,其中,预投票消息包括用于识别待加入节点的信息。交互单元302A可以接收N个节点中的M个节点针对预投票消息发送的M个预投票确认消息,其中,每个预投票确认消息指示发送该预投票确认消息的节点的共识状态,M为正整数。交互单元302A可以基于M个预投票确认消息,确定区块链系统是否处于主节点选举过程中。
在另一实施例中,如果M个预投票确认消息中的至少K个预投票确认消息都指示主节点选举状态,则交互单元302A可以确定区块链系统处于主节点选举过程中,其中,K是基于区块链系统所使用的共识算法确定的法定数量。
如果M个预投票确认消息中的至少K个预投票确认消息都指示与主节点选举状态不同的另一共识状态,则交互单元302A可以确定区块链系统没有处于主节点选举过程中。
在另一实施例中,预投票消息可以包括待加入节点的标识和网络地址。
在另一实施例中,每个预投票确认消息可以包括发送该预投票确认消息的节点的共识状态信息、标识以及当前主节点标识。
在另一实施例中,在区块链系统没有处于主节点选举过程中的情况下,加入单元304A可以向区块链系统中的节点发送交易请求,其中,交易请求用于请求执行激活待加入节点的交易。其中,区块链系统中的节点在达成执行交易的共识之后执行交易,使得待加入节点加入区块链系统。
在另一实施例中,在区块链系统处于主节点选举过程中的情况下,确定单元306A可以确定不向区块链系统中的节点发送交易请求,其中,交易请求用于请求执行激活待加入节点的交易。
在另一实施例中,在区块链系统处于主节点选举过程中的情况下,确定单元306A可以向区块链系统中的节点发送交易请求,其中,交易请求用于请求执行激活待加入节点的交易。其中,区块链系统中的节点在达成不执行交易的共识之后不执行交易,使得待加入节点确定无法加入区块链系统。
在另一实施例中,区块链系统可以包括联盟链系统。
装置300A的各个单元可以执行图1A和图2的方法实施例中的相应步骤,因此,为了描述的简洁,装置300A的各个单元的具体操作和功能此处不再赘述。
上述装置300A可以采用硬件实现,也可以采用软件实现,或者可以通过软硬件的组合来实现。例如,装置300A在采用软件实现时,其可以通过其所在设备的处理器将存储器(比如非易失性存储器)中对应的可执行指令读取到内存中运行来形成。
图3B是根据一个实施例的节点的示意性框图。图3B的节点300B可以是区块链系统中的成员节点。
节点300B可以包括交互单元302B和执行单元304B。
交互单元302B可以与待加入节点进行预投票交互,以辅助待加入节点确定区块链系统是否处于主节点选举过程中。如果待加入节点在区块链系统没有处于主节点选举过程中的情况下请求加入区块链系统,则执行单元304B可以执行使得待加入节点加入区块链系统的操作。如果待加入节点在区块链系统处于主节点选举过程中的情况下请求加入区块链系统,则执行单元304B可以拒绝待加入节点加入区块链系统。
可见,在该技术方案中,在区块链系统没有处于主节点选举过程中的情况下使得待加入节点正常加入区块链系统,而在区块链系统处于主节点选举过程中的情况下拒绝待加入节点加入区块链系统,从而能够有效地确保区块链系统在主节点选举过程中的稳定性和可靠性。
在一个实施例中,交互单元302B可以从待加入节点接收预投票消息,其中,预投票消息包括用于识别待加入节点的信息。
交互单元302B可以向待加入节点发送针对预投票消息的预投票确认消息,其中,预投票确认消息指示节点300B的共识状态。
在另一实施例中,预投票消息可以包括待加入节点的标识和网络地址。
在另一实施例中,预投票确认消息可以包括节点300B的共识状态信息、标识以及当前主节点标识。
在另一实施例中,执行单元304B可以接收待加入节点在区块链系统没有处于主节点选举过程的情况下发送的交易请求,其中,交易请求用于请求执行激活待加入节点的交易。
执行单元304B可以在与区块链系统中的各个节点达成执行交易的共识之后,执行交易,使得待加入节点加入区块链系统。
在另一实施例中,执行单元304B可以接收待加入节点在区块链系统处于主节点选举过程的情况下发送的交易请求,其中,交易请求用于请求执行激活待加入节点的交易。执行单元304B可以在与区块链系统中的各个节点达成不执行交易的共识之后,拒绝执行交易,使得待加入节点无法加入区块链系统。
在另一实施例中,区块链系统可以包括联盟链系统。
装置300B的各个单元可以执行图1B和图2的方法实施例中的相应步骤,因此,为了描述的简洁,装置300B的各个单元的具体操作和功能此处不再赘述。
上述装置300B可以采用硬件实现,也可以采用软件实现,或者可以通过软硬件的组合来实现。例如,装置300B在采用软件实现时,其可以通过其所在设备的处理器将存储器(比如非易失性存储器)中对应的可执行指令读取到内存中运行来形成。
图4A是根据一个实施例的用于区块链系统的节点管理的计算设备的硬件结构图。如图4A所示,计算设备400A可以包括至少一个处理器402A、存储器404A、内存406A和通信接口408A,并且至少一个处理器402A、存储器404A、内存406A和通信接口408A经由总线410A连接在一起。至少一个处理器402A执行在存储器404A中存储或编码的至少一个可执行指令(即,上述以软件形式实现的元素)。
在一个实施例中,在存储器404A中存储的可执行指令在被至少一个处理器402A执行时,使得计算设备实现以上结合图1A和2描述的各种过程。
计算设备400A可以采用本领域任何适用的形式来实现,例如,其包括但不限于台式计算机、膝上型计算机、智能电话、平板计算机、消费电子设备、可穿戴智能设备等等。
图4B是根据一个实施例的用于区块链系统的节点管理的计算设备的硬件结构图。如图4B所示,计算设备400B可以包括至少一个处理器402B、存储器404B、内存406B和通信接口408B,并且至少一个处理器402B、存储器404B、内存406B和通信接口408B经由总线410B连接在一起。至少一个处理器402B执行在存储器404B中存储或编码的至少一个可执行指令(即,上述以软件形式实现的元素)。
在一个实施例中,在存储器404B中存储的可执行指令在被至少一个处理器402B执行时,使得计算设备实现以上结合图1B和2描述的各种过程。
计算设备400B可以采用本领域任何适用的形式来实现,例如,其包括但不限于台式计算机、膝上型计算机、智能电话、平板计算机、消费电子设备、可穿戴智能设备等等。
本说明书的实施例还提供了一种机器可读存储介质。该机器可读存储介质可以存储有可执行指令,可执行指令在被机器执行时使得机器实现上面参照图1A和图2描述的关于待加入节点的方法实施例的具体过程。
本说明书的实施例还提供了一种机器可读存储介质。该机器可读存储介质可以存储有可执行指令,可执行指令在被机器执行时使得机器实现上面参照图1B和图2描述 的关于区块链系统中的第一节点的方法实施例的具体过程。
例如,机器可读存储介质可以包括但不限于随机存取存储器(Random Access Memory,RAM)、只读存储器(Read-Only Memory,ROM)、电可擦除可编程只读存储器(Electrically-Erasable Programmable Read-Only Memory,EEPROM)、静态随机存取存储器(Static Random Access Memory,SRAM)、硬盘、闪存等等。
应当理解的是,本说明书中的各个实施例均采用递进的方式来描述,各个实施例之间相同或相似的部分相互参见即可,每个实施例重点说明的都是与其它实施例的不同之处。例如,对于上述关于装置的实施例、关于计算设备的实施例以及关于机器可读存储介质的实施例而言,由于它们基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。
上文对本说明书特定实施例进行了描述。其它实施例在所附权利要求书的范围内。在一些情况下,在权利要求书中记载的动作或步骤可以按照不同于实施例中的顺序来执行并且仍然可以实现期望的结果。另外,在附图中描绘的过程不一定要求示出的特定顺序或者连续顺序才能实现期望的结果。在某些实施方式中,多任务处理和并行处理也是可以的或者可能是有利的。
应当理解的是,对于本领域普通技术人员来说,对本说明书中的实施例进行的各种修改将是显而易见的,并且可以在不脱离权利要求书的保护范围的情况下,将本文所定义的一般性原理应用于其它变型。
Claims (34)
- 一种用于区块链系统的节点管理的方法,包括:待加入节点与区块链系统中的节点进行预投票交互,以确定所述区块链系统是否处于主节点选举过程中;在所述区块链系统没有处于主节点选举过程中的情况下,所述待加入节点加入所述区块链系统;在所述区块链系统处于主节点选举过程中的情况下,所述待加入节点确定无法加入所述区块链系统。
- 根据权利要求1所述的方法,其中,所述区块链系统包括N个节点,N为大于1的正整数;所述待加入节点与区块链系统中的节点进行预投票交互,以确定所述区块链系统是否处于主节点选举过程中,包括:所述待加入节点向所述N个节点发送预投票消息,其中,所述预投票消息包括用于识别所述待加入节点的信息;所述待加入节点接收所述N个节点中的M个节点针对所述预投票消息发送的M个预投票确认消息,其中,每个预投票确认消息指示发送该预投票确认消息的节点的共识状态,M为正整数;所述待加入节点基于所述M个预投票确认消息,确定所述区块链系统是否处于主节点选举过程中。
- 根据权利要求2所述的方法,其中,所述待加入节点基于所述M个预投票确认消息,确定所述区块链系统是否处于主节点选举过程中,包括:如果所述M个预投票确认消息中的至少K个预投票确认消息都指示主节点选举状态,则所述待加入节点确定所述区块链系统处于主节点选举过程中,其中,K是基于所述区块链系统所使用的共识算法确定的法定数量;如果所述M个预投票确认消息中的至少K个预投票确认消息都指示与主节点选举状态不同的另一共识状态,则所述待加入节点确定所述区块链系统没有处于主节点选举过程中。
- 根据权利要求2或3所述的方法,其中,所述预投票消息包括所述待加入节点的标识和网络地址。
- 根据权利要求2或3所述的方法,其中,所述每个预投票确认消息包括发送该预投票确认消息的节点的共识状态信息、标识以及当前主节点标识。
- 根据权利要求1至3中任一项所述的方法,其中,在所述区块链系统没有处于主节点选举过程中的情况下,所述待加入节点加入所述区块链系统,包括:在所述区块链系统没有处于主节点选举过程中的情况下,所述待加入节点向所述区块链系统中的节点发送交易请求,其中,所述交易请求用于请求执行激活所述待加入节点的交易;其中,所述区块链系统中的节点在达成执行所述交易的共识之后执行所述交易,使得所述待加入节点加入所述区块链系统。
- 根据权利要求1至3中任一项所述的方法,其中,在所述区块链系统处于主节点选举过程中的情况下,所述待加入节点确定无法加入所述区块链系统,包括:在所述区块链系统处于主节点选举过程中的情况下,所述待加入节点确定不向所述区块链系统中的节点发送交易请求,其中,所述交易请求用于请求执行激活所述待加入节点的交易。
- 根据权利要求1至3中任一项所述的方法,其中,在所述区块链系统处于主节点选举过程中的情况下,所述待加入节点确定无法加入所述区块链系统,包括:在所述区块链系统处于主节点选举过程中的情况下,所述待加入节点向所述区块链系统中的节点发送交易请求,其中,所述交易请求用于请求执行激活所述待加入节点的交易;其中,所述区块链系统中的节点在达成不执行所述交易的共识之后不执行所述交易,使得所述待加入节点确定无法加入所述区块链系统。
- 根据权利要求1至3中任一项所述的方法,其中,所述区块链系统包括联盟链系统。
- 一种用于区块链系统的节点管理的方法,包括:区块链系统中的第一节点与待加入节点进行预投票交互,以辅助所述待加入节点确定所述区块链系统是否处于主节点选举过程中;如果所述待加入节点在所述区块链系统没有处于主节点选举过程中的情况下请求加入所述区块链系统,则所述第一节点执行使得所述待加入节点加入所述区块链系统的操作;如果所述待加入节点在所述区块链系统处于主节点选举过程中的情况下请求加入所述区块链系统,则所述第一节点拒绝所述待加入节点加入所述区块链系统。
- 根据权利要求10所述的方法,其中,所述区块链系统中的第一节点与待加入节点进行预投票交互,包括:所述第一节点从所述待加入节点接收预投票消息,其中,所述预投票消息包括用于识别所述待加入节点的信息;所述第一节点向所述待加入节点发送针对所述预投票消息的预投票确认消息,其中,所述预投票确认消息指示所述第一节点的共识状态。
- 根据权利要求11所述的方法,其中,所述预投票消息包括所述待加入节点的标识和网络地址。
- 根据权利要求11或12所述的方法,其中,所述预投票确认消息包括所述第一节点的共识状态信息、标识以及当前主节点标识。
- 根据权利要求10至12中任一项所述的方法,其中,所述第一节点执行使得所述待加入节点加入所述区块链系统的操作,包括:所述第一节点接收所述待加入节点在所述区块链系统没有处于主节点选举过程的情况下发送的交易请求,其中,所述交易请求用于请求执行激活所述待加入节点的交易;在与所述区块链系统中的各个节点达成执行所述交易的共识之后,所述第一节点执行所述交易,使得所述待加入节点加入所述区块链系统。
- 根据权利要求10至12中任一项所述的方法,其中,所述第一节点拒绝所述待加入节点加入所述区块链系统,包括:所述第一节点接收所述待加入节点在所述区块链系统处于主节点选举过程的情况下发送的交易请求,其中,所述交易请求用于请求执行激活所述待加入节点的交易;在与所述区块链系统中的各个节点达成不执行所述交易的共识之后,所述第一节点拒绝执行所述交易,使得所述待加入节点无法加入所述区块链系统。
- 根据权利要求10至12中任一项所述的方法,其中,所述区块链系统包括联盟链系统。
- 一种节点,其中,所述节点是待加入区块链系统的待加入节点,所述节点包括:交互单元,用于与区块链系统中的节点进行预投票交互,以确定所述区块链系统是否处于主节点选举过程中;加入单元,用于在所述区块链系统没有处于主节点选举过程中的情况下,加入所述区块链系统;确定单元,用于在所述区块链系统处于主节点选举过程中的情况下,确定无法加入所述区块链系统。
- 根据权利要求17所述的节点,其中,所述区块链系统包括N个节点,N为大于1的正整数;所述交互单元具体用于:向所述N个节点发送预投票消息,其中,所述预投票消息包括用于识别所述待加入节点的信息;接收所述N个节点中的M个节点针对所述预投票消息发送的M个预投票确认消息,其中,每个预投票确认消息指示发送该预投票确认消息的节点的共识状态,M为正整数;基于所述M个预投票确认消息,确定所述区块链系统是否处于主节点选举过程中。
- 根据权利要求18所述的节点,其中,所述交互单元具体用于:如果所述M个预投票确认消息中的至少K个预投票确认消息都指示主节点选举状态,则确定所述区块链系统处于主节点选举过程中,其中,K是基于所述区块链系统所使用的共识算法确定的法定数量;如果所述M个预投票确认消息中的至少K个预投票确认消息都指示与主节点选举状态不同的另一共识状态,则确定所述区块链系统没有处于主节点选举过程中。
- 根据权利要求18或19所述的节点,其中,所述预投票消息包括所述待加入节点的标识和网络地址。
- 根据权利要求18或19所述的节点,其中,所述每个预投票确认消息包括发送 该预投票确认消息的节点的共识状态信息、标识以及当前主节点标识。
- 根据权利要求17至19中任一项所述的节点,其中,所述加入单元具体用于:在所述区块链系统没有处于主节点选举过程中的情况下,向所述区块链系统中的节点发送交易请求,其中,所述交易请求用于请求执行激活所述待加入节点的交易;其中,所述区块链系统中的节点在达成执行所述交易的共识之后执行所述交易,使得所述待加入节点加入所述区块链系统。
- 根据权利要求17至19中任一项所述的节点,其中,所述确定单元具体用于:在所述区块链系统处于主节点选举过程中的情况下,确定不向所述区块链系统中的节点发送交易请求,其中,所述交易请求用于请求执行激活所述待加入节点的交易。
- 根据权利要求17至19中任一项所述的节点,其中,所述确定单元具体用于:在所述区块链系统处于主节点选举过程中的情况下,向所述区块链系统中的节点发送交易请求,其中,所述交易请求用于请求执行激活所述待加入节点的交易;其中,所述区块链系统中的节点在达成不执行所述交易的共识之后不执行所述交易,使得所述待加入节点确定无法加入所述区块链系统。
- 根据权利要求17至19中任一项所述的节点,其中,所述区块链系统包括联盟链系统。
- 一种节点,其中,所述节点是区块链系统中的成员节点,所述节点包括:交互单元,用于与待加入节点进行预投票交互,以辅助所述待加入节点确定所述区块链系统是否处于主节点选举过程中;执行单元,用于:如果所述待加入节点在所述区块链系统没有处于主节点选举过程中的情况下请求加入所述区块链系统,则执行使得所述待加入节点加入所述区块链系统的操作;如果所述待加入节点在所述区块链系统处于主节点选举过程中的情况下请求加入所述区块链系统,则拒绝所述待加入节点加入所述区块链系统。
- 根据权利要求26所述的节点,其中,所述交互单元具体用于:从所述待加入节点接收预投票消息,其中,所述预投票消息包括用于识别所述待加入节点的信息;向所述待加入节点发送针对所述预投票消息的预投票确认消息,其中,所述预投票确认消息指示所述节点的共识状态。
- 根据权利要求27所述的节点,其中,所述预投票消息包括所述待加入节点的标识和网络地址。
- 根据权利要求27或28所述的节点,其中,所述预投票确认消息包括所述节点的共识状态信息、标识以及当前主节点标识。
- 根据权利要求26至28中任一项所述的节点,其中,所述执行单元具体用于:接收所述待加入节点在所述区块链系统没有处于主节点选举过程的情况下发送的交易请求,其中,所述交易请求用于请求执行激活所述待加入节点的交易;在与所述区块链系统中的各个节点达成执行所述交易的共识之后,执行所述交易,使得所述待加入节点加入所述区块链系统。
- 根据权利要求26至28中任一项所述的节点,其中,所述执行单元具体用于:接收所述待加入节点在所述区块链系统处于主节点选举过程的情况下发送的交易请求,其中,所述交易请求用于请求执行激活所述待加入节点的交易;在与所述区块链系统中的各个节点达成不执行所述交易的共识之后,拒绝执行所述交易,使得所述待加入节点无法加入所述区块链系统。
- 根据权利要求26至28中任一项所述的节点,其中,所述区块链系统包括联盟链系统。
- 一种计算设备,包括:至少一个处理器;与所述至少一个处理器进行通信的存储器,其上存储有可执行指令,所述可执行指令在被所述至少一个处理器执行时使得所述至少一个处理器实现根据权利要求1至9中任一项所述的方法。
- 一种计算设备,包括:至少一个处理器;与所述至少一个处理器进行通信的存储器,其上存储有可执行指令,所述可执行指令在被所述至少一个处理器执行时使得所述至少一个处理器实现根据权利要求10至16中任一项所述的方法。
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010181033.6A CN111046110B (zh) | 2020-03-16 | 2020-03-16 | 用于区块链系统的节点管理的方法、节点和计算设备 |
CN202010181033.6 | 2020-03-16 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2021184877A1 true WO2021184877A1 (zh) | 2021-09-23 |
Family
ID=70230996
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2020/139711 WO2021184877A1 (zh) | 2020-03-16 | 2020-12-26 | 用于区块链系统的节点管理的方法、节点和计算设备 |
Country Status (2)
Country | Link |
---|---|
CN (2) | CN111046110B (zh) |
WO (1) | WO2021184877A1 (zh) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114448769A (zh) * | 2022-04-02 | 2022-05-06 | 支付宝(杭州)信息技术有限公司 | 一种基于共识系统的节点竞选投票方法及装置 |
CN115208895A (zh) * | 2022-07-19 | 2022-10-18 | 中软航科数据科技(珠海横琴)有限公司 | 一种用于区块链技术的自动化组网方法及系统 |
CN116192692A (zh) * | 2022-12-30 | 2023-05-30 | 蚂蚁区块链科技(上海)有限公司 | 一种区块链网络中的共识数据分发方法和区块链网络 |
CN116260707A (zh) * | 2023-05-15 | 2023-06-13 | 安徽中科晶格技术有限公司 | 基于共识的区块链节点灾备方法、装置、设备及存储介质 |
CN118337789A (zh) * | 2024-06-12 | 2024-07-12 | 安徽中科晶格技术有限公司 | 基于区块链快速共识优化方法、设备及存储介质 |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111046110B (zh) * | 2020-03-16 | 2020-06-26 | 支付宝(杭州)信息技术有限公司 | 用于区块链系统的节点管理的方法、节点和计算设备 |
CN112910982B (zh) * | 2021-01-27 | 2023-06-16 | 网易(杭州)网络有限公司 | 一种联盟链的节点准入方法、装置、电子设备及存储介质 |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106331046A (zh) * | 2015-07-02 | 2017-01-11 | 中兴通讯股份有限公司 | 集群主节点选举方法及装置 |
CN107040594A (zh) * | 2017-04-12 | 2017-08-11 | 山大地纬软件股份有限公司 | 基于pbft的许可区块链节点准入的方法及装置 |
CN107171829A (zh) * | 2017-04-24 | 2017-09-15 | 杭州趣链科技有限公司 | 一种基于bft共识算法实现的动态节点管理方法 |
US20190379546A1 (en) * | 2018-06-12 | 2019-12-12 | Chunghwa Telecom Co., Ltd. | Method for reaching consensus on public distributed ledgers and system using the same |
CN110727731A (zh) * | 2019-09-05 | 2020-01-24 | 阿里巴巴集团控股有限公司 | 区块链网络中加入节点的方法和区块链系统 |
CN111046110A (zh) * | 2020-03-16 | 2020-04-21 | 支付宝(杭州)信息技术有限公司 | 用于区块链系统的节点管理的方法、节点和计算设备 |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101478774B (zh) * | 2009-01-20 | 2010-07-28 | 中国科学院软件研究所 | 语音采集和传输的无线传感器网络准入控制方法及其系统 |
US10142347B2 (en) * | 2016-02-10 | 2018-11-27 | Bank Of America Corporation | System for centralized control of secure access to process data network |
CN109165945B (zh) * | 2018-09-07 | 2021-04-16 | 腾讯科技(深圳)有限公司 | 代表节点设备选举方法、装置、计算机设备及存储介质 |
CN110474986B (zh) * | 2019-08-20 | 2022-08-12 | 深圳前海微众银行股份有限公司 | 一种基于区块链系统的共识方法、装置及系统 |
CN110796547A (zh) * | 2019-10-30 | 2020-02-14 | 桂林电子科技大学 | 一种基于联盟区块链的改进的实用拜占庭容错系统 |
-
2020
- 2020-03-16 CN CN202010181033.6A patent/CN111046110B/zh active Active
- 2020-03-16 CN CN202010778955.5A patent/CN112015811B/zh active Active
- 2020-12-26 WO PCT/CN2020/139711 patent/WO2021184877A1/zh active Application Filing
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106331046A (zh) * | 2015-07-02 | 2017-01-11 | 中兴通讯股份有限公司 | 集群主节点选举方法及装置 |
CN107040594A (zh) * | 2017-04-12 | 2017-08-11 | 山大地纬软件股份有限公司 | 基于pbft的许可区块链节点准入的方法及装置 |
CN107171829A (zh) * | 2017-04-24 | 2017-09-15 | 杭州趣链科技有限公司 | 一种基于bft共识算法实现的动态节点管理方法 |
US20190379546A1 (en) * | 2018-06-12 | 2019-12-12 | Chunghwa Telecom Co., Ltd. | Method for reaching consensus on public distributed ledgers and system using the same |
CN110727731A (zh) * | 2019-09-05 | 2020-01-24 | 阿里巴巴集团控股有限公司 | 区块链网络中加入节点的方法和区块链系统 |
CN111046110A (zh) * | 2020-03-16 | 2020-04-21 | 支付宝(杭州)信息技术有限公司 | 用于区块链系统的节点管理的方法、节点和计算设备 |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114448769A (zh) * | 2022-04-02 | 2022-05-06 | 支付宝(杭州)信息技术有限公司 | 一种基于共识系统的节点竞选投票方法及装置 |
CN114448769B (zh) * | 2022-04-02 | 2022-07-01 | 支付宝(杭州)信息技术有限公司 | 一种基于共识系统的节点竞选投票方法及装置 |
CN115208895A (zh) * | 2022-07-19 | 2022-10-18 | 中软航科数据科技(珠海横琴)有限公司 | 一种用于区块链技术的自动化组网方法及系统 |
CN116192692A (zh) * | 2022-12-30 | 2023-05-30 | 蚂蚁区块链科技(上海)有限公司 | 一种区块链网络中的共识数据分发方法和区块链网络 |
CN116260707A (zh) * | 2023-05-15 | 2023-06-13 | 安徽中科晶格技术有限公司 | 基于共识的区块链节点灾备方法、装置、设备及存储介质 |
CN116260707B (zh) * | 2023-05-15 | 2023-10-10 | 安徽中科晶格技术有限公司 | 基于共识的区块链节点灾备方法、装置、设备及存储介质 |
CN118337789A (zh) * | 2024-06-12 | 2024-07-12 | 安徽中科晶格技术有限公司 | 基于区块链快速共识优化方法、设备及存储介质 |
Also Published As
Publication number | Publication date |
---|---|
CN111046110B (zh) | 2020-06-26 |
CN112015811A (zh) | 2020-12-01 |
CN111046110A (zh) | 2020-04-21 |
CN112015811B (zh) | 2024-06-18 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2021184877A1 (zh) | 用于区块链系统的节点管理的方法、节点和计算设备 | |
WO2021184878A1 (zh) | 用于区块链系统的节点管理的方法、节点和计算设备 | |
US11552950B2 (en) | Blockchain interoperability | |
CN111213340B (zh) | 选择用于密码功能的证明委托并使其安全 | |
WO2020216280A1 (zh) | 一种区块处理方法和节点以及系统 | |
US20200134613A1 (en) | Method and Apparatus for Running Smart Contract | |
CN110263035A (zh) | 基于区块链的数据存储、查询方法及装置和电子设备 | |
WO2019042101A1 (zh) | 一种跨链交易方法及装置 | |
TWI719797B (zh) | 區塊鏈中智能合約的儲存、執行方法及裝置和電子設備 | |
CN110502319B (zh) | 分布式事务的处理方法、装置、电子设备及存储介质 | |
US20040153558A1 (en) | System and method for providing java based high availability clustering framework | |
CN100359508C (zh) | 用于处理集群计算机系统的合并协议的方法和装置 | |
CN112929225B (zh) | 会话异常处理方法、装置、计算机设备和存储介质 | |
WO2023040498A1 (zh) | 用户服务使用 | |
CN113067895A (zh) | 组建区块链子网的方法和区块链系统 | |
CN112910982B (zh) | 一种联盟链的节点准入方法、装置、电子设备及存储介质 | |
JPH10149286A (ja) | 効率的な共通オブジェクトリクエストブローカアーキテクチャトランザクションを実行するための方法および装置 | |
CN114363162A (zh) | 区块链日志的生成方法及装置、电子设备、存储介质 | |
CN117356070A (zh) | 零知识证明私有交易认可 | |
WO2023207077A1 (zh) | 区块链节点的迁移方法及装置 | |
WO2023040450A1 (zh) | 区块链服务网络的组建 | |
WO2019178839A1 (zh) | 为分布式应用创建一致性快照的方法、装置和分布式系统 | |
CN113259462A (zh) | 区块链消息的分发方法及装置 | |
CN112950183A (zh) | 跨链数据互换方法、系统、装置、电子设备 | |
US8868758B2 (en) | Provider connection framework |
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: 20925440 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: 20925440 Country of ref document: EP Kind code of ref document: A1 |