CN112184454B - 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
CN112184454B
CN112184454B CN202011239853.2A CN202011239853A CN112184454B CN 112184454 B CN112184454 B CN 112184454B CN 202011239853 A CN202011239853 A CN 202011239853A CN 112184454 B CN112184454 B CN 112184454B
Authority
CN
China
Prior art keywords
node
transaction
information
candidate
signature verification
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011239853.2A
Other languages
Chinese (zh)
Other versions
CN112184454A (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
Du Xiaoman Technology Beijing 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 Du Xiaoman Technology Beijing Co Ltd filed Critical Du Xiaoman Technology Beijing 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

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

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 an 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 signature verification state of the initiating node and the at least one first candidate node for the transaction meets the first signature verification condition, and the second node determines that the signature verification state of the receiving node and the at least one second candidate node for the transaction meets the second signature verification condition, block information representing the transaction is generated and 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 creating a decentralised environment, the method achieves complete decentralisation of compatibility and resource consumption reduction in block chain consensus.

Description

Block chain consensus method, device, system and storage medium
Technical Field
The present invention relates to the technical field of consensus mechanisms, and in particular, to a block chain consensus method, device, system and storage medium.
Background
With the development of technology, blockchain (Blockchain) receives a great deal of attention by virtue of the characteristics of decentralization credit, non-tamperability of data and the like.
Currently, the common mechanisms of blockchains are mainly divided into two main categories: the middle-cost intellectual consensus and BFT intellectual consensus. The POW is mainly applied to the public chain field, comprises POW (Proof of Work), POS (Proof of Stake) and the like, and can realize complete decentralization, but a large amount of resource consumption is brought along with the POW, the POS reduces the resource consumption to a certain extent, but the rights and interests distributor slowly concentrates in a few people, and the requirement of complete decentralization cannot be met; for BFT consensus, the method is mainly applied to the field of alliance chains at present, can realize better performance under a small number of nodes, cannot be directly used in public chains, and needs to create a decentralizing environment by combining the alliance chains and the public chains.
Disclosure of Invention
In view of the above, the present invention provides a method, apparatus, system and storage medium for block chain consensus, so as to achieve the purposes of complete decentralization and resource consumption reduction compatible in block chain consensus without creating a decentralization environment. The technical proposal is as follows:
The first aspect of the invention discloses a block chain consensus method, comprising the following steps:
determining a transaction to be subjected to blockchain 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 blockchain, wherein the position of the node in the ordered virtual ring is independent of the physical position of the node;
determining a first node of the originating 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 signature verification state of the initiating node and the at least one first candidate node on the transaction meets a preset first signature verification condition, and the second node determines that the signature verification state of the receiving node and the at least one second candidate node on the transaction meets a preset second signature verification condition, block information representing the transaction is generated;
and 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 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 blockchain;
calculating a hash value of the node according to the node information of the node;
and sequencing all the nodes in the blockchain by utilizing the hash values of the nodes to generate an ordered virtual ring of the blockchain.
Optionally, the 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 the 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 initiating node of the transaction as at least one first candidate node associated with the initiating node;
a second number of nodes in the ordered virtual ring that are nearest neighbors to a receiving node of the transaction are obtained as at least one second candidate node associated with the receiving node.
Optionally, the first node determines that the signature verification state 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 state of the transaction by the receiving node and the at least one second candidate node meets a preset second signature verification condition, including:
The first node determines that the signature verification information of the transaction by the initiating node represents the successful signature verification, and a third number of third candidate nodes exist in the at least one first candidate node, and the signature verification information of the transaction by the third candidate nodes represents the successful signature verification;
and, in addition, the method comprises the steps of,
the second node determines that the signature verification information of the transaction by the receiving node represents the successful signature verification, and a fourth number of fourth candidate nodes exist in the at least one second candidate node, and the signature verification information of the transaction by the fourth candidate nodes represents the successful signature verification.
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 signature verification information of the transaction by the initiating node and the third candidate node, and the second information comprises signature verification information of the transaction by the receiving node and the fourth candidate node;
generating first block information for the transaction stored at the first node according to 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 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 store the first block information locally;
broadcasting the second block information to the receiving node and each node except the second node in the at least one second candidate node, wherein the second block information is used for triggering the node receiving the second block information to store the second block information locally.
Optionally, the method further comprises:
generating first rewarding information of the initiating node to the first node and second rewarding information of the receiving node to the second node according to the transaction;
the first bonus information is stored in the first block information of the originating node and the first node, and the second bonus information is stored in the second block information of the receiving node and the second node.
The second aspect of the present invention discloses a blockchain consensus device, comprising:
a first determining unit, configured to determine a transaction to be subjected to blockchain consensus;
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 among the at least one first candidate node and a second node of the receiving node among 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 state of the initiating node and the at least one first candidate node on the transaction meets a preset first signature verification condition, and the second node determines that the signature verification state of the receiving node and the at least one second candidate node on the transaction meets a preset second signature verification condition;
and the first storage unit is used for 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.
A third aspect of the present invention discloses a blockchain, comprising:
an initiating node, configured to determine a transaction to be performed with blockchain consensus, obtain 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 blockchain, and determine a first node of the initiating nodes in the at least one first candidate node;
a receiving node for obtaining at least one second candidate node in the ordered virtual ring related to the 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 signature verification states of the initiating node and the at least one first candidate node on the transaction meet a preset first signature verification condition, and the signature verification states of the receiving node and the at least one second candidate node on the transaction meet a preset second signature verification condition;
the first candidate node is used for returning a signature verification state of the transaction and storing block information of the transaction to the first node;
The second candidate nodes are used for returning the signature verification state of the transaction and storing block information of the transaction to the second node;
the originating node and the receiving node are further configured to store block information of the transaction
A fourth aspect of the present invention discloses a computer readable storage medium having stored therein computer executable instructions for performing a blockchain consensus method as disclosed in any of the first aspects of the present invention above.
The utility model provides a block chain consensus method, device, system and storage medium, which is characterized in that all nodes in a block chain form an ordered virtual ring, and the positions of all nodes in the block chain can be disordered through the ordered virtual ring because the positions of the nodes in the ordered virtual ring are independent of the physical positions of the nodes. Based on this, after determining the initiating node and the receiving node of the transaction, the physical locations in the blockchain of the at least one first candidate node associated with the initiating node obtained from the ordered virtual ring are scattered and the locations in the ordered virtual ring are correlated, and the physical locations in the blockchain of the at least one second candidate node associated with the receiving node obtained from the ordered virtual ring are scattered and the locations in the ordered virtual ring are correlated. In this way, whether the trade consensus is successful or not is determined based on the label checking information of the trade by at least one first candidate node and at least one second candidate node, the aim of decentralization can be effectively achieved, and particularly, the more nodes on the blockchain, the more obvious the decentralization effect is, the setting can be approaching to complete decentralization. In addition, the transaction consensus can be realized only by 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 based on part of nodes in the blockchain, and other nodes in the blockchain 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 that are required to be used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only embodiments of the present invention, and that other drawings can be obtained according to the provided drawings without inventive effort for a person skilled in the art.
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 blockchain 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 of 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 following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the 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 one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
Examples:
based on the above background, it is difficult to satisfy the complete decentralization and high performance without creating a decentralization environment in the conventional common link consensus mechanism, and a trade-off needs to be made.
In view of this, the embodiments of the present application provide a blockchain consensus method, apparatus, system, and storage medium, which implement decentralization and scalability of blockchain consensus through dht slicing technology, the more nodes, the higher the decentralization degree thereof, and when the number of nodes reaches a certain scale, from the perspective of probability, approximate complete decentralization; and on the basis, local asynchronous multi-stage consensus is realized, the decentralization is satisfied, meanwhile, the distributed network has high-performance processing capacity, the response speed of the consensus is greatly improved, and the response speed can be linearly improved along with the increase of the number of nodes.
The present application provides a blockchain consensus method (which may also be referred to as an asynchronous multi-stage consensus method) that can abstract all of the actions into a Transaction (which is more similar to transactions in the database domain than a narrow Transaction in the payment domain). To facilitate describing the general flow of the blockchain consensus algorithm, we first make the following assumptions about 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 denoted as candidateset_a, and the candidate node of the node a may also be referred to as a first candidate node;
the candidate node of the node B is denoted as candidateset_b, and the candidate node of the node B may also be referred to as a second candidate node;
for TB, the consensus agent determined by the node A is marked as A ', and the consensus agent A' of the node A is one candidate node in the first candidate nodes of the node A;
the identified consensus agent of 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 blockchain form an ordered virtual ring through a dht network;
2. the candidate set node of the node A is a group of nodes determined by a candidate set node determination method, wherein the determination method is built in a block chain consensus implementation scheme, and all other nodes can verify whether the other node is the candidate set node of the node A. 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 for a.
In combination with the above description of the consensus scenario, a detailed description of a blockchain consensus method is provided in the embodiments of the present application. Fig. 1 is a flowchart of a blockchain consensus method according to an embodiment of the present application.
As shown in fig. 1, the method includes:
s101, determining a transaction to be subjected to block chain consensus;
the blockchain is composed of a plurality of nodes, and all nodes in the blockchain form an ordered virtual ring. The generation process of the ordered virtual ring of the blockchain 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 ordering all nodes in the blockchain according to the hash value of the nodes to generate the ordered virtual ring may be: and ordering all the nodes in the block chain according to the order 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, namely node 1, node 2, node 3, node 4, node 5, node 6, node 7 and node 8, respectively, wherein the hash values are sequentially from small to large, namely node 2, node 3, node 1, node 5, node 6, node 8, node 4 and node 7, the ordered virtual ring of the blockchain is as shown in fig. 2.
In this embodiment of the present application, the node information of the node may include a node MAC address, or may include a node IP address, or may include 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 merely a preferred manner of constructing all nodes of a blockchain into ordered virtual rings provided by embodiments of the present invention. The inventor can set the specific generation method of the ordered virtual ring according to own requirements, and the embodiment of the application is not limited.
S102, 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 the blockchain are obtained, and the position of the node in the ordered virtual ring is independent of the physical position of the node;
for a transaction sent from one node of the blockchain to another node, the transaction may be considered to be a transaction for which blockchain consensus is to be made, the node sending the transaction is referred to as the initiating 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 sent from node A to node B, node A may be considered the initiating node for the transaction and node B may be considered the receiving node for the transaction.
All nodes of the blockchain form an ordered virtual ring, each node related to the initiating node in the ordered virtual ring can be acquired, and each acquired 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 acquired from the ordered virtual ring. Accordingly, each node associated with the receiving node in the ordered virtual ring may also be acquired, and each acquired node may be referred to as a second candidate node of the receiving node, so that at least one second candidate node associated with the receiving node may be acquired from the ordered virtual ring.
In this embodiment, the manner of obtaining at least one first candidate node related 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 an initiating node of the transaction are determined as at least one first candidate node associated with the initiating node.
In one manner, 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 of the embodiment of the present application, the first number of nodes in the ordered virtual ring that are nearest to the initiating node of the transaction may be: the ordered virtual ring is located at a first number of nodes immediately preceding and adjacent to the initiating node of the transaction.
As another preferred implementation of the embodiment of the present application, the first number of nodes in the ordered virtual ring that are nearest to the initiating node of the transaction may be: the ordered virtual ring is located a first number of nodes immediately following and proximate to the initiating node of the transaction.
As a further preferred implementation of the embodiments of the present application, the first number of nodes in the ordered virtual ring that are nearest neighbors to the initiating node of the transaction may be: a fifth number of nodes in the ordered virtual ring that are located nearest neighbors to the initiating node of the transaction before the initiating node of the transaction, and a sixth number of nodes in the ordered virtual ring that are located nearest neighbors to the initiating node of the transaction after the initiating node of the transaction. Wherein the sum of the fifth number and the sixth number is the first number.
For example, with a first number preset and a first data amount preset of 6, referring to fig. 2, if the initiating node is node 5, 6 nodes, which are closest to the initiating node (node 5) of the transaction and are located before the initiating node (node 5) of the transaction, of the ordered virtual ring are determined to be at least one first candidate node related to the initiating node (node 5), that is, node 1, node 3, node 2, node 7, node 4 and node 8 are determined to be at least one first candidate node related to the initiating node (node 5). Alternatively, 6 nodes located in the ordered virtual ring after the initiating node (node 5) of the transaction and nearest to the initiating node (node 5) of the transaction are determined as at least one first candidate node associated with the initiating node (node 5), i.e. node 6, node 8, node 4, node 7, node 2, node 3 are determined as at least one first candidate node associated with the initiating node (node 5). Alternatively, 3 (fifth number) nodes located before the initiating node (node 5) of the transaction and 3 (sixth number) nodes located after the initiating node (node 5) of the transaction and closest to the initiating node (node 5) of the transaction in the ordered virtual ring are determined as at least one first candidate node related to the initiating node (node 5), i.e. node 1, node 2, node 3, node 6, node 8, node 4 are determined as at least one first candidate node related to the initiating node (node 5).
In this embodiment, 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 nearest to the receiving node of the transaction is obtained as at least one second candidate node associated with the receiving node.
In one way, the second number may be preset. Alternatively, the 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 of the embodiment of the present application, the second number of nodes in the ordered virtual ring that are nearest to the receiving node of the transaction may be: a second number of nodes in the ordered virtual ring that are located nearest neighbors to the receiving node of the transaction prior to the receiving node of the transaction.
As another preferred implementation 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 located immediately after and proximate to the receiving node of the transaction.
As a further preferred implementation of the embodiments 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 number of nodes in the ordered virtual ring immediately preceding the receiving node of the transaction and an eighth number of nodes in the ordered virtual ring immediately following the receiving node of the transaction. Wherein the sum of the seventh number and the eighth number is the second number.
For example, with a second number preset and the second number preset being 6, referring to fig. 2, if the initiating node is node 4, 6 nodes, which are closest to the receiving node (node 4) of the transaction before the receiving node (node 4) of the transaction, of the ordered virtual ring are determined to be at least one second candidate node related to the receiving node (node 4), that is, node 2, node 3, node 1, node 5, node 6, node 8 are determined to be at least one second candidate node related to the receiving node (node 4). Alternatively, 6 nodes located in the ordered virtual ring after the receiving node (node 4) of the transaction and nearest to the receiving node (node 4) of the transaction are determined as at least one second candidate node related to the receiving node (node 4), namely, node 7, node 2, node 3, node 1, node 5, node 6 are determined as at least one second candidate node related to the receiving node (node 4). Alternatively, 3 (seventh number) nodes located before the receiving node (node 4) of the transaction and 3 (eighth number) nodes located after the receiving node (node 4) of the transaction and closest to 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), i.e. node 5, node 6, node 8, node 7, node 2, node 3 are determined as at least one second candidate node related to the receiving node (node 4).
The foregoing is merely a preferred manner 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 inventor may set the specific manner of determining at least one first candidate node and at least one second candidate node according to his 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 calculation mode, 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 be prone to selecting a node with a higher R value, where the R value may be considered as a credit value of the node, and the inventor of the allocation mode of the R value may set the node according to his own requirement, which is not limited herein.
Accordingly, a node for the consensus agent as a receiving node may be determined from at least one second candidate node based on the transparent public consensus agent calculation method, and the determined node for the consensus agent as a receiving node may be referred to as a second node for convenience of distinction.
S104, if the first node determines that the signature verification state of the initiating node and at least one first candidate node for the transaction meets a preset first signature verification condition, and the second node determines that the signature verification state of the receiving node and at least one second candidate node for the transaction meets a preset second signature verification condition, block information representing the transaction is generated;
in the embodiment of the application, a 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 signature verification information of the receiving node for the transaction and the signature verification information of at least one second candidate node for the transaction, and further determines that the signature verification information of the initiating node for the transaction and the signature verification information of at least one first candidate node for the transaction meet the first signature verification condition at the first node, and when the second node determines that the signature verification information of the receiving node for the transaction and the signature verification information of the at least one second candidate node for the transaction meet the second signature verification condition, the success of the transaction signature verification can be primarily determined, namely, the consensus of the nodes in the block chain for the transaction is primarily determined; otherwise, determining that the transaction verification fails, namely determining that nodes in the blockchain do not agree on the transaction.
The signature verification information of the initiating node on the transaction represents successful signature verification, and the first node can determine that the signature verification states of the initiating node and the at least one first candidate node on the transaction meet the first signature verification condition under the condition that a third number of third candidate nodes exist in the at least one first candidate node. The third candidate node is a first candidate node for representing successful signature verification of the signature verification information of the transaction.
The signature verification information of the receiving node on the transaction represents successful signature verification, and under the condition that a fourth number of fourth candidate nodes exist in at least one second candidate node, the second node can determine that the signature verification states of the receiving node and the at least one second candidate node on the transaction meet preset second signature verification conditions. The fourth candidate node is a second candidate node for representing successful signature verification of the signature verification information of the transaction.
In this embodiment of the present application, the third number and the fourth number may be the same or different, and the specific value related to the third number is related to the first label checking condition, the specific value related to the fourth number is related to the second label checking condition, and the inventor may set the specific content related to the first label checking condition and the second label checking condition according to his own requirement, which is not limited herein.
And S105, 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 respectively.
In the embodiment of the application, after the success of the transaction verification is preliminarily determined, the first block information of the transaction can be generated and stored in the first node, and the second block information of the transaction can be generated and stored in the second node. Wherein, the first block information and the second block information both carry block identifiers.
It should be noted that, according to the blockchain consensus method provided by the embodiment of the application, two modes of pessimistic mode and optimistic mode are proposed based on asynchronous multi-stage consensus, so as to meet different concurrency requirements.
The pessimistic mode has the advantage that a node can be careful to make a consensus of the current transaction, and after successful/failed writing to the ledger, the node resumes the next transaction. However, for some high-frequency transactions, blocking of the transactions is easy to cause, and the application also provides a corresponding optimistic mode, in which parallel execution of multiple transactions consensus can be realized by one node at the same time. The inventor can set the mode according to his own requirements, and the invention is not limited herein.
In this embodiment, after a transaction initiated by a node, if the transaction consensus is successful, first block information of the transaction is 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 stored in each node of a second node set to which the 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 a node is related to the order of the transactions to which the block information belongs in the transaction consensus sequence of the node, and the transaction consensus sequence does not include transactions for which the consensus fails.
Further, after the success of the consensus of the transaction is preliminarily determined, the further confirmation of the consensus of the transaction can be realized by a mode 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 signature verification information of the initiating node and the third candidate node for the transaction, and the second information comprises signature verification information of the receiving node and the fourth candidate node for the transaction.
The first node receives the second information and then performs signature verification on the second information, the second node receives the first information and then performs signature verification on the first information, if the first node successfully performs signature verification on the second information and the second node successfully performs signature verification on the first information, the success of consensus on the transaction is determined, at the moment, the first block information is generated and stored by the first node, and the second block information is generated and stored by the second node.
In an embodiment of the present application, storing block information in an originating node, at least one first candidate node, a receiving node, and at least one second candidate node, respectively, includes: the first block information is broadcast by the first node to each of the originating node and the at least one first candidate node except the first node, and the second block information is broadcast by the second node to each of the receiving node and the at least one second candidate node except the second node, respectively.
Accordingly, the node that receives the first block information may store the first block information locally at the node, that is, the originating node may store the first block information locally at the originating node after receiving the first block information, and the first candidate node may store the first block information locally at the first candidate node after receiving the first block information.
The node that receives the second block information may store the second block information locally at the node, i.e., the receiving node may store the second block information locally at the receiving node after receiving the second block information, and the second candidate node may store the second block information locally at the second candidate node after receiving the second block information.
In this embodiment of the present application, the first block information and the second block information may be considered as block information, and the block information may be composed of signature verification information of the initiating node to the transaction, signature verification information of the third candidate node to the transaction, signature verification information of the receiving node to the transaction, signature verification information of the fourth candidate node to the transaction, and the transaction. It should be noted that, the block identifier of the block information is related to the consensus sequence of the transaction to which the block information belongs at the node, the block identifier of the first block information may be the same as the block identifier of the second block information, and the block identifier of the first block information may be different from the block identifier of the second block information.
FIG. 3 is a flowchart of another block chain consensus method according to an embodiment of the present application.
As shown in fig. 3, the method includes:
s301, determining a transaction to be subjected to blockchain 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 the blockchain are obtained, and the position of the node in the ordered virtual ring is independent of the physical position of the node;
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 signature verification state of the initiating node and at least one first candidate node for the transaction meets a preset first signature verification condition, and the second node determines that the signature verification state of the receiving node and at least one second candidate node for the transaction meets a preset second signature verification condition, block information representing the transaction is generated;
s305, storing the block information into an initiating node, at least one first candidate node, a receiving node and at least one second candidate node respectively;
the execution of steps S301 to S305 shown in fig. 3 in the embodiment of the present application is the same as the execution of steps S101 to S105 in the embodiment described above, and the detailed description of steps S101 to S105 is omitted here for the specific execution of steps S301 to S305.
S306, generating first rewarding information of the initiating node to the first node and second rewarding information of the receiving node to the second node according to the transaction;
in this embodiment, after the transaction consensus is successful and accounting is completed, the initiating node may generate the first rewarding information according to the transaction and the receiving node may generate the second rewarding information according to the transaction.
S307, storing the first bonus information in the first block information of the originating node and the first node, and storing the second bonus information in the second block information of the receiving node and the second node.
After generating the first rewards information of the transaction, the initiating node may further store the first rewards information in the first block information of the transaction stored locally at the initiating node, and send the first rewards information to the first node, so as to further store the first rewards information in the first block information of the transaction stored locally at the first node.
After generating the second rewarding information of the transaction, the receiving node may further store the second rewarding information in the second block information of the transaction stored locally in the receiving node, and send the second rewarding information to the second node, so as to further store the second rewarding information in the second block information of the transaction stored locally in the second node.
In this embodiment of the present application, the first incentive information and the second incentive information are incentive information, and the incentive information may be considered as a token.
The method and the device have the greatest characteristics that the network is divided into local area networks through dht fragments on the basis of dht network fragments, and consensus is carried out on the basis of the local area networks. The nodes participating in consensus are screened out through dht algorithm, so long as the nodes are enough, the nodes can be considered to meet random distribution, and for the nodes in any interval [ n-i, n+i ], the nodes are considered to also meet random sampling, so that the block chain consensus method provided by the embodiment of the application can be obtained on the basis of decentralization; meanwhile, as the number of nodes increases, the slicing 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 core process of consensus is realized through a consensus agent, so that the performance is greatly improved; meanwhile, besides accounting of transaction sponsors, the receiver also stores the same account book, and as the size of the account book increases, the probability of crossing among different account books is increased, and the difficulty of cheating the account book increases geometrically.
Furthermore, the block chain consensus method provided by the embodiment of the application realizes algorithm and excitation complementation, realizes consensus based on the algorithm, and is difficult to meet the requirements of expansion, safety, performance and certainty on a universal level. Thus, configurable options (e.g., first number, second number, third number, fourth number, etc.) are reserved, and the traffic trades off for configurability based on its traffic characteristics. Meanwhile, the excitation mode of the cooperation of the R value and the token is combined for supplementing, so that a feasible consensus mechanism in actual operation is realized.
Fig. 4 is a schematic diagram of a blockchain consensus method according to an embodiment of the present application. A detailed description of a blockchain consensus method provided in the embodiments of the present application is provided below with reference to a blockchain consensus diagram shown in fig. 4.
Referring to fig. 4, a transaction TB transmitted from a node a to a node B is determined, the node a may be considered as an initiating node of the transaction TB, and the node B may be a receiving node of the transaction TB; node A (initiating node) encrypts a transaction TB by using a private key a of the node A to generate a signature Sa, and marks the signature Sa to generate a unique mark Ea; determining 5 (first number) nodes located nearest to node a (originating node) before node a (originating node) in the ordered virtual ring as at least one first candidate node related to node a (originating node), and determining a first node (consensus agent node a') for serving as node a (originating node) from the at least one first candidate nodes based on the transparent public consensus agent calculation; the < transaction TB, signature Sa, public keys a, ea corresponding to private key a, and first node (consensus agent node a') > are packaged and transmitted to node B (receiving node).
Node B (receiving node) performs signature verification on signature Sa by using public key a, if signature verification is successful, determines 5 (second number) nodes located nearest to node B (receiving node) before node B (receiving node) in the ordered virtual ring as at least one second candidate node related to node B (receiving node), and determines a second node (consensus agent node B') for serving as node B (receiving node) from the at least one second candidate nodes based on transparent public consensus agent calculation mode; signing the received transaction TB by using the private key b of the self to generate a signature Sb, and identifying the signature Sb to generate a unique identifier Eb; the < signature Sb, the public keys B, eb corresponding to the private key B, and the second node (consensus proxy node B') > are packaged and sent to node a (originating node).
After receiving the package information returned by the node B (receiving node), the node A (initiating node) sends the < transaction TB, the signature Sa, the public keys a, ea and B corresponding to the private key a, the public keys B and Eb corresponding to the private key B and the second node (consensus agent node B ') > (the signature verification information of the initiating node) to the first node (consensus agent node A'); after transmitting the generated package information to the node a, the node B (receiving node) transmits < transaction TB, signature Sa, public keys a, ea corresponding to the private key a, the first node (consensus agent node a '), signature B, 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') signs the signature Sa with the public key a and signs the signature Sb with the public key b; if signature Sa is successfully checked by using public key a and signature Sb is successfully checked by using public key B, determining that node A (initiating node) and node B (receiving node) agree with each other on transaction TB, namely determining that the signature checking information of node A (initiating node) on transaction TB represents successful check and the signature checking information of node B (receiving node) on transaction TB represents successful check; the first node (consensus agent node a ') encrypts the transaction TB using the private key a ' to generate a signature Sa ', determines a current time stamp, associates the determined time stamp < transaction TB, signature Sa, public key a corresponding to private key a, signature B, public key B corresponding to private key B, second node (consensus agent node B '), public key a ' corresponding to private key a ' and signature Sa ', and transmits the time stamp associated < transaction TB, signature Sa, public key a corresponding to private key a, signature B, public key B corresponding to private key B, second node (consensus agent node B '), public key a ' corresponding to private key a ' and signature Sa ' to at least one first candidate node of node a (originating node).
The second node (consensus agent node B') signs the signature Sa with the public key a and signs the signature Sb with the public key B; if signature Sa is successfully checked by using the public key a and signature Sb is successfully checked by using the public key B, it is determined that node a (initiating node) and node B (receiving node) agree on the transaction TB, that is, it is determined that the signature checking information of node a (initiating node) on the transaction TB represents the success of the signature checking, and the signature checking information of node B (receiving node) on the transaction TB represents the success of the signature checking. The second node (consensus agent node B ') encrypts the transaction TB with the private key B ' to generate a signature Sb ', determines a current time stamp, associates the determined time stamp < transaction TB, signature Sa, public key a corresponding to private key a, signature Sb, public key B corresponding to private key B, first node (consensus agent node a '), public key B ' corresponding to private key B ', and signature Sb ', and transmits the time stamp associated < transaction TB, signature Sa, public key a corresponding to private key a, signature Sb, public key B corresponding to private key B, first node (consensus agent node a '), public key B ' corresponding to private key B ', and signature Sb ' > to at least one second candidate node candidateset_b of node B (receiving node).
For each first candidate node candidateset_a of the at least one first candidate node, judging whether the current consensus time exceeds the preset consensus time according to the associated timestamp by the first candidate node candidateset_a; if the current consensus time does not exceed the preset consensus time, the first candidate node candidateset_a judges whether the node sending < transaction TB, signature Sa, public key a corresponding to private key a, signature Sb, public key B corresponding to private key B, second node (consensus agent node B '), public key a ' corresponding to private key a ' and 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 Candida ateset_A encrypts the transaction TB by using the private key a 'to generate an encrypted signature Sa', and the signature verification information of the first candidate node Candida ateset_A is generated according to the signature Sa 'and the public key a'; the current time stamp is determined, the current time stamp is associated with the signature verification information, and the signature verification information associated with the current time stamp is transmitted to the first node (consensus agent node a').
For each second candidate node candidateset_b of the at least one second candidate node, judging whether the current consensus time exceeds the preset consensus time according to the associated timestamp by the second candidate node candidateset_b; 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 agent node B '), the public key B ' corresponding to the private key B ' and the signature Sb ' is the second node (consensus agent node B ') or not 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 Sb ' is verified based on the public key B ', 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 Sb ' is successfully verified based on the public key B ', the second candidate node Candida set_B encrypts the transaction TB by using the private key B ' to generate encryption so as to generate the signature Sb ', and the signature verification information of the second candidate node Candida set_B is generated according to the signature Sb ' and the public key B '; the current time stamp is determined, the current time stamp is associated with the signature verification information, and the signature verification information associated with the current time stamp is transmitted to the second node (consensus agent node B').
After receiving the signature verification information returned by the first candidate node candidateset_a, the first node (consensus proxy node a ') 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 Sa ' is verified according to the public key a ' in the signature verification information of the first candidate node candidateset_a, and if the verification is successful, the success of the first candidate node in verifying the transaction TB is determined, namely the success of the signature verification information returned by the first candidate node candidateset_a is represented. And judging whether the number of the first candidate nodes Candida (third candidate nodes) returning the signature verification information representing successful signature verification is larger than or equal to the third number.
After receiving the signature verification information returned by the second candidate node candidateset_b, the second node (consensus proxy 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 the public key B' in the signature verification information of the second candidate node candidateset_b, and if verification is successful, the success of the second candidate node in verifying the transaction TB is determined, namely the success of the signature verification information returned by the second candidate node candidateset_b is represented. And judging whether the number of the second candidate nodes Candida_B (third candidate nodes) which return the signature verification information representing the successful signature verification is larger than or equal to the fourth number.
In the case that the number of the first candidate nodes candidateset_a (third candidate nodes) returning the signature verification information representing the signature verification success is greater than or equal to the third number, and the number of the second candidate nodes candidateset_b (third candidate nodes) returning the signature verification information representing the signature verification success is greater than or equal to the fourth number, that is, in the case that the first node determines that the signature verification information of the initiating node on the transaction and the signature verification information of the at least one first candidate node on the transaction satisfy the first signature verification condition, and the second node determines that the signature verification information of the receiving node on the transaction and the signature verification information of the at least one second candidate node on the transaction satisfy the second signature verification condition, the transaction signature verification success can be primarily determined, that is, the node in the block chain is primarily determined to agree with the transaction.
The first node (consensus agent node A ') sends first information (signature verification information of the transaction TB by the initiating node and the third candidate node) to the second node (consensus agent node B '), and the second node (consensus agent node B) sends second information (signature verification information of the transaction TB by the receiving node and the fourth candidate node) to the first node (consensus agent node A '); the first node (consensus agent node a ') receives the second information and signs the second information, and the second node (consensus agent node B) signs the first information after receiving the first information, if the first node (consensus agent node a') signs the second information successfully and the second node (consensus agent node B) signs the first information successfully, it is determined that the transaction is successful, at this 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 broadcast to each of the originating node and the at least one first candidate node except the first node (consensus agent node a'), and the second block information is broadcast to each of the receiving node and the at least one second candidate node except the second node (consensus agent node B), respectively, by the second node (consensus agent node B).
After the transaction consensus is successful and accounting is completed, the node A (initiating node) can generate first rewarding information according to the transaction TB, further store the first rewarding information in the first block information of the transaction stored locally, and send the first rewarding information to the first node (consensus agent node A ') so as to further store the first rewarding information in the first block information of the transaction stored locally by the first node (consensus agent node A'); the node B (receiving node) may generate second prize information from the transaction TB, further store the second prize information in the locally stored second block information of the transaction, and send the second prize information to the second node (consensus agent node B ') so as to further store the second prize information in the locally stored second block information of the transaction at the second node (consensus agent node B').
Corresponding to the above-described blockchain consensus method disclosed in the embodiments of the present invention, referring to fig. 5, the embodiments of the present invention further provide a schematic structural diagram of a blockchain consensus device, where the consensus device includes:
a first determining unit 51 for determining a transaction to be subjected to blockchain consensus;
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 the 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 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;
the first generating unit 54 is configured to generate block information representing the transaction if the first node determines that the signature verification state of the initiating node and the at least one first candidate node for the transaction meets a preset first signature verification condition, and the second node determines that the signature verification state of the receiving node and the at least one second candidate node for the transaction 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 an ordered virtual ring, where the generation process of the ordered virtual ring includes:
the second acquisition unit is used for acquiring node information of each node in all nodes of the blockchain;
a calculation unit for calculating a hash value of the node according to node information of the node;
and the second generation unit is used for sequencing all the nodes in the blockchain by utilizing the hash value of the node to generate an ordered virtual ring of the blockchain.
In an embodiment of the present application, preferably, the first obtaining unit includes:
a third determining unit, configured to determine a first number of nodes in the ordered virtual ring that are nearest to the initiating node of the transaction as at least one first candidate node related to the initiating node;
and a fourth determining unit, configured to obtain a second number of nodes in the ordered virtual ring that are nearest to the receiving node of the transaction, as at least one second candidate node related to the receiving node.
In an embodiment of the present application, preferably, the first generating unit includes:
a fifth determining unit, configured to determine, by the first node, that the signature verification information of the transaction by the initiating node indicates that the signature verification is successful, and that a third number of third candidate nodes exist in at least one first candidate node, where the signature verification information of the transaction by the third candidate nodes indicates that the signature verification is successful;
and, in addition, the method comprises the steps of,
a sixth determining unit, configured to determine, by the second node, that the signature verification information of the transaction by the receiving node indicates that the signature verification is successful, and that a fourth number of fourth candidate nodes exist in at least one second candidate node, where the signature verification information of the transaction by the fourth candidate node indicates that the signature verification is successful
In an embodiment of the present application, preferably, the first generating 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 signature verification information of the initiating node and the third candidate node for the transaction, and the second information comprises signature verification information of the receiving node and the fourth candidate node for the transaction;
a third generation unit for generating first block information for the transaction stored at the first node based on the second information;
and a fourth generation unit for generating second block information for the transaction stored at the second node using the first information.
In an embodiment of the present application, preferably, the first storage unit includes:
a first broadcasting unit, configured to broadcast first block information to each node except the first node in the initiating node and at least one first candidate node, where the first block information is used to trigger the node that receives the first block information to store the first block information locally;
and the second broadcasting unit is used for broadcasting second block information to each node except the second node in the receiving node and 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.
Further, the block chain consensus device provided in the embodiment of the present application further includes:
a fifth generating unit, configured to generate, according to the transaction, first rewarding information of the initiating node to the first node and second rewarding information of the receiving node to the second node;
and a second storage unit for storing the first bonus information in the first block information of the originating node and the first node, and storing the second bonus information in the second block information of the receiving node and the second node.
Corresponding to the above-described method for block chain consensus disclosed in the embodiments of the present invention, the embodiments of the present invention further provide a block chain system, where the block chain system includes:
the method comprises the steps of initiating a node, determining a transaction to be subjected to blockchain 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 the blockchain, and determining a first node of the initiating node in the at least one first candidate node;
a receiving node for acquiring at least one second candidate node in the ordered virtual ring related to the 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 used for generating block information representing the transaction if the signature verification states of the initiating node and the at least one first candidate node on the transaction meet the preset first signature verification conditions, and the signature verification states of the receiving node and the at least one second candidate node on the transaction meet the preset second signature verification conditions;
the first candidate node is used for returning the signature verification state of the transaction to the first node and storing the block information of the transaction;
the second candidate nodes are used for returning the signature verification state of the transaction to the second node and storing the block information of the transaction;
the originating node and the receiving node are also configured to store the block information of the transaction.
Further, the embodiment of the application also provides a computer storage medium, and the computer storage medium stores computer executable instructions for executing the consensus method.
For details of the computer executable instructions, reference is made to the above detailed description of a blockchain consensus method provided in the embodiments of the present application, and details thereof are not repeated herein.
The utility model provides a block chain consensus method, device, system and storage medium, which is characterized in that all nodes in a block chain form an ordered virtual ring, and the positions of all nodes in the block chain can be disordered through the ordered virtual ring because the positions of the nodes in the ordered virtual ring are independent of the physical positions of the nodes. Based on this, after determining the initiating node and the receiving node of the transaction, the physical locations in the blockchain of the at least one first candidate node associated with the initiating node obtained from the ordered virtual ring are scattered and the locations in the ordered virtual ring are correlated, and the physical locations in the blockchain of the at least one second candidate node associated with the receiving node obtained from the ordered virtual ring are scattered and the locations in the ordered virtual ring are correlated. In this way, whether the trade consensus is successful or not is determined based on the label checking information of the trade by at least one first candidate node and at least one second candidate node, the aim of decentralization can be effectively achieved, and particularly, the more nodes on the blockchain, the more obvious the decentralization effect is, the setting can be approaching to complete decentralization. In addition, the transaction consensus can be realized only by 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 based on part of nodes in the blockchain, and other nodes in the blockchain can also perform consensus of other transactions at the same time, so that the consensus efficiency can be further improved.
The foregoing has outlined rather broadly the more detailed description of the method, apparatus, server and storage medium that is provided herein, and the detailed description of the principles and embodiments that are provided herein has been given by way of example only to assist in the understanding of the method and core idea of the invention; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in accordance with the ideas of the present invention, the present description should not be construed as limiting the present invention in view of the above.
It should be noted that, in the present specification, each embodiment is described in a progressive manner, and each embodiment is mainly described as different from other embodiments, and identical and similar parts between the embodiments are all enough to be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant points refer to the description of the method section.
It is further noted that relational terms such as first and second, and the like are 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. Moreover, 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 is intended to include, elements inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like 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 (8)

1. A method of blockchain consensus, comprising:
determining a transaction to be subjected to blockchain 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 blockchain, wherein the position of the node in the ordered virtual ring is independent of the physical position of the node;
determining a first node of the originating 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 signature verification state of the initiating node and the at least one first candidate node on the transaction meets a preset first signature verification condition, and the second node determines that the signature verification state of the receiving node and the at least one second candidate node on the transaction meets a preset second signature verification 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;
the initiating node generates first rewarding information according to the transaction, stores the first rewarding information into the block information stored by the initiating node and sends the first rewarding information to a first node so that the first node stores the first rewarding information into the block information stored by the first node;
the receiving node generates second rewarding information according to the transaction, stores the second rewarding information into the block information stored by the receiving node and sends the second rewarding information to a second node so that the second node stores the second rewarding information into the block information stored by the second node;
The generation process of the ordered virtual ring comprises the following steps:
acquiring node information of each node in all nodes of the blockchain, wherein the node information comprises any one or more of a node MAC address, a node IP address and node area combination information;
calculating a hash value of the node according to the node information of the node;
and sequencing all the nodes in the blockchain by utilizing the hash values of the nodes to generate an ordered virtual ring of the blockchain.
2. The method of claim 1, wherein the obtaining at least one first candidate node associated with the initiating node of the transaction and at least one second candidate node associated with the receiving node of the transaction in the ordered virtual ring of all nodes of the blockchain comprises:
determining a first number of nodes in the ordered virtual ring that are nearest neighbors to an initiating node of the transaction as at least one first candidate node associated with the initiating node;
a second number of nodes in the ordered virtual ring that are nearest neighbors to a receiving node of the transaction are obtained as at least one second candidate node associated with the receiving node.
3. The method of claim 1, wherein the first node determining that the initiation node and the at least one first candidate node satisfy a preset first signature verification condition for the transaction, and the second node determining that the receipt node and the at least one second candidate node satisfy a preset second signature verification condition for the transaction, comprises:
the first node determines that the signature verification information of the transaction by the initiating node represents the successful signature verification, and a third number of third candidate nodes exist in the at least one first candidate node, and the signature verification information of the transaction by the third candidate nodes represents the successful signature verification;
and, in addition, the method comprises the steps of,
the second node determines that the signature verification information of the transaction by the receiving node represents the successful signature verification, and a fourth number of fourth candidate nodes exist in the at least one second candidate node, and the signature verification information of the transaction by the fourth candidate nodes represents the successful signature verification.
4. The method of claim 3, wherein the 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 signature verification information of the transaction by the initiating node and the third candidate node, and the second information comprises signature verification information of the transaction by the receiving node and the fourth candidate node;
Generating first block information for the transaction stored at the first node according to the second information;
generating second block information for the transaction stored at the second node using the first information.
5. The method of claim 4, wherein 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, 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 store the first block information locally;
broadcasting the second block information to the receiving node and each node except the second node in the at least one second candidate node, wherein the second block information is used for triggering the node receiving the second block information to store the second block information locally.
6. A blockchain consensus device, comprising:
a first determining unit, configured to determine a transaction to be subjected to blockchain consensus;
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 among the at least one first candidate node and a second node of the receiving node among 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 state of the initiating node and the at least one first candidate node on the transaction meets a preset first signature verification condition, and the second node determines that the signature verification state of the receiving node and the at least one second candidate node on the transaction meets a preset second signature verification condition;
a first storage unit, 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;
A fifth generating unit, configured to enable the initiating node to generate first rewarding information according to the transaction, and enable the receiving node to generate second rewarding information according to the transaction;
a second storage unit, configured to store the first bonus information into the block information stored in the originating node and the block information stored in the first node; storing the second rewarding information into the block information stored by the receiving node and the block information stored by the second node;
the generation process of the ordered virtual ring comprises the following steps:
acquiring node information of each node in all nodes of the blockchain, wherein the node information comprises any one or more of a node MAC address, a node IP address and node area combination information;
calculating a hash value of the node according to the node information of the node;
and sequencing all the nodes in the blockchain by utilizing the hash values of the nodes to generate an ordered virtual ring of the blockchain.
7. A blockchain, comprising:
an initiating node, configured to determine a transaction to be performed with blockchain consensus, obtain 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 blockchain, and determine a first node of the initiating nodes in the at least one first candidate node;
A receiving node for obtaining at least one second candidate node in the ordered virtual ring related to the 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 signature verification states of the initiating node and the at least one first candidate node on the transaction meet a preset first signature verification condition, and the signature verification states of the receiving node and the at least one second candidate node on the transaction meet a preset second signature verification condition;
the first candidate node is used for returning a signature verification state of the transaction and storing block information of the transaction to the first node;
the second candidate nodes are used for returning the signature verification state of the transaction and storing block information of the transaction to the second node;
the initiating node is further used for storing block information of the transaction, generating first rewarding information according to the transaction, and storing the first rewarding information into the locally stored block information; and transmitting the first bonus information to a first node;
The receiving node is further configured to store block information of the transaction, generate second rewarding information according to the transaction, store the second rewarding information into the locally stored block information, and send the second rewarding information to a second node;
the first node is further configured to store the first bonus information into the locally stored block information;
the second node is further configured to store the second prize information into the locally stored block information;
the generation process of the ordered virtual ring comprises the following steps:
acquiring node information of each node in all nodes of the blockchain, wherein the node information comprises any one or more of a node MAC address, a node IP address and node area combination information;
calculating a hash value of the node according to the node information of the node;
and sequencing all the nodes in the blockchain by utilizing the hash values of the nodes to generate an ordered virtual ring of the blockchain.
8. A computer readable storage medium having stored therein computer executable instructions for performing the blockchain consensus method according to any of the claims 1-5.
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 CN112184454A (en) 2021-01-05
CN112184454B true 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)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113076376B (en) * 2021-03-29 2024-02-06 湖北央中巨石信息技术有限公司 Multi-party asynchronous sampling consensus method, system and device based on block chain and medium
CN114710507B (en) * 2022-03-30 2023-10-27 蚂蚁区块链科技(上海)有限公司 Consensus method, blockchain node, medium and consensus 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
分布式金融技术白皮书;无;《豆丁网》;20200102;第64-72页 *

Also Published As

Publication number Publication date
CN112184454A (en) 2021-01-05

Similar Documents

Publication Publication Date Title
CN109544334B (en) Method for realizing network extensible block chain
CN107220130B (en) Method, device and system for realizing information consensus at nodes of block chain
CN107464106B (en) Method and system for transaction between main chain and side chain of block chain
CN108492103B (en) Joint block chain consensus method
CN107169865B (en) Asset data processing system based on block chain technology
CN110945548A (en) Computer-implemented system and method for managing large distributed storage pools in a blockchain network
CN109447795A (en) Byzantine consensus method supporting rapid achievement of final confirmation
CN112184454B (en) Block chain consensus method, device, system and storage medium
CN108900585A (en) Across chain transaction consistency implementation method
CN108848056A (en) Block chain common recognition method based on verifying
CN108881274A (en) A kind of block chain sharding method and device based on application
CN108665359A (en) Block chain processing method, accounting nodes and verification node
Sun et al. Rtchain: A reputation system with transaction and consensus incentives for e-commerce blockchain
CN110610421B (en) Guarantee fund management method and device under fragment framework
Zhang et al. Cycledger: A scalable and secure parallel protocol for distributed ledger via sharding
CN111080452A (en) Hierarchical transaction method suitable for energy source block chain
Chakrabarti et al. A blockchain based incentive scheme for post disaster opportunistic communication over DTN
WO2020082213A1 (en) Network expandability blockchain implementation method
CN113568972A (en) Mixed consensus realization device and method for schema block chain
Hoepman Distributed double spending prevention
CN113612618B (en) Alliance chain consensus method and device
Peterson et al. Towards detection of selfish mining using machine learning
Wels Guaranteed-TX: The exploration of a guaranteed cross-shard transaction execution protocol for Ethereum 2.0.
WO2021016546A1 (en) Unity protocol consensus
WO2020089567A1 (en) Parallel pool formation under decision-making by decentralized network nodes

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