CN112184454A - Block chain consensus method, device, system and storage medium - Google Patents

Block chain consensus method, device, system and storage medium Download PDF

Info

Publication number
CN112184454A
CN112184454A CN202011239853.2A CN202011239853A CN112184454A CN 112184454 A CN112184454 A CN 112184454A CN 202011239853 A CN202011239853 A CN 202011239853A CN 112184454 A CN112184454 A CN 112184454A
Authority
CN
China
Prior art keywords
node
transaction
candidate
information
receiving
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.)
Granted
Application number
CN202011239853.2A
Other languages
Chinese (zh)
Other versions
CN112184454B (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.)
Du Xiaoman Technology Beijing Co Ltd
Original Assignee
Shanghai Youyang New Media Information Technology 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 Shanghai Youyang New Media Information Technology Co ltd filed Critical Shanghai Youyang New Media Information Technology Co ltd
Priority to CN202011239853.2A priority Critical patent/CN112184454B/en
Publication of CN112184454A publication Critical patent/CN112184454A/en
Application granted granted Critical
Publication of CN112184454B publication Critical patent/CN112184454B/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
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
    • 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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/64Protecting data integrity, e.g. using checksums, certificates or signatures

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Business, Economics & Management (AREA)
  • General Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Finance (AREA)
  • Computer Hardware Design (AREA)
  • General Health & Medical Sciences (AREA)
  • Software Systems (AREA)
  • Bioethics (AREA)
  • Accounting & Taxation (AREA)
  • Health & Medical Sciences (AREA)
  • Data Mining & Analysis (AREA)
  • Computing Systems (AREA)
  • Development Economics (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Strategic Management (AREA)
  • Technology Law (AREA)
  • General Business, Economics & Management (AREA)
  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a block chain consensus method, a device, a system and a storage medium, which are used for determining a transaction to be subjected to block chain consensus; acquiring at least one first candidate node related to an initiating node of a transaction and at least one second candidate node related to a receiving node of the transaction in the ordered virtual ring; determining a first node of the at least one first candidate node and a second node of the at least one second candidate node; if the first node determines that the label checking state of the initiating node and at least one first candidate node on the transaction meets a first label checking condition, and the second node determines that the label checking state of the receiving node and at least one second candidate node on the transaction meets a second label checking condition, block information for generating and characterizing the transaction is respectively stored in the initiating node, the at least one first candidate node, the receiving node and the at least one second candidate node. On the basis of not needing to create a decentralized environment, complete decentralized and resource consumption reduction are achieved when the block chains are in consensus.

Description

Block chain consensus method, device, system and storage medium
Technical Field
The present invention relates to the field of consensus mechanisms, and in particular, to a method, an apparatus, a system, and a storage medium for block chain consensus.
Background
With the development of science and technology, digital currency represented by Bitcoin (Bitcoin) rises, and a bottom layer support framework of the digital currency, namely a block chain (Blockchain), is widely concerned by the characteristics of decentralized credit, data non-falsification and the like.
The consensus mechanism of the current block chain is mainly divided into two categories: the traditional Chinese people have smart class consensus and BFT class consensus. The former is mainly applied to the field of public chains, including POW (proof of work), POS (proof of stamp), etc., the POW can realize complete decentralization, but brings with it a large amount of resource consumption, and although the POS reduces the resource consumption to a certain extent, the distributors of interest slowly concentrate on a few hands, and cannot meet the requirement of complete decentralization; for the BFT type consensus, the BFT type consensus is mainly applied to the field of alliance chains at present, better performance can be realized under a small number of nodes, the BFT type consensus cannot be directly used in public chains, and a decentralized environment needs to be created by combining the alliance chains and the public chains.
Disclosure of Invention
In view of the above, the present invention provides a method, an apparatus, a system and a storage medium for blockchain consensus, so as to achieve the objective of compatible complete decentralization and resource consumption reduction during blockchain consensus without creating a decentralization environment. The technical scheme is as follows:
the invention discloses a block chain consensus method in a first aspect, which comprises the following steps:
determining a transaction to be subjected to block chain consensus;
acquiring at least one first candidate node related to an initiating node of the transaction and at least one second candidate node related to a receiving node of the transaction in an ordered virtual ring formed by all nodes of a block chain, wherein the positions of the nodes in the ordered virtual ring are independent of the physical positions of the nodes;
determining a first node of the initiating node of the at least one first candidate node and a second node of the receiving node of the at least one second candidate node;
if the first node determines that the label checking state of the initiating node and the at least one first candidate node on the transaction meets a preset first label checking condition, and the second node determines that the label checking state of the receiving node and the at least one second candidate node on the transaction meets a preset second label checking condition, block information representing the transaction is generated;
storing the block information into the originating node, the at least one first candidate node, the receiving node, and the at least one second candidate node, respectively.
Optionally, the method further includes a generation process of the ordered virtual ring, where the generation process of the ordered virtual ring includes:
acquiring node information of each node in all nodes of the block chain;
calculating the hash value of the node according to the node information of the node;
and sorting all the nodes in the block chain by utilizing the hash values of the nodes to generate an ordered virtual ring of the block chain.
Optionally, obtaining at least one first candidate node related to the initiating node of the transaction and at least one second candidate node related to the receiving node of the transaction in an ordered virtual ring formed by all nodes of the blockchain includes:
determining a first number of nodes in the ordered virtual ring that are nearest neighbors to an originating node of the transaction as at least one first candidate node associated with the originating node;
obtaining a second number of nodes in the ordered virtual ring that are nearest neighbors to a receiving node of the transaction as at least one second candidate node associated with the receiving node.
Optionally, the determining, by the first node, that the signature verification status of the initiating node and the at least one first candidate node for the transaction satisfies a preset first signature verification condition, and determining, by the second node, that the signature verification status of the receiving node and the at least one second candidate node for the transaction satisfies a preset second signature verification condition includes:
the first node determines that the signing verification information of the initiating node for the transaction characterizes successful signing verification, and a third number of third candidate nodes exist in the at least one first candidate node, wherein the signing verification information of the initiating node for the transaction characterizes successful signing verification;
and the number of the first and second electrodes,
the second node determines that the receiving node is successful in verifying the signature of the transaction, and a fourth number of fourth candidate nodes exist in the at least one second candidate node, and the fourth candidate node is successful in verifying the signature of the transaction.
Optionally, the generating block information characterizing the transaction includes:
determining first information transmitted by the first node to the second node and second information transmitted by the second node to the first node; the first information comprises the signing information of the initiating node and the third candidate node for the transaction, and the second information comprises the signing information of the receiving node and the fourth candidate node for the transaction;
generating first block information for the transaction stored at the first node from the second information;
generating second block information for the transaction stored at the second node using the first information.
Optionally, the storing the block information in the initiating node, the at least one first candidate node, the receiving node, and the at least one second candidate node respectively includes:
broadcasting the first block information to each node except the first node in the initiating node and the at least one first candidate node, wherein the first block information is used for triggering the node receiving the first block information to locally store the first block information;
broadcasting the second block information to each node except the second node among the receiving node and the at least one second candidate node, wherein the second block information is used for triggering the node receiving the second block information to locally store the second block information.
Optionally, the method further includes:
generating first reward information of the initiating node to the first node and second reward information of the receiving node to the second node according to the transaction;
storing the first reward information in the first block information of the originating node and the first node, and storing the second reward information in the second block information of the receiving node and the second node.
The second aspect of the present invention discloses a block chain consensus device, comprising:
the system comprises a first determining unit, a second determining unit and a third determining unit, wherein the first determining unit is used for determining the transaction of block chain consensus to be carried out;
a first obtaining unit, configured to obtain at least one first candidate node related to an initiating node of the transaction and at least one second candidate node related to a receiving node of the transaction in an ordered virtual ring formed by all nodes of a blockchain, where a position of the node in the ordered virtual ring is independent of a physical position of the node;
a second determining unit, configured to determine a first node of the initiating node in the at least one first candidate node and a second node of the receiving node in the at least one second candidate node;
a first generating unit, configured to generate block information representing the transaction if the first node determines that the signature verification status of the initiating node and the at least one first candidate node for the transaction satisfies a preset first signature verification condition, and the second node determines that the signature verification status of the receiving node and the at least one second candidate node for the transaction satisfies a preset second signature verification condition;
a first storage unit, configured to store the block information in the initiating node, the at least one first candidate node, the receiving node, and the at least one second candidate node, respectively.
A third aspect of the present invention discloses a blockchain, comprising:
the system comprises an initiating node and at least one first candidate node, wherein the initiating node is used for determining a transaction to be subjected to block chain consensus, acquiring at least one first candidate node related to the initiating node of the transaction in an ordered virtual ring formed by all nodes of a block chain, and determining the first node of the initiating node in the at least one first candidate node;
a receiving node for obtaining at least one second candidate node in the ordered virtual ring associated with a receiving node of the transaction and determining a second node of the receiving nodes in the at least one second candidate node; the position of the node in the ordered virtual ring is independent of the physical position of the node;
the first node and the second node are both used for generating block information representing the transaction if the signing check states of the initiating node and the at least one first candidate node on the transaction meet a preset first signing check condition and the signing check states of the receiving node and the at least one second candidate node on the transaction meet a preset second signing check condition;
the first candidate node is used for returning the signature verification state of the transaction and storing the block information of the transaction to the first node;
the second candidate nodes are all used for returning the signature verification state of the transaction and storing the block information of the transaction to the second node;
the initiating node and the receiving node are also used for storing block information of the transaction
A fourth aspect of the present invention discloses a computer-readable storage medium having stored thereon computer-executable instructions for performing the block chain consensus method as disclosed in any one of the above first aspects of the present invention.
The application provides a block chain consensus method, a block chain consensus device, a block chain consensus system and a storage medium, wherein all nodes in a block chain form an ordered virtual ring, and because the positions of the nodes in the ordered virtual ring are irrelevant to the physical positions of the nodes, the positions of all the nodes in the block chain can be disordered through the ordered virtual ring. Based on this, after determining the originating node and the receiving node of the transaction, the physical locations of the at least one first candidate node associated with the originating node obtained from the ordered virtual ring in the blockchain are dispersed and the locations in the ordered virtual ring are correlated, and the physical locations of the at least one second candidate node associated with the receiving node obtained from the ordered virtual ring in the blockchain are dispersed and the locations in the ordered virtual ring are correlated. Therefore, whether the transaction consensus is successful or not is determined based on the signature verification information of the at least one first candidate node and the at least one second candidate node on the transaction, the purpose of decentralization can be effectively achieved, and particularly, the more nodes on the blockchain, the more obvious decentralization effect is, and the setting can approach to complete decentralization. In addition, the transaction consensus can be realized only on the basis of partial nodes (the initiating node, the receiving node, the first candidate node and the second candidate node) in the block chain, so that the consensus efficiency is effectively improved, and the resource consumption is reduced. Furthermore, the transaction consensus can be realized only on the basis of partial nodes in the block chain, and other nodes in the block chain can also perform consensus of other transactions at the same time, so that the consensus efficiency can be further improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a flowchart of a block chain consensus method according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of an ordered virtual ring of a block chain according to an embodiment of the present invention;
fig. 3 is a flowchart of another block chain consensus method according to an embodiment of the present invention;
fig. 4 is a schematic diagram illustrating a block chain consensus method according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a block chain consensus device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In this application, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
Example (b):
based on the above background art, it is difficult to satisfy both complete decentralization and high performance on the basis of not creating decentralization environment in the existing public chain consensus mechanism, and a choice needs to be made.
In view of this, embodiments of the present application provide a method, an apparatus, a system, and a storage medium for blockchain consensus, where decentralization and scalability of blockchain consensus are achieved through an dht fragmentation technique, and the decentralization degree is higher when more nodes are provided, and when the number of nodes reaches a certain scale, the decentralization is similar to complete decentralization from the perspective of probability; and on the basis, the local asynchronous multi-stage consensus is realized, the decentralized requirement is met, meanwhile, the high-performance processing capacity of a distributed network is possessed, the response speed of the consensus is greatly improved, and the linear promotion can be realized along with the increase of the number of the nodes.
The present application provides a blockchain consensus method (which may also be referred to as an asynchronous multistage consensus method), in which all actions can be abstracted into a Transaction (the Transaction is more similar to a Transaction in the database domain, rather than a bottleneck Transaction in the payment domain). To facilitate the general flow of the blockchain consensus algorithm, we first make the following assumptions for the consensus scenario:
for a batch of transactions sent from node A to node B, denoted TB (transaction batch)
The candidate node of the node A is marked as CandidateSet _ A, and the candidate node of the node A can also be called a first candidate node;
the candidate node of the node B is marked as CandidateSet _ B, and the candidate node of the node B may also be referred to as a second candidate node;
for the TB, the consensus agent determined by the node A is marked as A ', and the consensus agent A' of the node A is one of the first candidate nodes of the node A;
the consensus agent determined by the node B is denoted B ', and the consensus agent B' of the node B is one of the second candidate nodes of the node B.
The CandidateSet determination method is as follows:
1. all nodes in the block chain form an ordered virtual ring through dht network;
2. the candidate set node of the node A is a group of nodes determined by a candidate set node determination method, the determination method is built in the block chain consensus implementation scheme, and all other nodes can verify whether another node is a candidate set node of the node A or not. For example, one candidate set node determination method is: on the ordered virtual ring, the first n nodes of node a are naturally candidate set nodes of a.
In conjunction with the above description of the consensus scenario, a detailed description is provided below for a block chain consensus method provided in the embodiments of the present application. Fig. 1 is a flowchart of a block chain consensus method according to an embodiment of the present disclosure.
As shown in fig. 1, the method includes:
s101, determining a block chain consensus transaction to be carried out;
the block chain is composed of a plurality of nodes, and all the nodes in the block chain form an ordered virtual ring. The generation process of the ordered virtual ring of the block chain comprises the following steps: determining all nodes in the block chain, acquiring node information of each node, calculating hash values of the nodes according to the node information of the nodes, wherein the hash values of all the nodes in the block chain are different from each other, and sequencing all the nodes in the block chain according to the hash values of the nodes to generate an ordered virtual ring.
The method for sorting all the nodes in the block chain according to the hash values of the nodes to generate the ordered virtual ring may be as follows: and sequencing all nodes in the block chain according to the sequence of the hash values of the nodes from small to large to obtain a node sequence, wherein the node with the small hash value in the node sequence points to the node with the large hash value adjacent to the node, and the last node in the node sequence points to the first node in the node sequence to generate the ordered virtual ring. For example, if the blockchain is composed of 8 nodes, which are respectively node 1, node 2, node 3, node 4, node 5, node 6, node 7, and node 8, where the node 2, node 3, node 1, node 5, node 6, node 8, node 4, and node 7 are sequentially arranged in the order of the hash value from small to large, the ordered virtual ring of the blockchain is as shown in fig. 2.
In this embodiment, the node information of the node may include a node MAC address, a node IP address, and a node IP address and node area combination information. The node information may be any one or more of a node MAC address, a node IP address, and combination information.
The above is only a preferred way to form an ordered virtual ring from all nodes of a block chain, which is provided by the embodiment of the present invention. The inventor can set the specific generation method of the ordered virtual ring according to the needs of the inventor, and the embodiment of the application is not limited.
S102, acquiring at least one first candidate node related to a transaction initiating node and at least one second candidate node related to a transaction receiving node in an ordered virtual ring formed by all nodes of a block chain, wherein the positions of the nodes in the ordered virtual ring are independent of the physical positions of the nodes;
a transaction sent from one node of the blockchain to another may be considered to be a transaction to be subject to blockchain consensus, the node sending the transaction is referred to as the originating node of the transaction, and the node to which the transaction is sent is referred to as the receiving node of the transaction. For example, a transaction is sent from node a to node B, where node a may be considered the originating node of the transaction and node B may be considered the receiving node of the transaction.
All nodes of the block chain form an ordered virtual ring, each node related to the initiating node in the ordered virtual ring can be obtained, and each obtained node is called as a first candidate node of the initiating node, so that at least one first candidate node related to the initiating node can be obtained from the ordered virtual ring. Correspondingly, each node related to the receiving node in the ordered virtual ring may also be acquired, and each acquired node is referred to as a second candidate node of the receiving node, so that at least one second candidate node related to the receiving node may be acquired from the ordered virtual ring.
In this embodiment of the present application, the manner of obtaining at least one first candidate node related to the transaction initiating node in the ordered virtual ring may be: a first number of nodes in the ordered virtual ring that are nearest neighbors to an originating node of the transaction are determined as at least one first candidate node associated with the originating node.
One way, the first number may be preset. Alternatively, the first ratio may be preset, and if the first ratio is preset, the product of the total number of nodes in the ordered virtual ring and the first ratio may be used as the first number.
As a preferred implementation manner of the embodiment of the present application, the first number of nodes nearest to the initiating node of the transaction in the ordered virtual ring may be: a first number of nodes in the ordered virtual ring that are immediately adjacent to the originating node of the transaction before the originating node of the transaction.
As another preferred implementation manner of the embodiment of the present application, the first number of nodes nearest to the initiating node of the transaction in the ordered virtual ring may be: a first number of nodes in the ordered virtual ring that are nearest neighbors to the originating node of the transaction after the originating node of the transaction.
As another preferred implementation manner of the embodiment of the present application, the first number of nodes nearest to the initiating node of the transaction in the ordered virtual ring may be: a fifth number of nodes in the ordered virtual ring that are immediately adjacent to the originating node of the transaction before the originating node of the transaction, and a sixth number of nodes in the ordered virtual ring that are immediately adjacent to the originating node of the transaction after the originating node of the transaction. Wherein the sum of the fifth number and the sixth number is the first number.
For example, a first number is preset, and the preset first data amount is 6, referring to fig. 2, if the initiating node is the node 5, the ordered virtual ring is located at 6 nodes nearest to the initiating node (node 5) of the transaction before the initiating node (node 5) of the transaction, and is determined as at least one first candidate node related to the initiating node (node 5), that is, the node 1, the node 3, the node 2, the node 7, the node 4, and the node 8 are determined as at least one first candidate node related to the initiating node (node 5). Or, 6 nodes which are positioned in the ordered virtual ring after the initiating node (node 5) of the transaction and are nearest to the initiating node (node 5) of the transaction are determined as at least one first candidate node related to the initiating node (node 5), namely, the nodes 6, 8, 4, 7, 2 and 3 are determined as at least one first candidate node related to the initiating node (node 5). Or, 3 (fifth number) nodes which are positioned before the initiating node (node 5) of the transaction in the ordered virtual ring and are nearest to the initiating node (node 5) of the transaction and 3 (sixth number) nodes which are positioned after the initiating node (node 5) of the transaction in the ordered virtual ring and are nearest to the initiating node (node 5) of the transaction are determined as at least one first candidate node related to the initiating node (node 5), namely, the node 1, the node 2, the node 3, the node 6, the node 8 and the node 4 are determined as at least one first candidate node related to the initiating node (node 5).
In this embodiment of the present application, the manner of obtaining at least one second candidate node related to the receiving node of the transaction in the ordered virtual ring may be: a second number of nodes in the ordered virtual ring that are nearest neighbors to a recipient node of the transaction are obtained as at least one second candidate node associated with the recipient node.
In one way, the second number may be preset. Alternatively, a second ratio may be preset, and if the second ratio is preset, the product of the total number of nodes in the ordered virtual ring and the second ratio may be used as the second number.
As a preferred implementation manner of the embodiment of the present application, the second number of nodes in the ordered virtual ring that are nearest neighbors to the receiving node of the transaction may be: a second number of nodes in the ordered virtual ring that are immediately adjacent to the receiving node of the transaction before the receiving node of the transaction.
As another preferred implementation manner of the embodiment of the present application, the second number of nodes in the ordered virtual ring that are nearest neighbors to the receiving node of the transaction may be: a second number of nodes in the ordered virtual ring that are nearest neighbors to the receiving node of the transaction after the receiving node of the transaction.
As another preferred implementation manner of the embodiment of the present application, the second number of nodes in the ordered virtual ring that are nearest neighbors to the receiving node of the transaction may be: a seventh quantity of nodes in the ordered virtual ring that are immediately adjacent to the receiving node of the transaction before the receiving node of the transaction, and an eighth quantity of nodes in the ordered virtual ring that are immediately adjacent to the receiving node of the transaction after the receiving node of the transaction. Wherein the sum of the seventh number and the eighth number is the second number.
For example, if the initiating node is the node 4, and the preset second data volume is 6, referring to fig. 2, if the initiating node is the node 4, the 6 nodes, which are located before the receiving node (node 4) of the transaction and are nearest to the receiving node (node 4) of the transaction, of the ordered virtual ring are determined as at least one second candidate node related to the receiving node (node 4), that is, the node 2, the node 3, the node 1, the node 5, the node 6, and the node 8 are determined as at least one second candidate node related to the receiving node (node 4). Alternatively, the 6 nodes closest to the receiving node (node 4) of the transaction in the ordered virtual ring after the receiving node (node 4) of the transaction are determined as at least one second candidate node related to the receiving node (node 4), i.e. the node 7, the node 2, the node 3, the node 1, the node 5 and the node 6 are determined as at least one second candidate node related to the receiving node (node 4). Alternatively, the 3 (seventh number) nodes nearest to the receiving node (node 4) of the transaction before the receiving node (node 4) of the transaction in the ordered virtual ring and the 3 (eighth number) nodes nearest to the receiving node (node 4) of the transaction after the receiving node (node 4) of the transaction in the ordered virtual ring are determined as at least one second candidate node related to the receiving node (node 4), that is, the node 5, the node 6, the node 8, the node 7, the node 2 and the node 3 are determined as at least one second candidate node related to the receiving node (node 4).
The above is only the preferred way of determining at least one first candidate node and at least one second candidate node provided in the embodiments of the present application, and the inventors may set the preferred way of determining at least one first candidate node and at least one second candidate node according to their own needs, which is not limited herein.
S103, determining a first node of an initiating node in at least one first candidate node and a second node of a receiving node in at least one second candidate node;
the embodiment of the application provides a transparent public consensus agent computing method, based on which a node used as a consensus agent of an initiating node can be determined from at least one first candidate node, and the determined node used as the consensus agent of the initiating node can be called a first node for convenience of distinguishing.
The transparent public consensus agent calculation method may tend to select a node with a higher R value, which may be considered as a credit value of the node, and the inventor may set the allocation mode of the R value according to his own needs, which is not limited herein.
Accordingly, a node for the consensus agent as the receiving node may be determined from the at least one second candidate node based on the transparent public consensus agent calculation manner, and the determined node for the consensus agent as the receiving node may be referred to as the second node for convenience of distinguishing.
S104, if the first node determines that the label checking state of the initiating node and at least one first candidate node on the transaction meets a preset first label checking condition, and the second node determines that the label checking state of the receiving node and at least one second candidate node on the transaction meets a preset second label checking condition, block information representing the transaction is generated;
in the embodiment of the application, the first node collects the signature verification information of the initiating node on the transaction and the signature verification information of at least one first candidate node on the transaction; the second node collects the verification information of the receiving node for the transaction and the verification information of at least one second candidate node for the transaction, and further can preliminarily determine that the transaction verification is successful when the first node determines that the verification information of the initiating node for the transaction and the verification information of at least one first candidate node for the transaction meet a first verification condition and the second node determines that the verification information of the receiving node for the transaction and the verification information of at least one second candidate node for the transaction meet a second verification condition, namely preliminarily determines that the node in the block chain agrees with the transaction; otherwise, determining that the transaction signature verification fails, namely determining that the nodes in the blockchain do not agree on the transaction.
The signature verification information of the initiating node for the transaction characterizes that the signature verification is successful, and the first node can determine that the signature verification state of the initiating node and the at least one first candidate node for the transaction meets a first signature verification condition when a third number of third candidate nodes exist in the at least one first candidate node. And the third candidate node is the first candidate node which represents successful signature verification on the signature verification information of the transaction.
The receiving node may determine that the signature verification state of the receiving node and the at least one second candidate node for the transaction satisfies a preset second signature verification condition, where the signature verification information of the transaction by the receiving node represents that the signature verification is successful, and a fourth number of fourth candidate nodes exist in the at least one second candidate node. And the fourth candidate node represents the second candidate node with successful signature verification for the signature verification information of the transaction.
In this embodiment of the application, the third quantity and the fourth quantity may be the same or different, a specific numerical value related to the third quantity is related to the first label-checking condition, a specific numerical value related to the fourth quantity is related to the second label-checking condition, and specific contents related to the first label-checking condition and the second label-checking condition may be set by the inventor according to his own needs, which is not limited herein.
S105, respectively storing the block information into the initiating node, the at least one first candidate node, the receiving node and the at least one second candidate node.
In the embodiment of the application, after the transaction verification is preliminarily determined to be successful, first block information of the transaction can be generated and stored at the first node, and second block information of the transaction can be generated and stored at the second node. And the first block information and the second block information both carry block identifiers.
It should be noted that, the block chain consensus method provided in the embodiment of the present application provides two ways, namely a pessimistic mode and an optimistic mode, based on asynchronous multistage consensus, so as to meet different concurrency requirements.
The pessimistic mode has the advantages that a node can attentively make the consensus of the current transaction, and after the account book is successfully written/fails, the node continues the next transaction. However, for some high-frequency transactions, the transactions are easily blocked, and the application also provides a corresponding optimistic mode, and under the optimistic mode, the concurrent execution of multiple transaction consensus can be simultaneously realized by one node. The pessimistic mode and optimistic mode switching mode may be set by the inventor according to the needs of the inventor, and is not limited herein.
In the embodiment of the application, after a transaction initiated by a node, if the transaction is successfully identified, first block information of the transaction is respectively stored in each node of a first node set to which the initiating node of the transaction belongs, and second block information of the transaction is respectively stored in each node of a second node set to which a receiving node of the transaction belongs. The first node set is an initiating node and at least one first candidate node, and the second node set is a receiving node and at least one second candidate node.
The block identification of the block information stored in the node is related to the order of the transaction to which the block information belongs in the transaction consensus sequence of the node, and the transaction with consensus failure is not included in the transaction consensus sequence.
Furthermore, after the preliminary confirmation of the transaction consensus is successful, the further confirmation of the transaction consensus can be realized by the way that the first node transmits the first information to the second node and the second node transmits the second information to the first node. The first information comprises the signature verification information of the initiating node and the third candidate node on the transaction, and the second information comprises the signature verification information of the receiving node and the fourth candidate node on the transaction.
And the first node checks and signs the second information after receiving the second information, and the second node checks and signs the first information after receiving the first information, if the first node successfully checks and signs the second information and the second node successfully checks and signs the first information, the transaction consensus is determined to be successful, at the moment, the first node generates and stores the first block information, and the second node generates and stores the second block information.
In this embodiment of the present application, storing the block information in the initiating node, the at least one first candidate node, the receiving node, and the at least one second candidate node respectively includes: broadcasting, by the first node, the first block information to each of the originating node and the at least one first candidate node other than the first node, respectively, and broadcasting, by the second node, the second block information to each of the receiving node and the at least one second candidate node other than the second node, respectively.
Accordingly, the node receiving the first block information may locally store the first block information at the node, that is, the originating node may locally store the first block information at the originating node after receiving the first block information, and the first candidate node may locally store the first block information at the first candidate node after receiving the first block information.
The node receiving the second blocking information may store the second blocking information locally at the node, i.e. the receiving node may store the second blocking information locally at the receiving node after receiving the second blocking information, and the second candidate node may store the second blocking information locally at the second candidate node after receiving the second blocking information.
In the embodiment of the present application, whether the first block information or the second block information may be considered as block information, and the block information may be composed of signature verification information of an initiating node to transaction, signature verification information of a third candidate node to transaction, signature verification information of a receiving node to transaction, signature verification information of a fourth candidate node to transaction, and transaction. It should be noted that the block id of the block information is related to the consensus sequence of the transaction belonging to the block information at the node, the block id of the first block information may be the same as the block id of the second block information, and the block id of the first block information may also be different from the block id of the second block information.
Fig. 3 is a flowchart of another block chain consensus method according to an embodiment of the present disclosure.
As shown in fig. 3, the method includes:
s301, determining a transaction to be subjected to block chain consensus;
s302, at least one first candidate node related to a transaction initiating node and at least one second candidate node related to a transaction receiving node in an ordered virtual ring formed by all nodes of a block chain are obtained, and the positions of the nodes in the ordered virtual ring are independent of the physical positions of the nodes;
s303, determining a first node of an initiating node in at least one first candidate node and a second node of a receiving node in at least one second candidate node;
s304, if the first node determines that the label checking state of the initiating node and at least one first candidate node for the transaction meets a preset first label checking condition, and the second node determines that the label checking state of the receiving node and at least one second candidate node for the transaction meets a preset second label checking condition, block information representing the transaction is generated;
s305, respectively storing the block information into the initiating node, the at least one first candidate node, the receiving node and the at least one second candidate node;
the execution process of steps S301 to S305 shown in fig. 3 provided in the embodiment of the present application is the same as the execution process of steps S101 to S105 provided in the above embodiment, and for the specific execution manner of steps S301 to S305, please refer to the detailed description of steps S101 to S105, which is not limited herein.
S306, generating first reward information of the initiating node to the first node and second reward information of the receiving node to the second node according to the transaction;
in the embodiment of the application, after the transaction consensus is successful and the accounting is completed, the initiating node may generate first reward information according to the transaction and the receiving node may generate second reward information according to the transaction.
S307, storing the first reward information in the first block information of the initiating node and the first node, and storing the second reward information in the second block information of the receiving node and the second node.
After generating the first reward information of the transaction, the initiating node may further store the first reward information in the first block information of the transaction locally stored by the initiating node, and send the first reward information to the first node, so as to further store the first reward information in the first block information of the transaction locally stored by the first node.
After generating the second incentive information of the transaction, the receiving node may further store the second incentive information in the second block information of the transaction locally stored by the receiving node, and send the second incentive information to the second node, so as to further store the second incentive information in the second block information of the transaction locally stored by the second node.
In the embodiment of the present application, the first incentive information and the second incentive information are both incentive information, and the incentive information may be regarded as token.
The embodiment of the application has the greatest characteristic that the embodiment is established on the basis of dht network fragmentation, the network is divided into local area networks through dht fragmentation, and consensus is carried out on the basis. The nodes participating in consensus are screened out through an dht algorithm, as long as enough nodes can be considered to meet random distribution, the nodes in any interval [ n-i, n + i ] can be considered to meet random sampling, and therefore the block chain consensus method provided by the embodiment of the application is established on the basis of decentralization; meanwhile, with the increase of nodes, the fragmentation scale is linearly expandable.
In addition, the block chain consensus method provided by the embodiment of the application realizes asynchronous multi-stage consensus, each stage in the asynchronous multi-stage consensus process is performed in an asynchronous mode, and in the specific realization process, the consensus core process is realized through a consensus agent, so that the performance is greatly improved; meanwhile, except for the accounting of the transaction initiator, the receiving party can also store the same account book, along with the increase of the scale of the account book, the probability of intersection among different account books is higher and higher, and the difficulty of cheating on the account book is increased geometrically.
Furthermore, the block chain consensus method provided by the embodiment of the application realizes algorithm and excitation complementation, realizes consensus purely based on the algorithm, and is difficult to simultaneously meet the requirements of expansion, safety, performance and certainty on a general level. Therefore, configurable options (such as a first number, a second number, a third number, a fourth number, and the like) are reserved, and the service is made configurable according to the service characteristics of the service. Meanwhile, the R value and token are combined to cooperate in an excitation mode for supplementation, so that a feasible consensus mechanism in actual operation is realized.
Fig. 4 is a schematic diagram of a block chain consensus method according to an embodiment of the present disclosure. A block chain consensus method provided in the present embodiment is described in detail below with reference to the block chain consensus method diagram shown in fig. 4.
Referring to fig. 4, a transaction TB sent by node a to node B is determined, where node a may be considered as an initiating node of the transaction TB, and node B may be a receiving node of the transaction TB; the node A (initiating node) encrypts the transaction TB by using a private key a of the node A to generate a signature Sa, and identifies the signature Sa to generate a unique identifier Ea; determining 5 (a first number) nodes which are positioned in the ordered virtual ring and are nearest to and adjacent to the node A (the initiating node) before the node A (the initiating node) as at least one first candidate node related to the node A (the initiating node), and determining a first node (a consensus agent node A') used as the node A (the initiating node) from the at least one first candidate node based on a transparent public consensus agent calculation mode; and packaging and sending < transaction TB, signature Sa, public keys a and Ea corresponding to the private key a and a first node (consensus agent node A') > to a node B (receiving node).
The node B (receiving node) checks the signature Sa by using the public key a, if the check is successful, 5 (second number) nodes which are positioned in the ordered virtual ring and are nearest to the node B (receiving node) are determined as at least one second candidate node related to the node B (receiving node), and a second node (consensus agent node B') used as the node B (receiving node) is determined from the at least one second candidate node based on a transparent public consensus agent computing mode; signing the received transaction TB by using a private key b of the user to generate a signature Sb, and identifying the signature Sb to generate a unique identifier Eb; and packaging and sending the < signature Sb, the public key B corresponding to the private key B, Eb and a second node (consensus agent node B') > to the node A (initiating node).
After receiving the packaging information returned by the node B (the receiving node), the node A (the initiating node) sends < transaction TB, signature Sa, < public key a, Ea and signature B corresponding to the private key a, < public key B and Eb corresponding to the private key B, < signature verification information of the initiating node > and a second node (a consensus agent node B ') > (signature verification information of the initiating node) to a first node (the consensus agent node A'); after transmitting the generated packet information to the node a, the node B (receiving node) transmits < transaction TB, signature Sa, public keys a and Ea corresponding to the private key a, the first node (consensus agent node a '), the signature B, a public key B corresponding to the private key B, and Eb > (signature verification information of the receiving node) to the second node (consensus agent node B').
The first node (consensus agent node A') checks the signature Sa by using a public key a and checks the signature Sb by using a public key b; if the signature Sa is successfully verified by using the public key a and the signature Sb is successfully verified by using the public key B, determining that the node A (initiating node) and the node B (receiving node) achieve consensus on the transaction TB, namely determining that the signature verification information representation of the transaction TB is successfully verified by the node A (initiating node) and the signature verification information representation of the transaction TB is successfully verified by the node B (receiving node); the first node (consensus agent node a ') encrypts the transaction TB with a private key a ' to generate a signature Sa ', determines a current timestamp, associates the determined timestamp < transaction TB, signature Sa, a public key a corresponding to the private key a, a signature B, a public key B corresponding to the private key B, the second node (consensus agent node B '), a public key a ' corresponding to the private key a ', and a signature Sa ' > and transmits < transaction TB, signature Sa, a public key a corresponding to the private key a, a signature B, a public key B corresponding to the private key B, the second node (consensus agent node B '), a public key a ' corresponding to the private key a ', and a signature Sa ' > associated with the timestamp to at least one first candidate node of the node a (initiating node).
The second node (consensus agent node B') checks the signature Sa by using the public key a and checks the signature Sb by using the public key B; if the signature Sa is successfully verified by the public key a and the signature Sb is successfully verified by the public key B, the node A (initiating node) and the node B (receiving node) are determined to achieve consensus on the transaction TB, namely the signature verification information representation of the transaction TB by the node A (initiating node) is successfully verified, and the signature verification information representation of the transaction TB by the node B (receiving node) is successfully verified. The second node (consensus agent node B ') encrypts the transaction TB with the private key B ' to generate a signature Sb ', determines the current timestamp, associates the determined timestamp < transaction TB, signature Sa, the public key a corresponding to the private key a, signature Sb, the public key B corresponding to the private key B, the first node (consensus agent node a '), the public key B ' corresponding to the private key B ' and the signature Sb ' > and sends < transaction TB, signature Sa, the public key a corresponding to the private key a, signature Sb, the public key B corresponding to the private key B, the first node (consensus agent node a '), the public key B ' corresponding to the private key B ' and the signature Sb ' > associated with the timestamp to at least one second candidate node CandidateSet _ B of the node B (receiving node).
For each first candidate node CandidateSet _ A of the at least one first candidate node, the first candidate node CandidateSet _ A determines whether the current consensus time exceeds a preset consensus time according to the associated timestamp; if the current consensus time does not exceed the preset consensus time, the first candidate node CandidateSet _ A judges whether the node sending the transaction TB, the signature Sa, the public key a corresponding to the private key a, the signature Sb, the public key B corresponding to the private key B, the second node (consensus agent node B '), the public key a ' corresponding to the private key a ', and the signature Sa ' > is the first node (consensus agent node A ') according to a verifiable random algorithm; if the signature Sa is verified based on the public key a, the signature Sb is verified based on the public key b, the signature Sa 'is verified based on the public key a', if the signature Sa is successfully verified by the public key a, the signature Sb is successfully verified based on the public key b, and the signature Sa 'is successfully verified based on the public key a', the first candidate node CandidateSet _ A encrypts the transaction TB by using the own private key a 'to generate the encrypted signature Sa', and the signature verification information of the first candidate node CandidateSet _ A is generated according to the signature Sa 'and the public key a'; and determining the current timestamp, associating the current timestamp with the signature verification information, and sending the signature verification information associated with the current timestamp to the first node (the consensus agent node A').
For each second candidate node CandidateSet _ B of the at least one second candidate node, the second candidate node CandidateSet _ B determines whether the current consensus time exceeds a preset consensus time according to the associated timestamp; if the current consensus time does not exceed the preset consensus time, the second candidate node judges whether the node sending the transaction TB, the signature Sa, the public key a corresponding to the private key a, the signature Sb, the public key B corresponding to the private key B, the second node (consensus proxy node B '), the public key B ' corresponding to the private key B ' and the signature Sb ' > is the second node (consensus proxy node B ') according to a verifiable random algorithm; if yes, verifying the signature Sa based on the public key a, verifying the signature Sb based on the public key B, and verifying the signature Sb ' based on the public key B ', if the public key a successfully verifies the signature Sa, successfully verifying the signature Sb based on the public key B, and successfully verifying the signature Sb ' based on the public key B ', encrypting the transaction TB by using the private key B ' of the second candidate node CandidateSet _ B to generate a signature Sb, and generating the signature verification information of the second candidate node CandidateSet _ B according to the signature Sb ' and the public key B '; and determining the current timestamp, associating the current timestamp with the signature verification information, and sending the signature verification information associated with the current timestamp to a second node (a consensus agent node B').
After a first node (consensus agent node A ') receives the signature verification information returned by the first candidate node CandidateSet _ A, whether the current consensus time exceeds the preset consensus time is judged according to a timestamp associated with the signature verification information, if the current consensus time does not exceed the preset consensus time, the signature Sa is compared and verified according to a public key a' in the signature verification information of the first candidate node CandidateSet _ A, and if verification is successful, it is determined that the first candidate node successfully verifies the transaction TB, namely, the signature verification information returned by the first candidate node CandidateSet _ A represents that signature verification is successful. And judging whether the number of the first candidate nodes CandidateSet _ A (third candidate nodes) returning the signature verification information representing the successful signature verification is larger than or equal to a third number.
After receiving the signature verification information returned by the second candidate node CandidateSet _ B, the second node (consensus agent node B ') judges whether the current consensus time exceeds the preset consensus time according to the timestamp associated with the signature verification information, if the current consensus time does not exceed the preset consensus time, the signature Sb ' is verified according to a public key B ' in the signature verification information of the second candidate node CandidateSet _ B, and if the verification is successful, the second candidate node is determined to be successful in signature verification on the transaction TB, namely the signature verification information returned by the second candidate node CandidateSet _ B represents that the signature verification is successful. And judging whether the number of second candidate nodes CandidateSet _ B (third candidate nodes) returning the signature verification information representing the successful signature verification is larger than or equal to a fourth number.
In case the number of first candidate nodes CandidateSet _ a (third candidate nodes) returning the signing information characterizing successful signing is larger than or equal to the third number and the number of second candidate nodes CandidateSet _ B (third candidate nodes) returning the signing information characterizing successful signing is larger than or equal to the fourth number, i.e. in case the first node determines that the signing information of the originating node-to-transaction and the signing information of the at least one first candidate node-to-transaction satisfy the first signing condition and the second node determines that the signing information of the receiving node-to-transaction and the signing information of the at least one second candidate node-to-transaction satisfy the second signing condition, the transaction signing success may be preliminarily determined, i.e. the node-to-transaction in the blockchain is preliminarily determined to agree on the transaction.
The first node (consensus agent node A ') sends first information (the signature verification information of the initiating node and the third candidate node on the transaction TB) to the second node (consensus agent node B '), and the second node (consensus agent node B) sends second information (the signature verification information of the receiving node and the fourth candidate node on the transaction TB) to the first node (consensus agent node A '); the first node (consensus agent node A ') checks the second information after receiving the second information, and the second node (consensus agent node B) checks the first information after receiving the first information, and if the first node (consensus agent node A ') successfully checks the second information and the second node (consensus agent node B) successfully checks the first information, it is determined that the transaction is successful, at which time the first block information is generated and stored by the first node (consensus agent node A '), and the second block information is generated and stored by the second node (consensus agent node B), and the first block information is broadcasted by the first node (consensus agent node A ') to each of the initiating node and the at least one first candidate node other than the first node (consensus agent node A '), and the second node (consensus agent node B) broadcasts the first block information to the receiving node and the at least one second candidate node other than the second node, respectively Each node other than the node (consensus proxy node B) broadcasts the second block information.
After the transaction consensus is successful and the accounting is completed, the node a (initiating node) may generate first reward information according to the transaction TB, further store the first reward information in the locally stored first block information of the transaction, and send the first reward information to the first node (consensus agent node a ') so as to further store the first reward information in the locally stored first block information of the transaction at the first node (consensus agent node a'); the node B (receiving node) may generate second reward information according to the transaction TB, further store the second reward information in the locally stored second block information of the transaction, and transmit the second reward information to the second node (consensus proxy node B ') so as to further store the second reward information in the second block information of the transaction locally stored by the second node (consensus proxy node B').
Corresponding to the block chain consensus method disclosed in the above-mentioned embodiment of the present invention, referring to fig. 5, an embodiment of the present invention further provides a schematic structural diagram of a block chain consensus device, where the block chain consensus device includes:
a first determining unit 51, configured to determine that a block chain consensus transaction is to be performed;
a first obtaining unit 52, configured to obtain at least one first candidate node related to an initiating node of a transaction and at least one second candidate node related to a receiving node of the transaction in an ordered virtual ring formed by all nodes of a blockchain, where a position of a node in the ordered virtual ring is independent of a physical position of the node;
a second determining unit 53, configured to determine a first node of the initiating node in the at least one first candidate node and a second node of the receiving node in the at least one second candidate node;
a first generating unit 54, configured to generate block information representing a transaction if the first node determines that the signature verification status of the transaction by the initiating node and the at least one first candidate node meets a preset first signature verification condition, and the second node determines that the signature verification status of the transaction by the receiving node and the at least one second candidate node meets a preset second signature verification condition;
the first storage unit 55 is configured to store the block information into the originating node, the at least one first candidate node, the receiving node, and the at least one second candidate node, respectively.
Further, the blockchain consensus device provided by the present application further includes a generation process of the ordered virtual ring, where the generation process of the ordered virtual ring includes:
a second obtaining unit, configured to obtain node information of each node in all nodes of the block chain;
the computing unit is used for computing the hash value of the node according to the node information of the node;
and the second generation unit is used for sorting all the nodes in the block chain by using the hash values of the nodes to generate the ordered virtual ring of the block chain.
In this embodiment of the application, preferably, the first obtaining unit includes:
a third determining unit, configured to determine, as at least one first candidate node related to an initiating node, a first number of nodes in the ordered virtual ring that are nearest neighbors to the initiating node of the transaction;
and the fourth determining unit is used for acquiring a second number of nodes which are nearest to the receiving node of the transaction in the ordered virtual ring as at least one second candidate node related to the receiving node.
In the embodiment of the present application, it is preferable that the first generation unit includes:
the fifth determining unit is used for the first node to determine that the verification information of the initiating node for the transaction represents that the verification is successful, and at least one first candidate node has a third number of third candidate nodes which represent that the verification is successful;
and the number of the first and second electrodes,
a sixth determining unit, configured to determine, by the second node, that the verification information of the transaction by the receiving node represents that the verification is successful, and that a fourth number of fourth candidate nodes exist in the at least one second candidate node, where the verification information of the transaction by the fourth candidate node represents that the verification is successful
In the embodiment of the present application, it is preferable that the first generation unit includes:
a seventh determining unit, configured to determine first information transmitted by the first node to the second node and second information transmitted by the second node to the first node; the first information comprises the signature verification information of the initiating node and the third candidate node on the transaction, and the second information comprises the signature verification information of the receiving node and the fourth candidate node on the transaction;
a third generating unit for generating first block information for the transaction stored at the first node according to the second information;
a fourth generating unit for generating second block information for the transaction stored at the second node using the first information.
In this embodiment, preferably, the first storage unit includes:
the first broadcasting unit is used for broadcasting first block information to each node except the first node in the initiating node and the at least one first candidate node, and the first block information is used for triggering the node receiving the first block information to locally store the first block information;
and the second broadcasting unit is used for broadcasting the second block information to the receiving node and each node except the second node in the at least one second candidate node, and the second block information is used for triggering the node receiving the second block information to locally store the second block information.
Further, the block chain consensus device provided in the embodiment of the present application further includes:
the fifth generating unit is used for generating first reward information of the initiating node to the first node and second reward information of the receiving node to the second node according to the transaction;
and the second storage unit is used for storing the first reward information in the first block information of the initiating node and the first node and storing the second reward information in the second block information of the receiving node and the second node.
Corresponding to the block chain consensus method disclosed in the above embodiment of the present invention, an embodiment of the present invention further provides a block chain system, where the block chain system includes:
the system comprises an initiating node and a first node, wherein the initiating node is used for determining a transaction to be subjected to block chain consensus, acquiring at least one first candidate node related to the initiating node of the transaction in an ordered virtual ring formed by all nodes of a block chain, and determining the first node of the initiating node in the at least one first candidate node;
the receiving node is used for acquiring at least one second candidate node related to the receiving node of the transaction in the ordered virtual ring and determining a second node of the receiving node in the at least one second candidate node; the position of the node in the ordered virtual ring is independent of the physical position of the node;
the first node and the second node are used for generating block information representing the transaction if the signing check states of the initiating node and the at least one first candidate node for the transaction meet a preset first signing check condition and the signing check states of the receiving node and the at least one second candidate node for the transaction meet a preset second signing check condition;
the first candidate node is used for returning the signature verification state of the transaction and the block information of the stored transaction to the first node;
the second candidate nodes are used for returning the signature verification state of the transaction and the block information of the stored transaction to the second node;
the initiating node and the receiving node are also used for storing block information of the transaction.
Further, an embodiment of the present application also provides a computer storage medium, where computer-executable instructions are stored in the computer storage medium, and the computer-executable instructions are used to execute the above consensus method.
For details of the computer executable instructions, reference may be made to the above detailed description of a block chain consensus method provided in the embodiments of the present application, which is not repeated herein.
The application provides a block chain consensus method, a block chain consensus device, a block chain consensus system and a storage medium, wherein all nodes in a block chain form an ordered virtual ring, and because the positions of the nodes in the ordered virtual ring are irrelevant to the physical positions of the nodes, the positions of all the nodes in the block chain can be disordered through the ordered virtual ring. Based on this, after determining the originating node and the receiving node of the transaction, the physical locations of the at least one first candidate node associated with the originating node obtained from the ordered virtual ring in the blockchain are dispersed and the locations in the ordered virtual ring are correlated, and the physical locations of the at least one second candidate node associated with the receiving node obtained from the ordered virtual ring in the blockchain are dispersed and the locations in the ordered virtual ring are correlated. Therefore, whether the transaction consensus is successful or not is determined based on the signature verification information of the at least one first candidate node and the at least one second candidate node on the transaction, the purpose of decentralization can be effectively achieved, and particularly, the more nodes on the blockchain, the more obvious decentralization effect is, and the setting can approach to complete decentralization. In addition, the transaction consensus can be realized only on the basis of partial nodes (the initiating node, the receiving node, the first candidate node and the second candidate node) in the block chain, so that the consensus efficiency is effectively improved, and the resource consumption is reduced. Furthermore, the transaction consensus can be realized only on the basis of partial nodes in the block chain, and other nodes in the block chain can also perform consensus of other transactions at the same time, so that the consensus efficiency can be further improved.
The consensus method, the consensus device, the consensus server and the storage medium provided by the invention are described in detail, specific examples are applied in the description to explain the principles and the implementation of the invention, and the description of the embodiments is only used to help understanding the method and the core idea of the invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.
It should be noted that, in the present specification, the embodiments are all described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments may be referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description.
It is further noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include or include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. A block chain consensus method, comprising:
determining a transaction to be subjected to block chain consensus;
acquiring at least one first candidate node related to an initiating node of the transaction and at least one second candidate node related to a receiving node of the transaction in an ordered virtual ring formed by all nodes of a block chain, wherein the positions of the nodes in the ordered virtual ring are independent of the physical positions of the nodes;
determining a first node of the initiating node of the at least one first candidate node and a second node of the receiving node of the at least one second candidate node;
if the first node determines that the label checking state of the initiating node and the at least one first candidate node on the transaction meets a preset first label checking condition, and the second node determines that the label checking state of the receiving node and the at least one second candidate node on the transaction meets a preset second label checking condition, block information representing the transaction is generated;
storing the block information into the originating node, the at least one first candidate node, the receiving node, and the at least one second candidate node, respectively.
2. The method of claim 1, further comprising a generation process of the ordered virtual ring, the generation process of the ordered virtual ring comprising:
acquiring node information of each node in all nodes of the block chain;
calculating the hash value of the node according to the node information of the node;
and sorting all the nodes in the block chain by utilizing the hash values of the nodes to generate an ordered virtual ring of the block chain.
3. The method of claim 1, wherein obtaining at least one first candidate node associated with an originating node of the transaction and at least one second candidate node associated with a receiving node of the transaction in an ordered virtual ring of all nodes of a blockchain comprises:
determining a first number of nodes in the ordered virtual ring that are nearest neighbors to an originating node of the transaction as at least one first candidate node associated with the originating node;
obtaining a second number of nodes in the ordered virtual ring that are nearest neighbors to a receiving node of the transaction as at least one second candidate node associated with the receiving node.
4. The method of claim 1, wherein the first node determining that the signing status of the initiating node and the at least one first candidate node for the transaction satisfies a preset first signing condition, and the second node determining that the signing status of the receiving node and the at least one second candidate node for the transaction satisfies a preset second signing condition comprises:
the first node determines that the signing verification information of the initiating node for the transaction characterizes successful signing verification, and a third number of third candidate nodes exist in the at least one first candidate node, wherein the signing verification information of the initiating node for the transaction characterizes successful signing verification;
and the number of the first and second electrodes,
the second node determines that the receiving node is successful in verifying the signature of the transaction, and a fourth number of fourth candidate nodes exist in the at least one second candidate node, and the fourth candidate node is successful in verifying the signature of the transaction.
5. The method of claim 4, wherein generating block information characterizing the transaction comprises:
determining first information transmitted by the first node to the second node and second information transmitted by the second node to the first node; the first information comprises the signing information of the initiating node and the third candidate node for the transaction, and the second information comprises the signing information of the receiving node and the fourth candidate node for the transaction;
generating first block information for the transaction stored at the first node from the second information;
generating second block information for the transaction stored at the second node using the first information.
6. The method of claim 5, wherein the storing the block information in the originating node, the at least one first candidate node, the receiving node, and the at least one second candidate node respectively comprises:
broadcasting the first block information to each node except the first node in the initiating node and the at least one first candidate node, wherein the first block information is used for triggering the node receiving the first block information to locally store the first block information;
broadcasting the second block information to each node except the second node among the receiving node and the at least one second candidate node, wherein the second block information is used for triggering the node receiving the second block information to locally store the second block information.
7. The method of claim 1, further comprising:
generating first reward information of the initiating node to the first node and second reward information of the receiving node to the second node according to the transaction;
storing the first reward information in the first block information of the originating node and the first node, and storing the second reward information in the second block information of the receiving node and the second node.
8. A blockchain consensus apparatus, comprising:
the system comprises a first determining unit, a second determining unit and a third determining unit, wherein the first determining unit is used for determining the transaction of block chain consensus to be carried out;
a first obtaining unit, configured to obtain at least one first candidate node related to an initiating node of the transaction and at least one second candidate node related to a receiving node of the transaction in an ordered virtual ring formed by all nodes of a blockchain, where a position of the node in the ordered virtual ring is independent of a physical position of the node;
a second determining unit, configured to determine a first node of the initiating node in the at least one first candidate node and a second node of the receiving node in the at least one second candidate node;
a first generating unit, configured to generate block information representing the transaction if the first node determines that the signature verification status of the initiating node and the at least one first candidate node for the transaction satisfies a preset first signature verification condition, and the second node determines that the signature verification status of the receiving node and the at least one second candidate node for the transaction satisfies a preset second signature verification condition;
a first storage unit, configured to store the block information in the initiating node, the at least one first candidate node, the receiving node, and the at least one second candidate node, respectively.
9. A blockchain, comprising:
the system comprises an initiating node and at least one first candidate node, wherein the initiating node is used for determining a transaction to be subjected to block chain consensus, acquiring at least one first candidate node related to the initiating node of the transaction in an ordered virtual ring formed by all nodes of a block chain, and determining the first node of the initiating node in the at least one first candidate node;
a receiving node for obtaining at least one second candidate node in the ordered virtual ring associated with a receiving node of the transaction and determining a second node of the receiving nodes in the at least one second candidate node; the position of the node in the ordered virtual ring is independent of the physical position of the node;
the first node and the second node are both used for generating block information representing the transaction if the signing check states of the initiating node and the at least one first candidate node on the transaction meet a preset first signing check condition and the signing check states of the receiving node and the at least one second candidate node on the transaction meet a preset second signing check condition;
the first candidate node is used for returning the signature verification state of the transaction and storing the block information of the transaction to the first node;
the second candidate nodes are all used for returning the signature verification state of the transaction and storing the block information of the transaction to the second node;
the initiating node and the receiving node are further configured to store block information for the transaction.
10. A computer-readable storage medium having computer-executable instructions stored thereon for performing the blockchain consensus method of any one of claims 1-7.
CN202011239853.2A 2020-11-09 2020-11-09 Block chain consensus method, device, system and storage medium Active CN112184454B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011239853.2A CN112184454B (en) 2020-11-09 2020-11-09 Block chain consensus method, device, system and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011239853.2A CN112184454B (en) 2020-11-09 2020-11-09 Block chain consensus method, device, system and storage medium

Publications (2)

Publication Number Publication Date
CN112184454A true CN112184454A (en) 2021-01-05
CN112184454B CN112184454B (en) 2023-07-25

Family

ID=73917168

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011239853.2A Active CN112184454B (en) 2020-11-09 2020-11-09 Block chain consensus method, device, system and storage medium

Country Status (1)

Country Link
CN (1) CN112184454B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113076376A (en) * 2021-03-29 2021-07-06 湖北央中巨石信息技术有限公司 Multi-party asynchronous sampling consensus method, system, device and medium based on block chain
WO2023185059A1 (en) * 2022-03-30 2023-10-05 蚂蚁区块链科技(上海)有限公司 Consensus method and blockchain node

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109711192A (en) * 2018-12-24 2019-05-03 众安信息技术服务有限公司 Method of commerce and system between block catenary system construction method, node
CN110505305A (en) * 2019-08-27 2019-11-26 深圳市网心科技有限公司 A kind of block chain sharding method, device and block catenary system
CN110896396A (en) * 2018-09-12 2020-03-20 三星电子株式会社 Authentication circuit, electronic system including the same, and method of forming network
CN111127013A (en) * 2019-12-24 2020-05-08 深圳大学 Decentralized data transaction method, device, equipment and medium based on block chain

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110896396A (en) * 2018-09-12 2020-03-20 三星电子株式会社 Authentication circuit, electronic system including the same, and method of forming network
CN109711192A (en) * 2018-12-24 2019-05-03 众安信息技术服务有限公司 Method of commerce and system between block catenary system construction method, node
CN110505305A (en) * 2019-08-27 2019-11-26 深圳市网心科技有限公司 A kind of block chain sharding method, device and block catenary system
CN111127013A (en) * 2019-12-24 2020-05-08 深圳大学 Decentralized data transaction method, device, equipment and medium based on block chain

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
无: "分布式金融技术白皮书", 《豆丁网》 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113076376A (en) * 2021-03-29 2021-07-06 湖北央中巨石信息技术有限公司 Multi-party asynchronous sampling consensus method, system, device and medium based on block chain
CN113076376B (en) * 2021-03-29 2024-02-06 湖北央中巨石信息技术有限公司 Multi-party asynchronous sampling consensus method, system and device based on block chain and medium
WO2023185059A1 (en) * 2022-03-30 2023-10-05 蚂蚁区块链科技(上海)有限公司 Consensus method and blockchain node

Also Published As

Publication number Publication date
CN112184454B (en) 2023-07-25

Similar Documents

Publication Publication Date Title
CN109544334B (en) Method for realizing network extensible block chain
CN109075964B (en) Block chaining supporting multiple one-way functions for block verification
CN109493050B (en) Transfer method based on block chain main chain and parallel multiple sub-chains
CN110784346A (en) Reputation value-based PBFT consensus system and method
CN111131209B (en) Improved efficient consensus method, system, computer device and storage medium
JP7319961B2 (en) Computer-implemented systems and methods related to binary blockchains forming a pair of coupled blockchains
JP7165148B2 (en) Method and system for consistent distributed memory pool in blockchain network
WO2020258252A1 (en) Consensus method for block chain data and related device
CN112184454A (en) Block chain consensus method, device, system and storage medium
CN109493052B (en) Cross-chain contract system based on main chain and parallel multiple sub-chains
WO2023045620A1 (en) Transaction data processing method and apparatus, computer device and storage medium
CN108647965A (en) Across chain method of commerce, device, storage medium and electronic equipment
CN108648081B (en) Transaction processing method and device based on block chain and electronic equipment
CN112003820A (en) Block chain consensus optimization method based on ring signature and aggregated signature
Buchnik et al. Fireledger: A high throughput blockchain consensus protocol
CN110149379B (en) Multi-primitive-chain throughput expansion method based on layer logic
WO2020082213A1 (en) Network expandability blockchain implementation method
US20230017790A1 (en) Graphic-blockchain-orientated hybrid consensus implementation apparatus and implementation method thereof
CN113259179A (en) Byzantine fault-tolerant consensus method and system based on node scoring
CN111292190A (en) Transaction generation method, block creation method, related device and equipment
CN113626875A (en) Knowledge graph file storage method for block chain fragment enabling
Hoepman Distributed double spending prevention
CN113612618B (en) Alliance chain consensus method and device
CN114124410A (en) Improved POA consensus method suitable for multi-party verification in supply chain scene
CN113409047A (en) Data processing method, device and equipment based on block chain and readable storage medium

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
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 401121 b7-7-2, Yuxing Plaza, No.5 Huangyang Road, Yubei District, Chongqing

Applicant after: Chongqing duxiaoman Youyang Technology Co.,Ltd.

Address before: 201800 room 307, 3 / F, building 8, 55 Huiyuan Road, Jiading District, Shanghai

Applicant before: SHANGHAI YOUYANG NEW MEDIA INFORMATION TECHNOLOGY Co.,Ltd.

TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20211217

Address after: 100193 Room 606, 6 / F, building 4, West District, courtyard 10, northwest Wangdong Road, Haidian District, Beijing

Applicant after: Du Xiaoman Technology (Beijing) Co.,Ltd.

Address before: 401121 b7-7-2, Yuxing Plaza, No.5 Huangyang Road, Yubei District, Chongqing

Applicant before: Chongqing duxiaoman Youyang Technology Co.,Ltd.

GR01 Patent grant
GR01 Patent grant