WO2022160901A1 - Blockchain consensus method, consensus node, and electronic device - Google Patents

Blockchain consensus method, consensus node, and electronic device Download PDF

Info

Publication number
WO2022160901A1
WO2022160901A1 PCT/CN2021/132998 CN2021132998W WO2022160901A1 WO 2022160901 A1 WO2022160901 A1 WO 2022160901A1 CN 2021132998 W CN2021132998 W CN 2021132998W WO 2022160901 A1 WO2022160901 A1 WO 2022160901A1
Authority
WO
WIPO (PCT)
Prior art keywords
consensus
node
transaction
blockchain
switching operation
Prior art date
Application number
PCT/CN2021/132998
Other languages
French (fr)
Chinese (zh)
Inventor
杨达一
Original Assignee
蚂蚁区块链科技(上海)有限公司
支付宝(杭州)信息技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 蚂蚁区块链科技(上海)有限公司, 支付宝(杭州)信息技术有限公司 filed Critical 蚂蚁区块链科技(上海)有限公司
Publication of WO2022160901A1 publication Critical patent/WO2022160901A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION 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
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/40Authorisation, e.g. identification of payer or payee, verification of customer or shop credentials; Review and approval of payers, e.g. check credit lines or negative lists
    • G06Q20/401Transaction verification
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor

Definitions

  • This document belongs to the field of blockchain technology, and in particular relates to a consensus method, consensus node and electronic equipment of a blockchain.
  • the consensus nodes of the blockchain synchronize all transactions in the transaction pool of this node to other consensus nodes through broadcasting.
  • This broadcast synchronization method will cause transactions to be sent redundantly, resulting in a large waste of bandwidth resources.
  • the waste of bandwidth resources will lead to a decrease in consensus computing power, thus affecting the execution efficiency of blockchain business.
  • the purpose of the embodiments of this specification is to provide a consensus method, consensus node and electronic device for a blockchain, so as to improve the waste of bandwidth resources caused by synchronous transactions between consensus nodes.
  • a consensus method for a blockchain including: a target consensus node of the blockchain performs a view switching operation, wherein the target consensus node is in the After performing the view switching operation, it becomes the consensus backup node; the target consensus node sends the transactions in the transaction pool of this node to the consensus master node of the blockchain; the consensus master node of the blockchain responds to the received The transaction is verified for legality, and the verified transaction is stored in the transaction pool of this node; the consensus master node initiates a consensus proposal based on the transaction in the transaction pool of this node.
  • a consensus method for a blockchain including: a target consensus node of the blockchain performs a view switching operation, wherein the target consensus node is a consensus backup node after performing the view switching operation; the target consensus node The node sends the transaction in the transaction pool of this node to the consensus master node of the blockchain, so that the consensus master node of the blockchain verifies the validity of the received transaction, and stores the verified transaction in the The transaction pool of this node, so as to initiate a consensus proposal based on the transactions in the transaction pool of this node.
  • a third aspect provides a blockchain consensus method, comprising: a target consensus node of the blockchain performs a view switching operation, wherein the target consensus node is a consensus master node after performing the view switching operation; the target consensus node The node receives the transaction sent by the consensus backup node of the blockchain and the blockchain client; the target consensus node verifies the validity of the received transaction, and stores the verified transaction in the transaction pool of the node; The target consensus node initiates a consensus proposal based on transactions in the transaction pool of the node.
  • a consensus node of a blockchain including: a view switching module, which executes a view switching operation of the consensus node; a sending module, if the view switching operation makes the consensus node serve as a consensus backup node, it will The transaction in the transaction pool of the consensus node is directed to the consensus master node of the blockchain; the receiving module, if the view switching operation makes the consensus node as the consensus master node, then receives the consensus of the blockchain The transaction sent by the backup node and the blockchain client; the synchronization module, if the view switching operation makes the consensus node act as the consensus master node, the validity of the transaction received by the receiving module is verified, and the verification is passed.
  • the transaction is stored in the transaction pool of the consensus node; the consensus module, if the view switching operation makes the consensus node act as the consensus master node, a consensus proposal is initiated based on the transactions in the transaction pool of the consensus node.
  • an electronic device comprising: a memory, a processor, and a computer program stored on the memory and executable on the processor, the computer program being executed by the processor: View switching operation; if the view switching operation makes the consensus node act as a consensus backup node, the transaction in the transaction pool of the consensus node is sent to the consensus master node of the blockchain; if the view switching operation The operation makes the consensus node act as the consensus master node, and then receives the transaction sent by the consensus backup node of the blockchain and the blockchain client; if the view switching operation makes the consensus node serve as the consensus master node, the The validity of the transaction received by the receiving module is verified, and the verified transaction is stored in the transaction pool of the consensus node; if the view switching operation makes the consensus node act as the consensus master node, based on the consensus Transactions in the node's transaction pool initiate consensus proposals.
  • a computer-readable storage medium is provided, a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the following steps are implemented: performing a view switching operation of a consensus node; If the view switching operation makes the consensus node act as a consensus backup node, then the transactions in the transaction pool of the consensus node are directed to the consensus master node of the blockchain; if the view switching operation makes the consensus node As the consensus master node, it receives the transaction sent by the consensus backup node of the blockchain and the blockchain client; if the view switching operation makes the consensus node as the consensus master node, the receiving module receives Verify the validity of the transaction, and store the verified transaction into the transaction pool of the consensus node; if the view switching operation makes the consensus node act as the consensus master node, the transaction pool based on the consensus node Transactions initiate consensus proposals.
  • the consensus backup node of the blockchain only directs synchronous transactions to the consensus master node, which can effectively save bandwidth overhead. Subsequently, if the blockchain changes the consensus master node, the consensus backup node will re-synchronize the transaction with the new consensus master node.
  • the directional synchronization method can also effectively reduce the redundant transmission of transactions, thereby improving the problem of wasting bandwidth resources, and avoiding the problem of the reduction of consensus computing power in the blockchain system due to excessive bandwidth usage.
  • FIG. 1 is a schematic flowchart of a first type of consensus method of a blockchain provided by an embodiment of this specification.
  • FIG. 2 is a schematic flowchart of a second block chain consensus method provided by an embodiment of the present specification.
  • FIG. 3 is a schematic structural diagram of a consensus node provided by an embodiment of the present specification.
  • FIG. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present specification.
  • the current consensus nodes of the blockchain synchronize all transactions in the transaction pool of this node to other consensus nodes through broadcasting.
  • This broadcast synchronization method will cause transactions to be sent redundantly, resulting in a waste of bandwidth resources.
  • the transaction pool of consensus node A has transactions 1 and 2
  • the transaction pool of consensus node B has transactions 2 and 3
  • the transaction pool of consensus node C has transaction 4.
  • consensus node A broadcasts transactions 1 and 2 to consensus nodes B and C
  • consensus node B broadcasts transaction 2 to consensus nodes A and C.
  • consensus node C broadcasts transaction 4 to consensus nodes A and B. It can be seen that the first round of synchronization results in redundant sending of transaction 2.
  • the transaction pools of consensus nodes A, B, and C all store transactions 1, 2, 3, and 4. Therefore, during the second round of synchronization, consensus nodes A, B, and C will redundantly send all transactions 1, 2, 3, and 4 in their respective transaction pools.
  • this paper aims to propose a technical solution that can improve the waste of bandwidth resources caused by synchronous transactions between consensus nodes.
  • FIG. 1 is a flowchart of the consensus method of the blockchain according to the embodiment of this specification.
  • the method shown in FIG. 1 can be performed by the corresponding hardware below, including the following steps: S102 , the target consensus node of the blockchain performs a view switching operation, wherein the target consensus node is a consensus backup node after performing the view switching operation.
  • each consensus node of the blockchain corresponds to a view number.
  • the blockchain generally switches views periodically based on certain rules (such as polling), and the corresponding consensus node is to perform the view switching operation.
  • the target consensus node if the blockchain switches to the view corresponding to the view number of this node, it will be the consensus master node, otherwise it will be the consensus backup node.
  • each consensus node of the blockchain can have a certain chance to become the consensus master node to initiate consensus proposals (consensus backup nodes cannot initiate consensus proposals), thereby achieving a certain degree of decentralization.
  • the target consensus node sends the transactions in the transaction pool of the node to the consensus master node of the blockchain.
  • the target consensus node sends the transactions in the transaction pool of this node to the consensus master node of the blockchain in a direction, which can mean that the consensus backup node only synchronizes transactions with the consensus master node, that is, any consensus The backup node will not add new transactions to the transaction pool of this node through other consensus backup nodes.
  • the target consensus node when the target consensus node acts as a consensus backup node, it can obtain new transactions initiated by the blockchain client and add the new transactions to the transaction pool of this node. On this basis, in order to achieve a smaller bandwidth overhead, as a possible but not necessary solution, when the target consensus node acts as a consensus backup node, it will only add transactions initiated by the blockchain client to the transaction pool of this node. , that is, only using bandwidth resources to receive transactions sent directly from the blockchain client. Of course, the target consensus node may also not reject transactions received by other means, but not process them.
  • the consensus master node of the blockchain verifies the validity of the received transaction, and stores the verified transaction into the transaction pool of this node.
  • the legality verification in this step may refer to the verification that an existing blockchain consensus node needs to perform before adding a transaction to the transaction pool. Since the embodiments of this specification do not involve improvements in this aspect, detailed descriptions are therefore omitted.
  • the consensus master node initiates a consensus proposal based on the transactions in the transaction pool of this node.
  • the consensus master node will select at least a part of the transactions from the transaction pool of this node to initiate a consensus proposal, and the transactions selected to initiate consensus here may include transactions provided by the target node. Among them, the consensus transaction will be generated by each consensus node to save the block, so as to realize the on-chain transaction data.
  • the consensus master node of the blockchain can initiate a consensus proposal for a transaction.
  • the consensus backup node of the blockchain only directs synchronous transactions to the consensus master node, which can effectively save bandwidth overhead. Subsequently, if the blockchain changes the consensus master node, the consensus backup node will re-synchronize the transaction with the new consensus master node.
  • the directional synchronization method can also effectively reduce the redundant transmission of transactions, thereby improving the problem of wasting bandwidth resources, and avoiding the problem of the reduction of consensus computing power in the blockchain system due to excessive bandwidth usage.
  • the target consensus node when the target consensus node is a consensus backup node, the transaction that has been sent to the consensus master node of the blockchain in the transaction pool of the node can be marked.
  • the target consensus node sends the unmarked transactions in the transaction pool of the node to the consensus master node of the blockchain. That is, if the blockchain does not switch views to replace the consensus master node, the target consensus node (consensus backup node) will not synchronize duplicate transactions with the consensus master node.
  • the target consensus node after the target consensus node performs the view switching operation, it can also clear the transaction mark in the transaction pool of this node. It should be understood that the new consensus master node will be replaced after the blockchain view is switched.
  • the target consensus node clears the mark and then executes the above S104, the new consensus master node can send the original message to the old consensus master node but not to the new consensus master node. transaction sent.
  • the transactions in the target consensus node transaction pool are mainly divided into two categories.
  • One is the transaction of the target consensus node's own node, which is the transaction initiated by the blockchain client directly to the target consensus node after entering the target consensus node; the other is the transaction of other consensus nodes, which is connected by other blockchain clients. Transactions initiated after entering other consensus nodes need to be synchronized through other consensus nodes (consensus backup nodes) after the target node acts as the consensus master node.
  • the process of executing the consensus method is shown in Figure 2, including: the target consensus node sends its own transactions in the transaction pool of this node to the current consensus master of the blockchain node.
  • the target consensus node ignores transactions belonging to other consensus nodes in the node's transaction pool.
  • the target consensus node also receives the new transaction initiated by the blockchain client, and verifies the validity of the new transaction initiated by the blockchain client. If the verification passes, it will be added to the transaction pool of the target consensus node.
  • the target consensus node adds a new transaction initiated by the blockchain client, which is a completely independent process, and is not restricted by other steps and the distinction between master and backup.
  • the blockchain switch view initiates a master change, and the target consensus node performs the view switch operation.
  • the target consensus node If the target consensus node is still the consensus backup node after performing the view switching operation, it will send all its own transactions in the transaction pool of this node to the new consensus master node of the blockchain, and the sent transactions include: the previous round of consensus master nodes.
  • the node sends transactions, and, in addition, new transactions are added to the node's transaction pool via the blockchain client.
  • the target consensus node is the consensus master node after performing the view switching operation, it will receive the transaction sent by the consensus backup node and the blockchain client, verify the validity of the received transaction, and store the verified transaction in this The node's transaction pool.
  • the target consensus node initiates a consensus proposal based on the transactions in the transaction pool of this node.
  • the transaction initiated by the consensus proposal is not limited to the source, but can be the transaction of the target consensus node and other consensus nodes.
  • the consensus backup node selects whether to send the existing transaction to the new consensus master node according to whether the consensus master node switches, which not only reduces the use of network bandwidth, but also ensures that the transaction is packaged successfully. Rate. A linear increase in the throughput of the blockchain is achieved.
  • the target consensus node is a consensus backup node after the view switching operation is performed, the following steps are performed: send the transaction in the transaction pool of this node to the The consensus master node of the blockchain enables the consensus master node of the blockchain to verify the validity of the received transactions, and store the verified transactions into the transaction pool of this node, so as to be based on the transactions in the transaction pool of this node. Initiate a consensus proposal.
  • the target consensus node is the consensus master node after the view switching operation is performed, the following steps are performed: receiving the transaction sent by the consensus backup node of the blockchain and the blockchain client; validating the received transaction. Validation is performed, and the verified transactions are stored in the transaction pool of this node; consensus proposals are initiated based on transactions in the transaction pool of this node.
  • FIG. 3 is a schematic structural diagram of a consensus node 300 according to an embodiment of the present invention, including: a view switching module 310, which performs a view switching operation of the consensus node.
  • the sending module 320 sends the transactions in the transaction pool of the consensus node to the consensus master node of the blockchain, if the view switching operation makes the consensus node act as a consensus backup node.
  • the receiving module 330 if the view switching operation makes the consensus node act as the consensus master node, receives the transaction sent by the consensus backup node of the blockchain and the blockchain client.
  • the synchronization module 340 if the view switching operation makes the consensus node act as the consensus master node, verify the validity of the transaction received by the receiving module, and store the verified transaction into the transaction pool of the consensus node .
  • the consensus module 350 if the view switching operation makes the consensus node act as the consensus master node, initiates a consensus proposal based on transactions in the transaction pool of the consensus node.
  • the master node of the blockchain can initiate consensus proposals for transactions.
  • the consensus node in the embodiment of this specification performs the view switching operation, if it is a consensus backup node, it will only direct synchronous transactions to the consensus master node, thereby effectively saving bandwidth overhead.
  • the blockchain changes the consensus master node it will re-synchronize the transaction to the new consensus master node.
  • the directional synchronization method can also effectively reduce the redundant transmission of transactions, thereby improving the problem of wasting bandwidth resources, and avoiding the problem of the reduction of consensus computing power in the blockchain system due to excessive bandwidth usage.
  • the sending module 320 only sends the transactions directly obtained from the blockchain client in the transaction pool of the consensus node to the consensus master node of the blockchain.
  • the sending module 320 marks the transactions that have been sent to the consensus master node of the blockchain in the transaction pool of the consensus node, and sends the transaction of the node to the transaction pool. Unmarked transactions in the pool are directed to the consensus master node of the blockchain.
  • the sending module 320 may also clear the transaction flag in the transaction pool of the consensus node after the view switching module 310 completes the view switching operation.
  • the synchronization module 340 when the consensus node acts as a consensus backup node, the synchronization module 340 only adds transactions initiated by the blockchain client to the transaction pool of the node.
  • the consensus node in the embodiment of this specification can be used as the execution body of the consensus method shown in FIG. 1 above, and thus can realize the functions implemented by the consensus method in FIG. 1 and FIG. 2 . Since the principle is the same, this article will not repeat them.
  • FIG. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present specification.
  • the electronic device includes a processor, and optionally an internal bus, a network interface, and a memory.
  • the memory may include memory, such as high-speed random-access memory (Random-Access Memory, RAM), or may also include 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 equipment may also include hardware required for other services.
  • the processor, network interface and memory can be connected to each other through an internal bus, which can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect, peripheral component interconnect standard) bus or an EISA (Extended Component Interconnect) bus. Industry Standard Architecture, extended industry standard structure) bus, etc.
  • the bus can be divided into an address bus, a data bus, a control bus, and the like. For ease of presentation, only one bidirectional arrow is used in FIG. 4, but it does not mean that there is only one bus or one type of bus.
  • the program may include program code, and the program code includes computer operation instructions.
  • the memory may include memory and non-volatile memory and provide instructions and data to the processor.
  • the processor reads the corresponding computer program from the non-volatile memory into the memory and runs it, forming a consensus device at the logical level, and the consensus device can be a consensus node or a component in a consensus node.
  • the processor executes the program stored in the memory, and is specifically configured to perform the following operations: perform the view switching operation of the consensus node.
  • the view switching operation makes the consensus node serve as a consensus backup node, the transactions in the transaction pool of the consensus node are directed to the consensus master node of the blockchain.
  • the view switching operation makes the consensus node act as the consensus master node, then receive the transaction sent by the consensus backup node of the blockchain and the blockchain client.
  • the view switching operation makes the consensus node act as the consensus master node, the validity of the transaction received by the receiving module is verified, and the verified transaction is stored in the transaction pool of the consensus node.
  • the view switching operation makes the consensus node act as the consensus master node, a consensus proposal is initiated based on transactions in the transaction pool of the consensus node.
  • the consensus backup node of the blockchain only directs synchronous transactions to the consensus master node, which can effectively save bandwidth overhead. Subsequently, if the blockchain changes the consensus master node, the consensus backup node will re-synchronize the transaction with the new consensus master node.
  • the directional synchronization method can also effectively reduce the redundant transmission of transactions, thereby improving the problem of wasting bandwidth resources, and avoiding the problem of the reduction of consensus computing power in the blockchain system due to excessive bandwidth usage.
  • a processor may be an integrated circuit chip with signal processing capabilities.
  • each step of the above-mentioned method can be completed by a hardware integrated logic circuit 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), 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 methods disclosed in conjunction with the embodiments of this specification may be directly embodied as being executed by a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor.
  • the software modules may be located in random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, registers and other storage media mature in the art.
  • 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 devices in this specification do not exclude other implementations, such as logic devices or the combination of software and hardware, etc. That is to say, the execution subjects of the following processing procedures are not limited to each logic unit. It can also be a hardware or logic device.
  • the embodiments of this specification also provide a computer-readable storage medium, where the computer-readable storage medium stores one or more programs, and the one or more programs include instructions, and the instructions, when stored in a portable computer including multiple application programs
  • the portable electronic device can be made to execute the method of the embodiment shown in FIG. 1 , and is specifically configured to execute the following steps: execute the view switching operation of the consensus node.
  • the view switching operation makes the consensus node serve as a consensus backup node, the transactions in the transaction pool of the consensus node are directed to the consensus master node of the blockchain.
  • the view switching operation makes the consensus node act as the consensus master node, then receive the transaction sent by the consensus backup node of the blockchain and the blockchain client.
  • the view switching operation makes the consensus node act as the consensus master node, the validity of the transaction received by the receiving module is verified, and the verified transaction is stored in the transaction pool of the consensus node.
  • the view switching operation makes the consensus node act as the consensus master node, a consensus proposal is initiated based on transactions in the transaction pool of the consensus node.
  • the embodiments of the present specification may be provided as a method, a system or a computer program product. Accordingly, this description may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present specification may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
  • computer-usable storage media including, but not limited to, disk storage, CD-ROM, optical storage, etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Accounting & Taxation (AREA)
  • Physics & Mathematics (AREA)
  • Finance (AREA)
  • General Business, Economics & Management (AREA)
  • Strategic Management (AREA)
  • Computing Systems (AREA)
  • Computer Security & Cryptography (AREA)
  • Data Mining & Analysis (AREA)
  • General Engineering & Computer Science (AREA)
  • Retry When Errors Occur (AREA)
  • Hardware Redundancy (AREA)

Abstract

Embodiments of the present description provide a blockchain consensus method, a consensus node, and an electronic device. The consensus method comprises: a target consensus node of a blockchain performs a view switching operation, wherein the target consensus node becomes a consensus backup node after performing the view switching operation; the target consensus node directionally sends transactions in a transaction pool of the present node to a consensus master node of the blockchain; the consensus master node of the blockchain performs validity verification on the received transactions, and stores the transaction that passes the verification into a transaction pool of the present node; and the consensus master node initiates a consensus proposal on the basis of transactions in the transaction pool of the present node.

Description

一种区块链的共识方法、共识节点及电子设备A consensus method, consensus node and electronic device for blockchain 技术领域technical field
本文件属于区块链技术领域,尤其涉及一种区块链的共识方法、共识节点及电子设备。This document belongs to the field of blockchain technology, and in particular relates to a consensus method, consensus node and electronic equipment of a blockchain.
背景技术Background technique
目前区块链的共识节点之间是通过广播方式将本节点交易池中的全量交易同步给其他共识节点。这种广播的同步方式会导致交易被冗余发送,从而造成带宽资源的大量浪费。对于共识节点规模较多以及交易数据庞大的区块链系统,带宽资源的浪费会导致共识算力下降,从而影响到区块链业务的执行效率。At present, the consensus nodes of the blockchain synchronize all transactions in the transaction pool of this node to other consensus nodes through broadcasting. This broadcast synchronization method will cause transactions to be sent redundantly, resulting in a large waste of bandwidth resources. For a blockchain system with a large number of consensus nodes and huge transaction data, the waste of bandwidth resources will lead to a decrease in consensus computing power, thus affecting the execution efficiency of blockchain business.
有鉴于此,当前亟需一种可以改善共识节点之间同步交易所造成的带宽资源浪费的技术方案。In view of this, there is an urgent need for a technical solution that can improve the waste of bandwidth resources caused by synchronous transactions between consensus nodes.
发明内容SUMMARY OF THE INVENTION
本说明书实施例目的是提供一种区块链的共识方法、共识节点及电子设备,改善共识节点之间同步交易所造成的带宽资源浪费。The purpose of the embodiments of this specification is to provide a consensus method, consensus node and electronic device for a blockchain, so as to improve the waste of bandwidth resources caused by synchronous transactions between consensus nodes.
为了实现上述目的,本说明书实施例是这样实现的:第一方面,提供一种区块链的共识方法,包括:区块链的目标共识节点执行视图切换操作,其中,所述目标共识节点在执行视图切换操作后为共识备份节点;所述目标共识节点将本节点的交易池中的交易定向发送至所述区块链的共识主节点;所述区块链的共识主节点对接收到的交易进行合法性验证,并将验证通过的交易存入本节点的交易池;共识主节点基于本节点的交易池中的交易发起共识提议。In order to achieve the above purpose, the embodiments of this specification are implemented as follows: In a first aspect, a consensus method for a blockchain is provided, including: a target consensus node of the blockchain performs a view switching operation, wherein the target consensus node is in the After performing the view switching operation, it becomes the consensus backup node; the target consensus node sends the transactions in the transaction pool of this node to the consensus master node of the blockchain; the consensus master node of the blockchain responds to the received The transaction is verified for legality, and the verified transaction is stored in the transaction pool of this node; the consensus master node initiates a consensus proposal based on the transaction in the transaction pool of this node.
第二方面,提供一种区块链的共识方法,包括:区块链的目标共识节点执行视图切换操作,其中,所述目标共识节点在执行视图切换操作后为共识备份节点;所述目标共识节点将本节点的交易池中的交易发送至所述区块链的共识主节点,使得所述区块链的共识主节点对接收到的交易进行合法性验证,并将验证通过的交易存入本节点的交易池,从而基于本节点的交易池中的交易发起共识提议。In a second aspect, a consensus method for a blockchain is provided, including: a target consensus node of the blockchain performs a view switching operation, wherein the target consensus node is a consensus backup node after performing the view switching operation; the target consensus node The node sends the transaction in the transaction pool of this node to the consensus master node of the blockchain, so that the consensus master node of the blockchain verifies the validity of the received transaction, and stores the verified transaction in the The transaction pool of this node, so as to initiate a consensus proposal based on the transactions in the transaction pool of this node.
第三方面,提供一种区块链的共识方法,包括:区块链的目标共识节点执行视图切 换操作,其中,所述目标共识节点在执行视图切换操作后为共识主节点;所述目标共识节点接收所述区块链的共识备份节点及区块链客户端发送的交易;所述目标共识节点对接收到的交易进行合法性验证,并将验证通过的交易存入本节点的交易池;所述目标共识节点基于本节点的交易池中的交易发起共识提议。A third aspect provides a blockchain consensus method, comprising: a target consensus node of the blockchain performs a view switching operation, wherein the target consensus node is a consensus master node after performing the view switching operation; the target consensus node The node receives the transaction sent by the consensus backup node of the blockchain and the blockchain client; the target consensus node verifies the validity of the received transaction, and stores the verified transaction in the transaction pool of the node; The target consensus node initiates a consensus proposal based on transactions in the transaction pool of the node.
第四方面,提供一种区块链的共识节点,包括:视图切换模块,执行共识节点的视图切换操作;发送模块,若所述视图切换操作使所述共识节点作为共识备份节点,则将所述共识节点的交易池中的交易定向发送至所述区块链的共识主节点;接收模块,若所述视图切换操作使所述共识节点作为共识主节点,则接收所述区块链的共识备份节点及区块链客户端发送的交易;同步模块,若所述视图切换操作使所述共识节点作为共识主节点,则对所述接收模块接收到的交易进行合法性验证,并将验证通过的交易存入所述共识节点的交易池;共识模块,若所述视图切换操作使所述共识节点作为共识主节点,则基于所述共识节点的交易池中的交易发起共识提议。In a fourth aspect, a consensus node of a blockchain is provided, including: a view switching module, which executes a view switching operation of the consensus node; a sending module, if the view switching operation makes the consensus node serve as a consensus backup node, it will The transaction in the transaction pool of the consensus node is directed to the consensus master node of the blockchain; the receiving module, if the view switching operation makes the consensus node as the consensus master node, then receives the consensus of the blockchain The transaction sent by the backup node and the blockchain client; the synchronization module, if the view switching operation makes the consensus node act as the consensus master node, the validity of the transaction received by the receiving module is verified, and the verification is passed. The transaction is stored in the transaction pool of the consensus node; the consensus module, if the view switching operation makes the consensus node act as the consensus master node, a consensus proposal is initiated based on the transactions in the transaction pool of the consensus node.
第五方面,提供一种电子设备包括:存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机程序,所述计算机程序被所述处理器执行:执行共识节点的视图切换操作;若所述视图切换操作使所述共识节点作为共识备份节点,则将所述共识节点的交易池中的交易定向发送至所述区块链的共识主节点;若所述视图切换操作使所述共识节点作为共识主节点,则接收所述区块链的共识备份节点及区块链客户端发送的交易;若所述视图切换操作使所述共识节点作为共识主节点,则对所述接收模块接收到的交易进行合法性验证,并将验证通过的交易存入所述共识节点的交易池;若所述视图切换操作使所述共识节点作为共识主节点,则基于所述共识节点的交易池中的交易发起共识提议。In a fifth aspect, an electronic device is provided, comprising: a memory, a processor, and a computer program stored on the memory and executable on the processor, the computer program being executed by the processor: View switching operation; if the view switching operation makes the consensus node act as a consensus backup node, the transaction in the transaction pool of the consensus node is sent to the consensus master node of the blockchain; if the view switching operation The operation makes the consensus node act as the consensus master node, and then receives the transaction sent by the consensus backup node of the blockchain and the blockchain client; if the view switching operation makes the consensus node serve as the consensus master node, the The validity of the transaction received by the receiving module is verified, and the verified transaction is stored in the transaction pool of the consensus node; if the view switching operation makes the consensus node act as the consensus master node, based on the consensus Transactions in the node's transaction pool initiate consensus proposals.
第六方面,提供一种算机可读存储介质,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现如下步骤:执行共识节点的视图切换操作;若所述视图切换操作使所述共识节点作为共识备份节点,则将所述共识节点的交易池中的交易定向发送至所述区块链的共识主节点;若所述视图切换操作使所述共识节点作为共识主节点,则接收所述区块链的共识备份节点及区块链客户端发送的交易;若所述视图切换操作使所述共识节点作为共识主节点,则对所述接收模块接收到的交易进行合法性验证,并将验证通过的交易存入所述共识节点的交易池;若所述视图切换操作使所述共识节点作为共识主节点,则基于所述共识节点的交易池中的交易发起共识提议。In a sixth aspect, a computer-readable storage medium is provided, a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the following steps are implemented: performing a view switching operation of a consensus node; If the view switching operation makes the consensus node act as a consensus backup node, then the transactions in the transaction pool of the consensus node are directed to the consensus master node of the blockchain; if the view switching operation makes the consensus node As the consensus master node, it receives the transaction sent by the consensus backup node of the blockchain and the blockchain client; if the view switching operation makes the consensus node as the consensus master node, the receiving module receives Verify the validity of the transaction, and store the verified transaction into the transaction pool of the consensus node; if the view switching operation makes the consensus node act as the consensus master node, the transaction pool based on the consensus node Transactions initiate consensus proposals.
对于共识节点主备区别的共识机制中,区块链只有共识主节点能够针对交易发起共 识提议。基于本说明书实施例的方法,区块链的共识备份节点只向共识主节点定向同步交易,可以有效节省带宽开销。后续如果区块链更换共识主节点,则共识备份节点再重新向新的共识主节点同步交易。此外,定向的同步方式还可以有效减少交易的冗余发送,从而改善带宽资源浪费的问题,可避免区块链系统因带宽占用过高而导致共识算力下降的问题发生。In the consensus mechanism that distinguishes between master and slave of consensus nodes, only the master node of the blockchain can initiate consensus proposals for transactions. Based on the method of the embodiment of this specification, the consensus backup node of the blockchain only directs synchronous transactions to the consensus master node, which can effectively save bandwidth overhead. Subsequently, if the blockchain changes the consensus master node, the consensus backup node will re-synchronize the transaction with the new consensus master node. In addition, the directional synchronization method can also effectively reduce the redundant transmission of transactions, thereby improving the problem of wasting bandwidth resources, and avoiding the problem of the reduction of consensus computing power in the blockchain system due to excessive bandwidth usage.
附图说明Description of drawings
为了更清楚地说明本说明书实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本说明书实施例中记载的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present specification or the prior art, the following briefly introduces the accompanying drawings required in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only These are some of the embodiments described in the embodiments of this specification. For those of ordinary skill in the art, other drawings can also be obtained based on these drawings without any creative effort.
图1为本说明书实施例提供的区块链的共识方法的第一种流程示意图。FIG. 1 is a schematic flowchart of a first type of consensus method of a blockchain provided by an embodiment of this specification.
图2为本说明书实施例提供的区块链的共识方法的第二种流程示意图。FIG. 2 is a schematic flowchart of a second block chain consensus method provided by an embodiment of the present specification.
图3为本说明书实施例提供的共识节点的结构示意图。FIG. 3 is a schematic structural diagram of a consensus node provided by an embodiment of the present specification.
图4为本说明书实施例提供的电子设备的结构示意图。FIG. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present specification.
具体实施方式Detailed ways
为了使本技术领域的人员更好地理解本说明书中的技术方案,下面将结合本说明书实施例中的附图,对本说明书实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本说明书一部分实施例,而不是全部的实施例。基于本说明书中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都应当属于本说明书保护的范围。In order to make those skilled in the art better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings in the embodiments of this specification. Obviously, the described The embodiments are only some of the embodiments of the present specification, but not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by persons of ordinary skill in the art without creative efforts shall fall within the protection scope of this specification.
如前所述,目前区块链的共识节点之间是通过广播方式将本节点交易池中的全量交易同步给其他共识节点。而这种广播的同步方式会导致交易被冗余发送,从而造成带宽资源的浪费。As mentioned above, the current consensus nodes of the blockchain synchronize all transactions in the transaction pool of this node to other consensus nodes through broadcasting. This broadcast synchronization method will cause transactions to be sent redundantly, resulting in a waste of bandwidth resources.
比如,共识节点A的交易池有交易1、2,共识节点B的交易池有交易2、3,共识节点C的交易池有交易4。在不考虑新交易添加以及旧交易移除的情况下,经第一轮交易同步后,共识节点A向共识节点B、C广播交易1、2,共识节点B向共识节点A、C广播交易2、3,共识节点C向共识节点A、B广播交易4。其中可以看出,第一轮同步 造成交易2的冗余发送。For example, the transaction pool of consensus node A has transactions 1 and 2, the transaction pool of consensus node B has transactions 2 and 3, and the transaction pool of consensus node C has transaction 4. Without considering the addition of new transactions and the removal of old transactions, after the first round of transaction synchronization, consensus node A broadcasts transactions 1 and 2 to consensus nodes B and C, and consensus node B broadcasts transaction 2 to consensus nodes A and C. , 3, consensus node C broadcasts transaction 4 to consensus nodes A and B. It can be seen that the first round of synchronization results in redundant sending of transaction 2.
由于经第一轮同步后,共识节点A、B、C各自的交易池均存储了交易1、2、3、4。因此在进行第二轮同步时,共识节点A、B、C会将各自交易池中的交易1、2、3、4全部进行冗余发送。After the first round of synchronization, the transaction pools of consensus nodes A, B, and C all store transactions 1, 2, 3, and 4. Therefore, during the second round of synchronization, consensus nodes A, B, and C will redundantly send all transactions 1, 2, 3, and 4 in their respective transaction pools.
可以看出,在传统的交易同步方式下,共识节点规模越多、交易数据越庞大,则带宽资源浪费的现象就越严重,从而导致区块链的共识算力大幅下降,最终影响到区块链业务的执行效率。It can be seen that under the traditional transaction synchronization method, the larger the scale of consensus nodes and the larger the transaction data, the more serious the waste of bandwidth resources will be, which will lead to a significant decrease in the consensus computing power of the blockchain, which will eventually affect the block chain. Execution efficiency of chain business.
为此,本文旨在提出一种能够改善共识节点之间同步交易所造成的带宽资源浪费的技术方案。To this end, this paper aims to propose a technical solution that can improve the waste of bandwidth resources caused by synchronous transactions between consensus nodes.
图1是本说明书实施例区块链的共识方法的流程图。图1所示的方法可以由下文相对应的硬件执行,包括如下步骤:S102,区块链的目标共识节点执行视图切换操作,其中,目标共识节点在执行视图切换操作后为共识备份节点。FIG. 1 is a flowchart of the consensus method of the blockchain according to the embodiment of this specification. The method shown in FIG. 1 can be performed by the corresponding hardware below, including the following steps: S102 , the target consensus node of the blockchain performs a view switching operation, wherein the target consensus node is a consensus backup node after performing the view switching operation.
应理解,区块链的各共识节点对应有视图编号。区块链一般会基于一定规则(比如轮询)定期切换视图,对应到共识节点就是执行视图切换操作。对于目标共识节点来讲,若区块链切换到本节点视图编号所对应的视图,则作为共识主节点,否则作为共识备份节点。基于这种视图切换机制,可以让区块链的各共识节点都有一定机会成为共识主节点以发起共识提议(共识备份节点无法发起共识提议),从而实现一定程度的去中心化。It should be understood that each consensus node of the blockchain corresponds to a view number. The blockchain generally switches views periodically based on certain rules (such as polling), and the corresponding consensus node is to perform the view switching operation. For the target consensus node, if the blockchain switches to the view corresponding to the view number of this node, it will be the consensus master node, otherwise it will be the consensus backup node. Based on this view switching mechanism, each consensus node of the blockchain can have a certain chance to become the consensus master node to initiate consensus proposals (consensus backup nodes cannot initiate consensus proposals), thereby achieving a certain degree of decentralization.
S104,目标共识节点将本节点的交易池中的交易定向发送至区块链的共识主节点。S104, the target consensus node sends the transactions in the transaction pool of the node to the consensus master node of the blockchain.
应理解,本说明书实施例方案中,目标共识节点将本节点的交易池中的交易定向发送至区块链的共识主节点可以表示:共识备份节点只向共识主节点同步交易,也就是任意共识备份节点不会通过其他共识备份节点向本节点交易池中添加新的交易。It should be understood that, in the solution of the embodiment of this specification, the target consensus node sends the transactions in the transaction pool of this node to the consensus master node of the blockchain in a direction, which can mean that the consensus backup node only synchronizes transactions with the consensus master node, that is, any consensus The backup node will not add new transactions to the transaction pool of this node through other consensus backup nodes.
这里,目标共识节点在作为共识备份节点时,可以获取区块链客户端所发起的新的交易,并将新的交易加至本节点的交易池中。在此基础上,为实现更小的带宽开销,作为可以但非必须的方案,目标共识节点在作为共识备份节点时,只会将区块链客户端发起的交易添加至本节点的交易池中,也就是只占用带宽资源接收直接来自区块链客户端发送的交易。当然,目标共识节点也可以不拒绝通过其他方式所接收的交易,但不进行处理。Here, when the target consensus node acts as a consensus backup node, it can obtain new transactions initiated by the blockchain client and add the new transactions to the transaction pool of this node. On this basis, in order to achieve a smaller bandwidth overhead, as a possible but not necessary solution, when the target consensus node acts as a consensus backup node, it will only add transactions initiated by the blockchain client to the transaction pool of this node. , that is, only using bandwidth resources to receive transactions sent directly from the blockchain client. Of course, the target consensus node may also not reject transactions received by other means, but not process them.
S106,区块链的共识主节点对接收到的交易进行合法性验证,并将验证通过的交易存入本节点的交易池。S106, the consensus master node of the blockchain verifies the validity of the received transaction, and stores the verified transaction into the transaction pool of this node.
其中,本步骤的合法性验证可以是指已有区块链共识节点在向交易池添加交易前所需执行的验证。由于本说明书实施例未涉及该方面的改进,因此不再具体赘述。Wherein, the legality verification in this step may refer to the verification that an existing blockchain consensus node needs to perform before adding a transaction to the transaction pool. Since the embodiments of this specification do not involve improvements in this aspect, detailed descriptions are therefore omitted.
S108,共识主节点基于本节点的交易池中的交易发起共识提议。S108, the consensus master node initiates a consensus proposal based on the transactions in the transaction pool of this node.
本步骤中,共识主节点会从本节点的交易池中选取至少一部分交易发起共识提议,这里被选取发起共识提供的交易可能会包含有目标节点所提供的交易。其中,达成共识的交易则会被各共识节点生成区块以进行保存,从而实现交易数据的上链。In this step, the consensus master node will select at least a part of the transactions from the transaction pool of this node to initiate a consensus proposal, and the transactions selected to initiate consensus here may include transactions provided by the target node. Among them, the consensus transaction will be generated by each consensus node to save the block, so as to realize the on-chain transaction data.
应理解,对于共识节点主备区别的共识机制中,区块链只有共识主节点能够针对交易发起共识提议。基于本说明书实施例的方法,区块链的共识备份节点只向共识主节点定向同步交易,可以有效节省带宽开销。后续如果区块链更换共识主节点,则共识备份节点再重新向新的共识主节点同步交易。此外,定向的同步方式还可以有效减少交易的冗余发送,从而改善带宽资源浪费的问题,可避免区块链系统因带宽占用过高而导致共识算力下降的问题发生。It should be understood that in the consensus mechanism of the distinction between the master and the standby of the consensus nodes, only the consensus master node of the blockchain can initiate a consensus proposal for a transaction. Based on the method of the embodiment of this specification, the consensus backup node of the blockchain only directs synchronous transactions to the consensus master node, which can effectively save bandwidth overhead. Subsequently, if the blockchain changes the consensus master node, the consensus backup node will re-synchronize the transaction with the new consensus master node. In addition, the directional synchronization method can also effectively reduce the redundant transmission of transactions, thereby improving the problem of wasting bandwidth resources, and avoiding the problem of the reduction of consensus computing power in the blockchain system due to excessive bandwidth usage.
具体地,本说明实施例中,目标共识节点为共识备份节点时,可以对本节点的交易池中已向区块链的共识主节点发送的交易进行标记。对应地,在上述S104中,目标共识节点将本节点的交易池中未被标记的交易定向发送至区块链的共识主节点。也就是说,如果区块链未切换视图更换共识主节点,目标共识节点(共识备份节点)不会向共识主节点同步重复的交易。Specifically, in this illustrative embodiment, when the target consensus node is a consensus backup node, the transaction that has been sent to the consensus master node of the blockchain in the transaction pool of the node can be marked. Correspondingly, in the above S104, the target consensus node sends the unmarked transactions in the transaction pool of the node to the consensus master node of the blockchain. That is, if the blockchain does not switch views to replace the consensus master node, the target consensus node (consensus backup node) will not synchronize duplicate transactions with the consensus master node.
此外,在上述基础之上,目标共识节点在执行视图切换操作后,还可以清除本节点的交易池中交易的标记。应理解,区块链切换视图后会更换新的共识主节点,目标共识节点清除标记后再执行上述S104时,可以向新共识主节点发送原先向旧共识主节点发送但未向新共识主节点发送的交易。In addition, on the basis of the above, after the target consensus node performs the view switching operation, it can also clear the transaction mark in the transaction pool of this node. It should be understood that the new consensus master node will be replaced after the blockchain view is switched. When the target consensus node clears the mark and then executes the above S104, the new consensus master node can send the original message to the old consensus master node but not to the new consensus master node. transaction sent.
下面对本说明书实施例的共识方法进行详细介绍。The consensus method in the embodiments of the present specification will be described in detail below.
在本说明书实施例的共识方法中,目标共识节点交易池中的交易主要分为两类。一类是目标共识节点自身节点的交易,是区块链客户端入目标共识节点后,直接向目标共识节点发起的交易;另一类是其他共识节点的交易,是其他区块链客户端接入其他共识节点后所发起的交易,需要在目标节点作为共识主节点后,经过其他共识节点(共识备份节点)进行同步。In the consensus method of the embodiment of this specification, the transactions in the target consensus node transaction pool are mainly divided into two categories. One is the transaction of the target consensus node's own node, which is the transaction initiated by the blockchain client directly to the target consensus node after entering the target consensus node; the other is the transaction of other consensus nodes, which is connected by other blockchain clients. Transactions initiated after entering other consensus nodes need to be synchronized through other consensus nodes (consensus backup nodes) after the target node acts as the consensus master node.
其中,以目标共识节点初始为共识备份节点为实例,执行共识方法的流程如图2所示,包括:目标共识节点将本节点的交易池中属于自己的交易发送至区块链当前的共识 主节点。这里,目标共识节点忽视本节点交易池中属于其他共识节点的交易。Among them, taking the target consensus node initially as the consensus backup node as an example, the process of executing the consensus method is shown in Figure 2, including: the target consensus node sends its own transactions in the transaction pool of this node to the current consensus master of the blockchain node. Here, the target consensus node ignores transactions belonging to other consensus nodes in the node's transaction pool.
同时,目标共识节点也接收区块链客户端发起的新交易,并对区块链客户端发起的新交易进行合法性验证,如果验证通过,则添加至目标共识节点的交易池中。这里,目标共识节点添加区块链客户端发起的新交易属于完全独立的流程,并不受其他步骤以及主备之分的限制。At the same time, the target consensus node also receives the new transaction initiated by the blockchain client, and verifies the validity of the new transaction initiated by the blockchain client. If the verification passes, it will be added to the transaction pool of the target consensus node. Here, the target consensus node adds a new transaction initiated by the blockchain client, which is a completely independent process, and is not restricted by other steps and the distinction between master and backup.
之后,区块链切换视图发起换主,目标共识节点执行视图切换操作。After that, the blockchain switch view initiates a master change, and the target consensus node performs the view switch operation.
如果目标共识节点在执行视图切换操作后依然为共识备份节点,则将本节点的交易池中所有属于自己的交易发送至区块链新的共识主节点,发送交易包括:之前向上一轮共识主节点发送交易,以及,此外通过区块链客户端向本节点交易池所添加的新交易。If the target consensus node is still the consensus backup node after performing the view switching operation, it will send all its own transactions in the transaction pool of this node to the new consensus master node of the blockchain, and the sent transactions include: the previous round of consensus master nodes. The node sends transactions, and, in addition, new transactions are added to the node's transaction pool via the blockchain client.
如果目标共识节点在执行视图切换操作后为共识主节点,则接收共识备份节点及区块链客户端发送的交易,并对接收到的交易进行合法性验证,并将验证通过的交易存入本节点的交易池。If the target consensus node is the consensus master node after performing the view switching operation, it will receive the transaction sent by the consensus backup node and the blockchain client, verify the validity of the received transaction, and store the verified transaction in this The node's transaction pool.
之后,如果触发共识执行条件,目标共识节点基于本节点的交易池中的交易发起共识提议。这里,被发起共识提议的交易不限于来源,可以是目标共识节点和其他共识节点的交易。After that, if the consensus execution condition is triggered, the target consensus node initiates a consensus proposal based on the transactions in the transaction pool of this node. Here, the transaction initiated by the consensus proposal is not limited to the source, but can be the transaction of the target consensus node and other consensus nodes.
显然基于本说明书实施例定向的同步方式,共识备份节点根据共识主节点是否切换来选择是否将存量的交易发送给新的共识主节点,即减少了网络带宽的使用,又保证了交易被打包成功率。对区块链的吞吐量实现了线性的提升。Obviously, based on the directional synchronization method of the embodiment of this specification, the consensus backup node selects whether to send the existing transaction to the new consensus master node according to whether the consensus master node switches, which not only reduces the use of network bandwidth, but also ensures that the transaction is packaged successfully. Rate. A linear increase in the throughput of the blockchain is achieved.
以上对本发明实施例方法的示例性介绍。在不脱离本文上述原理基础之上,还可以进行适当的变化,这些变化也应视为本发明实施例的保护范围。The above is an exemplary introduction to the method of the embodiment of the present invention. Appropriate changes may also be made without departing from the above-mentioned principles herein, and these changes should also be regarded as the protection scope of the embodiments of the present invention.
此外,还应理解的是,在本说明书实施例的方法中,若目标共识节在执行视图切换操作后为共识备份节点,则执行以下步骤:将本节点的交易池中的交易发送至所述区块链的共识主节点,使得区块链的共识主节点对接收到的交易进行合法性验证,并将验证通过的交易存入本节点的交易池,从而基于本节点的交易池中的交易发起共识提议。In addition, it should also be understood that, in the method of the embodiment of this specification, if the target consensus node is a consensus backup node after the view switching operation is performed, the following steps are performed: send the transaction in the transaction pool of this node to the The consensus master node of the blockchain enables the consensus master node of the blockchain to verify the validity of the received transactions, and store the verified transactions into the transaction pool of this node, so as to be based on the transactions in the transaction pool of this node. Initiate a consensus proposal.
对应地,若目标共识节在执行视图切换操作后为共识主节点,则执行以下步骤:接收所述区块链的共识备份节点及区块链客户端发送的交易;对接收到的交易进行合法性验证,并将验证通过的交易存入本节点的交易池;基于本节点的交易池中的交易发起共识提议。Correspondingly, if the target consensus node is the consensus master node after the view switching operation is performed, the following steps are performed: receiving the transaction sent by the consensus backup node of the blockchain and the blockchain client; validating the received transaction. Validation is performed, and the verified transactions are stored in the transaction pool of this node; consensus proposals are initiated based on transactions in the transaction pool of this node.
此外,对应于图1所示的共识方法,本发明实施例还提供一种区块链的共识节点。图3是本发明实施例共识节点300的结构示意图,包括:视图切换模块310,执行共识节点的视图切换操作。In addition, corresponding to the consensus method shown in FIG. 1 , an embodiment of the present invention further provides a consensus node of a blockchain. FIG. 3 is a schematic structural diagram of a consensus node 300 according to an embodiment of the present invention, including: a view switching module 310, which performs a view switching operation of the consensus node.
发送模块320,若所述视图切换操作使所述共识节点作为共识备份节点,则将所述共识节点的交易池中的交易定向发送至所述区块链的共识主节点。The sending module 320 sends the transactions in the transaction pool of the consensus node to the consensus master node of the blockchain, if the view switching operation makes the consensus node act as a consensus backup node.
接收模块330,若所述视图切换操作使所述共识节点作为共识主节点,则接收所述区块链的共识备份节点及区块链客户端发送的交易。The receiving module 330, if the view switching operation makes the consensus node act as the consensus master node, receives the transaction sent by the consensus backup node of the blockchain and the blockchain client.
同步模块340,若所述视图切换操作使所述共识节点作为共识主节点,则对所述接收模块接收到的交易进行合法性验证,并将验证通过的交易存入所述共识节点的交易池。The synchronization module 340 , if the view switching operation makes the consensus node act as the consensus master node, verify the validity of the transaction received by the receiving module, and store the verified transaction into the transaction pool of the consensus node .
共识模块350,若所述视图切换操作使所述共识节点作为共识主节点,则基于所述共识节点的交易池中的交易发起共识提议。The consensus module 350, if the view switching operation makes the consensus node act as the consensus master node, initiates a consensus proposal based on transactions in the transaction pool of the consensus node.
对于共识节点主备区别的共识机制中,区块链只有共识主节点能够针对交易发起共识提议。本说明书实施例的共识节点在执行视图切换操作后,若为共识备份节点,则只向共识主节点定向同步交易,从而有效节省带宽开销。后续如果区块链更换共识主节点,则再重新向新的共识主节点同步交易。此外,定向的同步方式还可以有效减少交易的冗余发送,从而改善带宽资源浪费的问题,可避免区块链系统因带宽占用过高而导致共识算力下降的问题发生。In the consensus mechanism that distinguishes between master and slave of consensus nodes, only the master node of the blockchain can initiate consensus proposals for transactions. After the consensus node in the embodiment of this specification performs the view switching operation, if it is a consensus backup node, it will only direct synchronous transactions to the consensus master node, thereby effectively saving bandwidth overhead. Subsequently, if the blockchain changes the consensus master node, it will re-synchronize the transaction to the new consensus master node. In addition, the directional synchronization method can also effectively reduce the redundant transmission of transactions, thereby improving the problem of wasting bandwidth resources, and avoiding the problem of the reduction of consensus computing power in the blockchain system due to excessive bandwidth usage.
可选地,发送模块320只将所述共识节点的交易池中直接从区块链客户端获取到的交易定向发送至所述区块链的共识主节点。Optionally, the sending module 320 only sends the transactions directly obtained from the blockchain client in the transaction pool of the consensus node to the consensus master node of the blockchain.
可选地,发送模块320在所述共识节点作为共识备份节点时,对所述共识节点的交易池中已向所述区块链的共识主节点发送的交易进行标记,并将本节点的交易池中未被标记的交易定向发送至所述区块链的共识主节点。Optionally, when the consensus node acts as a consensus backup node, the sending module 320 marks the transactions that have been sent to the consensus master node of the blockchain in the transaction pool of the consensus node, and sends the transaction of the node to the transaction pool. Unmarked transactions in the pool are directed to the consensus master node of the blockchain.
在上述基础之上,发送模块320还可以在视图切换模块310每执行完成视图切换操作后,清除所述共识节点的交易池中交易的标记。On the basis of the above, the sending module 320 may also clear the transaction flag in the transaction pool of the consensus node after the view switching module 310 completes the view switching operation.
可选地,所述同步模块340在所述共识节点作为共识备份节点时,只将区块链客户端所发起的交易添加至本节点的交易池中。Optionally, when the consensus node acts as a consensus backup node, the synchronization module 340 only adds transactions initiated by the blockchain client to the transaction pool of the node.
显然,本说明书实施例的共识节点可以作为上述图1所示的共识方法的执行主体,因此能够实现共识方法在图1和图2所实现的功能。由于原理相同,本文不再赘述。Obviously, the consensus node in the embodiment of this specification can be used as the execution body of the consensus method shown in FIG. 1 above, and thus can realize the functions implemented by the consensus method in FIG. 1 and FIG. 2 . Since the principle is the same, this article will not repeat them.
图4是本说明书的一个实施例电子设备的结构示意图。请参考图4,在硬件层面,该电子设备包括处理器,可选地还包括内部总线、网络接口、存储器。其中,存储器可能包含内存,例如高速随机存取存储器(Random-Access Memory,RAM),也可能还包括非易失性存储器(non-volatile memory),例如至少1个磁盘存储器等。当然,该电子设备还可能包括其他业务所需要的硬件。FIG. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present specification. Referring to FIG. 4 , at the hardware level, the electronic device includes a processor, and optionally an internal bus, a network interface, and a memory. The memory may include memory, such as high-speed random-access memory (Random-Access Memory, RAM), or may also include non-volatile memory (non-volatile memory), such as at least one disk memory. Of course, the electronic equipment may also include hardware required for other services.
处理器、网络接口和存储器可以通过内部总线相互连接,该内部总线可以是ISA(Industry Standard Architecture,工业标准体系结构)总线、PCI(Peripheral Component Interconnect,外设部件互连标准)总线或EISA(Extended Industry Standard Architecture,扩展工业标准结构)总线等。所述总线可以分为地址总线、数据总线、控制总线等。为便于表示,图4中仅用一个双向箭头表示,但并不表示仅有一根总线或一种类型的总线。The processor, network interface and memory can be connected to each other through an internal bus, which can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect, peripheral component interconnect standard) bus or an EISA (Extended Component Interconnect) bus. Industry Standard Architecture, extended industry standard structure) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, and the like. For ease of presentation, only one bidirectional arrow is used in FIG. 4, but it does not mean that there is only one bus or one type of bus.
存储器,用于存放程序。具体地,程序可以包括程序代码,所述程序代码包括计算机操作指令。存储器可以包括内存和非易失性存储器,并向处理器提供指令和数据。memory for storing programs. Specifically, the program may include program code, and the program code includes computer operation instructions. The memory may include memory and non-volatile memory and provide instructions and data to the processor.
处理器从非易失性存储器中读取对应的计算机程序到内存中然后运行,在逻辑层面上形成共识装置,该共识装置可以是共识节点或者共识节点中的部件。处理器,执行存储器所存放的程序,并具体用于执行以下操作:执行共识节点的视图切换操作。The processor reads the corresponding computer program from the non-volatile memory into the memory and runs it, forming a consensus device at the logical level, and the consensus device can be a consensus node or a component in a consensus node. The processor executes the program stored in the memory, and is specifically configured to perform the following operations: perform the view switching operation of the consensus node.
若所述视图切换操作使所述共识节点作为共识备份节点,则将所述共识节点的交易池中的交易定向发送至所述区块链的共识主节点。If the view switching operation makes the consensus node serve as a consensus backup node, the transactions in the transaction pool of the consensus node are directed to the consensus master node of the blockchain.
若所述视图切换操作使所述共识节点作为共识主节点,则接收所述区块链的共识备份节点及区块链客户端发送的交易。If the view switching operation makes the consensus node act as the consensus master node, then receive the transaction sent by the consensus backup node of the blockchain and the blockchain client.
若所述视图切换操作使所述共识节点作为共识主节点,则对所述接收模块接收到的交易进行合法性验证,并将验证通过的交易存入所述共识节点的交易池。If the view switching operation makes the consensus node act as the consensus master node, the validity of the transaction received by the receiving module is verified, and the verified transaction is stored in the transaction pool of the consensus node.
若所述视图切换操作使所述共识节点作为共识主节点,则基于所述共识节点的交易池中的交易发起共识提议。If the view switching operation makes the consensus node act as the consensus master node, a consensus proposal is initiated based on transactions in the transaction pool of the consensus node.
对于共识节点主备区别的共识机制中,区块链只有共识主节点能够针对交易发起共识提议。基于本说明书实施例的电子设备,区块链的共识备份节点只向共识主节点定向同步交易,可以有效节省带宽开销。后续如果区块链更换共识主节点,则共识备份节点再重新向新的共识主节点同步交易。此外,定向的同步方式还可以有效减少交易的冗余发送,从而改善带宽资源浪费的问题,可避免区块链系统因带宽占用过高而导致共识算力下降的问题发生。In the consensus mechanism that distinguishes between master and slave of consensus nodes, only the master node of the blockchain can initiate consensus proposals for transactions. Based on the electronic device of the embodiment of this specification, the consensus backup node of the blockchain only directs synchronous transactions to the consensus master node, which can effectively save bandwidth overhead. Subsequently, if the blockchain changes the consensus master node, the consensus backup node will re-synchronize the transaction with the new consensus master node. In addition, the directional synchronization method can also effectively reduce the redundant transmission of transactions, thereby improving the problem of wasting bandwidth resources, and avoiding the problem of the reduction of consensus computing power in the blockchain system due to excessive bandwidth usage.
上述如本说明书图1所示实施例揭示的共识方法可以应用于处理器中,或者由处理器实现。处理器可能是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法的各步骤可以通过处理器中的硬件的集成逻辑电路或者软件形式的指令完成。上述的处理器可以是通用处理器,包括中央处理器(Central Processing Unit,CPU)、网络处理器(Network Processor,NP)等;还可以是数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。可以实现或者执行本说明书实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本说明书实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器,处理器读取存储器中的信息,结合其硬件完成上述方法的步骤。The above consensus method disclosed in the embodiment shown in FIG. 1 of this specification may be applied to a processor, or implemented by a processor. A processor may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above-mentioned method can be completed by a hardware integrated logic circuit 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), 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. Various methods, steps and logic block diagrams disclosed in the embodiments of this specification can be implemented or executed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the methods disclosed in conjunction with the embodiments of this specification may be directly embodied as being executed by a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules may be located in random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, registers and other storage media mature in the art. 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.
应理解,本说明书实施例的电子设备可以实现上述共识方法在图1和图2所示的实施例的功能。由于原理相同,本文不再赘述。It should be understood that the electronic device in the embodiments of the present specification can implement the functions of the above consensus method in the embodiments shown in FIG. 1 and FIG. 2 . Since the principle is the same, this article will not repeat them.
当然,除了软件实现方式之外,本说明书的电子设备并不排除其他实现方式,比如逻辑器件抑或软硬件结合的方式等等,也就是说以下处理流程的执行主体并不限定于各个逻辑单元,也可以是硬件或逻辑器件。Of course, in addition to software implementations, the electronic devices in this specification do not exclude other implementations, such as logic devices or the combination of software and hardware, etc. That is to say, the execution subjects of the following processing procedures are not limited to each logic unit. It can also be a hardware or logic device.
此外,本说明书实施例还提出了一种计算机可读存储介质,该计算机可读存储介质存储一个或多个程序,该一个或多个程序包括指令,该指令当被包括多个应用程序的便携式电子设备执行时,能够使该便携式电子设备执行图1所示实施例的方法,并具体用于执行以下步骤:执行共识节点的视图切换操作。In addition, the embodiments of this specification also provide a computer-readable storage medium, where the computer-readable storage medium stores one or more programs, and the one or more programs include instructions, and the instructions, when stored in a portable computer including multiple application programs When executed by the electronic device, the portable electronic device can be made to execute the method of the embodiment shown in FIG. 1 , and is specifically configured to execute the following steps: execute the view switching operation of the consensus node.
若所述视图切换操作使所述共识节点作为共识备份节点,则将所述共识节点的交易池中的交易定向发送至所述区块链的共识主节点。If the view switching operation makes the consensus node serve as a consensus backup node, the transactions in the transaction pool of the consensus node are directed to the consensus master node of the blockchain.
若所述视图切换操作使所述共识节点作为共识主节点,则接收所述区块链的共识备份节点及区块链客户端发送的交易。If the view switching operation makes the consensus node act as the consensus master node, then receive the transaction sent by the consensus backup node of the blockchain and the blockchain client.
若所述视图切换操作使所述共识节点作为共识主节点,则对所述接收模块接收到的交易进行合法性验证,并将验证通过的交易存入所述共识节点的交易池。If the view switching operation makes the consensus node act as the consensus master node, the validity of the transaction received by the receiving module is verified, and the verified transaction is stored in the transaction pool of the consensus node.
若所述视图切换操作使所述共识节点作为共识主节点,则基于所述共识节点的交易池中的交易发起共识提议。If the view switching operation makes the consensus node act as the consensus master node, a consensus proposal is initiated based on transactions in the transaction pool of the consensus node.
本领域技术人员应明白,本说明书的实施例可提供为方法、系统或计算机程序产品。因此,本说明书可采用完全硬件实施例、完全软件实施例或结合软件和硬件方面的实施例的形式。而且,本说明书可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。As will be appreciated by one skilled in the art, the embodiments of the present specification may be provided as a method, a system or a computer program product. Accordingly, this description may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present specification may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
上述对本说明书特定实施例进行了描述。其它实施例在所附权利要求书的范围内。在一些情况下,在权利要求书中记载的动作或步骤可以按照不同于实施例中的顺序来执行并且仍然可以实现期望的结果。另外,在附图中描绘的过程不一定要求示出的特定顺序或者连续顺序才能实现期望的结果。在某些实施方式中,多任务处理和并行处理也是可以的或者可能是有利的。The foregoing describes specific embodiments of the present specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in an order different from that in the embodiments and still achieve desirable results. Additionally, the processes depicted in the figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
以上仅为本说明书的实施例而已,并不用于限制本说明书。对于本领域技术人员来说,本说明书可以有各种更改和变化。凡在本说明书的精神和原理之内所作的任何修改、等同替换、改进等,均应包含在本说明书的权利要求范围之内。此外,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都应当属于本文件的保护范围。The above are merely examples of the present specification, and are not intended to limit the present specification. Various modifications and variations of this specification are possible for those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this specification shall be included within the scope of the claims of this specification. In addition, all other embodiments obtained by persons of ordinary skill in the art without creative efforts shall fall within the protection scope of this document.

Claims (10)

  1. 一种区块链的共识方法,包括:A consensus method for blockchain, including:
    区块链的目标共识节点执行视图切换操作,其中,所述目标共识节点在执行视图切换操作后为共识备份节点;The target consensus node of the blockchain performs a view switching operation, wherein the target consensus node is a consensus backup node after performing the view switching operation;
    所述目标共识节点将本节点的交易池中的交易定向发送至所述区块链的共识主节点;The target consensus node sends the transactions in the transaction pool of this node to the consensus master node of the blockchain;
    所述区块链的共识主节点对接收到的交易进行合法性验证,并将验证通过的交易存入本节点的交易池;The consensus master node of the blockchain verifies the validity of the received transaction, and stores the verified transaction into the transaction pool of this node;
    共识主节点基于本节点的交易池中的交易发起共识提议。The consensus master node initiates a consensus proposal based on the transactions in the transaction pool of this node.
  2. 根据权利要求1所述的方法,The method of claim 1,
    目标共识节点将本节点的交易池中的交易定向发送至所述区块链的共识主节点,包括:The target consensus node sends the transactions in the transaction pool of this node to the consensus master node of the blockchain, including:
    目标共识节点只将本节点的交易池中直接从区块链客户端获取到的交易定向发送至所述区块链的共识主节点。The target consensus node only sends the transactions directly obtained from the blockchain client in the transaction pool of this node to the consensus master node of the blockchain.
  3. 根据权利要求1所述的方法,还包括:The method of claim 1, further comprising:
    在所述目标共识节点为共识备份节点时,对本节点的交易池中已向所述区块链的共识主节点发送的交易进行标记;When the target consensus node is a consensus backup node, mark the transaction that has been sent to the consensus master node of the blockchain in the transaction pool of the node;
    所述目标共识节点将本节点的交易池中的交易定向发送至所述区块链的共识主节点,包括:The target consensus node sends the transactions in the transaction pool of this node to the consensus master node of the blockchain, including:
    所述目标共识节点将本节点的交易池中未被标记的交易定向发送至所述区块链的共识主节点。The target consensus node sends the unmarked transactions in the transaction pool of the node to the consensus master node of the blockchain.
  4. 根据权利要求3所述的方法,还包括:The method of claim 3, further comprising:
    所述目标共识节点在执行视图切换操作后,清除本节点的交易池中交易的标记。After the target consensus node performs the view switching operation, it clears the transaction mark in the transaction pool of the node.
  5. 根据权利要求1所述的方法,还包括:The method of claim 1, further comprising:
    所述目标共识节点在作为共识备份节点时,只将区块链客户端所发起的交易添加至本节点的交易池中。When the target consensus node acts as a consensus backup node, only the transactions initiated by the blockchain client are added to the transaction pool of this node.
  6. 一种区块链的共识方法,包括:A consensus method for blockchain, including:
    区块链的目标共识节点执行视图切换操作,其中,所述目标共识节点在执行视图切换操作后为共识备份节点;The target consensus node of the blockchain performs a view switching operation, wherein the target consensus node is a consensus backup node after performing the view switching operation;
    所述目标共识节点将本节点的交易池中的交易发送至所述区块链的共识主节点,使得所述区块链的共识主节点对接收到的交易进行合法性验证,并将验证通过的交易存入 本节点的交易池,从而基于本节点的交易池中的交易发起共识提议。The target consensus node sends the transaction in the transaction pool of the node to the consensus master node of the blockchain, so that the consensus master node of the blockchain verifies the validity of the received transaction and passes the verification The transactions of this node are stored in the transaction pool of this node, so as to initiate a consensus proposal based on the transactions in the transaction pool of this node.
  7. 一种区块链的共识方法,包括:A consensus method for blockchain, including:
    区块链的目标共识节点执行视图切换操作,其中,所述目标共识节点在执行视图切换操作后为共识主节点;The target consensus node of the blockchain performs a view switching operation, wherein the target consensus node is the consensus master node after performing the view switching operation;
    所述目标共识节点接收所述区块链的共识备份节点及区块链客户端发送的交易;The target consensus node receives the transaction sent by the consensus backup node of the blockchain and the blockchain client;
    所述目标共识节点对接收到的交易进行合法性验证,并将验证通过的交易存入本节点的交易池;The target consensus node verifies the validity of the received transaction, and stores the verified transaction into the transaction pool of the node;
    所述目标共识节点基于本节点的交易池中的交易发起共识提议。The target consensus node initiates a consensus proposal based on transactions in the transaction pool of the node.
  8. 一种区块链的共识节点,包括:A consensus node of a blockchain, including:
    视图切换模块,执行共识节点的视图切换操作;The view switching module, which performs the view switching operation of the consensus node;
    发送模块,若所述视图切换操作使所述共识节点作为共识备份节点,则将所述共识节点的交易池中的交易定向发送至所述区块链的共识主节点;A sending module, if the view switching operation makes the consensus node serve as a consensus backup node, then directionally sends the transactions in the transaction pool of the consensus node to the consensus master node of the blockchain;
    接收模块,若所述视图切换操作使所述共识节点作为共识主节点,则接收所述区块链的共识备份节点及区块链客户端发送的交易;The receiving module, if the view switching operation makes the consensus node act as the consensus master node, then receives the transaction sent by the consensus backup node of the blockchain and the blockchain client;
    同步模块,若所述视图切换操作使所述共识节点作为共识主节点,则对所述接收模块接收到的交易进行合法性验证,并将验证通过的交易存入所述共识节点的交易池;The synchronization module, if the view switching operation makes the consensus node act as the consensus master node, verify the validity of the transaction received by the receiving module, and store the verified transaction in the transaction pool of the consensus node;
    共识模块,若所述视图切换操作使所述共识节点作为共识主节点,则基于所述共识节点的交易池中的交易发起共识提议。The consensus module, if the view switching operation makes the consensus node act as the consensus master node, initiates a consensus proposal based on transactions in the transaction pool of the consensus node.
  9. 一种电子设备包括:存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机程序,所述计算机程序被所述处理器执行:An electronic device includes: a memory, a processor, and a computer program stored on the memory and executable on the processor, the computer program being executed by the processor:
    执行共识节点的视图切换操作;Perform the view switching operation of the consensus node;
    若所述视图切换操作使所述共识节点作为共识备份节点,则将所述共识节点的交易池中的交易定向发送至所述区块链的共识主节点;If the view switching operation enables the consensus node to serve as a consensus backup node, the transactions in the transaction pool of the consensus node are directed to the consensus master node of the blockchain;
    若所述视图切换操作使所述共识节点作为共识主节点,则接收所述区块链的共识备份节点及区块链客户端发送的交易;If the view switching operation makes the consensus node act as the consensus master node, receiving the transaction sent by the consensus backup node of the blockchain and the blockchain client;
    若所述视图切换操作使所述共识节点作为共识主节点,则对所述接收模块接收到的交易进行合法性验证,并将验证通过的交易存入所述共识节点的交易池;If the view switching operation makes the consensus node act as the consensus master node, verify the validity of the transaction received by the receiving module, and store the verified transaction in the transaction pool of the consensus node;
    若所述视图切换操作使所述共识节点作为共识主节点,则基于所述共识节点的交易池中的交易发起共识提议。If the view switching operation makes the consensus node act as the consensus master node, a consensus proposal is initiated based on transactions in the transaction pool of the consensus node.
  10. 一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现如下步骤:A computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the following steps are implemented:
    执行共识节点的视图切换操作;Perform the view switching operation of the consensus node;
    若所述视图切换操作使所述共识节点作为共识备份节点,则将所述共识节点的交易池中的交易定向发送至所述区块链的共识主节点;If the view switching operation enables the consensus node to serve as a consensus backup node, the transactions in the transaction pool of the consensus node are directed to the consensus master node of the blockchain;
    若所述视图切换操作使所述共识节点作为共识主节点,则接收所述区块链的共识备份节点及区块链客户端发送的交易;If the view switching operation makes the consensus node act as the consensus master node, receiving the transaction sent by the consensus backup node of the blockchain and the blockchain client;
    若所述视图切换操作使所述共识节点作为共识主节点,则对所述接收模块接收到的交易进行合法性验证,并将验证通过的交易存入所述共识节点的交易池;If the view switching operation makes the consensus node act as the consensus master node, verify the validity of the transaction received by the receiving module, and store the verified transaction in the transaction pool of the consensus node;
    若所述视图切换操作使所述共识节点作为共识主节点,则基于所述共识节点的交易池中的交易发起共识提议。If the view switching operation makes the consensus node act as a consensus master node, a consensus proposal is initiated based on transactions in the consensus node's transaction pool.
PCT/CN2021/132998 2021-01-28 2021-11-25 Blockchain consensus method, consensus node, and electronic device WO2022160901A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110118983.9A CN112465515B (en) 2021-01-28 2021-01-28 Block chain consensus method, consensus node and electronic equipment
CN202110118983.9 2021-01-28

Publications (1)

Publication Number Publication Date
WO2022160901A1 true WO2022160901A1 (en) 2022-08-04

Family

ID=74802338

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/132998 WO2022160901A1 (en) 2021-01-28 2021-11-25 Blockchain consensus method, consensus node, and electronic device

Country Status (2)

Country Link
CN (1) CN112465515B (en)
WO (1) WO2022160901A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2024066010A1 (en) * 2022-09-30 2024-04-04 蚂蚁区块链科技(上海)有限公司 Method and apparatus for transaction processing in blockchain system, and blockchain system

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112465515B (en) * 2021-01-28 2022-02-25 支付宝(杭州)信息技术有限公司 Block chain consensus method, consensus node and electronic equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180101560A1 (en) * 2016-10-07 2018-04-12 International Business Machines Corporation Establishing overlay trust consensus for blockchain trust validation system
CN111464349A (en) * 2020-03-30 2020-07-28 南京中诚区块链研究院有限公司 Mixed consensus network algorithm and system of block chain Raft + PBFT
CN111581286A (en) * 2020-05-07 2020-08-25 成都汉为科技有限公司 Energy block chain block storage method based on consistency hash
CN112465515A (en) * 2021-01-28 2021-03-09 支付宝(杭州)信息技术有限公司 Block chain consensus method, consensus node and electronic equipment

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11503036B2 (en) * 2019-03-13 2022-11-15 Nec Corporation Methods of electing leader nodes in a blockchain network using a role-based consensus protocol
CN111355810B (en) * 2020-03-17 2022-05-10 重庆邮电大学 Improved PBFT consensus method based on credit and voting mechanism

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180101560A1 (en) * 2016-10-07 2018-04-12 International Business Machines Corporation Establishing overlay trust consensus for blockchain trust validation system
CN111464349A (en) * 2020-03-30 2020-07-28 南京中诚区块链研究院有限公司 Mixed consensus network algorithm and system of block chain Raft + PBFT
CN111581286A (en) * 2020-05-07 2020-08-25 成都汉为科技有限公司 Energy block chain block storage method based on consistency hash
CN112465515A (en) * 2021-01-28 2021-03-09 支付宝(杭州)信息技术有限公司 Block chain consensus method, consensus node and electronic equipment

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2024066010A1 (en) * 2022-09-30 2024-04-04 蚂蚁区块链科技(上海)有限公司 Method and apparatus for transaction processing in blockchain system, and blockchain system

Also Published As

Publication number Publication date
CN112465515A (en) 2021-03-09
CN112465515B (en) 2022-02-25

Similar Documents

Publication Publication Date Title
US10721326B2 (en) Method, apparatus, and electronic device for processing consensus requests in a blockchain consensus network
WO2022160901A1 (en) Blockchain consensus method, consensus node, and electronic device
US11368317B2 (en) Consensus method of consortium blockchain, and consortium blockchain system
CN108648078B (en) Transaction preprocessing method and device and electronic equipment
EP4053711A1 (en) Consensus method for blockchain, and consensus node, electronic device and storage medium
WO2022021852A1 (en) Fpga-based fast protocol decoding method, apparatus, and device
US11366932B2 (en) Consensus method and data verification method, apparatus, and system of consortium blockchain
US20210314179A1 (en) Methods and consensus nodes for block generation
WO2023056974A1 (en) Consensus method, blockchain system and consensus nodes
WO2023056964A1 (en) Consensus method, blockchain system, and consensus node
WO2023056976A1 (en) Consensus method, blockchain system and consensus node
US11899652B2 (en) Method and apparatus for processing information of blockchain network, device and storage medium
WO2023056967A1 (en) Consensus method, blockchain system and consensus nodes
WO2023184881A1 (en) Proposal consensus execution method, blockchain system, device and storage medium
He et al. An improvement of consensus fault tolerant algorithm applied to alliance chain
WO2023056966A1 (en) Consensus method, blockchain system, and consensus node
WO2022017052A1 (en) Method and apparatus for shared device instruction control and device
WO2023193783A1 (en) Blockchain consensus method and blockchain copy device
WO2023160086A1 (en) Transaction processing method of blockchain, blockchain node, and electronic device
CN112003800A (en) Method and device for exchanging and transmitting messages of ports with different bandwidths
CN116232893A (en) Consensus method and device of distributed system, electronic equipment and storage medium
US20180034749A1 (en) System and method for distributing and replaying trigger packets via a variable latency bus interconnect
JP2019515516A (en) Image drawing method, related device and system
CN112131602B (en) Method, device and related product for quickly expanding trust relationship between nodes based on trusted computing
CN113760519A (en) Distributed transaction processing method, device and system and electronic equipment

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: 21922491

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: 21922491

Country of ref document: EP

Kind code of ref document: A1