CN110636113A - Byzantine fault-tolerant consensus method, system, device and storage medium for blockchains - Google Patents

Byzantine fault-tolerant consensus method, system, device and storage medium for blockchains Download PDF

Info

Publication number
CN110636113A
CN110636113A CN201910782131.2A CN201910782131A CN110636113A CN 110636113 A CN110636113 A CN 110636113A CN 201910782131 A CN201910782131 A CN 201910782131A CN 110636113 A CN110636113 A CN 110636113A
Authority
CN
China
Prior art keywords
consensus
information
node
target
nodes
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.)
Pending
Application number
CN201910782131.2A
Other languages
Chinese (zh)
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.)
Shanghai University of Electric Power
Original Assignee
Shanghai University of Electric Power
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 Shanghai University of Electric Power filed Critical Shanghai University of Electric Power
Priority to CN201910782131.2A priority Critical patent/CN110636113A/en
Publication of CN110636113A publication Critical patent/CN110636113A/en
Pending legal-status Critical Current

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
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/14Network architectures or network communication protocols for network security for detecting or protecting against malicious traffic
    • H04L63/1408Network architectures or network communication protocols for network security for detecting or protecting against malicious traffic by monitoring network traffic
    • H04L63/1416Event detection, e.g. attack signature detection
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/104Peer-to-peer [P2P] networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Finance (AREA)
  • Accounting & Taxation (AREA)
  • Development Economics (AREA)
  • General Engineering & Computer Science (AREA)
  • Computing Systems (AREA)
  • Computer Hardware Design (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Strategic Management (AREA)
  • Technology Law (AREA)
  • Physics & Mathematics (AREA)
  • General Business, Economics & Management (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Small-Scale Networks (AREA)

Abstract

The invention discloses a Byzantine fault-tolerant consensus method, a system, equipment and a storage medium based on a block chain, wherein the consensus method comprises the following steps: determining a target node for issuing transaction information; acquiring transaction information and issuing the transaction information to n consensus nodes participating in consensus; numbering the n consensus nodes, and acquiring a target Gossip set according to the numbers of the n consensus nodes; updating the node information of two adjacent consensus nodes of each subset in the target Gossip set in sequence by adopting a target communication mode, and finally obtaining preliminary consensus information; and determining that the n consensus nodes agree with each other when the preliminary consensus information meets a preset condition. The invention effectively shortens the consensus processing time of the consensus process of the block chain, ensures high-efficiency consensus, can tolerate less than half of the nodes in the network as Byzantine nodes, and improves the consensus processing efficiency and fault tolerance; and meanwhile, the expansibility is also greatly improved.

Description

Byzantine fault-tolerant consensus method, system, device and storage medium for blockchains
Technical Field
The present invention relates to the field of block chain technology, and in particular, to a byzantine fault-tolerant consensus method, system, device, and storage medium based on a block chain.
Background
The block chain technology is a novel multi-center distributed account book, and combines the existing technologies of distributed storage, consensus algorithm, digital encryption, time stamping, point-to-point information transmission and the like to form a novel decentralized distributed system which ensures information safety and transparency. The consensus algorithm is the core content of the block chain, and can ensure that each node is coordinated to automatically judge whether the information is correct according to a set rule under the condition that the system is not uniformly allocated by a central node, so that the distribution consistency of the information is realized. In the consensus process, malicious nodes, also called "byzantine nodes", which may lie in information to interfere with consensus, may exist in the blockchain, which poses a great challenge to the consensus algorithm, thereby creating a byzantine consensus algorithm to solve the problem. The Byzantine consensus algorithm can still achieve consensus under the condition that malicious nodes exist, and can be flexibly applied to multiple scenes, so that the Byzantine consensus algorithm is very important in a block chain.
The common consensus algorithm for byzantine fault tolerance of block chains at present mainly comprises: PoW (Proof of Work) algorithm, PoS (Proof of merit Proof) algorithm, and PBFT (practical byzantine Fault-tolerant algorithm) algorithm. The PoW algorithm obtains the accounting right through the calculation power between the spelling nodes to achieve consensus, so a large amount of resources are wasted, the consensus efficiency is low, and the single consensus period is long; the PoS algorithm mainly calculates the rights and interests of all nodes according to the coin ages, so that the rights of some nodes are too large; the PBFT algorithm can only tolerate the byzantine error of less than one third of the nodes in the system, and the view conversion of the failed node is very complicated and has poor expansibility.
Disclosure of Invention
The invention provides a Byzantine fault-tolerant consensus method, a system, equipment and a storage medium based on a block chain, aiming at overcoming the defects that the consensus process of the block chain in the prior art has long consensus processing time and can not achieve both processing efficiency and fault tolerance.
The invention solves the technical problems through the following technical scheme:
the invention provides a Byzantine fault-tolerant consensus method based on a block chain, which comprises the following steps:
determining a target node for issuing transaction information in N nodes in a P2P network (peer-to-peer network) of a block chain;
controlling the target node to acquire the transaction information and issuing the transaction information to n consensus nodes participating in consensus in the block chain; wherein N is more than 1 and less than or equal to N, and both N and N are integers;
numbering the n consensus nodes, and acquiring a target Gossip (Gossip) sequence according to the numbers of the n consensus nodes;
the target Gossip set comprises n-1 subsets, each subset corresponds to two numbers of adjacent consensus nodes, each subset comprises node information of the two numbers of adjacent consensus nodes, and each subset in the target Gossip set is sequentially ordered according to the numbers of the consensus nodes;
determining a target communication mode among the n consensus nodes according to a Gossip protocol;
according to the numbering sequence of the consensus nodes, sequentially updating the node information of two adjacent consensus nodes of each subset in the target Gossip set by adopting the target communication mode, and taking the updated node information of two adjacent consensus nodes of the (n-1) th subset in the target Gossip set as preliminary consensus information;
and judging whether the preliminary consensus information meets a preset condition, and if so, determining that consensus is achieved among the n consensus nodes.
Preferably, the step of obtaining the target Gossip set according to the numbers of the n common nodes includes:
acquiring a corresponding spanning tree according to the plurality of consensus nodes; wherein the spanning tree comprises n-1 edges;
and sequentially ordering the n-1 edges in the spanning tree according to the number of the consensus node to form the target Gossip set.
Preferably, the step of sequentially ordering the n-1 edges in the spanning tree according to the numbers of the consensus nodes to form the target Gossip set includes:
and sequentially ordering the n-1 edges in the spanning tree from small to large or from large to small according to the number of the common nodes to form the target Gossip set.
Preferably, the step of obtaining the corresponding spanning tree according to the plurality of common nodes includes:
determining the adjacent node of each consensus node according to the communication range corresponding to the consensus node;
connecting each common node with the corresponding adjacent node to form a corresponding connected graph;
and acquiring the spanning tree by adopting a broken circle method for the connected graph.
Preferably, the node information of each consensus node in the target Gossip set is information to be consensus corresponding to each consensus node and n-1 null values;
when the consensus node is a normal node, the information to be consensus comprises the transaction information;
and when the consensus node is a malicious node, the information to be consensus comprises malicious information except the transaction information.
Preferably, the preliminary consensus information includes n pieces of information to be consensus;
judging whether the preliminary consensus information meets a preset condition, if so, determining that n consensus nodes achieve consensus comprises the following steps:
acquiring a first quantity of information belonging to the same to-be-identified information in the preliminary identification information;
when the first number is larger than n/2, determining that consensus is achieved among n consensus nodes.
Preferably, the step of determining that n of the consensus nodes agree on each other further comprises:
determining information belonging to the same to-be-identified information as target identification information; judging whether the target consensus information is consistent with the transaction information or not, if so, determining that the target consensus information is correct, storing the target consensus information, and adding the preliminary consensus information generation block into the block chain;
if not, the step of determining the target node for issuing the transaction information in the N nodes in the P2P network of the block chain is executed again.
Preferably, the step of determining a target node for issuing transaction information among N nodes in the P2P network of the blockchain includes:
acquiring the block chain length, the times of consensus under the block chain length and a second number of the consensus nodes participating in consensus;
and acquiring the number of the target node used for issuing transaction information in the P2P network of the block chain according to the length of the block chain, the times and the second number.
Preferably, the step of obtaining the number of the target node used for issuing the transaction information in the P2P network of the blockchain according to the blockchain length, the number of times and the second number corresponds to a calculation formula as follows:
a=(b+c)%n
wherein a represents the number of the target node for issuing transaction information, b represents the blockchain length, c represents the number of times of consensus under the blockchain length, and% represents a remainder.
Preferably, the target communication mode includes a Push-Pull communication mode (Push-Pull communication mode).
The invention also provides a Byzantine fault-tolerant consensus system based on the block chain, which comprises a target node determining module, a transaction information acquiring module, a transaction information issuing module, a set acquiring module, a communication mode determining module, a primary consensus information acquiring module and a first judging module;
the target node determination module is used for determining a target node used for issuing transaction information in N nodes in a P2P network of a block chain;
the transaction information acquisition module is used for controlling the target node to acquire the transaction information;
the transaction information issuing module is used for issuing the transaction information to n consensus nodes participating in consensus in the block chain; wherein N is more than 1 and less than or equal to N, and both N and N are integers;
the set acquisition module is used for numbering the n consensus nodes and acquiring a target Gossip set according to the numbers of the n consensus nodes;
the target Gossip set comprises n-1 subsets, each subset corresponds to two numbers of adjacent consensus nodes, each subset comprises node information of the two numbers of adjacent consensus nodes, and each subset in the target Gossip set is sequentially ordered according to the numbers of the consensus nodes;
the communication mode determining module is used for determining a target communication mode among the n consensus nodes according to a Gossip protocol;
the preliminary consensus information acquisition module is used for sequentially updating the node information of two adjacent consensus nodes of each subset in the target Gossip set by adopting the target communication mode according to the numbering sequence of the consensus nodes, and taking the updated node information of two adjacent consensus nodes of the (n-1) th subset in the target Gossip set as preliminary consensus information;
the first judging module is used for judging whether the preliminary consensus information meets a preset condition or not, and if so, determining that consensus is achieved among the n consensus nodes.
Preferably, the set acquiring module includes a spanning tree acquiring unit and a set acquiring unit;
the spanning tree obtaining unit is used for obtaining a corresponding spanning tree according to the plurality of common identification nodes; wherein the spanning tree comprises n-1 edges;
and the set acquisition unit is used for sequentially ordering the n-1 edges in the spanning tree according to the number of the consensus node to form the target Gossip set.
Preferably, the set obtaining unit is configured to sequentially sort the n-1 edges in the spanning tree from small to large or from large to small according to the numbers of the common nodes to form the target Gossip set.
Preferably, the spanning tree obtaining unit includes an adjacent node determining subunit, a connected graph obtaining subunit and a spanning tree obtaining subunit;
the adjacent node determining subunit is configured to determine an adjacent node of each common node according to a communication range corresponding to the common node;
the connected graph acquiring subunit is configured to connect each common node with the corresponding adjacent node to form a corresponding connected graph;
and the spanning tree obtaining subunit is used for obtaining the spanning tree by adopting a broken circle method for the connected graph.
Preferably, the node information of each consensus node in the target Gossip set is information to be consensus corresponding to each consensus node and n-1 null values;
when the consensus node is a normal node, the information to be consensus comprises the transaction information;
and when the consensus node is a malicious node, the information to be consensus comprises malicious information except the transaction information.
Preferably, the preliminary consensus information includes n pieces of information to be consensus;
the first judging module is used for acquiring a first quantity of information belonging to the same to-be-identified information in the preliminary identification information;
when the first number is larger than n/2, determining that consensus is achieved among n consensus nodes.
Preferably, the consensus system further comprises an information determination module and a second judgment module;
the information determining module is used for determining the information belonging to the same to-be-identified information as target identification information;
the second judging module is used for judging whether the target consensus information is consistent with the transaction information or not, if so, determining that the target consensus information is correct, storing the target consensus information, and adding the preliminary consensus information generating block into the block chain; if not, the target node determining module is called.
Preferably, the target node determination module includes a block chain information unit and a target node determination obtaining unit;
the block chain information unit is used for acquiring a block chain length, the number of times of consensus under the block chain length and a second number of the consensus nodes participating in the consensus;
the target node determination obtaining unit is configured to obtain, according to the blockchain length, the number of times, and the second number, a number of a target node in a P2P network of the blockchain, where the target node is used to issue transaction information.
Preferably, the target node determination obtaining unit obtains a calculation formula corresponding to a number of a target node used for issuing transaction information in the P2P network of the blockchain according to the blockchain length, the number of times, and the second number, as follows:
a=(b+c)%n
wherein a represents the number of the target node for issuing transaction information, b represents the blockchain length, c represents the number of times of consensus under the blockchain length, and% represents a remainder.
Preferably, the target communication mode includes a Push-Pull communication mode.
The invention also provides an electronic device, which comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein the processor executes the computer program to realize the above-mentioned byzantine fault-tolerant consensus method based on the block chain.
The present invention also provides a computer readable storage medium having stored thereon a computer program which, when being executed by a processor, carries out the steps of the above-mentioned block chain based byzantine fault tolerant consensus method.
The positive progress effects of the invention are as follows:
in the consensus process, each consensus node can obtain preliminary consensus information only by communicating with adjacent nodes once, so that whether consensus can be achieved among n consensus nodes is determined according to the preliminary consensus information, and when the consensus is achieved, the node information of each consensus node is determined to be the same and is the target consensus information, so that the calculation complexity is effectively reduced, the consensus processing time is shortened, the consensus processing efficiency and the fault tolerance are improved, and less than half of the nodes in the network can be tolerated as Byzantine nodes while the high-efficiency consensus is ensured; in addition, the expansibility is greatly improved, and the common nodes can still communicate with each other under the condition that a large number of nodes enter and exit in the network.
Drawings
Fig. 1 is a flowchart of a byzantine fault-tolerant consensus method based on a block chain according to embodiment 1 of the present invention.
Fig. 2 is a flowchart of a byzantine fault-tolerant consensus method based on a block chain according to embodiment 2 of the present invention.
Fig. 3 is a schematic diagram illustrating a distribution of time spent on achieving consensus under different communication modes in the byzantine fault-tolerant consensus method based on the block chain according to embodiment 2 of the present invention.
Fig. 4 is a schematic diagram illustrating the distribution of the time spent by different byzantine algorithms to achieve consensus in the block chain-based byzantine fault-tolerant consensus method according to embodiment 2 of the present invention.
Fig. 5 is a schematic diagram illustrating a comparison of extensibility corresponding to different byzantine algorithms in the block chain based byzantine fault-tolerant consensus method according to embodiment 2 of the present invention.
Fig. 6 is a block diagram of a byzantine fault-tolerant consensus system based on a block chain according to embodiment 3 of the present invention.
Fig. 7 is a block diagram of a byzantine fault-tolerant consensus system based on a block chain according to embodiment 4 of the present invention.
Fig. 8 is a schematic structural diagram of an electronic device implementing the byzantine fault-tolerant consensus method based on a block chain in embodiment 5 of the present invention.
Detailed Description
The invention is further illustrated by the following examples, which are not intended to limit the scope of the invention.
Example 1
As shown in fig. 1, the method for byzantine fault-tolerant consensus based on a block chain in this embodiment includes:
s101, determining a target node for issuing transaction information in N nodes in a P2P network of a block chain;
and S102, controlling the target node to acquire the transaction information, for example, the target node acquires the transaction information from the transaction center.
S103, issuing the transaction information to n consensus nodes participating in consensus in the block chain; wherein N is more than 1 and less than or equal to N, and both N and N are integers;
s104, numbering the n common identification nodes;
s105, acquiring a target Gossip set according to the numbers of the n consensus nodes;
the target Gossip set comprises n-1 subsets, each subset corresponds to two consensus nodes with adjacent numbers, each subset comprises node information of the two consensus nodes with adjacent numbers, and each subset in the target Gossip set is sequentially ordered according to the numbers of the consensus nodes;
s106, determining a target communication mode among the n consensus nodes according to the Gossip protocol;
preferably, the target communication mode includes a Push-Pull communication mode, that is, after any two adjacent consensus nodes are updated in one communication period, corresponding node information is completely consistent.
S107, according to the numbering sequence of the consensus nodes, sequentially updating the node information of the two adjacent consensus nodes of each subset in the target Gossip set in a target communication mode, and taking the updated node information of the two adjacent consensus nodes of the (n-1) th subset in the target Gossip set as preliminary consensus information;
s108, judging whether the preliminary consensus information meets a preset condition or not, and if so, determining that consensus is achieved among the n consensus nodes; otherwise, step S101 is executed again.
In the embodiment, n common-known nodes in a P2P network of a block chain are sequentially arranged according to the serial numbers of the common-known nodes to form a target Gossip set, node information of two adjacent common-known nodes of each subset in the target Gossip set is sequentially updated by adopting a Push-Pull communication mode until the updated node information of the (n-1) th common-known node is obtained as preliminary common-known information, and when the preliminary common-known information meets a preset condition, the n common-known nodes are determined to achieve common knowledge, namely, each common-known node only needs to communicate with the adjacent nodes once in the common-known process to obtain the preliminary common-known information, so as to determine whether the n common-known nodes can achieve common knowledge according to the preliminary common-known information, and when the common knowledge is achieved, the node information of each common-known node is the same and is the target common-known information, thereby effectively reducing the complexity of calculation, the consensus processing time is shortened, the consensus processing efficiency and the fault tolerance are improved, efficient consensus is guaranteed, and meanwhile, the situation that less than half of nodes in the network are Byzantine nodes can be tolerated.
Example 2
As shown in fig. 2, the method for byzantine fault-tolerant consensus based on block chains in this embodiment is a further improvement of embodiment 1, specifically:
step S101 includes:
s1011, acquiring the length of the block chain, the times of consensus under the length of the block chain and a second number of consensus nodes participating in consensus;
s1012, acquiring the number of the target node used for issuing the transaction information in the P2P network of the blockchain according to the length, the times and the second number of the blockchain.
In step S1012, the corresponding calculation formula is as follows:
a=(b+c)%n
wherein, a represents the number of the target node for issuing the transaction information, b represents the block chain length, c represents the number of times of consensus under the block chain length,% represents the remainder, and n is the number of consensus nodes participating in the consensus.
Step S105 includes:
s1051, obtaining a corresponding spanning tree according to the plurality of consensus nodes; wherein, the spanning tree comprises n-1 edges;
specifically, the method comprises the following steps: determining the adjacent node of each consensus node according to the communication range corresponding to the consensus node;
connecting each common node with the corresponding adjacent node to form a corresponding connected graph;
and acquiring the spanning tree by adopting a broken circle method for the connected graph.
The principle that a connected graph is formed by connecting nodes and adjacent nodes which can be covered by the corresponding communication range of the nodes and the connected graph and the spanning tree is obtained by adopting a circle-breaking method belongs to the existing mature technology, and therefore the detailed description is omitted here.
And S1052, sequentially ordering the n-1 edges in the spanning tree according to the numbers of the common nodes to form a target Gossip set.
Specifically, n-1 edges in the spanning tree are sequentially ordered from small to large or from large to small according to the number of the common nodes to form a target Gossip set.
In addition, the node information of each consensus node in the target Gossip set is information to be consensus and n-1 null values corresponding to each consensus node;
when the consensus node is a normal node, the information to be consensus comprises transaction information; the information to be consensus may also include other information that needs to be included in the consensus.
When the consensus node is a malicious node, the information to be consensus comprises malicious information except the transaction information.
The preliminary consensus information comprises n information to be consensus;
step S108 includes:
s1081, obtaining a first quantity of information to be identified in the preliminary identification information;
s1082, judging whether the first number is larger than n/2, and if yes, determining that consensus is achieved among the n consensus nodes.
Step S108 is followed by:
determining information belonging to the same to-be-identified information as target identification information;
judging whether the target consensus information is consistent with the transaction information or not, if so, determining that the target consensus information is correct, storing the target consensus information, and adding a preliminary consensus information generation block into a block chain; if not, step S101 is executed again.
The following is illustrated with reference to specific examples:
for example: the P2P network of the blockchain includes 4 nodes, the consensus node participating in consensus is 4 nodes, 1 target node for distributing transaction information is determined according to the blockchain length, the number of times of consensus performed under the blockchain length, and the number of the consensus nodes participating in consensus, and the transaction information issued by the target node is "1". The transaction information corresponding to the normal consensus node is '1', and the transaction information corresponding to the malicious consensus node is other information except '1'. Specifically, the initial node information of the consensus node with the number 1 is [1,0,0,0], the initial node information of the consensus node with the number 2 is [0,1,0,0], the initial node information of the consensus node with the number 3 is [0,0,2,0], and the initial node information of the consensus node with the number 4 is [0,0,0,1], that is, the consensus node with the number 3 is a malicious node (byertine node).
Connecting 4 consensus nodes with the numbers of 1-4 to form a connected graph, and obtaining a corresponding spanning tree by adopting a circle-breaking method, wherein the spanning tree has 3 edges, each edge is formed by two consensus nodes with adjacent numbers, and each edge is sequenced according to the sequence of the numbers from large to small to obtain a target Gossip set, namely the target Gossip set comprises 3 subsets, and each subset corresponds to one edge of the spanning tree. The first subset corresponds to the common node with the number 1 and the common node with the number 2, the second subset corresponds to the common node with the number 2 and the common node with the number 3, and the third subset corresponds to the common node with the number 3 and the common node with the number 4.
Starting from a first edge (corresponding to a first subset) of the spanning tree, communicating and updating the first subset including the consensus node with the number 1 and the consensus node with the number 2 by adopting a Push-Pull communication mode to obtain node information of [1,1,0,0 ]; judging whether the next edge is the last edge of the spanning tree, if not, starting from a second edge (corresponding to a second subset) of the spanning tree, wherein the second subset comprises the common identification node with the number 2 and the common identification node with the number 3, and obtaining node information of [1,1,2,0] after communication and updating; and continuously judging whether the next edge is the last edge of the spanning tree, if so, starting from the third edge (corresponding to a third subset) of the spanning tree, carrying out communication and updating on the third subset including the common node with the number 3 and the common node with the number 4 to obtain node information of [1,1,2,1], and taking the common node with the number 3 and the node information [1,1,2,1] corresponding to the common node with the number 4 as preliminary common information.
The preliminary consensus information includes 4 pieces of information to be consensus, which are respectively "1", "2" and "1", where the information belonging to the same piece of information to be consensus is "1", and the corresponding number is 3, and if the number of the information belonging to the same piece of information to be consensus is 3 > 4/2 ═ 2, it is determined that consensus is achieved among the 4 pieces of consensus nodes.
Then taking '1' of the same information to be identified as target identification information, comparing the target identification information '1' with transaction information '1' issued by a target node, if the target identification information '1' and the transaction information '1' are both '1', determining that the target identification information is correct, storing the target identification information, and adding a generated block of the target identification information into a block chain; if the comparison result shows that the two are not consistent, the target node is reselected to issue the transaction until the information belonging to the same to-be-identified is consistent with the transaction information issued by the target node.
The above is an example of the case where the P2P network of the blockchain includes 4 nodes, and for the case where the P2P network of the blockchain includes a great number of nodes in an actual situation, the consensus principle is similar to the above-mentioned consensus process, and therefore, the details are not described here again.
In the whole communication and updating process, each consensus node only needs to communicate with the adjacent node once, and finally the initial consensus information is used as the node information of each consensus node, namely the consensus information CI of all the consensus nodes can be obtained only through one round of communication, so that the convergence speed of the consensus algorithm is greatly improved, and the calculation complexity is reduced.
As shown in fig. 3, the time distribution of the consensus between different numbers of consensus nodes in three communication methods (Push, Pull, and Push-Pull) in the Gossip protocol is shown, where from left to right, a1-c1, a1 corresponds to the Push communication method, b1 corresponds to the Push communication method, and c1 corresponds to the Push-Pull communication method, the horizontal axis represents the number of nodes (unit: one), and the vertical axis represents the time (unit: ms) taken to achieve the consensus.
It can be seen that the time spent by the Push-Push communication mode is shortest, and the Push communication mode is next, the time spent by the Push communication mode is longest, and the reasons can be easily seen from the principles of the three communication modes.
As shown in fig. 4, the time distribution taken for achieving consensus for different byzantine algorithms (common consensus algorithm, consensus algorithm based on Gossip protocol, and consensus algorithm based on target Gossip set of spanning tree construction in this embodiment) is shown. From left to right, the parameters are a2-c2, a2 corresponds to a common consensus algorithm, b2 corresponds to a consensus algorithm based on Gossip protocol, and c2 corresponds to a consensus algorithm based on a target Gossip set of a spanning tree structure in the embodiment, wherein the horizontal axis represents the number of nodes (unit: one), and the vertical axis represents the time (unit: ms) spent on achieving consensus.
The time spent on completing consensus by the consensus algorithm based on the target Gossip set is shortest, so that the number of times of communication needed between the consensus nodes is greatly reduced, the consensus is particularly obvious in a network with more consensus nodes, the consensus speed is increased, and the time spent on consensus is shortest.
As shown in fig. 5, comparison of the extensibility of different byzantine algorithms (common consensus algorithm, consensus algorithm based on Gossip protocol, and consensus algorithm based on target Gossip set of spanning tree construction in this embodiment). From left to right, the parameters are a2-c2, a2 corresponds to a common consensus algorithm, b2 corresponds to a consensus algorithm based on Gossip protocol, and c2 corresponds to a consensus algorithm based on a target Gossip set of a spanning tree structure in the embodiment, wherein the horizontal axis represents the number of increased nodes (unit: one), and the vertical axis represents the time taken by increased consensus (unit: ms).
The difference of the expansibility of the three algorithms is reflected mainly by comparing the time spent by the added consensus under the condition of increasing the number of different consensus nodes. As can be seen from fig. 5, the common byzantine consensus algorithm takes the most time to increase consensus, which indicates that the algorithm has the worst expansibility; although the difference between the added consensus times of the two algorithms is not very large, the additional consensus time corresponding to the consensus algorithm based on the target Gossip set in the embodiment is shorter, that is, the enhancement of the extensibility is shown from the side.
In the embodiment, a connected graph is formed according to n consensus nodes in a P2P network of a block chain, a corresponding spanning tree is obtained by a circle-breaking method, then each edge of the spanning tree is sequentially arranged according to the numbers of the consensus nodes to form a target Gossip set, then the node information of two adjacent consensus nodes of each subset in the target Gossip set is sequentially updated by a Push-Pull communication mode until the updated node information of the (n-1) th consensus node is obtained as preliminary consensus information, consensus among the n consensus nodes is determined when the preliminary consensus information meets preset conditions, namely, each consensus node only needs to communicate with the adjacent node once in the consensus process to obtain the preliminary consensus information, so that whether the n preliminary consensus nodes can achieve consensus or not is determined according to the consensus information, and the node information of each consensus node is the same and is the target consensus information, therefore, the calculation complexity is effectively reduced, the consensus processing time is shortened, the consensus processing efficiency and the fault tolerance are improved, and the Byzantine nodes can be tolerated by less than half of the nodes in the network while the high-efficiency consensus is ensured; in addition, the expansibility is greatly improved, and the common nodes can still communicate with each other under the condition that a large number of nodes enter and exit in the network.
Example 3
As shown in fig. 6, the byzantine fault-tolerant consensus system based on the block chain in this embodiment includes a target node determining module 1, a transaction information obtaining module 2, a transaction information publishing module 3, a set obtaining module 4, a communication mode determining module 5, a preliminary consensus information obtaining module 6, and a first determining module 7.
The target node determination module 1 is used for determining a target node for issuing transaction information in N nodes in a P2P network of a block chain;
the transaction information obtaining module 2 is configured to control the target node to obtain the transaction information, for example, the target node obtains the transaction information from the transaction center. The transaction information issuing module 3 is used for issuing the transaction information to n consensus nodes participating in consensus in the block chain; wherein N is more than 1 and less than or equal to N, and both N and N are integers;
the set acquisition module 4 is configured to number the n consensus nodes and acquire a target Gossip set according to the numbers of the n consensus nodes;
the target Gossip set comprises n-1 subsets, each subset corresponds to two consensus nodes with adjacent numbers, each subset comprises node information of the two consensus nodes with adjacent numbers, and each subset in the target Gossip set is sequentially ordered according to the numbers of the consensus nodes;
the communication mode determining module 5 is used for determining a target communication mode among the n consensus nodes according to the Gossip protocol;
preferably, the target communication mode includes a Push-Pull communication mode, that is, after any two adjacent consensus nodes are updated in one communication period, corresponding node information is completely consistent.
The preliminary consensus information acquisition module 6 is configured to sequentially update node information of two adjacent consensus nodes of each subset in the target Gossip set in a target communication manner according to the numbering sequence of the consensus nodes, and use the updated node information of two adjacent consensus nodes of the (n-1) th subset in the target Gossip set as preliminary consensus information;
the first judging module 7 is configured to judge whether the preliminary consensus information satisfies a preset condition, and if so, determine that consensus is achieved among the n consensus nodes; otherwise, calling the target node determination module 1.
In the embodiment, n common-known nodes in a P2P network of a block chain are sequentially arranged according to the serial numbers of the common-known nodes to form a target Gossip set, node information of two adjacent common-known nodes of each subset in the target Gossip set is sequentially updated by adopting a Push-Pull communication mode until the updated node information of the (n-1) th common-known node is obtained as preliminary common-known information, and when the preliminary common-known information meets a preset condition, the n common-known nodes are determined to achieve common knowledge, namely, each common-known node only needs to communicate with the adjacent nodes once in the common-known process to obtain the preliminary common-known information, so as to determine whether the n common-known nodes can achieve common knowledge according to the preliminary common-known information, and when the common knowledge is achieved, the node information of each common-known node is the same and is the target common-known information, thereby effectively reducing the complexity of calculation, the consensus processing time is shortened, the consensus processing efficiency and the fault tolerance are improved, efficient consensus is guaranteed, and meanwhile, less than half of nodes in the network can be tolerated as Byzantine nodes; in addition, the expansibility is greatly improved, and the common nodes can still communicate with each other under the condition that a large number of nodes enter and exit in the network.
Example 4
As shown in fig. 7, the byzantine fault-tolerant consensus system based on the block chain in this embodiment is a further improvement of embodiment 3, specifically:
the target node determination module 1 includes a blockchain information unit 8 and a target node determination acquisition unit 9.
The block chain information unit 8 is configured to obtain a block chain length, a number of times of performing consensus on the block chain length, and a second number of consensus nodes participating in the consensus;
the target node determination acquiring unit 9 is configured to acquire a calculation formula corresponding to the number of the target node used for issuing the transaction information in the P2P network of the blockchain according to the blockchain length, the number of times, and the second number, as follows:
a=(b+c)%n
wherein, a represents the number of the target node for issuing the transaction information, b represents the block chain length, c represents the number of times of consensus under the block chain length,% represents the remainder, and n is the number of consensus nodes participating in the consensus.
The set acquisition module 4 includes a spanning tree acquisition unit 10 and a set acquisition unit 11.
The spanning tree obtaining unit 10 is configured to obtain a corresponding spanning tree according to the plurality of consensus nodes; wherein, the spanning tree comprises n-1 edges;
specifically, the spanning tree acquisition unit 10 includes an adjacent node determination subunit, a connected graph acquisition subunit, and a spanning tree acquisition subunit;
the adjacent node determining subunit is used for determining the adjacent node of each consensus node according to the communication range corresponding to the consensus node;
the connected graph acquiring subunit is used for connecting each common node with the corresponding adjacent node to form a corresponding connected graph;
and the spanning tree obtaining subunit is used for obtaining the spanning tree by adopting a broken circle method for the connected graph.
The set obtaining unit 11 is configured to sequentially sort the n-1 edges in the spanning tree according to the numbers of the consensus nodes to form a target Gossip set.
Specifically, the set obtaining unit is configured to sequentially sort n-1 edges in the spanning tree from small to large or from large to small according to the numbers of the common nodes to form the target Gossip set.
In addition, the node information of each consensus node in the target Gossip set is information to be consensus and n-1 null values corresponding to each consensus node;
when the consensus node is a normal node, the information to be consensus comprises transaction information; the information to be consensus may also include other information that needs to be included in the consensus.
When the consensus node is a malicious node, the information to be consensus comprises malicious information except the transaction information.
The preliminary consensus information comprises n information to be consensus;
the first judging module 7 is configured to obtain a first number of pieces of information belonging to the same to-be-identified group in the preliminary common identification information;
and when the first number is larger than n/2, determining that the n common nodes have common knowledge.
The consensus system further comprises an information determination module 12 and a second decision module 13.
The information determining module 12 is configured to determine that information belonging to the same to-be-identified group is target consensus information;
the second judging module 13 is configured to judge whether the target consensus information is consistent with the transaction information, determine that the target consensus information is correct if the target consensus information is consistent with the transaction information, store the target consensus information, and add the preliminary consensus information generating block to the block chain; if not, the target node determining module is called.
The following is illustrated with reference to specific examples:
for example: the P2P network of the blockchain includes 4 nodes, the consensus node participating in consensus is 4 nodes, 1 target node for distributing transaction information is determined according to the blockchain length, the number of times of consensus performed under the blockchain length, and the number of the consensus nodes participating in consensus, and the transaction information issued by the target node is "1". The transaction information corresponding to the normal consensus node is '1', and the transaction information corresponding to the malicious consensus node is other information except '1'. Specifically, the initial node information of the consensus node with the number 1 is [1,0,0,0], the initial node information of the consensus node with the number 2 is [0,1,0,0], the initial node information of the consensus node with the number 3 is [0,0,2,0], and the initial node information of the consensus node with the number 4 is [0,0,0,1], that is, the consensus node with the number 3 is a malicious node (byertine node).
Connecting 4 consensus nodes with the numbers of 1-4 to form a connected graph, and obtaining a corresponding spanning tree by adopting a circle-breaking method, wherein the spanning tree has 3 edges, each edge is formed by two consensus nodes with adjacent numbers, and each edge is sequenced according to the sequence of the numbers from large to small to obtain a target Gossip set, namely the target Gossip set comprises 3 subsets, and each subset corresponds to one edge of the spanning tree. The first subset corresponds to the common node with the number 1 and the common node with the number 2, the second subset corresponds to the common node with the number 2 and the common node with the number 3, and the third subset corresponds to the common node with the number 3 and the common node with the number 4.
Starting from a first edge (corresponding to a first subset) of the spanning tree, communicating and updating the first subset including the consensus node with the number 1 and the consensus node with the number 2 by adopting a Push-Pull communication mode to obtain node information of [1,1,0,0 ]; judging whether the next edge is the last edge of the spanning tree, if not, starting from a second edge (corresponding to a second subset) of the spanning tree, wherein the second subset comprises the common identification node with the number 2 and the common identification node with the number 3, and obtaining node information of [1,1,2,0] after communication and updating; and continuously judging whether the next edge is the last edge of the spanning tree, if so, starting from the third edge (corresponding to a third subset) of the spanning tree, carrying out communication and updating on the third subset including the common node with the number 3 and the common node with the number 4 to obtain node information of [1,1,2,1], and taking the common node with the number 3 and the node information [1,1,2,1] corresponding to the common node with the number 4 as preliminary common information.
The preliminary consensus information includes 4 pieces of information to be consensus, which are respectively "1", "2" and "1", where the information belonging to the same piece of information to be consensus is "1", and the corresponding number is 3, and if the number of the information belonging to the same piece of information to be consensus is 3 > 4/2 ═ 2, it is determined that consensus is achieved among the 4 pieces of consensus nodes.
Then taking '1' of the same information to be identified as target identification information, comparing the target identification information '1' with transaction information '1' issued by a target node, if the target identification information '1' and the transaction information '1' are both '1', determining that the target identification information is correct, storing the target identification information, and adding a generated block of the target identification information into a block chain; if the comparison result shows that the two are not consistent, the target node is reselected to issue the transaction until the information belonging to the same to-be-identified is consistent with the transaction information issued by the target node.
The above is an example of the case where the P2P network of the blockchain includes 4 nodes, and for the case where the P2P network of the blockchain includes a great number of nodes in an actual situation, the consensus principle is similar to the above-mentioned consensus process, and therefore, the details are not described here again.
In the whole communication and updating process, each consensus node only needs to communicate with the adjacent node once, and finally the initial consensus information is used as the node information of each consensus node, namely the consensus information CI of all the consensus nodes can be obtained only through one round of communication, so that the convergence speed of the consensus algorithm is greatly improved, and the calculation complexity is reduced.
As shown in fig. 3, the time distribution of the consensus between different numbers of consensus nodes in three communication methods (Push, Pull, and Push-Pull) in the Gossip protocol is shown, where from left to right, a1-c1, a1 corresponds to the Push communication method, b1 corresponds to the Push communication method, and c1 corresponds to the Push-Pull communication method, the horizontal axis represents the number of nodes (unit: one), and the vertical axis represents the time (unit: ms) taken to achieve the consensus.
It can be seen that the time spent by the Push-Push communication mode is shortest, and the Push communication mode is next, the time spent by the Push communication mode is longest, and the reasons can be easily seen from the principles of the three communication modes.
As shown in fig. 4, the time distribution taken for achieving consensus for different byzantine algorithms (common consensus algorithm, consensus algorithm based on Gossip protocol, and consensus algorithm based on target Gossip set of spanning tree construction in this embodiment) is shown. From left to right, the parameters are a2-c2, a2 corresponds to a common consensus algorithm, b2 corresponds to a consensus algorithm based on Gossip protocol, and c2 corresponds to a consensus algorithm based on a target Gossip set of a spanning tree structure in the embodiment, wherein the horizontal axis represents the number of nodes (unit: one), and the vertical axis represents the time (unit: ms) spent on achieving consensus.
The time spent on completing consensus by the consensus algorithm based on the target Gossip set is shortest, so that the number of times of communication needed between the consensus nodes is greatly reduced, the consensus is particularly obvious in a network with more consensus nodes, the consensus speed is increased, and the time spent on consensus is shortest.
As shown in fig. 5, comparison of the extensibility of different byzantine algorithms (common consensus algorithm, consensus algorithm based on Gossip protocol, and consensus algorithm based on target Gossip set of spanning tree construction in this embodiment). From left to right, the parameters are a2-c2, a2 corresponds to a common consensus algorithm, b2 corresponds to a consensus algorithm based on Gossip protocol, and c2 corresponds to a consensus algorithm based on a target Gossip set of a spanning tree structure in the embodiment, wherein the horizontal axis represents the number of increased nodes (unit: one), and the vertical axis represents the time taken by increased consensus (unit: ms).
The difference of the expansibility of the three algorithms is reflected mainly by comparing the time spent by the added consensus under the condition of increasing the number of different consensus nodes. As can be seen from fig. 5, the common byzantine consensus algorithm takes the most time to increase consensus, which indicates that the algorithm has the worst expansibility; although the difference between the added consensus times of the two algorithms is not very large, the additional consensus time corresponding to the consensus algorithm based on the target Gossip set in the embodiment is shorter, that is, the enhancement of the extensibility is shown from the side.
In the embodiment, a connected graph is formed according to n consensus nodes in a P2P network of a block chain, a corresponding spanning tree is obtained by a circle-breaking method, then each edge of the spanning tree is sequentially arranged according to the numbers of the consensus nodes to form a target Gossip set, then the node information of two adjacent consensus nodes of each subset in the target Gossip set is sequentially updated by a Push-Pull communication mode until the updated node information of the (n-1) th consensus node is obtained as preliminary consensus information, consensus among the n consensus nodes is determined when the preliminary consensus information meets preset conditions, namely, each consensus node only needs to communicate with the adjacent node once in the consensus process to obtain the preliminary consensus information, so that whether the n preliminary consensus nodes can achieve consensus or not is determined according to the consensus information, and the node information of each consensus node is the same and is the target consensus information, therefore, the calculation complexity is effectively reduced, the consensus processing time is shortened, the consensus processing efficiency and the fault tolerance are improved, and the Byzantine nodes can be tolerated by less than half of the nodes in the network while the high-efficiency consensus is ensured; in addition, the expansibility is greatly improved, and the common nodes can still communicate with each other under the condition that a large number of nodes enter and exit in the network.
Example 5
Fig. 8 is a schematic structural diagram of an electronic device according to embodiment 5 of the present invention. The electronic device comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein the processor executes the program to implement the block chain based byzantine fault tolerance consensus method in any one of embodiments 1 or 2. The electronic device 30 shown in fig. 8 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiment of the present invention.
As shown in fig. 8, the electronic device 30 may be embodied in the form of a general purpose computing device, which may be, for example, a server device. The components of the electronic device 30 may include, but are not limited to: the at least one processor 31, the at least one memory 32, and a bus 33 connecting the various system components (including the memory 32 and the processor 31).
The bus 33 includes a data bus, an address bus, and a control bus.
The memory 32 may include volatile memory, such as Random Access Memory (RAM)321 and/or cache memory 322, and may further include Read Only Memory (ROM) 323.
Memory 32 may also include a program/utility 325 having a set (at least one) of program modules 324, such program modules 324 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may comprise an implementation of a network environment.
The processor 31 executes a computer program stored in the memory 32 to execute various functional applications and data processing, such as the byzantine fault-tolerant consensus method based on the block chain in any one of the embodiments 1 or 2 of the present invention.
The electronic device 30 may also communicate with one or more external devices 34 (e.g., keyboard, pointing device, etc.). Such communication may be through input/output (I/O) interfaces 35. Also, model-generating device 30 may also communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the Internet) via network adapter 36. As shown in FIG. 8, network adapter 36 communicates with the other modules of model-generating device 30 via bus 33. It should be understood that although not shown in the figures, other hardware and/or software modules may be used in conjunction with the model-generating device 30, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID (disk array) systems, tape drives, and data backup storage systems, etc.
It should be noted that although in the above detailed description several units/modules or sub-units/modules of the electronic device are mentioned, such a division is merely exemplary and not mandatory. Indeed, the features and functionality of two or more of the units/modules described above may be embodied in one unit/module according to embodiments of the invention. Conversely, the features and functions of one unit/module described above may be further divided into embodiments by a plurality of units/modules.
Example 6
The present embodiment provides a computer-readable storage medium, on which a computer program is stored, which when executed by a processor implements the steps in the block chain based byzantine fault tolerant consensus method in any of embodiments 1 or 2.
More specific examples, among others, that the readable storage medium may employ may include, but are not limited to: a portable disk, a hard disk, random access memory, read only memory, erasable programmable read only memory, optical storage device, magnetic storage device, or any suitable combination of the foregoing.
In a possible implementation manner, the present invention can also be implemented in the form of a program product, which includes program code for causing a terminal device to execute the steps of implementing the block chain based byzantine fault tolerant consensus method in any of embodiments 1 or 2, when the program product is run on the terminal device.
Where program code for carrying out the invention is written in any combination of one or more programming languages, the program code may execute entirely on the user device, partly on the user device, as a stand-alone software package, partly on the user device and partly on a remote device or entirely on the remote device.
While specific embodiments of the invention have been described above, it will be appreciated by those skilled in the art that this is by way of example only, and that the scope of the invention is defined by the appended claims. Various changes and modifications to these embodiments may be made by those skilled in the art without departing from the spirit and scope of the invention, and these changes and modifications are within the scope of the invention.

Claims (22)

1. A Byzantine fault-tolerant consensus method based on a block chain is characterized by comprising the following steps:
determining a target node for issuing transaction information in N nodes in a P2P network of a blockchain;
controlling the target node to acquire the transaction information and issuing the transaction information to n consensus nodes participating in consensus in the block chain; wherein N is more than 1 and less than or equal to N, and both N and N are integers;
numbering the n consensus nodes, and acquiring a target Gossip set according to the numbers of the n consensus nodes;
the target Gossip set comprises n-1 subsets, each subset corresponds to two numbers of adjacent consensus nodes, each subset comprises node information of the two numbers of adjacent consensus nodes, and each subset in the target Gossip set is sequentially ordered according to the numbers of the consensus nodes;
determining a target communication mode among the n consensus nodes according to a Gossip protocol;
according to the numbering sequence of the consensus nodes, sequentially updating the node information of two adjacent consensus nodes of each subset in the target Gossip set by adopting the target communication mode, and taking the updated node information of two adjacent consensus nodes of the (n-1) th subset in the target Gossip set as preliminary consensus information;
and judging whether the preliminary consensus information meets a preset condition, and if so, determining that consensus is achieved among the n consensus nodes.
2. The block chain based byzantine fault tolerant consensus method of claim 1, wherein said step of obtaining a target Gossip set based on the number of n of said consensus nodes comprises:
acquiring a corresponding spanning tree according to the plurality of consensus nodes; wherein the spanning tree comprises n-1 edges;
and sequentially ordering the n-1 edges in the spanning tree according to the number of the consensus node to form the target Gossip set.
3. The Byzantine fault-tolerant consensus method based on block chains as claimed in claim 2, wherein said step of sequentially ordering n-1 edges in said spanning tree according to the number of said consensus nodes to form said target Gossip set comprises:
and sequentially ordering the n-1 edges in the spanning tree from small to large or from large to small according to the number of the common nodes to form the target Gossip set.
4. The block chain based byzantine fault tolerant consensus method of claim 2, wherein said step of obtaining a corresponding spanning tree from a plurality of said consensus nodes comprises:
determining the adjacent node of each consensus node according to the communication range corresponding to the consensus node;
connecting each common node with the corresponding adjacent node to form a corresponding connected graph;
and acquiring the spanning tree by adopting a broken circle method for the connected graph.
5. The block chain based byzantine fault tolerant consensus method of claim 1, wherein the node information of each of the consensus nodes in the target Gossip set is information to be consensus and n-1 nulls corresponding to each of the consensus nodes;
when the consensus node is a normal node, the information to be consensus comprises the transaction information;
and when the consensus node is a malicious node, the information to be consensus comprises malicious information except the transaction information.
6. The block chain based byzantine fault tolerant consensus method of claim 5, wherein the preliminary consensus information comprises n information of the to-be-consensus;
the step of judging whether the preliminary consensus information meets a preset condition, and if so, determining that consensus among the n consensus nodes is achieved comprises the following steps:
acquiring a first quantity of information belonging to the same to-be-identified information in the preliminary identification information;
when the first number is larger than n/2, determining that consensus is achieved among n consensus nodes.
7. The block chain based byzantine fault tolerant consensus method of claim 6, wherein said step of determining that consensus is achieved among n of said consensus nodes is further followed by:
determining information belonging to the same to-be-identified information as target identification information; judging whether the target consensus information is consistent with the transaction information or not, if so, determining that the target consensus information is correct, storing the target consensus information, and adding the preliminary consensus information generation block into the block chain;
if not, the step of determining the target node for issuing the transaction information in the N nodes in the P2P network of the block chain is executed again.
8. The blockchain-based byzantine fault-tolerant consensus method of claim 1, wherein the step of determining a target node of N nodes in the P2P network of blockchains for publishing the transaction information comprises:
acquiring the block chain length, the times of consensus under the block chain length and a second number of the consensus nodes participating in consensus;
and acquiring the number of the target node used for issuing transaction information in the P2P network of the block chain according to the length of the block chain, the times and the second number.
9. The blockchain-based byzantine fault-tolerant consensus method according to claim 8, wherein the step of obtaining the number of the target node for issuing transaction information in the P2P network of the blockchain according to the blockchain length, the number of times, and the second number corresponds to a calculation formula as follows:
a=(b+c)%n
wherein a represents the number of the target node for issuing transaction information, b represents the blockchain length, c represents the number of times of consensus under the blockchain length, and% represents a remainder.
10. The block chain based byzantine fault tolerant consensus method of claim 1, wherein the target communication mode comprises a Push-Pull communication mode.
11. A Byzantine fault-tolerant consensus system based on a block chain is characterized by comprising a target node determining module, a transaction information acquiring module, a transaction information issuing module, a set acquiring module, a communication mode determining module, a primary consensus information acquiring module and a first judging module;
the target node determination module is used for determining a target node used for issuing transaction information in N nodes in a P2P network of a block chain;
the transaction information acquisition module is used for controlling the target node to acquire the transaction information;
the transaction information issuing module is used for issuing the transaction information to n consensus nodes participating in consensus in the block chain; wherein N is more than 1 and less than or equal to N, and both N and N are integers;
the set acquisition module is used for numbering the n consensus nodes and acquiring a target Gossip set according to the numbers of the n consensus nodes;
the target Gossip set comprises n-1 subsets, each subset corresponds to two numbers of adjacent consensus nodes, each subset comprises node information of the two numbers of adjacent consensus nodes, and each subset in the target Gossip set is sequentially ordered according to the numbers of the consensus nodes;
the communication mode determining module is used for determining a target communication mode among the n consensus nodes according to a Gossip protocol;
the preliminary consensus information acquisition module is used for sequentially updating the node information of two adjacent consensus nodes of each subset in the target Gossip set by adopting the target communication mode according to the numbering sequence of the consensus nodes, and taking the updated node information of two adjacent consensus nodes of the (n-1) th subset in the target Gossip set as preliminary consensus information;
the first judging module is used for judging whether the preliminary consensus information meets a preset condition or not, and if so, determining that consensus is achieved among the n consensus nodes.
12. The blockchain-based byzantine fault-tolerant consensus system of claim 11, wherein the set acquisition module comprises a spanning tree acquisition unit and a set acquisition unit;
the spanning tree obtaining unit is used for obtaining a corresponding spanning tree according to the plurality of common identification nodes; wherein the spanning tree comprises n-1 edges;
and the set acquisition unit is used for sequentially ordering the n-1 edges in the spanning tree according to the number of the consensus node to form the target Gossip set.
13. The block chain based byzantine fault tolerant consensus system of claim 12, wherein the set obtaining unit is configured to order n-1 edges in the spanning tree sequentially from small to large or from large to small according to the number of the consensus node to form the target Gossip set.
14. The blockchain-based byzantine fault-tolerant consensus system of claim 12, wherein the spanning tree acquisition unit comprises a neighboring node determination subunit, a connectivity graph acquisition subunit, and a spanning tree acquisition subunit;
the adjacent node determining subunit is configured to determine an adjacent node of each common node according to a communication range corresponding to the common node;
the connected graph acquiring subunit is configured to connect each common node with the corresponding adjacent node to form a corresponding connected graph;
and the spanning tree obtaining subunit is used for obtaining the spanning tree by adopting a broken circle method for the connected graph.
15. The block chain based byzantine fault tolerant consensus system of claim 11, wherein the node information for each of the consensus nodes in the target Gossip set is information to be consensus and n-1 nulls corresponding to each of the consensus nodes;
when the consensus node is a normal node, the information to be consensus comprises the transaction information;
and when the consensus node is a malicious node, the information to be consensus comprises malicious information except the transaction information.
16. The blockchain-based byzantine fault-tolerant consensus system of claim 15, wherein the preliminary consensus information comprises n of the information to be consensus;
the first judging module is used for acquiring a first quantity of information belonging to the same to-be-identified information in the preliminary identification information;
when the first number is larger than n/2, determining that consensus is achieved among n consensus nodes.
17. The blockchain-based byzantine fault-tolerant consensus system of claim 16, wherein the consensus system further comprises an information determination module and a second determination module;
the information determining module is used for determining the information belonging to the same to-be-identified information as target identification information;
the second judging module is used for judging whether the target consensus information is consistent with the transaction information or not, if so, determining that the target consensus information is correct, storing the target consensus information, and adding the preliminary consensus information generating block into the block chain; if not, the target node determining module is called.
18. The blockchain-based byzantine fault-tolerant consensus system of claim 11, wherein the target node determination module comprises a blockchain information unit and a target node determination acquisition unit;
the block chain information unit is used for acquiring a block chain length, the number of times of consensus under the block chain length and a second number of the consensus nodes participating in the consensus;
the target node determination obtaining unit is configured to obtain, according to the blockchain length, the number of times, and the second number, a number of the target node in a P2P network of the blockchain, where the target node is used to issue transaction information.
19. The blockchain-based byzantine fault-tolerant consensus system according to claim 18, wherein the target node determination obtaining unit obtains a calculation formula corresponding to a number of the target node for issuing the transaction information in the P2P network of the blockchain according to the blockchain length, the number of times, and the second number as follows:
a=(b+c)%n
wherein a represents the number of the target node for issuing transaction information, b represents the blockchain length, c represents the number of times of consensus under the blockchain length, and% represents a remainder.
20. The blockchain-based byzantine fault-tolerant consensus system of claim 11, wherein the target communication mode comprises a Push-Pull communication mode.
21. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor when executing the computer program implements the block chain based byzantine fault tolerant consensus method according to any one of claims 1 to 10.
22. A computer-readable storage medium, having stored thereon a computer program, wherein the computer program, when being executed by a processor, is adapted to carry out the steps of the block chain based byzantine fault tolerant consensus method according to one of the claims 1 to 10.
CN201910782131.2A 2019-08-23 2019-08-23 Byzantine fault-tolerant consensus method, system, device and storage medium for blockchains Pending CN110636113A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910782131.2A CN110636113A (en) 2019-08-23 2019-08-23 Byzantine fault-tolerant consensus method, system, device and storage medium for blockchains

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910782131.2A CN110636113A (en) 2019-08-23 2019-08-23 Byzantine fault-tolerant consensus method, system, device and storage medium for blockchains

Publications (1)

Publication Number Publication Date
CN110636113A true CN110636113A (en) 2019-12-31

Family

ID=68970490

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910782131.2A Pending CN110636113A (en) 2019-08-23 2019-08-23 Byzantine fault-tolerant consensus method, system, device and storage medium for blockchains

Country Status (1)

Country Link
CN (1) CN110636113A (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111198895A (en) * 2020-02-18 2020-05-26 夏南南 Block chain updating method
CN111682942A (en) * 2020-05-18 2020-09-18 哈尔滨工业大学 Binary weighted Byzantine fault-tolerant consensus method applied to permit chain
CN111866076A (en) * 2020-06-18 2020-10-30 中电健康云科技有限公司 Discrete acquisition front-end processor node data synchronization method based on gossip protocol
CN112818409A (en) * 2020-07-03 2021-05-18 支付宝(杭州)信息技术有限公司 Block generation method and consensus node
CN112865959A (en) * 2020-12-30 2021-05-28 杭州趣链科技有限公司 Consensus method of distributed node equipment, node equipment and distributed network
CN114629772A (en) * 2022-03-22 2022-06-14 浙江大学 Byzantine fault-tolerant method, device, system, electronic device and storage medium
CN114663091A (en) * 2022-03-25 2022-06-24 上海电力大学 Power transaction method based on multi-chain block chain architecture

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW201832513A (en) * 2017-01-31 2018-09-01 安地卡及巴布達商區塊鏈控股有限公司 Computer-implemented system and method for updating a network's knowledge of the network's topology
CN109246122A (en) * 2018-09-29 2019-01-18 上海海事大学 A kind of Byzantine failure tolerance block chain generation method based on gossip propagation agreement
CN109327548A (en) * 2018-11-27 2019-02-12 北京瑞卓喜投科技发展有限公司 A kind of block chain update method and block chain more new system
WO2019072263A2 (en) * 2018-11-07 2019-04-18 Alibaba Group Holding Limited Facilitating practical byzantine fault tolerance blockchain consensus and node synchronization

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW201832513A (en) * 2017-01-31 2018-09-01 安地卡及巴布達商區塊鏈控股有限公司 Computer-implemented system and method for updating a network's knowledge of the network's topology
CN109246122A (en) * 2018-09-29 2019-01-18 上海海事大学 A kind of Byzantine failure tolerance block chain generation method based on gossip propagation agreement
WO2019072263A2 (en) * 2018-11-07 2019-04-18 Alibaba Group Holding Limited Facilitating practical byzantine fault tolerance blockchain consensus and node synchronization
CN109327548A (en) * 2018-11-27 2019-02-12 北京瑞卓喜投科技发展有限公司 A kind of block chain update method and block chain more new system

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
K. HAN,G. PEI,B. RAVINDRAN,E. D. JENSEN: ""Real-Time, Byzantine-Tolerant Information Dissemination in Unreliable and Untrustworthy Distributed Systems"", 《2008 IEEE INTERNATIONAL CONFERENCE ON COMMUNICATIONS》 *
张仕将,柴晶,陈泽华,贺海武: ""基于Gossip协议的拜占庭共识算法"", 《计算机科学》 *

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111198895A (en) * 2020-02-18 2020-05-26 夏南南 Block chain updating method
CN111682942A (en) * 2020-05-18 2020-09-18 哈尔滨工业大学 Binary weighted Byzantine fault-tolerant consensus method applied to permit chain
CN111682942B (en) * 2020-05-18 2022-06-10 哈尔滨工业大学 Binary weighted Byzantine fault-tolerant consensus method applied to license chain
CN111866076A (en) * 2020-06-18 2020-10-30 中电健康云科技有限公司 Discrete acquisition front-end processor node data synchronization method based on gossip protocol
CN112818409A (en) * 2020-07-03 2021-05-18 支付宝(杭州)信息技术有限公司 Block generation method and consensus node
CN112818409B (en) * 2020-07-03 2022-06-14 支付宝(杭州)信息技术有限公司 Block generation method and consensus node
CN112865959A (en) * 2020-12-30 2021-05-28 杭州趣链科技有限公司 Consensus method of distributed node equipment, node equipment and distributed network
CN114629772A (en) * 2022-03-22 2022-06-14 浙江大学 Byzantine fault-tolerant method, device, system, electronic device and storage medium
CN114629772B (en) * 2022-03-22 2023-03-10 浙江大学 Byzantine fault tolerance method, device, system, electronic device and storage medium
CN114663091A (en) * 2022-03-25 2022-06-24 上海电力大学 Power transaction method based on multi-chain block chain architecture
CN114663091B (en) * 2022-03-25 2023-01-31 上海电力大学 Power transaction method based on multi-chain block chain architecture

Similar Documents

Publication Publication Date Title
CN110636113A (en) Byzantine fault-tolerant consensus method, system, device and storage medium for blockchains
CN107733855A (en) A kind of block catenary system and application process that can support publicly-owned chain, alliance's chain and privately owned chain simultaneously
CN111630507A (en) Distributed blockchain data storage under account model
JP7050955B2 (en) Prioritize storage of shared blockchain data
EP3432157B1 (en) Data table joining mode processing method and apparatus
CN111630830A (en) Distributed blockchain data storage under account model
CN109886693B (en) Consensus realization method, device, equipment and medium for block chain system
TWI719797B (en) Storage and execution method and device of smart contract in blockchain and electronic equipment
Isaila et al. Collective I/O tuning using analytical and machine learning models
US20150019680A1 (en) Systems and Methods for Consistent Hashing Using Multiple Hash Rlngs
CN111553670B (en) Transaction processing method and device and computer readable storage medium
US20220358119A1 (en) Blockchain consensus method, apparatus and device
Fu et al. A study on the optimization of blockchain hashing algorithm based on PRCA
CN110704438B (en) Method and device for generating bloom filter in blockchain
WO2021190179A1 (en) Synchronous processing method and related apparatus
CN114726517A (en) Method, system and consensus node for generating random number seeds on block chain
Jia et al. Se-chain: A scalable storage and efficient retrieval model for blockchain
Biswas et al. A novel leader election algorithm based on resources for ring networks
CN114884652A (en) Method, system and consensus node for generating random number seed on block chain
Qin et al. A secure and effective construction scheme for blockchain networks
CN112148350A (en) Remote version management method for works, electronic device and computer storage medium
US20170300553A1 (en) System and methodology for propagating modifications in key-value pairs across a cluster of computers
CN111553669A (en) Transaction routing method, device and computer readable storage medium
EP3939236B1 (en) Node and cluster management on distributed self-governed ecosystem
Wels Guaranteed-TX: The exploration of a guaranteed cross-shard transaction execution protocol for Ethereum 2.0.

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20191231