CN113282603B - Block chain consensus node checking method, device, equipment and storage medium - Google Patents

Block chain consensus node checking method, device, equipment and storage medium Download PDF

Info

Publication number
CN113282603B
CN113282603B CN202110698294.XA CN202110698294A CN113282603B CN 113282603 B CN113282603 B CN 113282603B CN 202110698294 A CN202110698294 A CN 202110698294A CN 113282603 B CN113282603 B CN 113282603B
Authority
CN
China
Prior art keywords
consensus
node
information
block
consensus node
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
CN202110698294.XA
Other languages
Chinese (zh)
Other versions
CN113282603A (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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202110698294.XA priority Critical patent/CN113282603B/en
Publication of CN113282603A publication Critical patent/CN113282603A/en
Application granted granted Critical
Publication of CN113282603B publication Critical patent/CN113282603B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • 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/23Updating
    • G06F16/2365Ensuring data consistency and integrity
    • 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/64Protecting data integrity, e.g. using checksums, certificates or signatures
    • 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

Abstract

The embodiment of the application provides a method, a device, equipment and a storage medium for checking a block chain consensus node, wherein the method comprises the following steps: acquiring message data respectively sent by at least one consensus node, and determining consensus check information respectively corresponding to the at least one consensus node according to the message data; determining the consensus verification information respectively corresponding to the consensus nodes as information to be verified to obtain at least two pieces of information to be verified, and determining target verification information from the at least two pieces of information to be verified; if the quantity of the target verification information reaches a quantity threshold value and the information to be verified of the current consensus node is the same as the target verification information, determining that the current consensus node belongs to a normal consensus node; and if the quantity of the target verification information reaches a quantity threshold value and the to-be-verified information of the current consensus node is different from the target verification information, determining that the current consensus node belongs to the abnormal consensus node. By adopting the method and the device, the success rate of consensus can be effectively ensured, and the consensus efficiency of the block chains is improved.

Description

Block chain consensus node checking method, device, equipment and storage medium
The present application is a divisional application of chinese patent application with the application number 202010224584.6, entitled "method, apparatus, device and storage medium for checking blockchain consensus node", filed on 26.03.2020, which is incorporated by reference in its entirety.
Technical Field
The present application relates to the field of blockchain technologies, and in particular, to a method, an apparatus, a device, and a storage medium for checking a blockchain consensus node.
Background
The block chain is a decentralized distributed account book system and has the characteristics of data non-tampering, decentralized and openness. The consensus mechanism is used as a core in the blockchain technology, can ensure that the latest block is accurately added to the blockchain, and the blockchain information stored by the node is consistent and not forked, even can resist malicious attacks, and the consensus node plays an important role in the consensus mechanism.
In the prior art, after the verification of a new block is completed, the consensus node in the block chain network verifies the generated new block, and each consensus node needs to broadcast the verification result to other consensus nodes in the block chain network, and after receiving the verification results of the other consensus nodes, each consensus node can determine the validity of the new block. However, a network fault may exist in the consensus node in the blockchain network, that is, there may exist a consensus node in an invalid state in the blockchain network, and the new block cannot be verified by the consensus node in the invalid state, so that when there are too many consensus nodes in the invalid state in the blockchain network, it is difficult to ensure a success rate of consensus, and thus, the consensus efficiency of the blockchain may be low.
Disclosure of Invention
The embodiment of the application provides a block chain consensus node checking method, a block chain consensus node checking device and a block chain consensus node checking storage medium, which can effectively guarantee the success rate of consensus so as to improve the consensus efficiency of a block chain.
An aspect of the present application provides a method for checking a blockchain consensus node, including:
acquiring message data respectively sent by at least one consensus node in a block chain network, and determining consensus check information respectively corresponding to the at least one consensus node according to the message data; at least one consensus node is the rest consensus nodes except the current consensus node in the block chain network;
determining common identification check information respectively corresponding to at least one common identification node and a current common identification node as information to be checked to obtain at least two pieces of information to be checked, and determining target check information from the at least two pieces of information to be checked according to the number of the same pieces of information to be checked in the at least two pieces of information to be checked;
if the number of the target verification information is larger than or equal to the number threshold value and the information to be verified of the current consensus node is the same as the target verification information, determining that the current consensus node belongs to a normal consensus node;
and if the number of the target verification information is greater than or equal to the number threshold value and the information to be verified of the current consensus node is different from the target verification information, determining that the current consensus node belongs to the abnormal consensus node.
An aspect of the present application provides a device for checking a block chain consensus node, including:
the acquisition module is used for acquiring message data respectively sent by at least one consensus node in the block chain network and determining consensus check information respectively corresponding to the at least one consensus node according to the message data; at least one consensus node is the rest consensus nodes except the current consensus node in the block chain network;
the determining module is used for determining the consensus check information respectively corresponding to the at least one consensus node and the current consensus node as the information to be checked to obtain at least two pieces of information to be checked, and determining target check information from the at least two pieces of information to be checked according to the number of the information to be checked which is the same in the at least two pieces of information to be checked;
the checking module is used for determining that the current consensus node belongs to a normal consensus node if the number of the target checking information is larger than or equal to a number threshold and the information to be checked of the current consensus node is the same as the target checking information;
the checking module is further configured to determine that the current consensus node belongs to the abnormal consensus node if the number of the target checking information is greater than or equal to the number threshold and the information to be checked of the current consensus node is different from the target checking information.
Wherein the message data comprises a response data packet;
the acquisition module comprises:
a request sending unit, configured to send a request packet to at least one consensus node in the blockchain network, so that the at least one consensus node obtains a response packet associated with the request packet; the request data packet is used for confirming the data consensus state between the current consensus node and at least one consensus node;
and the response receiving unit is used for receiving response data packets respectively returned by the at least one consensus node and determining consensus check information respectively corresponding to the at least one consensus node according to the height of the consensus blocks in the response data packets and the consensus stage.
Wherein, the request sending unit is specifically configured to:
and sending a request data packet to at least one consensus node in the block chain network according to the time frequency information through a heartbeat mechanism, so that the at least one consensus node acquires a response data packet associated with the request data packet.
Wherein the message data comprises a consensus message;
the acquisition module comprises:
a consensus information obtaining unit, configured to obtain consensus information respectively broadcast by at least one consensus node in a block chain network, and obtain a consensus block height and a consensus stage associated with the at least one consensus node from the consensus information;
and the check information determining unit is used for determining the consensus check information corresponding to at least one consensus node according to the height of the consensus block and the consensus stage.
Wherein, the determining module comprises:
the classification unit is used for classifying at least two pieces of information to be verified to obtain at least one information category; the same information category has the same information to be verified;
and the counting unit is used for respectively counting the number of the information to be verified contained in each information category and determining the information to be verified in the information category corresponding to the maximum number as the target verification information.
Wherein, the device still includes:
the condition determining module is used for determining that the consensus nodes in the block chain network do not meet the consensus processing condition if the number corresponding to the target check information is smaller than the number threshold;
and the pause module is used for pausing the execution of the consensus processing process in the block chain network until the consensus nodes in the block chain network meet the consensus processing conditions.
Wherein, the device still includes:
the block height determining module is used for determining the height of the common identification block in the target checking information as a first block height, and determining the height of the common identification block in the information to be checked corresponding to the current common identification node as a second block height;
and the first synchronization module is used for acquiring the common block corresponding to the height from the second block height to the first block height and synchronizing the block data in the current common node according to the common block if the second block height is smaller than the first block height.
Wherein, the device still includes:
the consensus node determining module is used for determining a consensus stage in the information to be checked corresponding to the current consensus node as a first consensus stage and determining a consensus stage in the target check information as a second consensus stage if the height of the first block is equal to the height of the second block;
and the second synchronization module is used for acquiring the trigger message data from the first consensus stage to the second consensus stage and synchronizing the message in the current consensus node according to the trigger message data.
Wherein, the device still includes:
the candidate node determining module is used for determining the height of the consensus blocks in the target check information as a first block height, and determining candidate consensus nodes from at least one consensus node; the height of a consensus block corresponding to the candidate consensus node is greater than the height of the first block;
the block acquisition module is used for acquiring a block corresponding to the first block height from the candidate consensus node as a block to be verified;
and the working state determining module is used for determining the working state information of the candidate consensus node according to the verification result of the consensus node corresponding to the target verification information on the block to be verified.
Wherein, operating condition confirms the module includes:
the first comparison unit is used for determining that the candidate consensus node belongs to an invalid working state if the verified value in the verification result of the consensus node corresponding to the target verification information is smaller than the target value;
and the second comparison unit is used for determining that the candidate consensus node belongs to the effective working state if the verified value in the verification result of the consensus node corresponding to the target verification information is greater than or equal to the target value.
In one aspect, embodiments of the present application provide a computer device, which includes a memory and a processor, where the memory stores a computer program, and when the computer program is executed by the processor, the processor is caused to execute steps of the method in one aspect of the embodiments of the present application.
An aspect of the embodiments of the present application provides a computer-readable storage medium, in which a computer program is stored, the computer program comprising program instructions that, when executed by a processor, perform the steps of the method as in an aspect of the embodiments of the present application.
The method and the device for determining the common identification check information of the block chain network can determine the common identification check information corresponding to at least one common identification node according to the message data by acquiring the message data sent by at least one common identification node in the block chain network, determine the target check information according to the quantity of the common identification check information, and determine that the current common identification node belongs to a normal common identification node if the quantity of the target check information is greater than or equal to a quantity threshold value and the common identification check information of the current common identification node is the same as the target check information; and if the number of the target check information is greater than or equal to the number threshold and the consensus check information of the current consensus node is different from the target check information, determining that the current consensus node belongs to the abnormal consensus node. Therefore, the consensus check information corresponding to the other consensus nodes is determined through the message data sent by the other consensus nodes in the block chain network, the current consensus node is checked according to the consensus check information corresponding to the common nodes, the consensus nodes in the effective state in the block chain network can be determined, when the consensus number in the effective state in the block chain network reaches the number threshold, the consensus process is executed, the success rate of consensus can be effectively ensured, and the consensus efficiency of the block chain is improved.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a diagram of a network architecture provided by an embodiment of the present application;
fig. 2 is a schematic diagram of a block chain consensus node checking scenario provided in an embodiment of the present application;
fig. 3 is a schematic flowchart of a method for checking a blockchain consensus node according to an embodiment of the present disclosure;
fig. 4 is a schematic diagram of obtaining consensus verification information according to an embodiment of the present application;
fig. 5 is a schematic diagram of block data in a synchronous consensus node according to an embodiment of the present application;
fig. 6 is a schematic diagram of a message in a synchronous consensus node according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of an apparatus for checking a block chain common node according to an embodiment of the present disclosure;
fig. 8 is a schematic structural diagram of a computer device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The Blockchain (Blockchain) is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission (P2P transmission), a consensus mechanism, an encryption algorithm and the like. The blockchain is essentially a decentralized database, which is a string of data blocks associated by using cryptography, each data block contains information of a batch of network transactions, and the information is used for verifying the validity (anti-counterfeiting) of the information and generating the next block. The blockchain may include a blockchain underlying platform, a platform product services layer, and an application services layer.
The block chain underlying platform can comprise processing modules such as user management, basic service, intelligent contract and operation monitoring. The user management module is responsible for identity information management of all blockchain participants, and comprises public and private key generation maintenance (account management), key management, user real identity and blockchain address corresponding relation maintenance (authority management) and the like, and under the authorization condition, the user management module supervises and audits the transaction condition of certain real identities and provides rule configuration (wind control audit) of risk control; the basic service module is deployed on all block chain node equipment and used for verifying the validity of the service request, recording the service request to storage after consensus on the valid request is completed, for a new service request, the basic service firstly performs interface adaptation analysis and authentication processing (interface adaptation), then encrypts service information (consensus management) through a consensus algorithm, transmits the service information to a shared account (network communication) completely and consistently after encryption, and performs recording and storage; the intelligent contract module is responsible for registering and issuing contracts, triggering the contracts and executing the contracts, developers can define contract logics through a certain programming language, issue the contract logics to a block chain (contract registration), call keys or other event triggering and executing according to the logics of contract clauses, complete the contract logics and simultaneously provide the function of upgrading and canceling the contracts; the operation monitoring module is mainly responsible for deployment, configuration modification, contract setting, cloud adaptation in the product release process and visual output of real-time states in product operation, such as: alarm, monitoring network conditions, monitoring node equipment health status, and the like.
Fig. 1 is a diagram of a network architecture according to an embodiment of the present application. As shown in fig. 1, the network architecture may include a plurality of blockchain nodes (specifically, as shown in fig. 1, may include a node server 10a, a node server 10b, a node server 10c, and a node server 10d), and a terminal device 10 e. The node server 10a, the node server 10b, the node server 10c and the node server 10d are all represented as common nodes in a block chain network; the terminal device 10e may refer to a user terminal, and the terminal device 10e may upload data (e.g., newly generated transaction data) to the blockchain network and request the blockchain network to package the uploaded data into blocks to be written into the blockchain. After the terminal device 10e uploads data to the blockchain network, a consensus node that packs the data uploaded by the terminal device 10e into a new block may be selected from the blockchain network. Since the blocks generated in the block chain network all need to be identified together, only the blocks with passed identities can be added to the block chain, that is, after the blocks obtain the consistent votes of most of the common identity nodes in the block chain network (the specific votes of the common identity nodes are related to the adopted common identity algorithm, if more than 51% of the common identity nodes in the block chain network vote, it indicates that the new blocks pass the common identities), the new blocks can be determined to be legal blocks and can be added to the block chain. Therefore, after the node server 10a generates the new block, the new block needs to be broadcasted to the other common nodes in the blockchain network, for example, after the node server 10a generates the new block, the new block can be broadcasted to the node server 10b, the node server 10c, and the node server 10d, so that each common node can verify the new block. A heartbeat mechanism can be added in the consensus process of the block chain network, the consensus verification information of the consensus nodes in the consensus process can be obtained through the heartbeat mechanism, and then the effective states of the consensus nodes can be determined according to the consensus verification information corresponding to the consensus nodes respectively.
The terminal device 10e may include a mobile phone, a tablet computer, a notebook computer, a palm computer, a Mobile Internet Device (MID), a wearable device (e.g., a smart watch, a smart bracelet, etc.), and the like.
Please refer to fig. 2, which is a block chain common node checking scenario diagram according to an embodiment of the present disclosure. Taking the consensus node 1 as an example, a specific description is given to an implementation process of the block chain consensus node verification scheme, where the consensus node 1 may be referred to as a current consensus node. As shown in fig. 2, a consensus node 1 in a blockchain network may receive transaction data uploaded to the blockchain network by a client, and package the received transaction data into blocks; after the transaction data uploaded to the blockchain network by the client is packaged into a block, the consensus node 1 may broadcast the generated block in the blockchain network, so that the rest of the consensus nodes in the blockchain network perform consensus verification on the block generated by the consensus node 1. The transaction data may refer to data generated by the client according to transaction operations of the user, and each transaction data uploaded to the blockchain network may include a transaction initiator, a transaction receiver, and transaction contents. For example, if USER-1 wants to purchase 10 coins from USER-2, USER-1 can reach the transaction intent with USER-2; the user 2 may create transaction data through the client, and the initiator in the transaction data may be: the user 2 corresponding to the client that creates the transaction data, for example, the account of the user 2, may be: the user 1 who purchases the game chip, such as the account number of the user 1, the transaction content may be: transferring 10 gaming chips from the account of the originator to the account of the recipient; the transaction data is used to instruct the blockchain network to transfer 10 gaming chips from the account of USER-2 to the account of USER-1. After receiving the transaction data uploaded by the client, the consensus node 1 may verify the transaction data, where the verification is to determine whether the transaction data is maliciously tampered in the uploading process, for example, whether the transaction data received by the consensus node 1 is uploaded to a blockchain network by the client, or whether the transaction content in the received transaction data is the transaction content in the transaction data actually uploaded by the client, or the like. The verified transaction data parties can be packaged into blocks, each block generated in the blockchain network needs to be identified, and the identified blocks can be added into the blockchain.
A heartbeat mechanism can be added in the block chain network, in the block consensus process, each consensus node in the block chain network can send heartbeat data packets to other consensus nodes through the heartbeat mechanism, for example, the consensus node 1 can send heartbeat data packets to other consensus nodes (such as the consensus node 2, the consensus node 3, the consensus node 4 and the like) through the heartbeat mechanism, and when the network connection between the consensus node 1 and the other consensus nodes is normal, the other consensus nodes in the block chain network can return response data packets to the consensus node 1 after receiving the heartbeat data packets sent by the consensus node 1; when a network connection is not established between a common node (such as the common node 2) and the common node 1 in the blockchain network or a network connection between the common node (such as the common node 2) and the common node 1 is disconnected, the common node 2 cannot directly receive the heartbeat data packet sent by the common node 1, and in this situation, the common node (such as the common node 3) receiving the heartbeat data packet can broadcast the received heartbeat data packet, so that the other common nodes except the common node 1 in the blockchain network can obtain the heartbeat data packet sent by the common node 1 and return a response data packet matched with the heartbeat data packet. It is understood that the heartbeat mechanism may preset the time frequency information of sending the heartbeat data packet, the data type of the heartbeat data packet, and the data type of the response data packet. In other words, the consensus node 1 may automatically send heartbeat packets to the remaining consensus nodes at intervals, and the heartbeat packets may be used to confirm the consensus status of the consensus nodes.
After receiving the response data packets returned by the other consensus nodes, the consensus node 1 may determine, according to the data included in the response data packets, the consensus information corresponding to the other consensus nodes, and the consensus node 1 may further obtain the consensus information of itself, if the consensus information corresponding to the consensus node 1 is: the consensus check information 1 and the consensus check information corresponding to the consensus node 2 are as follows: the consensus check information 2, the consensus check information corresponding to the consensus node 3 is: the consensus check information 3, the consensus check information corresponding to the consensus node 4 is: consensus check information 4, etc. The consensus check information comprises the height of a consensus block in the consensus node and a consensus stage, wherein the height of the consensus block is the height of a block to be consensus in the consensus node, and the consensus stage is a consensus process to which the consensus node belongs in the consensus process; the consensus process of each block to be consensus may include at least one stage, such as a block to be consensus acquisition stage, a transaction list acquisition module, and a transaction data execution stage.
The consensus node 1 may perform classification statistics on the consensus information corresponding to each consensus node, use the same consensus information as a category, and respectively count the number corresponding to the consensus information in each category, and use the consensus information corresponding to the category with the largest number as the target check information, where the number corresponding to the target check information is a. When the number a is greater than or equal to a number threshold (when the number of the consensus nodes in the block chain network is n, the number threshold may be 2/(3 × n)), and the consensus information corresponding to the consensus node 1 is the same as the target check information, it may be determined that the consensus node 1 belongs to a normal consensus node, that is, the consensus process of the consensus node 1 is consistent with the consensus process of the majority of consensus nodes in the block chain network; when the number a is greater than or equal to the number threshold and the consensus information corresponding to the consensus node 1 is different from the target check information, it may be determined that the consensus node 1 belongs to an abnormal consensus node, that is, the consensus process of the consensus node 1 is inconsistent with the consensus process of the plurality of consensus nodes in the block chain network, and the consensus node 1 at this time may perform data synchronization with the remaining consensus nodes through a heartbeat mechanism.
Referring to fig. 3, which is a flowchart illustrating a method for checking a blockchain common node according to an embodiment of the present disclosure, it can be understood that the method may be executed by a computer device, where the computer device may be a common node in a blockchain network, and the common node may be a node server in the blockchain network or another node device in the blockchain network. As shown in fig. 3, the method for checking a blockchain consensus node may include the following steps:
step S101, acquiring message data respectively sent by at least one consensus node in a block chain network, and determining consensus check information respectively corresponding to the at least one consensus node according to the message data; at least one common node is the rest common nodes except the current common node in the block chain network.
Specifically, in the consensus process of the block chain network, any one consensus node may obtain message data sent by at least one consensus node, and according to the message data, consensus check information corresponding to the other consensus nodes (i.e., at least one consensus node) in the block chain network except the current consensus node may be determined, and of course, the consensus check information corresponding to the current consensus node may be directly obtained locally by the current consensus node; the current consensus node can check the effective state of the node according to the consensus check information respectively corresponding to each consensus node in the block chain network. In the block chain network, the consensus process needs the participation of a plurality of consensus nodes, so that in the consensus process, the effective state of the consensus nodes can be checked, and when the consensus nodes exceeding the number threshold in the block chain network are detected to be in the effective state, the consensus nodes can execute the consensus process; when detecting that the consensus nodes less than the threshold number are in an effective state, the block chain network indicates that the block chain network may have a network fault, and may suspend the current consensus process to wait for network recovery of the block chain network. In other words, when the number of the common nodes in the valid state in the blockchain network is less than the number threshold, even if the common verification result of the common node in the valid state on the block to be commonly recognized passes, the block to be commonly recognized still cannot satisfy the common condition in the blockchain network (the common condition may mean that the number passing the common verification exceeds the number threshold), and therefore, the common process may be suspended until the blockchain network returns to the normal state, and network resources may be saved. The number threshold depends on the consensus algorithm used in the blockchain network, and the adopted consensus algorithms are different and may have differences, for example, the number threshold in some consensus algorithms may refer to 2/3 of the number of consensus nodes in the blockchain network, or the number threshold in some consensus algorithms may refer to 51% of the number of consensus nodes in the blockchain network, which is not specifically limited herein.
The message data acquired by the consensus node in the block chain network may be a response data packet or a consensus message. The current consensus node can send a request data packet to at least one consensus node in the block chain network, so that the at least one consensus node obtains a response data packet associated with the request data packet, wherein the request data packet is used for confirming the data consensus state between the current consensus node and the at least one consensus node; and receiving at least one consensus node and respectively returning a response data packet, and determining consensus check information respectively corresponding to the at least one consensus node according to the height of the consensus blocks in the response data packet and the consensus stage. It should be noted that the consensus process of the to-be-consensus blocks may include a plurality of consensus stages, where the consensus stages included in the consensus process depend on the consensus algorithm adopted in the blockchain network, and for example, the consensus process corresponding to the to-be-consensus blocks may include: a to-be-identified block acquisition stage, a transaction sequencing acquisition stage, a transaction execution stage and the like. The consensus node in the blockchain network may verify the consensus to be treated based on a consensus algorithm, where the consensus algorithm includes but is not limited to: proof of Work (PoW), Proof of rights (PoS), a mixture of Proof of Work and Proof of rights (PoW + PoS), Proof of equity authorization (Delegated Proof of stamp, DPoS), a Practical Byzantine Fault Tolerance algorithm (PBFT), and a Rayleigh Consensus Protocol (RCP).
In a block chain network, network connection needs to be maintained for a long time between the consensus nodes to realize real-time data transmission between the consensus nodes, for example, after the consensus nodes generate the block to be agreed, the generated block to be agreed is broadcasted, or after the consensus nodes execute transaction data, execution results corresponding to the transaction data are broadcasted, and the like. Therefore, a heartbeat mechanism may be added in the blockchain network, and the heartbeat mechanism may include a self-defined structure (i.e., the request packet), time-frequency information, and an acknowledgement packet type corresponding to the structure, where the time-frequency information may be used to determine an interval time for sending the request packet, and the acknowledgement packet type corresponding to the structure may be used to determine information included in the acknowledgement packet. After the heartbeat mechanism is added in the blockchain network, the consensus node in the blockchain network can send a request data packet to at least one consensus node in the blockchain network according to the time frequency information through the heartbeat mechanism, so that the at least one consensus node obtains a response data packet associated with the request data packet. In other words, the consensus node in the blockchain network may send a custom structure (i.e., a request packet) to the other consensus nodes in the blockchain network at intervals, and after receiving the request packet, the other consensus nodes in the blockchain network may return a response packet to the consensus node sending the request packet, where the response packet may include the consensus block height and the consensus stage of the to-be-consensus block in the consensus node; after receiving the response data packets returned by the other consensus nodes, the current consensus node may determine the consensus check information corresponding to at least one consensus node according to the height of the consensus blocks and the consensus stage included in the response data packets. It should be noted that any one of the consensus nodes in the block chain network may directly send a request data packet to the other consensus nodes through a heartbeat mechanism, that is, the consensus nodes may directly receive response data packets respectively returned by the other consensus nodes; or, the consensus node in the blockchain network may also send a request data packet to the relay node through a heartbeat mechanism, and the relay node broadcasts the request data packet, so that all the other consensus nodes in the blockchain network can receive the request data packet, and then all the other consensus nodes can return response data packets corresponding to the request data packet to the relay node, and the relay node returns response data packets corresponding to all the other consensus nodes to the current consensus node, where the relay node may be any blockchain node in the blockchain network.
For example, the blockchain network includes 5 common nodes, which are: the consensus node 1, the consensus node 2, the consensus node 3, the consensus node 4, and the consensus node 5, wherein the consensus node 1 (the consensus node 1 may be referred to as a current consensus node at this time) may send a request packet to the consensus node 2, the consensus node 3, the consensus node 4, and the consensus node 5 through a heartbeat mechanism, after receiving the request packet, the consensus node 2, the consensus node 3, the consensus node 4, and the consensus node 5 may all return a response packet corresponding to the request packet to the consensus node 1, that is, the consensus node 2 may return the block height of the block to be consensus in the consensus node 2 and the consensus stage where the block to be consensus is located to the consensus node 1, the consensus node 3 may return the block height of the block to be consensus in the consensus node 3 and the consensus stage where the block to be consensus is located to the consensus node 1, and the consensus node 4 may return the height of the block to be consensus in the consensus node 4 and the height of the block to be consensus in the consensus zone to be consensus to be treated to the consensus node 1 The consensus node 5 can return the block height of the block to be consensus in the consensus node 5 and the consensus stage where the block to be consensus is located to the consensus node 1. And determining consensus check information corresponding to the consensus nodes 2, 3, 4 and 5 according to response data packets returned by the consensus nodes, wherein the consensus check information can be used for representing the heights and consensus stages of consensus blocks in the consensus nodes. It should be noted that, after a heartbeat mechanism is added to the blockchain network, the current consensus node in the blockchain network may actively send a request data packet to the other consensus nodes through the heartbeat mechanism, so as to obtain the consensus verification information corresponding to the other consensus nodes respectively.
Please refer to fig. 4, which is a schematic diagram of obtaining consensus verification information according to an embodiment of the present disclosure. As shown in fig. 4, the blockchain network includes 4 common nodes, namely, a common node 30a, a common node 30b, a common node 30c, and a common node 30 d. The consensus node 30a may send heartbeat request packets to the consensus node 30b, the consensus node 30c, and the consensus node 30d through a heartbeat mechanism, respectively, a timer may be started locally at the consensus node 30a, and the timer may be configured to send the heartbeat request packets to the consensus node 30b, the consensus node 30c, and the consensus node 30d at intervals, and after receiving the heartbeat request packet sent by the consensus node 30a, the consensus node 30b, the consensus node 30c, and the consensus node 30d may return a response data packet corresponding to the heartbeat request packet to the consensus node 30 a. When the block height of the block to be identified locally at the identifying node 30b is 100 and the block to be identified is at the first stage of the identifying process, the identifying node 30b may add the block height 100 and the first stage to the response packet and return to the identifying node 30 a; the consensus node 30a may determine, according to the response packet returned by the consensus node 30b, consensus check information 1 corresponding to the consensus node 30b, where the consensus check information 1 may include: the consensus block height is 100 (i.e., the height of the block corresponding to the block to be consensus in the consensus node 30 b), and the consensus step is the first step. Similarly, the consensus node 30a may determine, according to the response packet returned by the consensus node 30c, the consensus information 2 corresponding to the consensus node 30c, where the consensus information 2 may include: the consensus block height is 100 (i.e., the height of the block corresponding to the block to be consensus in the consensus node 30 c), and the consensus stage is the second stage; the consensus node 30a may determine, according to a response packet returned by the consensus node 30d, consensus check information 3 corresponding to the consensus node 30d, where the consensus check information 3 may include: the consensus block height is 101 (i.e., the height of the block corresponding to the block to be consensus in the consensus node 30 d), and the consensus step is the first step.
Optionally, when the message data is a consensus message, the current consensus node in the blockchain network may obtain the consensus messages respectively broadcast by at least one consensus node in the blockchain network, and obtain the consensus block height and the consensus stage associated with the at least one consensus node from the consensus messages respectively; and determining consensus check information corresponding to at least one consensus node respectively according to the height of the consensus block and the consensus stage. In the block chain network, each consensus node can verify a block to be consensus, and broadcast the consensus verification result as a consensus message to other consensus nodes, wherein the consensus message can include the height of the consensus block corresponding to the block to be consensus and the consensus stage where the block to be consensus is located; according to the height of the consensus block and the consensus stage contained in the consensus message, the consensus check information corresponding to the other consensus nodes except the current consensus node can be determined.
It should be understood that the pending consensus blocks refer to blocks generated by the consensus node according to the transaction data uploaded to the blockchain network by the client, and the generated blocks are in the consensus phase, i.e. the pending consensus blocks are blocks of the informal uplink. The transaction data can be data generated by the client according to the transaction operation of the user, and after the transaction data is uploaded to the block chain network and passes verification, the consensus node can pack the transaction data passing verification into the block to be consensus. Of course, the block to be identified commonly may include at least two transaction data, and the at least two transaction data have an arrangement sequence in the block to be identified commonly, and the arrangement sequence of the transaction data in the block to be identified commonly is an execution sequence of the transaction data.
When the transaction data uploaded to the blockchain network carries the digital signature, the consensus node in the blockchain network can check the signature of the transaction data, namely the digital signature carried by the transaction data is decrypted according to the public key uploaded to the blockchain network by the client, so that first abstract information is obtained, then hash operation is performed on the transaction data according to a hash algorithm, so that first abstract information corresponding to the transaction data is obtained, and when the first abstract information is the same as the second abstract information, it can be determined that the transaction data passes the signature check. The first summary information is summary information, obtained by the client through hash operation calculation, for the transaction data, the second summary information is summary information, obtained by the consensus node through hash operation calculation, for the transaction data received actually, and the hash algorithm used by the client and the consensus node is the same; when the client performs identity registration in the blockchain network, a key pair can be created, the key pair can include a public key and a private key, the client can upload the public key in the key pair to the blockchain network, and the private key is managed by the client. And a private key in the key pair is used for the client to digitally sign the transaction data uploaded to the block chain network, and a public key in the key pair is used for the block chain node to check and sign the transaction data uploaded to the block chain network. It should be noted that public keys in the blockchain network are unique, and one public key corresponds to one client.
The hash algorithm may compress data or message into digest, not only fix the format of data, but also reduce the amount of data, and may include, but not limited to, SHA-1, SHA-224, SHA-256, SHA-384, and SHA-512. Taking the SHA-256 algorithm as an example, the SHA-256 algorithm can generate a 256-bit hash value for any size of data, and can generate different hash values for different data.
The transaction data passing through the verification can be packaged into the block to be identified by the identification node, after the block to be identified is generated, the block to be identified is broadcasted in the block chain network by the block generation node corresponding to the block to be identified, the block to be identified enters the identification process, namely the identification node in the block chain network can verify the block to be identified after receiving the block to be identified, and each identification node can broadcast the identification verification result of the block to be identified. Verification of the block to be identified may include, but is not limited to: verifying whether the random number in the block head of the block to be identified accords with a target difficulty value; checking whether the generation time stamp in the block to be identified is less than a time threshold (such as 2 hours of the current system time); checking whether the Merck tree root in the block to be identified is correct or not, and checking whether the block capacity corresponding to the block to be identified is smaller than the upper limit of the block capacity or not; and verifying each transaction data contained in the block to be identified. When the random number in the block head of the block to be identified meets the target difficulty value, the generated timestamp is greater than the time threshold, the root of the Mercker tree in the block to be identified is correct, the block capacity of the block to be identified is smaller than the upper limit of the block capacity in the block chain network, and each transaction datum in the block to be identified passes the verification, the block to be identified can be determined to pass the verification; when any one of the above items is not satisfied, it may be determined that the block to be commonly recognized is not verified.
Step S102, determining the consensus check information respectively corresponding to the at least one consensus node and the current consensus node as information to be checked to obtain at least two pieces of information to be checked, and determining target check information from the at least two pieces of information to be checked according to the number of the information to be checked which is the same in the at least two pieces of information to be checked.
Specifically, a current consensus node in the block chain network may directly obtain self consensus information from local data, determine the self consensus information and consensus information corresponding to at least one consensus node (i.e., other consensus nodes except the current consensus node) as information to be checked, so as to obtain at least two pieces of information to be checked, count the number of pieces of information to be checked that are the same in the at least two pieces of information to be checked by the current consensus node, and determine target check information from the at least two pieces of information to be checked according to the number of pieces of information to be checked that are the same. Further, the current consensus node may classify at least two pieces of information to be verified to obtain at least one information category, where the same information category has the same consensus verification information, and may further count the number of pieces of information to be verified included in each information category, and determine the information category corresponding to the largest number as the target verification information.
For example, the blockchain network includes 5 common nodes, which can be represented as common node 1, common node 2, common node 3, common node 4, and common node 5; the information to be checked corresponding to the consensus node 1 comprises: the height of the consensus block is n, and the consensus stage is the first stage; the information to be checked corresponding to the consensus node 2 includes: the height of the consensus block is n, and the consensus stage is the first stage; the information to be checked corresponding to the consensus node 3 includes: the height of the consensus block is n, and the consensus stage is the first stage; the information to be checked corresponding to the consensus node 4 includes: the height of the consensus block is n, and the consensus stage is the first stage; the information to be checked corresponding to the consensus node 5 includes: the consensus block height is n +1, the consensus phase is the first phase. Taking the consensus node 1 as the current consensus node as an example, the consensus node 1 may divide the to-be-verified information corresponding to the 5 consensus nodes into two information categories, where the first information category is the to-be-verified information including the height n of the consensus block and the first stage, and the second information category is the to-be-verified information including the consensus block n +1 and the first stage; the consensus nodes corresponding to the first information category are respectively: the number of the common nodes 1, the common nodes 2, the common nodes 3 and the common nodes 4 is 4, that is, the number of the common nodes corresponding to the first information category is 4, and the number of the common nodes corresponding to the second information category is: the number of consensus nodes 5, i.e. second information categories, corresponds to 1. Therefore, the consensus node 1 may determine the information to be checked in the first information category as the target check information.
Step S103, if the number of the target verification information is greater than or equal to the number threshold and the information to be verified of the current consensus node is the same as the target verification information, determining that the current consensus node belongs to a normal consensus node.
Specifically, after the current consensus node determines the target check information, the number of the target check information may be compared with a number threshold in the block chain network, and when the number corresponding to the target check information is greater than or equal to the number threshold, it indicates that the current consensus process in the block chain network belongs to a normal execution state, and in the case that the consensus process is the normal execution state, if the information to be checked corresponding to the current consensus node is the same as the target consensus check information, it may be determined that the current consensus node keeps message consistency with the rest of the consensus nodes in the block chain network, and the current consensus node belongs to the normal consensus node. As shown in the foregoing example, the blockchain network includes 5 common nodes, the target check information is information to be checked including the height n of the common node and the first stage, and the number of the target check information is 4, where the information to be checked corresponding to the current common node (i.e. the common node 1) includes: the height of the consensus block is n, and the consensus stage is the first stage; since the number of the target verification information is greater than the number threshold (the number threshold may be (5 x 2)/3), and the information to be verified corresponding to the current consensus node is the same as the target verification information, it may be determined that the current consensus node belongs to the normal consensus node. Of course, based on the information to be checked corresponding to each of the common nodes, the current common node may also determine that the common node 2, the common node 3, and the common node 4 in the block chain network all belong to the normal common node.
Optionally, if the current consensus node belongs to the normal consensus node, the current consensus node may determine the height of the consensus block in the target check information as the first block height, and determine a candidate consensus node from at least one consensus node, where the height of the consensus block corresponding to the candidate consensus node is greater than the first block height; acquiring a block corresponding to the height of the first block from the candidate consensus node as a block to be verified; determining the working state information of the candidate consensus node according to the verification result of the consensus node corresponding to the target verification information on the to-be-verified block, namely determining that the candidate consensus node belongs to an invalid working state if the verified value in the verification result of the consensus node corresponding to the target verification information is smaller than the target value; and if the verified value in the verification result of the consensus node corresponding to the target verification information is greater than or equal to the target value, determining that the candidate consensus node belongs to an effective working state.
The current consensus node may determine the height of the consensus block in the target check information as a first block height, and if the height of the consensus block corresponding to a certain consensus node in the block chain network is greater than the first block height, the consensus node may be determined as a candidate consensus node, and a block corresponding to the first block height is obtained from the candidate consensus nodes as a to-be-verified block. And broadcasting the to-be-verified block in the block chain network so as to verify the to-be-verified block by using the consensus node (namely the normal consensus node) corresponding to the target verification information in the block chain network. The verification process of the block to be verified comprises the following steps: each normal consensus node in the block chain network can locally acquire a to-be-consensus block corresponding to the first block height, and if the to-be-consensus block corresponding to the first block height is the same as the to-be-verified block, it is indicated that the to-be-verified block passes verification; if the block to be identified corresponding to the first block height is different from the block to be verified, the block to be verified is not verified. After obtaining the verification result of the block to be verified, the normal consensus node can broadcast the verification result.
After the current consensus node obtains the verification result of each normal consensus node on the block to be verified, counting the number of votes approved (i.e., the number of normal consensus passing the verification) corresponding to the block to be verified, and if the number of votes approved exceeds 2/3 of the number of normal consensus, determining that the candidate consensus node belongs to an effective working state, where only the consensus process in the candidate consensus node leads a majority of consensus nodes in the block chain network; if the number of votes approved is less than 2/3 of the normal consensus number, it may be determined that the candidate consensus node belongs to an invalid working state, i.e., the block corresponding to the height of the first block in the candidate consensus node is different from the block to be consensus corresponding to the height of the first block in the remaining consensus nodes, indicating that the candidate consensus node may be maliciously attacked. As shown in the foregoing example, since the height of the common identification block in the common identification check information corresponding to the common identification node 5 is greater than the height of the common identification block in the target check information, the common identification node 1 may determine the common identification node 5 as a candidate common identification node, obtain a block with a block height n from the common identification node 5 as a to-be-verified block, and broadcast the to-be-verified block to the common identification node 2, the common identification node 3, and the common identification node 4; obtaining the verification results of the to-be-verified blocks of the consensus node 1, the consensus node 2, the consensus node 3 and the consensus node 4, and if at least three consensus nodes in the consensus node 1, the consensus node 2, the consensus node 3 and the consensus node 4 pass the verification of the to-be-verified blocks, determining that the consensus node 5 belongs to an effective working state; if less than three of the consensus nodes 1, 2, 3 and 4 pass the verification of the block to be verified, it can be determined that the consensus node 5 belongs to the invalid working state.
Optionally, if the number corresponding to the target verification information is smaller than the number threshold, it is determined that the consensus node in the blockchain network does not satisfy the consensus processing condition, and the execution of the consensus processing process in the blockchain network is suspended until the consensus node in the blockchain network satisfies the consensus processing condition. In other words, when the number corresponding to the target check information is smaller than the number threshold, it indicates that there may be a network fault in the blockchain network, the execution of the consensus process in the blockchain network may be suspended, and the recovery of the blockchain network is waited, after the network is recovered, the consensus nodes in the blockchain network may interact to continue to execute the consensus process.
And step S104, if the number of the target check information is greater than or equal to the number threshold and the consensus check information of the current consensus node is different from the target check information, determining that the current consensus node belongs to the abnormal consensus node.
Specifically, when the number of the target check information is greater than or equal to the number threshold, it may be indicated that the current consensus process in the block chain network belongs to a normal execution state, and in a case that the current consensus process is the normal execution state, if the to-be-checked information corresponding to the current consensus node is not the same as the target check information, it may be determined that the current consensus node is inconsistent with the messages of the other consensus nodes in the block chain network, and the current consensus node belongs to an abnormal consensus node.
Optionally, if the current consensus node belongs to the abnormal consensus node, the current consensus node may determine the height of the consensus block in the target check information as a first block height, and determine the height of the consensus block in the consensus check information corresponding to the current consensus node as a second block height; if the second block height is smaller than the first block height, acquiring a common block corresponding to the second block height to the first block height, and synchronizing the block data in the current common node according to the common block. In other words, when the block height of the block to be identified in the current common node (i.e., the second block height) is smaller than the common block height in the target check information, it may be indicated that the common processing status of the current common node lags the common processing status of the other common nodes, so that the current common node may obtain the common blocks from the other common nodes from the second block height to the first block height, and update the block data in the current common node according to the obtained common blocks. For example, if the height of the common identification block in the target check information is n, and the height of the block to be common identified in the current common identification node is n-2, the current common identification node may obtain the block with the block height of n-1 and the block with the block height of n from the other common identification nodes, and synchronize the block data in the current common identification node according to the block with the block height of n-1 and the block with the block height of n, so that the current common identification node and the other common identification nodes keep the block data consistent.
Please refer to fig. 5, which is a schematic diagram of block data in a synchronization common node according to an embodiment of the present disclosure. As shown in fig. 5, the blockchain network includes 5 common nodes, where the 5 common nodes are: a common node 1, a common node 2, a common node 3, a common node 4 and a common node 5. Taking the consensus node 1 as the current consensus node as an example, the block to be consensus in the consensus process of the consensus node 1 is a block n-1, that is, the block height of the block to be consensus is n-1; the to-be-identified block in the identifying process of the other identifying nodes (including the identifying node 2, the identifying node 3, the identifying node 4 and the identifying node 5) is the block n, i.e. the block heights of the to-be-identified block are all n, and it can be determined that the identifying process of the identifying node 1 lags behind the identifying process of the other identifying nodes, i.e. the identifying node 1 belongs to the abnormal identifying node. The consensus node 1 may send a data synchronization request to the remaining consensus nodes, and the remaining consensus nodes may return the block n to the consensus node 1 when receiving the data synchronization request of the consensus node 1. After receiving the tile n returned by the rest of the consensus nodes, the consensus node 1 may store the tile n locally.
If the first block height is equal to the second block height, the common identification stage in the common identification check information corresponding to the current common identification node can be determined as the first common identification stage, and the common identification stage in the target check information can be determined as the second common identification stage; and acquiring trigger message data from the first consensus stage to the second consensus stage, and synchronizing the messages in the current consensus node according to the trigger message data. In other words, when the common knowledge blocks of the current common knowledge node and the other common knowledge nodes in the common knowledge process are the same, the first common knowledge stage to which the common knowledge block belongs in the current common knowledge node and the second common knowledge stage in the target check information can be obtained, and if the first common knowledge stage is behind the second common knowledge stage, the trigger message data from the first common knowledge stage to the second common knowledge stage can be obtained, that is, the common knowledge process of the current common knowledge node can be triggered to enter the second common knowledge stage from the first common knowledge stage through the trigger message data, so that the message synchronization of the current common knowledge node is realized.
Please refer to fig. 6, which is a schematic diagram of a synchronization consensus node according to an embodiment of the present application. As shown in fig. 6, the blockchain network includes 5 common nodes, where the 5 common nodes are: a common node 1, a common node 2, a common node 3, a common node 4 and a common node 5. Taking the consensus node 1 as the current consensus node as an example, after obtaining the consensus verification information corresponding to the 5 consensus nodes respectively, the consensus nodes 1 all have to be the block n in the consensus process, where the block n in the consensus node 1 is in the second stage in the consensus process, and the block n in the remaining consensus nodes (including the consensus node 2, the consensus node 3, the consensus node 4, and the consensus node 5) is in the first stage in the consensus process, so that it can be determined that the consensus process of the consensus node 1 lags behind the consensus processes of the remaining consensus nodes, that is, the consensus node 1 belongs to the abnormal consensus node. The consensus node 1 may send a data synchronization request to the other consensus nodes, and the other consensus nodes may return trigger message data of the first stage to the second stage to the consensus node 1 when receiving the data synchronization request of the consensus node 1. After receiving the trigger message data returned by the rest of the consensus nodes, the consensus node 1 may store the trigger message data in the local, and trigger the execution process of the block n from the first stage to the second stage according to the trigger message data.
The method and the device for determining the common identification check information of the block chain network can determine the common identification check information corresponding to at least one common identification node according to the message data by acquiring the message data respectively sent by the at least one common identification node in the block chain network, determine the target check information according to the quantity of the common identification check information, and determine that the current common identification node belongs to a normal common identification node if the quantity of the target check information is greater than or equal to a quantity threshold value and the common identification check information of the current common identification node is the same as the target check information; and if the number of the target check information is greater than or equal to the number threshold and the consensus check information of the current consensus node is different from the target check information, determining that the current consensus node belongs to the abnormal consensus node. Therefore, the consensus check information corresponding to the rest of the consensus nodes is determined through the message data sent by the rest of the consensus nodes in the block chain network, the current consensus node is checked according to the consensus check information corresponding to the rest of the consensus nodes, the consensus nodes in the effective state in the block chain network can be determined, and when the number of the consensus in the effective state in the block chain network reaches the number threshold, the consensus process is executed, so that the success rate of consensus can be effectively ensured, and the consensus efficiency of the block chain is improved; when the consensus node is in an abnormal state, the local data of the consensus node can be synchronized in real time, and further the transaction processing capability of the block chain network is enhanced.
Please refer to fig. 7, which is a schematic structural diagram of a block chain common node checking apparatus according to an embodiment of the present disclosure. The blockchain common node check device may be a computer program (including program code) running on a computer apparatus, for example, the blockchain common node check device is an application software; the apparatus may be configured to perform corresponding steps in the methods provided in the embodiments of the present application. As shown in fig. 7, the device 1 for checking a blockchain common node may include: the system comprises an acquisition module 10, a determination module 11 and a verification module 12;
an obtaining module 10, configured to obtain message data sent by at least one consensus node in a block link network, and determine consensus check information corresponding to the at least one consensus node according to the message data; at least one consensus node is the rest consensus nodes except the current consensus node in the block chain network;
the determining module 11 is configured to determine common identification check information corresponding to at least one common identification node and a current common identification node as information to be checked, obtain at least two pieces of information to be checked, and determine target check information from the at least two pieces of information to be checked according to the number of the same pieces of information to be checked in the at least two pieces of information to be checked;
the checking module 12 is configured to determine that the current consensus node belongs to a normal consensus node if the number of the target checking information is greater than or equal to the number threshold and the to-be-checked information of the current consensus node is the same as the target checking information;
the checking module 12 is further configured to determine that the current consensus node belongs to the abnormal consensus node if the number of the target checking information is greater than or equal to the number threshold and the information to be checked of the current consensus node is different from the target checking information.
The specific functional implementation manners of the obtaining module 10, the determining module 11, and the verifying module 12 may refer to steps S101 to S104 in the embodiment corresponding to fig. 3, which is not described herein again.
Referring to fig. 7, when the message data includes a response packet, the obtaining module 10 may include: request transmission section 101, response reception section 102;
a request sending unit 101, configured to send a request packet to at least one consensus node in the blockchain network, so that the at least one consensus node obtains a response packet associated with the request packet; the request data packet is used for confirming the data consensus state between the current consensus node and at least one consensus node;
the response receiving unit 102 is configured to receive response data packets respectively returned by at least one consensus node, and determine consensus check information respectively corresponding to the at least one consensus node according to the consensus block height and the consensus stage in the response data packets.
The request sending unit 101 is specifically configured to:
and sending a request data packet to at least one consensus node in the block chain network according to the time frequency information through a heartbeat mechanism, so that the at least one consensus node acquires a response data packet associated with the request data packet.
When the message data includes the consensus message, the obtaining module 10 may include: a consensus information acquisition unit 103, a check information determination unit 104;
a consensus information obtaining unit 103, configured to obtain consensus information respectively broadcast by at least one consensus node in the block chain network, and obtain a consensus block height and a consensus stage associated with the at least one consensus node from the consensus information;
the check information determining unit 104 is configured to determine consensus check information corresponding to each of the at least one consensus node according to the height of the consensus block and the consensus phase.
For specific functional implementation manners of the request sending unit 101, the response receiving unit 102, the consensus information obtaining unit 103, and the check information determining unit 104, reference may be made to step S101 in the embodiment corresponding to fig. 3, which is not described herein again.
Referring to fig. 7, the determining module 11 may include: a classification unit 111, a statistic unit 112;
the classification unit 111 is configured to classify at least two pieces of information to be verified to obtain at least one information category; the same information category has the same consensus check information;
the counting unit 112 is configured to count the number of pieces of information to be verified included in each information category, and determine the piece of information to be verified in the information category corresponding to the largest number as the target verification information.
The specific functional implementation manners of the classifying unit 111 and the counting unit 112 may refer to step S102 in the embodiment corresponding to fig. 3, which is not described herein again.
Referring to fig. 7, the apparatus 1 for checking a blockchain common node may further include: the system comprises a condition determining module 13, a pause module 14, a block height determining module 15, a first synchronization module 16, a consensus node determining module 17, a second synchronization module 18, a candidate node determining module 19, a block acquiring module 20 and a working state determining module 21;
a condition determining module 13, configured to determine that the consensus node in the blockchain network does not satisfy the consensus processing condition if the number corresponding to the target verification information is smaller than the number threshold;
a suspending module 14, configured to suspend execution of a consensus processing process in the blockchain network until a consensus node in the blockchain network meets a consensus processing condition;
the block height determining module 15 is configured to determine a common block height in the target verification information as a first block height, and determine a common block height in the to-be-verified information corresponding to the current common node as a second block height;
a first synchronization module 16, configured to obtain a consensus block corresponding to the height from the second block height to the first block height if the second block height is smaller than the first block height, and synchronize block data in the current consensus node according to the consensus block;
a consensus node determining module 17, configured to determine a consensus stage in the to-be-verified information corresponding to the current consensus node as a first consensus stage and determine a consensus stage in the target verification information as a second consensus stage if the first block height is equal to the second block height;
the second synchronization module 18 is configured to acquire trigger message data from the first consensus phase to the second consensus phase, and synchronize the message in the current consensus node according to the trigger message data.
A candidate node determining module 19, configured to determine a consensus block height in the target check information as a first block height, and determine a candidate consensus node from at least one consensus node; the height of a consensus block corresponding to the candidate consensus node is greater than the height of the first block;
the block obtaining module 20 is configured to obtain a block corresponding to the first block height from the candidate consensus node as a block to be verified;
and the working state determining module 21 is configured to determine the working state information of the candidate consensus node according to the verification result of the consensus node corresponding to the target verification information on the to-be-verified block.
The specific functional implementation manners of the condition determining module 13, the suspending module 14, the candidate node determining module 19, the block obtaining module 20, and the working state determining module 21 may refer to step S103, the block height determining module 15, the first synchronizing module 16, the common node determining module 17, and the second synchronizing module 181 in the embodiment corresponding to fig. 3, and are not described herein again.
Referring to fig. 7, the operation state determining module 21 may include: a first comparing unit 211, a second comparing unit 212;
a first comparing unit 211, configured to determine that the candidate consensus node belongs to an invalid working state if a verified value in a verification result of the consensus node corresponding to the target verification information is smaller than the target value;
the second comparing unit 212 is configured to determine that the candidate consensus node belongs to the valid working state if a verified value in the verification result of the consensus node corresponding to the target verification information is greater than or equal to the target value.
The specific functional implementation manners of the first comparing unit 211 and the second comparing unit 212 may refer to step S103 in the embodiment corresponding to fig. 3, which is not described herein again.
The method and the device for determining the common identification check information of the block chain network can determine the common identification check information corresponding to at least one common identification node according to the message data by acquiring the message data respectively sent by the at least one common identification node in the block chain network, determine the target check information according to the quantity of the common identification check information, and determine that the current common identification node belongs to a normal common identification node if the quantity of the target check information is greater than or equal to a quantity threshold value and the common identification check information of the current common identification node is the same as the target check information; and if the number of the target check information is greater than or equal to the number threshold and the consensus check information of the current consensus node is different from the target check information, determining that the current consensus node belongs to the abnormal consensus node. Therefore, the consensus check information corresponding to the rest of the consensus nodes is determined through the message data sent by the rest of the consensus nodes in the block chain network, the current consensus node is checked according to the consensus check information corresponding to the rest of the consensus nodes, the consensus nodes in the effective state in the block chain network can be determined, and when the number of the consensus in the effective state in the block chain network reaches the number threshold, the consensus process is executed, so that the success rate of consensus can be effectively ensured, and the consensus efficiency of the block chain is improved; when the consensus node is in an abnormal state, the local data of the consensus node can be synchronized in real time, and further the transaction processing capability of the block chain network is enhanced.
Please refer to fig. 8, which is a schematic structural diagram of a computer device according to an embodiment of the present application. As shown in fig. 8, the computer apparatus 1000 may include: the processor 1001, the network interface 1004, and the memory 1005, further, the computer device 1000 may further include: a user interface 1003, and at least one communication bus 1002. Wherein a communication bus 1002 is used to enable connective communication between these components. The user interface 1003 may include a Display screen (Display) and a Keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a standard wireless interface. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., a WI-FI interface). The memory 1004 may be a high-speed RAM memory or a non-volatile memory, such as at least one disk memory. The memory 1005 may optionally be at least one memory device located remotely from the processor 1001. As shown in fig. 8, a memory 1005, which is a kind of computer-readable storage medium, may include therein an operating system, a network communication module, a user interface module, and a device control application program.
In the computer device 1000 shown in fig. 8, the network interface 1004 may provide a network communication function; the user interface 1003 is an interface for providing a user with input; and the processor 1001 may be configured to invoke the device control application stored in the memory 1005 to implement:
acquiring message data respectively sent by at least one consensus node in a block chain network, and determining consensus check information respectively corresponding to the at least one consensus node according to the message data; at least one consensus node is the rest consensus nodes except the current consensus node in the block chain network;
determining common identification check information respectively corresponding to at least one common identification node and the current common identification node as information to be checked to obtain at least two pieces of information to be checked, and determining target check information from the at least two pieces of information to be checked according to the number of the same information to be checked in the at least two pieces of information to be checked;
if the number of the target verification information is larger than or equal to the number threshold value and the information to be verified of the current consensus node is the same as the target verification information, determining that the current consensus node belongs to a normal consensus node;
and if the number of the target verification information is greater than or equal to the number threshold value and the information to be verified of the current consensus node is different from the target verification information, determining that the current consensus node belongs to the abnormal consensus node.
It should be understood that the computer device 1000 described in this embodiment of the present application may perform the description of the method for checking the blockchain common node in the embodiment corresponding to fig. 3, and may also perform the description of the apparatus 1 for checking the blockchain common node in the embodiment corresponding to fig. 7, which is not described herein again. In addition, the beneficial effects of the same method are not described in detail.
Further, here, it is to be noted that: an embodiment of the present invention further provides a computer-readable storage medium, where a computer program executed by the apparatus 1 for checking common node for blockchain is stored in the computer-readable storage medium, and the computer program includes program instructions, and when the processor executes the program instructions, the description of the method for checking common node for blockchain in the embodiment corresponding to fig. 3 can be executed, so that details are not repeated here. In addition, the beneficial effects of the same method are not described in detail. For technical details not disclosed in the embodiments of the computer-readable storage medium referred to in the present application, reference is made to the description of the embodiments of the method of the present application. As an example, the program instructions may be deployed to be executed on one computing device or on multiple computing devices located at one site, or on multiple computing devices distributed across multiple sites and interconnected by a communication network, which may constitute a blockchain network.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium and can include the processes of the embodiments of the methods described above when the computer program is executed. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
The above disclosure is only for the purpose of illustrating the preferred embodiments of the present application and is not to be construed as limiting the scope of the present application, so that the present application is not limited thereto, and all equivalent variations and modifications can be made to the present application.

Claims (10)

1. A method for checking a block chain common node comprises the following steps:
the current consensus node sends a request data packet to at least one consensus node in a block chain network through a heartbeat mechanism in the block chain network; the request data packet is used for confirming a data consensus state between the current consensus node and the at least one consensus node, wherein the at least one consensus node is the rest consensus nodes except the current consensus node in the block chain network;
receiving a response data packet which is returned by the at least one consensus node and aims at the request data packet, and determining consensus check information respectively corresponding to the at least one consensus node according to the height of the consensus blocks and the consensus stage contained in the response data packet;
determining target check information in the common identification check information corresponding to the current common identification node and the at least one common identification node;
if the quantity of the target verification information is larger than or equal to a quantity threshold value, determining that the consensus processing process in the block chain network belongs to a normal execution state, and executing the consensus processing process according to the target verification information;
and if the quantity of the target check information is smaller than the quantity threshold, determining that the block chain network has network faults, and suspending the execution of the consensus processing process in the block chain network.
2. The method according to claim 1, wherein the determining target verification information in the consensus verification information corresponding to the current consensus node and the at least one consensus node comprises:
acquiring consensus check information corresponding to the current consensus node in a local database, and determining the consensus check information corresponding to the current consensus node and the at least one consensus node as information to be checked to obtain at least two pieces of information to be checked;
classifying the at least two pieces of information to be verified to obtain at least one information category; the same information category has the same information to be verified;
and respectively counting the number of the information to be verified contained in each information category, and determining the information to be verified in the information category corresponding to the maximum number as the target verification information.
3. The method according to claim 1, wherein if the amount of the target check information is greater than or equal to an amount threshold, determining that a consensus process in the blockchain network belongs to a normal execution state, and executing the consensus process according to the target check information includes:
if the quantity of the target verification information is greater than or equal to a quantity threshold value, determining that a consensus processing process in the block chain network belongs to a normal execution state, and determining that a consensus node corresponding to the target verification information belongs to a normal consensus node in the current consensus node and the at least one consensus node;
when the current consensus node belongs to a normal consensus node, continuing to execute the consensus processing process according to the height of the consensus block in the target check information and the consensus stage;
and when the current consensus node belongs to an abnormal consensus node, synchronizing consensus data of the current consensus node in the consensus processing process according to the height of the consensus block and the consensus stage in the target check information.
4. The method according to claim 3, wherein when the current consensus node belongs to an abnormal consensus node, synchronizing consensus data of the current consensus node in the consensus processing process according to a consensus block height and a consensus stage in the target verification information, further comprising:
when the current common identification node belongs to an abnormal common identification node, determining the height of a common identification block in the target check information as a first block height, and determining the height of the common identification block in the common identification check information corresponding to the current common identification node as a second block height;
if the second block height is smaller than the first block height, acquiring a common block corresponding to the second block height to the first block height, and synchronizing block data in the current common node according to the common block.
5. The method of claim 4, further comprising:
if the first block height is equal to the second block height, determining a common identification stage in common identification check information corresponding to the current common identification node as a first common identification stage, and determining a common identification stage in the target check information as a second common identification stage;
and acquiring trigger message data from the first consensus stage to the second consensus stage, and synchronizing the messages in the current consensus node according to the trigger message data.
6. The method of claim 1, further comprising:
when the current consensus node detects that the network fault in the block chain network is recovered, the interaction between the current consensus node and the at least one consensus node is recovered, and the consensus processing process in the block chain network is continuously executed.
7. The method of claim 1, further comprising:
adding the heartbeat mechanism in the block chain network, and setting a self-defined structure body, time frequency information and a response data packet type in the heartbeat mechanism;
the time frequency information is used for determining the interval time of the current consensus node for sending the request data packet, and the type of the response data packet is used for determining the information contained in the response data packet.
8. An apparatus for checking a block chain common node, comprising:
a request sending unit, configured to send a request data packet to at least one consensus node in a blockchain network through a heartbeat mechanism in the blockchain network by a current consensus node; the request data packet is used for confirming a data consensus state between the current consensus node and the at least one consensus node, wherein the at least one consensus node is the rest consensus nodes except the current consensus node in the block chain network;
a response receiving unit, configured to receive a response packet for the request packet returned by the at least one consensus node, and determine consensus check information corresponding to the at least one consensus node according to a consensus block height and a consensus stage included in the response packet;
a determining module, configured to determine target verification information in the consensus verification information corresponding to the current consensus node and the at least one consensus node;
the checking module is used for determining that the consensus processing process in the block chain network belongs to a normal execution state if the quantity of the target checking information is greater than or equal to a quantity threshold value, and executing the consensus processing process according to the target checking information;
a condition determining module, configured to determine that a network fault exists in the blockchain network if the number of the target verification information is smaller than the number threshold;
a suspending module configured to suspend execution of the consensus process in the blockchain network.
9. A computer arrangement comprising a memory and a processor, the memory storing a computer program which, when executed by the processor, causes the processor to carry out the steps of the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program comprising program instructions which, when executed by a processor, perform the steps of the method according to any one of claims 1 to 7.
CN202110698294.XA 2020-03-26 2020-03-26 Block chain consensus node checking method, device, equipment and storage medium Active CN113282603B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110698294.XA CN113282603B (en) 2020-03-26 2020-03-26 Block chain consensus node checking method, device, equipment and storage medium

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010224584.6A CN111444211B (en) 2020-03-26 2020-03-26 Block chain consensus node checking method, device, equipment and storage medium
CN202110698294.XA CN113282603B (en) 2020-03-26 2020-03-26 Block chain consensus node checking method, device, equipment and storage medium

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
CN202010224584.6A Division CN111444211B (en) 2020-03-26 2020-03-26 Block chain consensus node checking method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113282603A CN113282603A (en) 2021-08-20
CN113282603B true CN113282603B (en) 2022-09-13

Family

ID=71648093

Family Applications (2)

Application Number Title Priority Date Filing Date
CN202110698294.XA Active CN113282603B (en) 2020-03-26 2020-03-26 Block chain consensus node checking method, device, equipment and storage medium
CN202010224584.6A Active CN111444211B (en) 2020-03-26 2020-03-26 Block chain consensus node checking method, device, equipment and storage medium

Family Applications After (1)

Application Number Title Priority Date Filing Date
CN202010224584.6A Active CN111444211B (en) 2020-03-26 2020-03-26 Block chain consensus node checking method, device, equipment and storage medium

Country Status (1)

Country Link
CN (2) CN113282603B (en)

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112035886B (en) * 2020-08-31 2023-01-10 深圳前海微众银行股份有限公司 Block chain consensus method, device, consensus node, system and storage medium
CN112422341B (en) * 2020-11-18 2021-09-28 腾讯科技(深圳)有限公司 Fault detection method of block chain network and related equipment
CN112994882B (en) * 2021-04-21 2021-07-20 腾讯科技(深圳)有限公司 Authentication method, device, medium and equipment based on block chain
CN113672994B (en) * 2021-09-03 2023-12-01 中国联合网络通信集团有限公司 Cooking equipment data management method, device and system based on blockchain
CN114338668B (en) * 2021-12-07 2023-10-31 中国联合网络通信集团有限公司 Data verification method, system, storage medium and equipment based on consensus mechanism
CN117130823A (en) * 2022-05-19 2023-11-28 腾讯科技(深圳)有限公司 Data processing method based on block chain network and related products
CN115567543A (en) * 2022-08-31 2023-01-03 云南电网有限责任公司信息中心 Block chain-based edge side transaction data consensus method, device and equipment
CN115225639B (en) * 2022-09-15 2022-12-27 杭州趣链科技有限公司 Changing method and device for consensus trusted cluster, computer equipment and medium
CN115687527B (en) * 2022-11-09 2023-10-10 北京北纬三十度网络科技有限公司 Storage system based on big data of block chain
CN116991623B (en) * 2023-08-30 2024-01-02 杭州趣链科技有限公司 Block chain node exception recovery method and device, electronic equipment and storage medium

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106506203B (en) * 2016-10-25 2019-12-10 杭州云象网络技术有限公司 Node monitoring system applied to block chain
CN107392040B (en) * 2017-04-28 2019-08-09 阿里巴巴集团控股有限公司 A kind of method and device of common recognition verifying
CN108564469A (en) * 2018-04-11 2018-09-21 北京奇虎科技有限公司 Representation data acquisition methods, device and the computing device of block chain node
US11063746B2 (en) * 2018-04-19 2021-07-13 Electronics And Telecommunications Research Institute Method for selecting consensus node using nonce and method and apparatus for generating blockchain using the same
RU2724181C1 (en) * 2018-11-07 2020-06-22 Алибаба Груп Холдинг Лимитед Simplification of consensus in blockchain based on principle of practical fail-safety based on byzantine agreement and synchronization of nodes
CN109981405B (en) * 2019-03-20 2021-04-23 上海和数软件有限公司 Node management method, node management device and computer-readable storage medium
CN110602108B (en) * 2019-09-16 2021-08-10 腾讯科技(深圳)有限公司 Data communication method, device, equipment and storage medium based on block chain network
CN110705893B (en) * 2019-10-11 2021-06-15 腾讯科技(深圳)有限公司 Service node management method, device, equipment and storage medium
CN110866546B (en) * 2019-10-30 2024-02-09 深圳前海微众银行股份有限公司 Method and device for evaluating consensus node

Also Published As

Publication number Publication date
CN111444211A (en) 2020-07-24
CN111444211B (en) 2021-07-13
CN113282603A (en) 2021-08-20

Similar Documents

Publication Publication Date Title
CN113282603B (en) Block chain consensus node checking method, device, equipment and storage medium
CN110601853B (en) Block chain private key generation method and equipment
CN111427957B (en) Block chain voting information verification method, device, equipment and storage medium
CN111382456B (en) Proposal message processing method, device, equipment and storage medium
CN111445333B (en) Block generation method, device, computer equipment and storage medium
CN111314067B (en) Block storage method and device, computer equipment and storage medium
CN111737724A (en) Data processing method and device, intelligent equipment and storage medium
WO2021233049A1 (en) Blockchain–based data processing method, apparatus, device, and readable storage medium
CN111654395B (en) Voting information processing method, device, equipment and storage medium
CN113691597A (en) Block chain contract deployment method, device, equipment and storage medium
CN110035058B (en) Resource request method, device and storage medium
CN111291060A (en) Method, device and computer readable medium for managing block chain nodes
CN113326516A (en) Block chain consensus method, block chain system and computer equipment
CN110866265A (en) Data storage method, device and storage medium based on block chain
CN110601815A (en) Block chain data processing method and equipment
CN110647583B (en) Block chain construction method, device, terminal and medium
CN112200680B (en) Block link point management method, device, computer and readable storage medium
CN111343212B (en) Message processing method, device, equipment and storage medium
CN111327602B (en) Equipment access processing method, equipment and storage medium
CN110570197B (en) Data processing method and device based on block chain
CN113129002A (en) Data processing method and equipment
CN112417052B (en) Data synchronization method, device, equipment and storage medium in block chain network
CN117411609A (en) Block chain-based data processing method, device, equipment and medium
CN117354255A (en) Transaction processing method, apparatus, product, device and medium of block chain network
CN117437052A (en) Transaction processing method, device, computer, storage medium and program product

Legal Events

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

Ref country code: HK

Ref legal event code: DE

Ref document number: 40050023

Country of ref document: HK

GR01 Patent grant
GR01 Patent grant