CN111478785B - Consensus method in block chain network, node and storage medium - Google Patents

Consensus method in block chain network, node and storage medium Download PDF

Info

Publication number
CN111478785B
CN111478785B CN201910070109.5A CN201910070109A CN111478785B CN 111478785 B CN111478785 B CN 111478785B CN 201910070109 A CN201910070109 A CN 201910070109A CN 111478785 B CN111478785 B CN 111478785B
Authority
CN
China
Prior art keywords
node
consensus
block
nodes
excitation
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
CN201910070109.5A
Other languages
Chinese (zh)
Other versions
CN111478785A (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.)
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Century Trading Co Ltd, Beijing Jingdong Shangke Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN201910070109.5A priority Critical patent/CN111478785B/en
Publication of CN111478785A publication Critical patent/CN111478785A/en
Application granted granted Critical
Publication of CN111478785B publication Critical patent/CN111478785B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/30Decision processes by autonomous network management units using voting and bidding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/08Network architectures or network communication protocols for network security for authentication of entities

Abstract

The invention provides a consensus method, a node and a storage medium in a block chain network, wherein the method comprises the following steps: receiving a confirmation message of a block, wherein the block comprises a certification-approved excitation transaction, and the certification-approved excitation transaction indicates that the node which participates in block consensus last time in the block chain network is subjected to certification excitation according to an excitation strategy; obtaining the number of certificates of the first node; and executing block consensus when the first node is determined to have the authority of executing block consensus based on the number of the certificates of the first node.

Description

Consensus method in block chain network, node and storage medium
Technical Field
The present invention relates to communications technologies, and in particular, to a consensus method in a blockchain network, a node, and a storage medium.
Background
In a block chain network in the related art, a coalition chain mostly adopts a Byzantine Fault tolerant (PBFT) consensus algorithm, nodes participating in consensus lack intra-chain excitation, and completely adopt out-chain excitation, so that the coalition chain lacks vitality and autonomy.
Disclosure of Invention
The embodiment of the invention provides a consensus method, a node and a storage medium in a block chain network, which can effectively improve the performance of a alliance chain.
The technical scheme of the embodiment of the invention is realized as follows:
in a first aspect, an embodiment of the present invention provides a consensus method in a blockchain network, which is applied to a first node, and includes:
receiving a confirmation message of a block, wherein the block comprises a certification-approved excitation transaction, and the certification-approved excitation transaction indicates that the node which participates in block consensus last time in the block chain network is subjected to certification excitation according to an excitation strategy;
and executing block consensus when the first node is determined to have the authority of executing block consensus based on the number of the certificates of the first node.
In the above scheme, the method further comprises:
in the process of identifying the blocks together, obtaining votes of nodes which identify the blocks together in the block chain network;
recording consensus status information of the nodes performing consensus on the blocks when determining that a second node exists among the nodes performing consensus on the blocks based on the obtained votes, the consensus status information being used for forming the certified incentive transaction when the blocks of the blockchain network are consensus next time;
the second node is a node, of the nodes performing consensus on the blocks, of which the voting time and/or the voting content do not meet preset conditions.
In the foregoing solution, the determining that the first node has the authority to perform block consensus based on the number of certificates of the first node includes:
determining the ordering of the first node in a consensus ordering queue of the block chain network based on the evidence passing number of the first node, wherein the consensus ordering queue comprises a plurality of nodes arranged according to the evidence passing number sequence;
determining that the first node has the authority to perform block consensus according to the determined ordering of the first node.
In the foregoing solution, the determining that the first node has the authority to perform block consensus according to the determined sequence of the first node includes:
in response to the order of the nodes in the consensus sequencing queue being arranged according to the order of the number of certificates from more to less,
and according to the determined sequence of the first node, when the sequence is determined to be in a preset sequence range, the first node has the authority of executing block consensus.
In the foregoing solution, after the performing the consensus on the blocks, the method further includes:
determining a number of passes for nodes performing consensus on the block;
updating the ordering of the nodes in the consensus ordering queue based on the determined number of passes.
In the above scheme, the method further comprises:
in response to the first node having the transaction packaging authority, packaging the transactions collected by the first node to form a block;
determining a node with block consensus executing authority in the consensus sequencing queue;
and broadcasting the blocks formed by packaging to the nodes with the block consensus executing authority in the consensus sequencing queue.
In the foregoing solution, the determining that the first node has the authority to perform block consensus based on the number of certificates of the first node includes:
and determining that the first node has the permission of executing block consensus when the certification amount reaches a preset amount threshold value based on the certification amount of the first node.
In a second aspect, an embodiment of the present invention further provides a node, where the node is a first node, and the node includes:
a receiving unit, configured to receive a confirmation message of a block, where the block includes a certified excitation transaction, and the certified excitation transaction indicates that certified excitation is performed on a node that last participated in block consensus in the block chain network according to an excitation policy;
and the consensus unit is used for executing block consensus when the first node is determined to have the authority of executing block consensus based on the number of the certificates of the first node.
In the foregoing solution, the node further includes:
an obtaining unit, configured to obtain, in a process of consensus on the blocks, a vote of a node performing consensus on the blocks in the block chain network;
a recording unit, configured to record consensus status information of nodes performing consensus on the block when it is determined that a second node exists among the nodes performing consensus on the block based on the obtained vote, where the consensus status information is used to form the certified incentive transaction when a next block of the blockchain network is in consensus;
the second node is a node, of the nodes performing consensus on the blocks, of which the voting time and/or the voting content do not meet preset conditions.
In the foregoing solution, the consensus unit is further configured to determine, based on the number of certificates approved by the first node, a ranking of the first node in a consensus ranking queue of the block chain network, where the consensus ranking queue includes a plurality of nodes arranged according to the order of the number of certificates approved;
determining that the first node has the authority to perform block consensus according to the determined ordering of the first node.
In the above solution, the consensus unit is further configured to respond to the order of the nodes in the consensus sorting queue being arranged according to the order of the number of certificates from more to less,
and according to the determined sequence of the first node, when the sequence is determined to be in a preset sequence range, the first node has the authority of executing block consensus.
In the foregoing solution, the node further includes:
an updating unit, configured to determine a certified quantity of nodes performing consensus on the blocks;
updating the ordering of the nodes in the consensus ordering queue based on the determined number of passes.
In the foregoing solution, the node further includes:
the packaging unit is used for packaging the transactions collected by the first node to form a block in response to the first node having the transaction packaging authority;
a broadcast unit, configured to determine a node in the consensus sequencing queue that has an authority to perform block consensus;
and broadcasting the blocks formed by packaging to the nodes with the block consensus executing authority in the consensus sequencing queue.
In the foregoing solution, the consensus unit is further configured to determine that the first node has an authority to perform block consensus when the number of certificates reaches a preset number threshold based on the number of certificates of the first node.
In a third aspect, an embodiment of the present invention provides a node in a blockchain network, where the node includes:
a memory for storing executable instructions;
and the processor is used for implementing the consensus method in the block chain network provided by the embodiment of the invention when the executable instructions stored in the memory are executed.
In a fourth aspect, an embodiment of the present invention provides a storage medium storing executable instructions for causing a processor to implement the consensus method in the blockchain network provided by the embodiment of the present invention when executed.
The application of the embodiment of the invention has the following beneficial effects:
by applying the consensus method, the node and the storage medium in the block chain network provided by the embodiment of the invention, the confirmation message of the block received by the node contains the evidence-based incentive transaction for instructing the node participating in the block consensus last time to perform evidence-based incentive transaction, and in the block consensus stage, the evidence-based incentive transaction is executed, so that the evidence-based incentive to the node participating in the block consensus last time is realized, and the permission of the node for the block consensus is based on the evidence-based quantity, so that the node actively participates in the consensus, and the performance of the block chain network is improved.
Drawings
Fig. 1 is a schematic functional architecture diagram of a block chain network according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of an organization of a blockchain network according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a node according to an embodiment of the present invention;
fig. 4 is a flowchart illustrating a consensus method in a blockchain network according to an embodiment of the present invention;
fig. 5 is a flowchart illustrating a consensus method in a blockchain network according to an embodiment of the present invention;
FIG. 6 is a diagram illustrating a consensus sequencing queue according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of a node in a block chain network according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the present invention will be further described in detail with reference to the accompanying drawings, the described embodiments should not be construed as limiting the present invention, and all other embodiments obtained by a person of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. The terminology used herein is for the purpose of describing embodiments of the invention only and is not intended to be limiting of the invention.
In the following description, reference is made to "some embodiments" which describe a subset of all possible embodiments, but it is understood that "some embodiments" may be the same subset or different subsets of all possible embodiments, and may be combined with each other without conflict.
It should be noted that the terms "first", "second", and the like in the embodiments of the present invention are used for distinguishing similar objects and not for representing a specific ordering of the objects, and it should be understood that "first", "second", and the like may be interchanged with one another in a specific order or sequence, where possible, to enable the embodiments of the present invention described herein to be performed in an order other than that illustrated or described herein.
Before further detailed description of the embodiments of the present invention, terms and expressions mentioned in the embodiments of the present invention are explained, and the terms and expressions mentioned in the embodiments of the present invention are applied to the following explanations.
1) Transactions (transactions), equivalent to the computer term "Transaction," does not refer solely to transactions in the business context, and embodiments of the present invention follow this convention in view of the convention in blockchain technology that colloquially uses the term "Transaction. In a blockchain network employing an account-based model, transactions include three different transaction types: deployment (deployment), invocation (Invoke) and Query (Query). The deployment transaction is used for installing a specified chain code to a node of the blockchain network, and the call and query type transaction is used for calling the chain code of the deployment number so as to realize the operation of relevant data of a target account in the ledger, wherein the operation of adding, deleting, checking and changing modifies the data in the form of Key-Value pairs in the account, or adds a new account in the ledger.
2) A Block (Block) recording a data structure of the ledger data updated by the exchange within a period of time, marked with a timestamp and a unique mark (e.g. a digital fingerprint) of a previous Block, and after the Block is subjected to consensus verification by nodes in the Block chain network, the Block is appended to the end of the Block chain to become a new Block.
3) A chain of blocks (Blockchain), a chain of data structures in which blocks are assembled in a sequentially contiguous manner, each block having a hash value of a previous block or a subset thereof referenced therein, to cryptographically secure the recorded transaction against tampering and forgery.
4) A blockchain network incorporates new blocks into a set of centerless nodes of the blockchain in a consensus manner.
5) Consensus (Consensus), a process in a blockchain network, is used to agree on transaction results among multiple nodes involved, and the mechanisms for achieving Consensus include Proof of workload (PoW), Proof of rights and interests (PoS, Proof of stamp), Proof of equity authority (DPoS), Proof of Elapsed Time (PoET, Proof of Elapsed Time), and so on.
For example, in a blockchain system, a node verifies the validity of a new block submitted by other nodes, and if the verification is successful, an acknowledgement is sent to the node sending the new block, and the new block is added to the tail of a blockchain stored by the corresponding node.
6) A voucher, i.e. a negotiable encrypted digital rights voucher, represents a right or an intrinsic and intrinsic value, such as a currency, a bill, a ticket, a point, a stock, a bond, etc., and is authentic and tamper-resistant, and can be distributed in a block-chain network.
7) In response to the condition or state on which the performed operation depends, one or more of the performed operations may be in real-time or may have a set delay when the dependent condition or state is satisfied; there is no restriction on the order of execution of the operations performed unless otherwise specified.
An exemplary functional architecture of a block chain network for implementing the embodiment of the present invention is described below, and referring to fig. 1, fig. 1 is a schematic functional architecture diagram of a block chain network provided in the embodiment of the present invention, which includes an application layer 101, a consensus layer 102, a network layer 103, a data layer 104, and a resource layer 105, which are described below respectively.
The resource layer 105 encapsulates various available computing and storage resources, such as those in computers, servers/clusters, and clouds, abstracts and provides a uniform interface to the data layer 104 to mask the variability of the underlying hardware implementing the resource layer 105.
The computing resources include various forms of processors such as a Central Processing Unit (CPU), an Application Specific Integrated Circuit (ASIC), and a Field-Programmable Gate Array (FPGA).
The storage resources include various types of storage media such as various volatile memories and nonvolatile memories. The nonvolatile Memory may be a Read Only Memory (ROM) or a Programmable Read-Only Memory (PROM). Volatile Memory can be Random Access Memory (RAM), which acts as external cache Memory.
The computing resources and storage resources of the resource layer 105 may be mapped to various types of nodes in a blockchain network, and the storage medium implementing an embodiment of the present invention stores executable instructions for implementing the blockchain network deployment method of an embodiment of the present invention, and once the executable instructions deployed to the nodes are executed, the underlying resources (e.g., various types of processors) implementing the nodes will implement the deployment of various types of nodes in the blockchain network and perform the functions of the various types of nodes, thereby implementing ledgers for transactions in business processes and various applications based on the ledgers.
By way of example, executable instructions may be written in any form of programming language, including compiled or interpreted languages, or declarative or procedural languages, in the form of software (including system programs and applications), software modules, scripts, plug-ins, and the like, and may be deployed in any form, including as a stand-alone program or as a module, component, or other unit suitable for use in a computing environment.
Data layer 104 encapsulates various data structures that implement the ledger, including ledger data implemented in a file system, ledger state and presence proofs implemented in a database form.
Network layer 103 encapsulates point-to-point (P2P) network protocols, data propagation and verification mechanisms, access and authentication mechanisms, and service agent identities. The P2P network protocol realizes communication among nodes in the blockchain network, a data propagation mechanism ensures the propagation of transaction/transaction results in the blockchain network, and a data verification mechanism is used for realizing the reliability of data transmission among the nodes based on an encryption method (such as a digital certificate, a digital signature and a public/private key pair); the access and authentication mechanism is used for managing the access and authentication of the terminal based on the identity of the service subject.
The consensus layer 102 encapsulates mechanisms for achieving consistency of transaction results propagated in the block chain, including POS, POW, DPOS, etc., and supports pluggable consensus mechanisms.
The application layer 101 encapsulates various services that the blockchain network can implement, including transaction settlement, tracing, and evidence storage.
An exemplary organization architecture of a blockchain network implementing an embodiment of the present invention is described below, referring to fig. 2, fig. 2 is a schematic organization architecture diagram of a blockchain network provided by an embodiment of the present invention, and includes at least two consensus nodes 110, and fig. 2 only shows a consensus node 110-1 and a consensus node 110-2 as an example; the consensus node 110-1 and the consensus node 110-2 are correspondingly deployed for the roles implemented in the service by two different service entities participating in the service. The blockchain network 100 responds to transactions submitted by the terminal 300 from the business entity to update the ledger or to query the ledger and displays various intermediate or final results in the user interface 310 of the terminal 300.
Next, a node in a blockchain network provided by an embodiment of the present invention is described, where the node may be one or more servers, and according to the structure of the node, other exemplary structures of the node may be foreseen, so that the structure described herein should not be considered as a limitation, for example, some components described below may be omitted, or components not described below may be added to adapt to special needs of some application scenarios. Fig. 3 is a schematic diagram of a structure of a node provided in an embodiment of the present invention, and referring to fig. 3, the node provided in the embodiment of the present invention includes: at least one processor 210, memory 240, at least one network interface 220, and a user interface 230. The various components in a node are coupled together by a bus system 250. It will be appreciated that the bus system 250 is used to enable communications among the components. The bus system 250 includes a power bus, a control bus, and a status signal bus in addition to a data bus. For clarity of illustration, however, the various buses are labeled as bus system 250 in fig. 3.
The user interface 230 may include a display, keyboard, mouse, trackball, click wheel, keys, buttons, touch pad or touch screen, etc.
The memory 240 may be either volatile memory or nonvolatile memory, and may include both volatile and nonvolatile memory. Among them, the nonvolatile Memory may be a Read Only Memory (ROM), a Programmable Read Only Memory (PROM), an Erasable Programmable Read Only Memory (EPROM), a Flash Memory (Flash Memory), and the like. Volatile Memory can be Random Access Memory (RAM), which acts as external cache Memory.
The Processor 210 may be an integrated circuit chip having Signal processing capabilities, such as a general purpose Processor, a Digital Signal Processor (DSP), or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, or the like, wherein the general purpose Processor may be a microprocessor or any conventional Processor, or the like.
The memory 240 is capable of storing executable instructions 2401 to support the operation of the message processing apparatus, examples of which include: various forms of software modules such as programs, plug-ins, and scripts for operating on a message processing device may include, for example, an operating system and application programs, where the operating system contains various system programs such as a framework layer, a core library layer, a driver layer, etc. for implementing various underlying services and handling hardware-based tasks.
The consensus mechanism employed by the blockchain network is explained next. The consensus mechanism is an agreement on a transaction between the nodes involved, or an algorithm that agrees on the sequence of transactions over a period of time. The embodiment of the present invention is described by taking a consensus mechanism as PBFT as an example. In practical application, a main node is elected in the whole network, each node in a block chain network broadcasts a transaction request sent by a client to the whole network, the main node packages the transaction requests collected from the whole network to generate a block to be confirmed, and then the block to be confirmed is broadcasted to the whole network, so that a consensus node receives the transaction requests; the consensus node executes the transactions, and after the transactions are executed, votes are conducted, so that the main node receives the votes and collects votes of other consensus nodes, when the approval votes collected by the consensus node for the new block reach 2f (f is the tolerable number of Byzantine nodes), the consensus node broadcasts a confirmation stage message (commit message) to the other consensus nodes, collects commit messages sent by the other nodes, and triggers a reply to the client after 2f +1 commit messages are received.
The following describes a method for consensus in a blockchain network according to an embodiment of the present invention. Fig. 4 is a schematic flowchart of a consensus method in a block chain network according to an embodiment of the present invention, where referring to fig. 4, the consensus method in the block chain network according to the embodiment of the present invention includes:
step 301: the first node receives an acknowledgement message for the block.
In one embodiment, the block includes a forensic incentive trade indicating a forensic incentive to a node in the blockchain network that last participated in block consensus according to an incentive policy.
Wherein, the evidence-passing incentive comprises a positive evidence-passing incentive (namely evidence-passing reward) and a negative evidence-passing incentive (namely evidence-passing punishment); in practical implementation, the incentive strategy may include performing a positive incentive for a node whose voting time and voting content both satisfy a preset condition in the node that participates in the block consensus last time, and performing a negative incentive for a node (second node) whose voting time and/or voting content do not satisfy the preset condition in the node that participates in the block consensus last time; in practical applications, the number of certificates for specific excitation can be set according to actual needs.
Here, the voting time and the voting content will be described. In the process of identifying the blocks in common, the nodes receive the confirmation message aiming at the blocks to be confirmed, execute the transaction in the blocks and vote the transaction result, in the process of identifying in common in the current round, if a certain identifying node goes down, the identifying node does not vote actually, namely other identifying nodes do not receive the vote of the identifying node, and the voting time and the voting content of the identifying node are considered to not meet the preset conditions; in the process of the consensus, if a certain consensus node is malignant, the content voted by the consensus node is different or opposite to the content voted by other consensus nodes, and the content voted by the consensus node is considered to not meet the preset condition; in the process of the current round of consensus, if the voting of a certain consensus node is not positive and slow, the time for other consensus nodes to receive the node voting exceeds a set time threshold, and the voting time is considered to not meet the preset condition.
In one embodiment, the forensic incentive transactions are formed based on consensus status information recorded by nodes that last participated in block consensus. The consensus status information records the voting condition of each consensus node in the last block consensus process, such as the voting time, the voting content, and the like of each consensus node.
Illustratively, after electing the master node in the blockchain network, the master node sorts and packages the collected transactions sent by the client to generate a to-be-confirmed block, the first transaction in the block is a certified incentive transaction, the certified incentive transaction is formed according to the consensus status information recorded by the node participating in the last block consensus, and indicates that the node participating in the last block consensus is certified positively and/or negatively, for example, in the consensus node participating in the last block consensus, the voting time and the voting content of the consensus node A, B, C both satisfy the preset conditions and the consensus node D is a rogue node (the second node) according to the recorded consensus status information, and indicates that the node D is certified negatively incentivized, for example, N (N value may be a multiple of 3 in practical application, and may be set specifically according to needs) is reduced in the formed certified incentive transaction, and (3) carrying out evidence-passing positive excitation on the nodes A to C, for example, averagely distributing the reduced N evidence-passing of the node D to the nodes A to C, and of course, in the practical implementation, the distribution of the evidence-passing can also adopt other distribution modes, for example, the distribution can be carried out according to the positive degree of node voting, for example, according to the voting time length.
It should be noted that, in the embodiment of the present invention, the nodes for performing the blockchain network to perform the blockchain consensus for the first time are pre-configured, that is, deployed in advance, for example, when the blockchain network performs the consensus node configuration, the nodes a to E in the blockchain network all have the qualification of performing the consensus on the blockchain, and the nodes a to D are configured to be the consensus nodes, so that when the blockchain network performs the blockchain consensus for the first time, the nodes participating in the consensus are the nodes a to D.
Step 302: and executing block consensus when the first node is determined to have the authority of executing block consensus based on the number of the certificates of the first node.
Here, after receiving the confirmation message of the block, the first node needs to determine whether or not it has the authority to perform consensus on the block, and in an embodiment, the first node determines whether or not it has the authority to perform consensus on the block according to the number of certificates of itself, specifically, the following method may be used to determine:
determining the ordering of the first node in a consensus ordering queue of the block chain network based on the evidence-passing number of the first node, wherein the consensus ordering queue comprises a plurality of nodes arranged according to the evidence-passing number sequence; and judging whether the first node has the authority of executing block consensus or not according to the determined sequence of the first node.
Illustratively, the node sequences in the consensus sequencing queue are sequentially arranged according to the sequence from more to less according to the number of certificates, and according to the determined sequencing of the first node, whether the sequencing is in a preset sequencing range is judged, and when the sequencing is in the preset sequencing range, the first node is determined to have the authority of executing block consensus; and when the sorting is not in the preset sorting range, determining that the first node does not have the authority of executing block consensus. For example, the node a, the node B, the node C, the node D, and the node E are sequentially arranged in the consensus sequencing queue according to the descending order of the number of certificates, the sequence of the first node is 5 th, that is, the first node is the node E, and the preset sequencing range is 1 to 4, that is, the nodes sequencing the first to fourth have consensus authority, it is determined that the first node is not in the preset sequencing range, and does not have the authority to execute block consensus.
In an embodiment, the first node may further determine whether it has the permission to perform consensus on the block according to the following manner: and determining the number of the certificates of the first node, and determining that the first node has the authority of executing block consensus when the number of the certificates reaches a preset number threshold value based on the number of the certificates of the first node. In practical implementation, a threshold value of the number of certificates is set, only when the number of the certificates of the nodes reaches the set threshold value, the nodes have the common identification authority, at the beginning of common identification of the blocks to be confirmed, the nodes judge whether the nodes have the common identification authority according to the number of the certificates of the nodes, when the nodes do not have the common identification authority, the received confirmation messages are ignored, and when the nodes have the common identification authority, the common identification process of the blocks to be confirmed is executed.
In practical implementation, when the first node determines that the first node has the authority to execute the block consensus, firstly, the certified excitation transaction in the block is executed, namely, the certified excitation (positive excitation and negative excitation) of the node participating in the block consensus last time is realized according to the excitation strategy, namely, the certified negative excitation is carried out on the second node, the certified quantity of the second node is reduced, the reduced certified quantity of the second node is distributed to the node (non-second node) participating in the block consensus last time, wherein the voting time and the voting content both meet the preset conditions, and then the transaction execution result is subjected to consensus.
In an embodiment, after the first node performs the consensus on the block, the first node may further determine a certified quantity of each node performing the consensus on the block in the current round of the consensus; updating the ordering of each node in the consensus ordering queue based on the determined number of passes. Therefore, by updating the sequence of the consensus sequence queue, the consensus authority of each node in the block chain network on the block is dynamically adjusted, and the dynamic adjustment of the consensus node in the block chain network is realized.
In an embodiment, a first node acquires votes of nodes performing consensus on blocks in a block chain network in the process of performing consensus on the blocks; recording consensus status information of the nodes performing consensus on the blocks when it is determined that a second node exists among the nodes performing consensus on the blocks based on the obtained votes, the consensus status information being used to form the forensic incentive transaction at a next block consensus of the blockchain network.
In one embodiment, if the first node is elected as a master node (having consensus for the block) by the blockchain network, the first node has transaction packaging authority, the first node packages the transactions collected by the first node and the authentication-enabled transactions (formed by the recorded consensus status information) to form a block to be confirmed, determines a node having block consensus authority in the consensus sorting queue, and broadcasts the packaged block to the node having block consensus authority in the consensus sorting queue. That is, the first node can obtain the node with the consensus authority by obtaining the consensus sorting queue information, and then only broadcasts the node with the consensus authority when the acknowledgement message of the block is broadcasted, so that the consensus efficiency of the block is improved, and the performance of the block chain network is improved.
Here, in practical applications, the first node may determine a node having the block consensus executing authority in the consensus sorting queue by acquiring the consensus sorting queue information stored in the first node.
By applying the embodiment of the invention, according to the voting condition of each consensus node in the consensus process of the blocks, the nodes participating in consensus are subjected to evidence-passing positive excitation and negative excitation, the nodes actively participating in consensus are rewarded, the nodes not actively participating in consensus (downtime, malignancy and slow voting) are punished, consensus competition is realized, the enthusiasm of each node for correctly participating in consensus is aroused, the permission of each node for carrying out consensus on the blocks is dynamically adjusted by updating the sequencing of the nodes in the consensus sequencing queue based on the evidence-passing number of the nodes, the autonomy of consensus is realized, and the performance of the block chain network is further improved.
Taking the super account book as an example, the blockchain network includes a node a, a node B, a node C, a node D, a node E, and a node F, where in the blockchain network, the nodes a to F all have the qualification of participating in the blockchain consensus, and the user deploys the nodes a, B, C, and D in advance as consensus nodes to implement the first round of consensus of the blockchain network through the nodes a to D, and the nodes E and F exist as candidate nodes, at the beginning of the consensus, the node a is selected as a master node, fig. 5 is a schematic flow diagram of the consensus method in the blockchain network provided by the embodiment of the present invention, referring to fig. 5, and the consensus method in the blockchain network provided by the embodiment of the present invention includes:
step 401: node a packages the collected transactions into a first block and broadcasts an acknowledgement message corresponding to the first block to node B to node D.
Here, in practical applications, the node a is used as a master node to broadcast the block formed by packaging to the node having the permission to perform consensus on the first block, and since it is the first round of consensus of the blockchain network, the node having the permission to perform consensus this time is the node a to the node D, specifically, fig. 6 is a schematic diagram of the consensus sequencing queue provided by the embodiment of the present invention, see fig. 6, where a state i represents the ith round of consensus of the blockchain network, the node a obtains the consensus sequencing queue information, and determines that for the first round of consensus of the blockchain network, the top G (G value may be set according to actual needs, e.g. 4) nodes in the consensus sequencing queue have the permission to perform consensus on the block, and for the node a determines that the nodes a to D have the permission to perform consensus on the block according to the obtained consensus sequencing queue information as shown in fig. 6, thus, an acknowledgement message corresponding to the first block is broadcast to node B to node D.
Step 402: node a collects the votes from node B to node D for the first block.
In practical applications, after the node a broadcasts the acknowledgement message corresponding to the first block to the nodes B to D, the votes collected by the nodes B to D for the first block are collected, because the PBFT allows a minority of nodes to do malicious vote, so the votes collected by the node a may be negative votes, or during the process of collecting the votes, a certain identified node (e.g., the node D) is down and votes are slow, so that the voting time of the node received by the node a and other nodes (the node B and the node C) is over, or the votes of the node cannot be received at all.
Step 403: the node A determines the node D as a rogue node based on the collected votes, and records consensus status information.
In practical implementation, the node a receives the negative vote cast by the node D for the first block, determines the node D as a negative node, and records consensus status information including voting conditions of the nodes a to D in the first round of consensus process. The voting situation here includes voting time information and voting content information, for example, node D votes for a negative vote in the first round of consensus process, and the voting time is X.
It should be noted that, during the process of performing consensus on the first block, other consensus nodes (node B to node D) also record consensus status information after performing consensus on the first block.
Step 404: node a receives an acknowledgement message for the second block.
Taking the common identification of the second block as the ith (i is a positive integer greater than 1) round common identification of the block chain network as an example, the confirmation message of the second block comprises the transaction sent by the client side collected by the round master node (such as node B) and also comprises a certification-approved excitation transaction, the certification-approved excitation transaction is formed according to the common identification state information recorded by the node a, the node participating in the block common identification for the i-1 th time in the block chain network is instructed to be certified and excited according to the excitation strategy, the value i is 2, namely the certification-approved excitation transaction in the confirmation message is instructed to be certified and excited to be certified to the nodes a to D correspondingly for the second common identification of the block chain network; since the node D is known as a rogue node according to the recorded consensus status information, the node D is subjected to a negotiable negative excitation, and the nodes a to C are subjected to a negotiable positive excitation, specifically, a certain number of negotiable certificates of the node D are reduced (specifically, the number of negotiable certificates can be set according to actual needs), and the reduced negotiable certificates of the node D are distributed (a specific distribution strategy can be set according to actual needs, such as average distribution or distribution according to consensus enthusiasm) to the nodes a to C.
Step 405: the node A judges whether the node A has the authority for carrying out consensus on the second block or not according to the number of the certificates of the node A, and if the node A has the authority for carrying out consensus on the second block, the step 406 is executed; otherwise, step 407 is executed.
In an embodiment, the node a may determine whether it has the permission to perform consensus on the second block by: and the node A determines the sequencing of the node A in the consensus sequencing queue based on the number of the evidence of the node A, judges whether the determined sequencing is in the first G sequencing ranges of the consensus sequencing queue, determines that the node A has the permission for consensus on the second block if the sequencing of the node A in the consensus sequencing queue is in the first G sequencing ranges, and otherwise determines that the node A does not have the permission for consensus on the second block.
Still taking the value of i as 2, since the consensus sequence queue is not updated or adjusted in the first round of consensus process, the node sequence in the consensus sequence queue is not changed in the second round of consensus, and the node a still has the permission to perform consensus on the second block.
Step 406: node a performs consensus on the second block.
Here, in practical applications, the node a first executes the certified excitation transaction in the second block, and then performs consensus on transaction results to realize certified positive excitation for the nodes a to C and certified negative excitation for the node D. In practical implementation, after the node a performs consensus on the second block, the node rank in the consensus ranking queue is updated according to the number of certificates of each current node, as shown in fig. 6, after the certified excitation transaction in the second block is performed, the number of certificates of the node D is less than the number of certificates of the node E, so that the rank of the node E in the updated node rank is the first (fourth), the rank of the node D is the second (fifth), that is, according to the node rank in the current consensus node ranking queue, the node D does not have the authority to perform block consensus any more, and instead, the node E is replaced, so that when the third round of consensus is performed on the blockchain network, the nodes participating in block consensus change to adjust to the node a, the node B, the node C and the node E, thus competition of consensus among the nodes is realized, and the dynamic adjustment treatment of the consensus node (the node with the confirmed block consensus) in the blockchain network is realized, the performance of the blockchain network is improved.
Step 407: and ending the processing flow.
Fig. 7 is a schematic diagram of a structure of a node in a blockchain network according to an embodiment of the present invention, where the node is configured to implement the consensus method according to the embodiment of the present invention, and as shown in fig. 7, the node in the blockchain network according to the embodiment of the present invention is a first node, and includes:
a receiving unit 71, configured to receive a confirmation message of a block, where the block includes a certified excitation transaction, and the certified excitation transaction indicates that certified excitation is performed on a node that last participates in block consensus in the block link network according to an excitation policy;
a consensus unit 72, configured to perform consensus on the block when it is determined that the first node has the authority to perform block consensus based on the number of certificates of the first node.
In one embodiment, the node further comprises:
an obtaining unit, configured to obtain, in a process of consensus on the blocks, a vote of a node performing consensus on the blocks in the block chain network;
a recording unit, configured to record consensus status information of nodes performing consensus on the block when it is determined that a second node exists among the nodes performing consensus on the block based on the obtained vote, where the consensus status information is used to form the certified incentive transaction when a next block of the blockchain network is in consensus;
the second node is a node, of the nodes performing consensus on the blocks, of which the voting time and/or the voting content do not meet preset conditions.
In an embodiment, the consensus unit is further configured to determine, based on the number of certificates of the first node, an ordering of the first node in a consensus ordering queue of the blockchain network, where the consensus ordering queue includes a plurality of nodes arranged in order according to the number of certificates;
determining that the first node has the authority to perform block consensus according to the determined ordering of the first node.
In one embodiment, the consensus unit is further configured to, in response to the order of the nodes in the consensus sorting queue being arranged according to the order of the number of certificates from more to less,
and according to the determined sequence of the first node, when the sequence is determined to be in a preset sequence range, the first node has the authority of executing block consensus.
In one embodiment, the node further comprises:
an updating unit, configured to determine a certified quantity of nodes performing consensus on the blocks;
updating the ordering of the nodes in the consensus ordering queue based on the determined number of passes.
In one embodiment, the node further comprises:
the packaging unit is used for packaging the transactions collected by the first node to form a block in response to the first node having the transaction packaging authority;
a broadcast unit, configured to determine a node in the consensus sequencing queue that has an authority to perform block consensus;
and broadcasting the blocks formed by packaging to the nodes with the block consensus executing authority in the consensus sequencing queue.
In an embodiment, the consensus unit is further configured to determine that the first node has an authority to perform block consensus when the number of certificates reaches a preset number threshold based on the number of certificates of the first node.
Here, it should be noted that: the above description related to the node is similar to the above description of the consensus method in the blockchain network, and the description of the beneficial effect of the same method is omitted for brevity. For technical details not disclosed in the node embodiments of the present invention, refer to the description of the method embodiments of the present invention.
The embodiment of the present invention further provides a storage medium, which stores executable instructions for causing a processor to execute the method for consensus in a blockchain network according to the embodiment of the present invention.
The above description is only an example of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, and improvement made within the spirit and scope of the present invention are included in the protection scope of the present invention.

Claims (16)

1. A consensus method in a blockchain network, applied to a first node, includes:
receiving a confirmation message of a block, wherein the block comprises a certification-approved excitation transaction, and the certification-approved excitation transaction indicates that the node which participates in block consensus last time in the block chain network is subjected to certification excitation according to an excitation strategy;
based on the number of the certificates of the first node, when the first node is determined to have the authority of executing block consensus, executing the consensus on the blocks; wherein the content of the first and second substances,
the evidence-passing excitation comprises evidence-passing positive excitation and evidence-passing negative excitation; the incentive policy includes: and carrying out the certified positive excitation on the node of which the voting time and the voting content both meet the preset conditions in the node which participates in the block consensus last time, and carrying out the certified negative excitation on the node of which the voting time and/or the voting content do not meet the preset conditions in the node which participates in the block consensus last time.
2. The consensus method of claim 1, further comprising:
in the process of identifying the blocks together, obtaining votes of nodes which identify the blocks together in the block chain network;
recording consensus status information of the nodes performing consensus on the blocks when determining that a second node exists among the nodes performing consensus on the blocks based on the obtained votes, the consensus status information being used for forming the certified incentive transaction when the blocks of the blockchain network are consensus next time;
the second node is a node, of the nodes performing consensus on the blocks, of which the voting time and/or the voting content do not meet preset conditions.
3. The consensus method of claim 1, wherein said determining that the first node has permission to perform block consensus based on the certified quantity of the first node comprises:
determining the ordering of the first node in a consensus ordering queue of the block chain network based on the evidence passing number of the first node, wherein the consensus ordering queue comprises a plurality of nodes arranged according to the evidence passing number sequence;
determining that the first node has the authority to perform block consensus according to the determined ordering of the first node.
4. The consensus method of claim 3, wherein said determining that the first node has permission to perform block consensus based on the determined ordering of the first node comprises:
in response to the order of the nodes in the consensus sequencing queue being arranged according to the order of the number of certificates from more to less,
and according to the determined sequence of the first node, when the sequence is determined to be in a preset sequence range, the first node has the authority of executing block consensus.
5. A consensus method as claimed in claim 3, wherein after said performing consensus on said blocks, said method further comprises:
determining a number of passes for nodes performing consensus on the block;
updating the ordering of the nodes in the consensus ordering queue based on the determined number of passes.
6. A consensus method as claimed in claim 3, further comprising:
in response to the first node having the transaction packaging authority, packaging the transactions collected by the first node to form a block;
determining a node with block consensus executing authority in the consensus sequencing queue;
and broadcasting the blocks formed by packaging to the nodes with the block consensus executing authority in the consensus sequencing queue.
7. The consensus method of claim 1, wherein said determining that the first node has permission to perform block consensus based on the certified quantity of the first node comprises:
and determining that the first node has the permission of executing block consensus when the certification amount reaches a preset amount threshold value based on the certification amount of the first node.
8. A node in a blockchain network, the node being a first node, the node comprising:
a receiving unit, configured to receive a confirmation message of a block, where the block includes a certified excitation transaction, and the certified excitation transaction indicates that certified excitation is performed on a node that last participated in block consensus in the block chain network according to an excitation policy;
the consensus unit is used for executing consensus on the blocks when the first node is determined to have the authority of executing block consensus based on the number of the certificates of the first node; wherein the content of the first and second substances,
the evidence-passing excitation comprises evidence-passing positive excitation and evidence-passing negative excitation; the incentive policy includes: and carrying out the certified positive excitation on the node of which the voting time and the voting content both meet the preset conditions in the node which participates in the block consensus last time, and carrying out the certified negative excitation on the node of which the voting time and/or the voting content do not meet the preset conditions in the node which participates in the block consensus last time.
9. The node of claim 8, wherein the node further comprises:
an obtaining unit, configured to obtain, in a process of consensus on the blocks, a vote of a node performing consensus on the blocks in the block chain network;
a recording unit, configured to record consensus status information of nodes performing consensus on the block when it is determined that a second node exists among the nodes performing consensus on the block based on the obtained vote, where the consensus status information is used to form the certified incentive transaction when a next block of the blockchain network is in consensus;
the second node is a node, of the nodes performing consensus on the blocks, of which the voting time and/or the voting content do not meet preset conditions.
10. The node of claim 8,
the consensus unit is further configured to determine, based on the number of certificates of the first node, a ranking of the first node in a consensus ranking queue of the block chain network, where the consensus ranking queue includes a plurality of nodes arranged in order according to the number of certificates;
determining that the first node has the authority to perform block consensus according to the determined ordering of the first node.
11. The node of claim 10,
the consensus unit is also used for responding to the order of the nodes in the consensus sequencing queue from more to less according to the order of the number of certificates,
and according to the determined sequence of the first node, when the sequence is determined to be in a preset sequence range, the first node has the authority of executing block consensus.
12. The node of claim 10, wherein the node further comprises:
an updating unit, configured to determine a certified quantity of nodes performing consensus on the blocks;
updating the ordering of the nodes in the consensus ordering queue based on the determined number of passes.
13. The node of claim 10, wherein the node further comprises:
the packaging unit is used for packaging the transactions collected by the first node to form a block in response to the first node having the transaction packaging authority;
a broadcast unit, configured to determine a node in the consensus sequencing queue that has an authority to perform block consensus;
and broadcasting the blocks formed by packaging to the nodes with the block consensus executing authority in the consensus sequencing queue.
14. The node of claim 8,
the consensus unit is further configured to determine that the first node has an authority to perform block consensus when the number of certificates reaches a preset number threshold based on the number of certificates approved by the first node.
15. A node in a blockchain network, the node comprising:
a memory for storing executable instructions;
a processor configured to implement the consensus method in a blockchain network of any one of claims 1 to 7 when executing executable instructions stored in the memory.
16. A storage medium having stored thereon executable instructions for causing a processor to perform the method of consensus in a blockchain network of one of claims 1 to 7 when executed.
CN201910070109.5A 2019-01-24 2019-01-24 Consensus method in block chain network, node and storage medium Active CN111478785B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910070109.5A CN111478785B (en) 2019-01-24 2019-01-24 Consensus method in block chain network, node and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910070109.5A CN111478785B (en) 2019-01-24 2019-01-24 Consensus method in block chain network, node and storage medium

Publications (2)

Publication Number Publication Date
CN111478785A CN111478785A (en) 2020-07-31
CN111478785B true CN111478785B (en) 2021-11-02

Family

ID=71743666

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910070109.5A Active CN111478785B (en) 2019-01-24 2019-01-24 Consensus method in block chain network, node and storage medium

Country Status (1)

Country Link
CN (1) CN111478785B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114979148B (en) * 2022-06-16 2023-07-14 中国联合网络通信集团有限公司 Data transmission method, device and computer readable storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107424066A (en) * 2017-07-19 2017-12-01 武汉凤链科技有限公司 A kind of method and its system of mechanism of being built a consensus based on the magnitude of value
CN107579848A (en) * 2017-08-30 2018-01-12 上海保险交易所股份有限公司 The method that common recognition node is dynamically changed in practical Byzantine failure tolerance common recognition mechanism
CN108492103A (en) * 2018-02-07 2018-09-04 北京大学深圳研究生院 A kind of alliance's block chain common recognition method
CN108648076A (en) * 2018-04-19 2018-10-12 上海分布信息科技有限公司 A kind of method and system elected common recognition node and generate nodal information table
CN108665359A (en) * 2017-03-29 2018-10-16 中国移动通信有限公司研究院 Block chain processing method, accounting nodes and verification node

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107124403A (en) * 2017-04-14 2017-09-01 朱清明 The generation method and computing device of common recognition block in block chain
US10790980B2 (en) * 2017-07-14 2020-09-29 International Business Machines Corporation Establishing trust in an attribute authentication system
CN108182635A (en) * 2017-12-18 2018-06-19 深圳前海微众银行股份有限公司 Block chain common recognition method, system and computer readable storage medium
CN109255597A (en) * 2018-08-30 2019-01-22 杭州复杂美科技有限公司 A kind of common recognition bonusing method, common recognition excitation system, equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108665359A (en) * 2017-03-29 2018-10-16 中国移动通信有限公司研究院 Block chain processing method, accounting nodes and verification node
CN107424066A (en) * 2017-07-19 2017-12-01 武汉凤链科技有限公司 A kind of method and its system of mechanism of being built a consensus based on the magnitude of value
CN107579848A (en) * 2017-08-30 2018-01-12 上海保险交易所股份有限公司 The method that common recognition node is dynamically changed in practical Byzantine failure tolerance common recognition mechanism
CN108492103A (en) * 2018-02-07 2018-09-04 北京大学深圳研究生院 A kind of alliance's block chain common recognition method
CN108648076A (en) * 2018-04-19 2018-10-12 上海分布信息科技有限公司 A kind of method and system elected common recognition node and generate nodal information table

Also Published As

Publication number Publication date
CN111478785A (en) 2020-07-31

Similar Documents

Publication Publication Date Title
JP7450339B2 (en) Systems, methods, and computer programs for resource fairness for blockchain
US11057225B2 (en) Enforcing compute equity models in distributed blockchain
US10609032B2 (en) Enforcing compute equity models in distributed blockchain
US20190179672A1 (en) Enforcing compute equity models in distributed blockchain
Ning et al. Blockchain-enabled intelligent transportation systems: a distributed crowdsensing framework
CN110991622B (en) Machine learning model processing method based on block chain network and node
CN109964446B (en) Consensus method based on voting
US10831530B2 (en) Secure consensus-based endorsement for self-monitoring blockchain
US11854405B2 (en) Performing vehicle logistics in a blockchain
JP2023018005A (en) Block chain for general calculation
Andrade et al. Discouraging free riding in a peer-to-peer cpu-sharing grid
US11593321B2 (en) Systems and methods of self-administered protocols on a blockchain platform
JP2019160312A (en) Blockchain node, method of blockchain node, and computer program for blockchain node
US11769156B2 (en) Automated data projection for smart contract groups on a blockchain
CN108846673B (en) Block data processing method, device, equipment and storage medium
CN112073483B (en) Authority certification consensus method and system based on credit and committee endorsement mechanism
TWI718472B (en) Event prediction method and device, electronic equipment
CN113407632A (en) PBFT (proxy-based policy and authorization-based ft) trust certification block chain consensus algorithm
CN111294379A (en) Block chain network service platform, authority hosting method thereof and storage medium
CN111737104A (en) Block chain network service platform, test case sharing method thereof and storage medium
CN110990790B (en) Data processing method and equipment
CN115131022B (en) Block chain based digital asset transaction method, device, equipment and medium
Fu et al. Teegraph: A Blockchain consensus algorithm based on TEE and DAG for data sharing in IoT
CN111478785B (en) Consensus method in block chain network, node and storage medium
Nardini et al. A blockchain-based decentralized electronic marketplace for computing resources

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
GR01 Patent grant
GR01 Patent grant