CN112465515B - Block chain consensus method, consensus node and electronic equipment - Google Patents

Block chain consensus method, consensus node and electronic equipment Download PDF

Info

Publication number
CN112465515B
CN112465515B CN202110118983.9A CN202110118983A CN112465515B CN 112465515 B CN112465515 B CN 112465515B CN 202110118983 A CN202110118983 A CN 202110118983A CN 112465515 B CN112465515 B CN 112465515B
Authority
CN
China
Prior art keywords
consensus
node
transaction
block chain
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110118983.9A
Other languages
Chinese (zh)
Other versions
CN112465515A (en
Inventor
杨达一
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alipay Hangzhou Information Technology Co Ltd
Ant Blockchain Technology Shanghai Co Ltd
Original Assignee
Alipay Hangzhou Information Technology Co Ltd
Ant Blockchain Technology Shanghai Co Ltd
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 Alipay Hangzhou Information Technology Co Ltd, Ant Blockchain Technology Shanghai Co Ltd filed Critical Alipay Hangzhou Information Technology Co Ltd
Priority to CN202110118983.9A priority Critical patent/CN112465515B/en
Publication of CN112465515A publication Critical patent/CN112465515A/en
Priority to PCT/CN2021/132998 priority patent/WO2022160901A1/en
Application granted granted Critical
Publication of CN112465515B publication Critical patent/CN112465515B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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

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)
  • Hardware Redundancy (AREA)
  • Retry When Errors Occur (AREA)

Abstract

The embodiment of the specification provides a block chain consensus method, a consensus node and electronic equipment. The consensus method comprises the following steps: and executing view switching operation by a target consensus node of the block chain, wherein the target consensus node is a consensus backup node after executing the view switching operation. And the target consensus node directionally sends the transaction in the transaction pool of the target consensus node to the consensus main node of the block chain. And the common identification main node of the block chain carries out validity verification on the received transaction and stores the transaction passing the verification into a transaction pool of the node. The consensus master node initiates a consensus proposal based on transactions in the transaction pool of the node.

Description

Block chain consensus method, consensus node and electronic equipment
Technical Field
The present disclosure relates to a block chain, and in particular, to a block chain consensus method, a block chain consensus node, and an electronic device.
Background
The total transaction in the transaction pool of the current node is synchronized to other common nodes through a broadcasting mode among the common nodes of the current block chain. The broadcast synchronization method can cause the traffic to be sent redundantly, thereby causing a great waste of bandwidth resources. For the blockchain system with a large number of common identification nodes and huge transaction data, the waste of bandwidth resources can cause the reduction of common identification calculation power, thereby affecting the execution efficiency of blockchain services.
In view of the above, a technical solution for improving the bandwidth resource waste caused by the synchronous transaction between the nodes of common knowledge is needed.
Disclosure of Invention
An embodiment of the present disclosure provides a block chain consensus method, a consensus node, and an electronic device, so as to improve bandwidth resource waste caused by synchronous transactions between the consensus nodes.
In order to achieve the above object, the embodiments of the present specification are implemented as follows:
in a first aspect, a method for identifying a blockchain is provided, including:
a target consensus node of the block chain executes view switching operation, wherein the target consensus node is a consensus backup node after executing the view switching operation;
the target consensus node directionally sends the transaction in the transaction pool of the target consensus node to the consensus main node of the block chain;
the common identification main node of the block chain carries out validity verification on the received transaction and stores the transaction passing the verification into a transaction pool of the node;
the consensus master node initiates a consensus proposal based on transactions in the transaction pool of the node.
In a second aspect, a block chain consensus method is provided, including:
a target consensus node of the block chain executes view switching operation, wherein the target consensus node is a consensus backup node after executing the view switching operation;
and the target consensus node sends the transaction in the transaction pool of the node to the consensus main node of the block chain, so that the consensus main node of the block chain carries out validity verification on the received transaction and stores the verified transaction into the transaction pool of the node, thereby initiating a consensus proposal based on the transaction in the transaction pool of the node.
In a third aspect, a block chain consensus method is provided, including:
a target consensus node of the block chain executes view switching operation, wherein the target consensus node is a consensus main node after executing the view switching operation;
the target consensus node receives the transaction sent by the consensus backup node of the block chain and the block chain client;
the target consensus node carries out validity verification on the received transaction and stores the transaction passing the verification into a transaction pool of the node;
the target consensus node initiates a consensus proposal based on the transactions in the transaction pool of the node.
In a fourth aspect, a consensus node of a blockchain is provided, including:
the view switching module executes the view switching operation of the consensus node;
the sending module is used for sending the transaction orientation in the transaction pool of the consensus node to the consensus main node of the block chain if the view switching operation enables the consensus node to be used as a consensus backup node;
the receiving module is used for receiving the transaction sent by the consensus backup node of the block chain and the block chain client if the view switching operation enables the consensus node to be used as a consensus main node;
the synchronization module is used for carrying out validity verification on the transaction received by the receiving module and storing the transaction passing the verification into a transaction pool of the consensus node if the view switching operation enables the consensus node to be used as a consensus master node;
and the consensus module is used for initiating a consensus proposal based on the transaction in the transaction pool of the consensus node if the view switching operation enables the consensus node to be used as a consensus main 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 to:
executing view switching operation of the consensus node;
if the view switching operation enables the consensus node to serve as a consensus backup node, the transaction in the transaction pool of the consensus node is directionally sent to the consensus main node of the block chain;
if the view switching operation enables the consensus node to be used as a consensus main node, receiving a transaction sent by a consensus backup node of the block chain and a block chain client;
if the view switching operation enables the consensus node to serve as a consensus main node, carrying out validity verification on the transaction received by the receiving module, and storing the transaction passing the verification into a transaction pool of the consensus node;
and if the view switching operation enables the consensus node to be used as a consensus master node, initiating a consensus proposal based on the transaction in the transaction pool of the consensus node.
In a sixth aspect, a computer readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of:
executing view switching operation of the consensus node;
if the view switching operation enables the consensus node to serve as a consensus backup node, the transaction in the transaction pool of the consensus node is directionally sent to the consensus main node of the block chain;
if the view switching operation enables the consensus node to be used as a consensus main node, receiving a transaction sent by a consensus backup node of the block chain and a block chain client;
if the view switching operation enables the consensus node to serve as a consensus main node, carrying out validity verification on the transaction received by the receiving module, and storing the transaction passing the verification into a transaction pool of the consensus node;
and if the view switching operation enables the consensus node to be used as a consensus master node, initiating a consensus proposal based on the transaction in the transaction pool of the consensus node.
In the consensus mechanism for the main-standby distinction of the consensus node, only the consensus master node of the block chain can initiate a consensus proposal for a transaction. Based on the method of the embodiment of the specification, the consensus backup node of the block chain only orients synchronous transaction to the consensus main node, and bandwidth overhead can be effectively saved. And if the block chain is replaced with the consensus main node subsequently, the consensus backup node carries out synchronous transaction again to a new consensus main node. In addition, the directional synchronization mode can effectively reduce the redundant transmission of transactions, thereby improving the problem of bandwidth resource waste and avoiding the problem of reduced common identification power caused by overhigh bandwidth occupation of a block chain system.
Drawings
In order to more clearly illustrate the embodiments of the present specification or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, it is obvious that the drawings in the following description are only some embodiments described in the embodiments of the present specification, and for those skilled in the art, other drawings can be obtained according to the drawings without any creative efforts;
fig. 1 is a first schematic flow chart of a block chain consensus method provided in an embodiment of the present disclosure;
fig. 2 is a second flowchart of a block chain consensus method provided in an embodiment of the present disclosure;
fig. 3 is a schematic structural diagram of a consensus node provided in an embodiment of the present specification;
fig. 4 is a schematic structural diagram of an electronic device provided in an embodiment of this specification.
Detailed Description
In order to make those skilled in the art better understand the technical solutions in the present specification, the technical solutions in the embodiments of the present specification will be clearly and completely described below with reference to the drawings in the embodiments of the present specification, and it is obvious that the described embodiments are only a part of the embodiments of the present specification, and not all of the embodiments. All other embodiments obtained by a person skilled in the art based on the embodiments in the present specification without any inventive step should fall within the scope of protection of the present specification.
As mentioned above, the total transaction in the transaction pool of the current node is synchronized to other common nodes by broadcasting between the common nodes of the block chain. The broadcast synchronization method can cause the traffic to be sent redundantly, thereby causing the waste of bandwidth resources.
For example, the transaction pool of the consensus node a has transactions 1, 2, the transaction pool of the consensus node B has transactions 2, 3, and the transaction pool of the consensus node C has transaction 4. Regardless of the addition of new transactions and the removal of old transactions, after the first round of transaction synchronization, consensus node a broadcasts transactions 1, 2 to consensus node B, C, consensus node B broadcasts transactions 2, 3 to consensus node A, C, and consensus node C broadcasts transaction 4 to consensus node A, B. It can be seen therein that the first round of synchronization results in a redundant transmission of transaction 2.
After the first round of synchronization, the respective transaction pools of the consensus node A, B, C store transactions 1, 2, 3, and 4. Thus, in performing the second round of synchronization, the consensus node A, B, C will send all transactions 1, 2, 3, 4 in the respective transaction pools redundantly.
It can be seen that, in the conventional transaction synchronization mode, the larger the scale of the consensus node is, the larger the transaction data is, the more serious the phenomenon of bandwidth resource waste is, so that the consensus computing power of the block chain is greatly reduced, and the execution efficiency of the block chain service is finally affected.
Therefore, the technical scheme capable of improving the waste of bandwidth resources caused by synchronous transaction between the consensus nodes is provided.
Fig. 1 is a flowchart illustrating a block chain consensus method according to an embodiment of the present disclosure. The method shown in fig. 1 may be performed by corresponding hardware below, comprising the steps of:
and S102, executing view switching operation by a target consensus node of the block chain, wherein the target consensus node is a consensus backup node after executing the view switching operation.
It should be understood that each common node of the blockchain corresponds to a view number. The blockchain typically switches views periodically based on certain rules (e.g., polling), and performs view switching operations corresponding to the common nodes. And for the target consensus node, if the block chain is switched to the view corresponding to the view number of the node, the target consensus node is used as a consensus main node, otherwise, the target consensus node is used as a consensus backup node. Based on the view switching mechanism, all the consensus nodes of the block chain have certain chance to become consensus master nodes to initiate consensus suggestions (consensus backup nodes cannot initiate consensus suggestions), so that decentralization is achieved to a certain degree.
And S104, the target consensus node directionally sends the transaction in the transaction pool of the target consensus node to the consensus main node of the block chain.
It should be understood that, in the embodiment of the present specification, the target consensus node sends the transaction direction in the transaction pool of the target consensus node to the consensus master node of the block chain may represent that: the consensus backup node only synchronously transacts to the consensus main node, namely any consensus backup node does not add new transaction to the transaction pool of the node through other consensus backup nodes.
Here, when the target consensus node is used as the consensus backup node, a new transaction initiated by the blockchain client may be acquired and added to the transaction pool of the target consensus node. On this basis, to achieve smaller bandwidth overhead, as a possible but unnecessary scheme, when the target consensus node is used as a consensus backup node, only the transaction initiated by the blockchain client is added to the transaction pool of the target consensus node, that is, only the bandwidth resource is occupied to receive the transaction directly sent from the blockchain client. Of course, the target consensus node may not reject transactions received by other means, but does not process them.
And S106, the consensus main node of the block chain carries out validity verification on the received transaction and stores the transaction passing the verification into a transaction pool of the node.
The validity verification in this step may refer to verification that an existing blockchain consensus node needs to perform before adding a transaction to the transaction pool. Since the embodiments of the present specification do not relate to the improvement in this respect, detailed description is omitted.
And S108, the consensus master node initiates a consensus proposal based on the transaction in the transaction pool of the node.
In this step, the consensus master node selects at least a portion of the transaction initiation consensus offer from the transaction pool of the node, where the selected transaction initiation consensus offer may include a transaction provided by the target node. The transaction achieving the consensus is generated into a block by each consensus node for storage, so as to realize the uplink of transaction data.
It should be appreciated that in the consensus mechanism for the active-standby distinction of consensus nodes, only the consensus master node of the blockchain can initiate a consensus proposal for the transaction. Based on the method of the embodiment of the specification, the consensus backup node of the block chain only orients synchronous transaction to the consensus main node, and bandwidth overhead can be effectively saved. And if the block chain is replaced with the consensus main node subsequently, the consensus backup node carries out synchronous transaction again to a new consensus main node. In addition, the directional synchronization mode can effectively reduce the redundant transmission of transactions, thereby improving the problem of bandwidth resource waste and avoiding the problem of reduced common identification power caused by overhigh bandwidth occupation of a block chain system.
Specifically, in this embodiment, when the target consensus node is a consensus backup node, the transaction sent to the consensus master node of the blockchain in the transaction pool of the target consensus node may be marked. Correspondingly, in the above S104, the target consensus node sends the unmarked transaction direction in the transaction pool of the node to the consensus master node of the block chain. That is, if the blockchain does not switch views to replace the consensus master node, the target consensus node (consensus backup node) does not synchronize repeated transactions to the consensus master node.
In addition, on the basis, after the view switching operation is performed by the target consensus node, the mark of the transaction in the transaction pool of the target consensus node can be cleared. It should be appreciated that the new consensus master node is replaced after the view is switched in the blockchain, and when the target consensus master node clears the mark and then performs the above step S104, the transaction that was originally sent to the old consensus master node but not sent to the new consensus master node may be sent to the new consensus master node.
The following describes in detail the consensus method of the examples of the present specification.
In the consensus method of the embodiments of the present specification, transactions in the target consensus node transaction pool are mainly classified into two types. One is the transaction of the target consensus node, and the transaction is directly initiated to the target consensus node after the block chain client enters the target consensus node; the other type is the transaction of other consensus nodes, which is initiated by other blockchain clients accessing other consensus nodes and needs to be synchronized by other consensus nodes (consensus backup nodes) after the target node is used as a consensus master node.
The process of executing the consensus method with the target consensus node as the initial consensus backup node as an example is shown in fig. 2, and includes:
and the target consensus node sends the own transaction in the transaction pool of the node to the current consensus main node of the block chain. Here, the target consensus node ignores transactions belonging to other consensus nodes in the transaction pool of the node.
Meanwhile, the target consensus node also receives a new transaction initiated by the blockchain client, verifies the validity of the new transaction initiated by the blockchain client, and if the verification is passed, adds the new transaction into a transaction pool of the target consensus node. Here, the new transaction initiated by the target consensus node adding blockchain client belongs to a completely independent flow, and is not limited by other steps and main and standby.
And then, initiating a master change by the block chain switching view, and executing view switching operation by the target consensus node.
If the target consensus node is still the consensus backup node after executing the view switching operation, all transactions belonging to the target consensus node in the transaction pool of the target consensus node are sent to a new consensus master node of the block chain, and the sending of the transactions comprises the following steps: the transaction is sent to the previous round of consensus master node and, in addition, a new transaction is added to the node's transaction pool by the blockchain client.
And if the target consensus node is the consensus main node after executing the view switching operation, receiving the transactions sent by the consensus backup node and the blockchain client, carrying out validity verification on the received transactions, and storing the verified transactions into a transaction pool of the target consensus node.
Thereafter, if a consensus execution condition is triggered, the target consensus node initiates a consensus proposal based on the transactions in the transaction pool of the node. Here, the transaction in which the consensus proposition is initiated is not limited to the source, and may be a transaction of the target consensus node and other consensus nodes.
Obviously, based on the directional synchronization mode in the embodiment of the present specification, the consensus backup node selects whether to send the stock transactions to the new consensus master node according to whether the consensus master node is switched, which not only reduces the use of network bandwidth, but also ensures the success rate of the packaged transactions. The throughput of the block chain is improved linearly.
The foregoing is an exemplary description of the method of embodiments of the present invention. Suitable variations may be made without departing from the principles described herein, and such variations are to be considered within the scope of the embodiments of the invention.
Further, it should be understood that, in the method of the embodiment of the present specification, if the target consensus node is a consensus backup node after performing the view switching operation, the following steps are performed: and sending the transaction in the transaction pool of the node to the consensus main node of the block chain, so that the consensus main node of the block chain carries out validity verification on the received transaction, and stores the transaction passing the verification into the transaction pool of the node, thereby initiating a consensus proposal based on the transaction in the transaction pool of the node.
Correspondingly, if the target consensus node is the consensus master node after the view switching operation is performed, the following steps are performed: receiving a transaction sent by a consensus backup node of the block chain and a block chain client; carrying out validity verification on the received transaction, and storing the transaction passing the verification into a transaction pool of the node; and initiating a consensus proposal based on the transaction in the transaction pool of the node.
In addition, corresponding to the consensus method shown in fig. 1, an embodiment of the present invention further provides a consensus node of a block chain. Fig. 3 is a schematic structural diagram of a consensus node 300 according to an embodiment of the present invention, including:
and the view switching module 310 performs a view switching operation of the consensus node.
A sending module 320, configured to send the transaction orientation in the transaction pool of the consensus node to the consensus master node of the block chain if the view switching operation makes the consensus node serve as a consensus backup node.
The receiving module 330 is configured to receive a 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 a consensus master node.
And a synchronization module 340, configured to, if the view switching operation makes the consensus node serve as a consensus master node, perform validity verification on the transaction received by the receiving module, and store the transaction passing the verification in a transaction pool of the consensus node.
A consensus module 350, if the view switching operation makes the consensus node a consensus master node, initiating a consensus proposal based on transactions in a transaction pool of the consensus node.
In the consensus mechanism for the main-standby distinction of the consensus node, only the consensus master node of the block chain can initiate a consensus proposal for a transaction. After the view switching operation is performed, if the consensus node is a consensus backup node, only the synchronous transaction is directed to the consensus master node, so that bandwidth overhead is effectively saved. And if the block chain changes the consensus main node, the transaction is synchronized again to a new consensus main node. In addition, the directional synchronization mode can effectively reduce the redundant transmission of transactions, thereby improving the problem of bandwidth resource waste and avoiding the problem of reduced common identification power caused by overhigh bandwidth occupation of a block chain system.
Optionally, the sending module 320 sends only the transaction orientation directly obtained from the blockchain client in the transaction pool of the consensus node to the consensus master node of the blockchain.
Optionally, when the consensus node serves as a consensus backup node, the sending module 320 marks the transaction that has been sent to the consensus main node of the block chain in the transaction pool of the consensus node, and directionally sends the unmarked transaction in the transaction pool of the node to the consensus main node of the block chain.
On the basis of the above, the sending module 320 may also clear the mark of the transaction in the transaction pool of the consensus node after the view switching module 310 completes the view switching operation.
Optionally, when the consensus node serves as a consensus backup node, the synchronization module 340 only adds the transaction initiated by the blockchain client to the transaction pool of the node.
Obviously, the consensus node of the embodiment of the present specification may be an execution subject of the consensus method shown in fig. 1, and thus can implement the functions of the consensus method implemented in fig. 1 and fig. 2. Since the principle is the same, the detailed description is omitted here.
Fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure. Referring to fig. 4, at a hardware level, the electronic device includes a processor, and optionally further includes an internal bus, a network interface, and a memory. The Memory may include a Memory, such as a Random-Access Memory (RAM), and may further include a non-volatile Memory, such as at least 1 disk Memory. Of course, the electronic device may also include hardware required for other services.
The processor, the network interface, and the memory may be connected to each other via an internal bus, which may be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, an EISA (Extended Industry Standard Architecture) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one double-headed arrow is shown in FIG. 4, but that does not indicate only one bus or one type of bus.
And the memory is used for storing programs. In particular, the program may include program code comprising computer operating instructions. The memory may include both memory and non-volatile storage and provides instructions and data to the processor.
The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it, forming a consensus device on a logical level, which can be a consensus node or a component in a consensus node. The processor is used for executing the program stored in the memory and is specifically used for executing the following operations:
and executing the view switching operation of the consensus node.
And if the view switching operation enables the consensus node to be used as a consensus backup node, the transaction orientation in the transaction pool of the consensus node is sent to the consensus main node of the block chain.
And if the view switching operation enables the consensus node to be used as a consensus main node, receiving the transaction sent by the consensus backup node of the block chain and the block chain client.
And if the view switching operation enables the consensus node to be used as a consensus main node, carrying out validity verification on the transaction received by the receiving module, and storing the transaction passing the verification into a transaction pool of the consensus node.
And if the view switching operation enables the consensus node to be used as a consensus master node, initiating a consensus proposal based on the transaction in the transaction pool of the consensus node.
In the consensus mechanism for the main-standby distinction of the consensus node, only the consensus master node of the block chain can initiate a consensus proposal for a transaction. Based on the electronic equipment of the embodiment of the specification, the consensus backup node of the block chain only orients synchronous transaction to the consensus main node, and bandwidth overhead can be effectively saved. And if the block chain is replaced with the consensus main node subsequently, the consensus backup node carries out synchronous transaction again to a new consensus main node. In addition, the directional synchronization mode can effectively reduce the redundant transmission of transactions, thereby improving the problem of bandwidth resource waste and avoiding the problem of reduced common identification power caused by overhigh bandwidth occupation of a block chain system.
The consensus method as disclosed above in the embodiment of fig. 1 of the present specification may be applied to or implemented by a processor. The processor may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware in a processor or instructions in the form of software. The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components. The various methods, steps and logic blocks disclosed in the embodiments of the present specification may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of a method disclosed in connection with the embodiments of the present specification may be embodied directly in a hardware decoding processor, or in a combination of hardware and software modules in the decoding processor. The software module may be located in ram, flash memory, rom, prom, or eprom, registers, etc. storage media as is well known in the art. The storage medium is located in a memory, and a processor reads information in the memory and completes the steps of the method in combination with hardware of the processor.
It should be understood that the electronic device of the embodiment of the present specification can implement the functions of the embodiments of the above-described consensus method shown in fig. 1 and fig. 2. Since the principle is the same, the detailed description is omitted here.
Of course, besides the software implementation, the electronic device in this specification does not exclude other implementations, such as logic devices or a combination of software and hardware, and the like, that is, the execution subject of the following processing flow is not limited to each logic unit, and may also be hardware or logic devices.
Furthermore, embodiments of the present specification also propose a computer-readable storage medium storing one or more programs, the one or more programs comprising instructions, which when executed by a portable electronic device comprising a plurality of application programs, enable the portable electronic device to perform the method of the embodiment shown in fig. 1, and in particular to perform the following steps:
and executing the view switching operation of the consensus node.
And if the view switching operation enables the consensus node to be used as a consensus backup node, the transaction orientation in the transaction pool of the consensus node is sent to the consensus main node of the block chain.
And if the view switching operation enables the consensus node to be used as a consensus main node, receiving the transaction sent by the consensus backup node of the block chain and the block chain client.
And if the view switching operation enables the consensus node to be used as a consensus main node, carrying out validity verification on the transaction received by the receiving module, and storing the transaction passing the verification into a transaction pool of the consensus node.
And if the view switching operation enables the consensus node to be used as a consensus master node, initiating a consensus proposal based on the transaction in the transaction pool of the consensus node.
As will be appreciated by one skilled in the art, embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, the description may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the description 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, and the like) having computer-usable program code embodied therein.
The foregoing description has been directed to specific embodiments of this disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
The above description is only an example of the present specification, and is not intended to limit the present specification. Various modifications and alterations to this description will become apparent to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present specification should be included in the scope of the claims of the present specification. Moreover, all other embodiments obtained by a person skilled in the art without making any inventive step shall fall within the scope of protection of this document.

Claims (10)

1. A method for block chain consensus, comprising:
a target consensus node of the block chain executes view switching operation, wherein the target consensus node is a consensus backup node after executing the view switching operation;
the target consensus node directionally transmits the transaction in the transaction pool of the target consensus node to the consensus main node of the block chain;
the common identification main node of the block chain carries out validity verification on the received transaction and stores the transaction passing the verification into a transaction pool of the node;
the consensus master node initiates a consensus proposal based on at least a portion of the transactions in the transaction pool of the node.
2. The method of claim 1, wherein the first and second light sources are selected from the group consisting of,
the target consensus node sends the transaction orientation in the transaction pool of the target consensus node to the consensus master node of the block chain, and the method comprises the following steps:
and the target consensus node only directionally transmits the transaction obtained directly from the blockchain client in the transaction pool of the target consensus node to the consensus main node of the blockchain.
3. The method of claim 1, further comprising:
when the target consensus node is a consensus backup node, marking the transaction which is sent to the consensus main node of the block chain in the transaction pool of the node;
the target consensus node sends the transaction orientation in the transaction pool of the target consensus node to the consensus master node of the block chain, and the method comprises the following steps:
and the target consensus node directionally transmits the unmarked transaction in the transaction pool of the target consensus node to the consensus main node of the block chain.
4. The method of claim 3, further comprising:
and after the target consensus node executes the view switching operation, clearing the mark of the transaction in the transaction pool of the target consensus node.
5. The method of claim 1, further comprising:
and when the target consensus node is used as a consensus backup node, only the transaction initiated by the blockchain client is added into the transaction pool of the target consensus node.
6. A method for block chain consensus, comprising:
a target consensus node of the block chain executes view switching operation, wherein the target consensus node is a consensus backup node after executing the view switching operation;
the target consensus node only directionally transmits the transaction in the transaction pool of the node to the consensus master node of the block chain, so that the consensus master node of the block chain carries out validity verification on the received transaction, and stores the verified transaction into the transaction pool of the node, thereby initiating a consensus proposal based on at least part of the transactions in the transaction pool of the node.
7. A method for block chain consensus, comprising:
a target consensus node of the block chain executes view switching operation, wherein the target consensus node is a consensus main node after executing the view switching operation;
the target consensus node receives the transaction sent by the consensus backup node of the block chain and the block chain client;
the target consensus node carries out validity verification on the received transaction and stores the transaction passing the verification into a transaction pool of the node;
the target consensus node initiates a consensus proposal based on the transactions in the transaction pool of the node.
8. A consensus node of a blockchain, comprising:
the view switching module executes the view switching operation of the consensus node;
the sending module is used for directionally sending the transaction in the transaction pool of the consensus node to the consensus main node of the block chain only if the view switching operation enables the consensus node to be used as a consensus backup node;
the receiving module is used for receiving the transaction sent by the consensus backup node of the block chain and the block chain client if the view switching operation enables the consensus node to be used as a consensus main node;
the synchronization module is used for carrying out validity verification on the transaction received by the receiving module and storing the transaction passing the verification into a transaction pool of the consensus node if the view switching operation enables the consensus node to be used as a consensus master node;
a consensus module to initiate a consensus proposal based on at least a portion of the transactions in a transaction pool of consensus nodes if the view switching operation causes the consensus node to act as a consensus master 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 to:
executing view switching operation of the consensus node;
if the view switching operation enables the consensus node to serve as a consensus backup node, the transaction in the transaction pool of the consensus node is only directionally sent to the consensus main node of the block chain;
if the view switching operation enables the consensus node to be used as a consensus main node, receiving a transaction sent by a consensus backup node of a block chain and a block chain client;
if the view switching operation enables the consensus node to serve as a consensus main node, carrying out validity verification on the received transaction, and storing the transaction passing the verification into a transaction pool of the consensus node;
if the view switching operation enables the consensus node to be used as a consensus master node, a consensus proposal is initiated based on at least a part of the transactions in the transaction pool of the consensus node.
10. A computer-readable storage medium having a computer program stored thereon, which when executed by a processor, performs the steps of:
executing view switching operation of the consensus node;
if the view switching operation enables the consensus node to serve as a consensus backup node, the transaction in the transaction pool of the consensus node is only directionally sent to the consensus main node of the block chain;
if the view switching operation enables the consensus node to be used as a consensus main node, receiving a transaction sent by a consensus backup node of a block chain and a block chain client;
if the view switching operation enables the consensus node to serve as a consensus main node, carrying out validity verification on the received transaction, and storing the transaction passing the verification into a transaction pool of the consensus node;
if the view switching operation enables the consensus node to be used as a consensus master node, a consensus proposal is initiated based on at least a part of the transactions in the transaction pool of the consensus node.
CN202110118983.9A 2021-01-28 2021-01-28 Block chain consensus method, consensus node and electronic equipment Active CN112465515B (en)

Priority Applications (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
PCT/CN2021/132998 WO2022160901A1 (en) 2021-01-28 2021-11-25 Blockchain consensus method, consensus node, and electronic device

Applications Claiming Priority (1)

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

Publications (2)

Publication Number Publication Date
CN112465515A CN112465515A (en) 2021-03-09
CN112465515B true CN112465515B (en) 2022-02-25

Family

ID=74802338

Family Applications (1)

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

Country Status (2)

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

Families Citing this family (3)

* 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
CN113873030A (en) * 2021-09-24 2021-12-31 支付宝(杭州)信息技术有限公司 Block chain consensus method, consensus node and electronic equipment
CN115665164A (en) * 2022-09-30 2023-01-31 蚂蚁区块链科技(上海)有限公司 Transaction processing method and device in blockchain system and blockchain system

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111355810A (en) * 2020-03-17 2020-06-30 重庆邮电大学 Improved PBFT consensus method based on credit and voting mechanism
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
WO2020182430A1 (en) * 2019-03-13 2020-09-17 NEC Laboratories Europe GmbH Methods of electing leader nodes in a blockchain network using a role-based consensus protocol

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10360191B2 (en) * 2016-10-07 2019-07-23 International Business Machines Corporation Establishing overlay trust consensus for blockchain trust validation system
CN112465515B (en) * 2021-01-28 2022-02-25 支付宝(杭州)信息技术有限公司 Block chain consensus method, consensus node and electronic equipment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2020182430A1 (en) * 2019-03-13 2020-09-17 NEC Laboratories Europe GmbH Methods of electing leader nodes in a blockchain network using a role-based consensus protocol
CN111355810A (en) * 2020-03-17 2020-06-30 重庆邮电大学 Improved PBFT consensus method based on credit and voting mechanism
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

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
区块链实用拜占庭容错共识算法的改进;甘俊 等;《计算机应用》;20190710;第39卷(第7期);正文第2150-2152页 *

Also Published As

Publication number Publication date
CN112465515A (en) 2021-03-09
WO2022160901A1 (en) 2022-08-04

Similar Documents

Publication Publication Date Title
CN112465515B (en) Block chain consensus method, consensus node and electronic equipment
US10897522B2 (en) Method, apparatus, and electronic device for processing consensus requests in a blockchain consensus network
EP4053711A1 (en) Consensus method for blockchain, and consensus node, electronic device and storage medium
CN111683118B (en) Block chain-based consensus method and device, master node equipment and slave node equipment
US20210314179A1 (en) Methods and consensus nodes for block generation
CN109951534B (en) Consensus method, device and system
CN111522697B (en) Restarting processing method of block chain consensus node, consensus node and block chain system
CN113760468A (en) Distributed election method, device, system and medium
CN113852691A (en) Block chain consensus method, consensus node and electronic equipment
CN114529413A (en) Processing method of block chain transaction, block chain node and electronic equipment
CN113849564B (en) Block chain consensus method, consensus node and electronic equipment
CN114547201A (en) Processing method of block chain transaction, block chain node and electronic equipment
CN113821569A (en) Block chain consensus method and block chain
US20100082875A1 (en) Transfer device
CN111522648B (en) Transaction processing method and device for block chain and electronic equipment
CN115409507A (en) Block processing method, block processing device, computer equipment and storage medium
CN111538785A (en) Data writing method, device and system of block chain and electronic equipment
CN116232893A (en) Consensus method and device of distributed system, electronic equipment and storage medium
CN114529414A (en) Transaction processing method of block chain, block chain node and electronic equipment
CN112597094B (en) Device and method for improving RDMA transmission efficiency
CN114866395A (en) Multi-component distributed consistency protocol cluster heartbeat communication method and device
CN112991066A (en) Consensus method and device in alliance chain and electronic equipment
CN114157716A (en) Data processing method and device based on block chain and electronic equipment
CN116635832A (en) Data processing network for data processing
CN114553727A (en) Data processing method and device based on content distribution network

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40047464

Country of ref document: HK

GR01 Patent grant
GR01 Patent grant