A blockchain-based data processing method, device, and readable storage medium

By identifying and removing abnormal consensus nodes in the blockchain network, the block timeout problem caused by abnormal consensus nodes is resolved, thereby improving the throughput of the blockchain network.

CN116205650BActive Publication Date: 2026-06-26TENCENT TECHNOLOGY (SHENZHEN) CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
TENCENT TECHNOLOGY (SHENZHEN) CO LTD
Filing Date
2021-12-01
Publication Date
2026-06-26

AI Technical Summary

Technical Problem

In a blockchain network, if an abnormal consensus node is not identified, it will cause block timeout and reduce the throughput of the blockchain network.

Method used

By obtaining the set of state message pairs of consensus nodes, the state score is determined, and the consensus nodes are sorted according to the state score. Consensus nodes with abnormal state are identified and deleted.

Benefits of technology

It improves the accuracy of identifying node status, avoids abnormal consensus nodes from becoming block-producing nodes, and increases the throughput of the blockchain network.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116205650B_ABST
    Figure CN116205650B_ABST
Patent Text Reader

Abstract

This application discloses a blockchain-based data processing method, device, and readable storage medium. The method includes: acquiring a set of state message pairs X. y ; Status message pair set X y Including status messages for A b Status message for A b Including consensus node Z b The first status message C of the broadcast b and consensus node Z y The generated second state message C y Determine consensus node Z b In status message pair A b The state score in the set X; based on the state message, the set X... y The consensus nodes are sorted according to the state score corresponding to each state message pair to obtain the set X of state message pairs. y The corresponding node sorting results; based on the node sorting results corresponding to the set of N state messages, the node states corresponding to the N consensus nodes are determined. Using this application, node states can be accurately identified and the throughput of the blockchain network can be improved. This application can be applied to various scenarios such as cloud technology, artificial intelligence, smart transportation, and assisted driving.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of Internet technology, and in particular to a data processing method, device and readable storage medium based on blockchain. Background Technology

[0002] With the rapid development of network technology and the increasing emphasis on data security by governments and enterprises, blockchain has been widely applied. Nodes in a blockchain network can include consensus nodes and synchronization nodes. Consensus nodes participate in the accounting consensus process, while synchronization nodes primarily execute business logic, do not participate in accounting consensus, and synchronize block data from the consensus nodes through identity authentication.

[0003] In consensus algorithms where consensus nodes in a consensus committee take turns producing blocks, if the currently selected block-producing node fails—for example, if it lags behind other consensus nodes by many blocks, or is unable to send a new block due to network issues—the algorithm will, to maintain liveness, have the next selected block-producing node produce a block after a timeout. While this method addresses liveness, it fails to identify abnormal consensus nodes. Therefore, when an abnormal consensus node is selected to produce a block again, a timeout will still occur, inevitably reducing the throughput of the blockchain network. Summary of the Invention

[0004] This application provides a blockchain-based data processing method, device, and readable storage medium, which can not only improve the accuracy of identifying node status but also increase the throughput of the blockchain network.

[0005] One embodiment of this application provides a blockchain-based data processing method, including:

[0006] The target consensus node obtains a set of state message pairs corresponding to N consensus nodes; N is a positive integer greater than 1; the set of N state message pairs includes consensus node Z. y The corresponding status message pair set X y ; y is a positive integer and y is less than or equal to N; the set of status messages is X. y Including status messages for A b Status message for A b Including consensus node Z b The first state message C broadcast to the consensus network b and consensus node Z y Regarding the first state message C b The generated second state message C y b is a positive integer and b is less than or equal to N; N consensus nodes include the target consensus node and consensus node Z. b and consensus node Z y ;

[0007] Determine consensus node Z b In status message pair A b The state score in the data; the state message pair A b The corresponding state score is used to represent the first state message C. b and the second state message C y The differences in state between them;

[0008] Based on the status message, set X y For each state message pair, a corresponding state score is assigned. These scores are then sorted across the N consensus nodes to obtain a set X of state message pairs. y The corresponding node sorting results;

[0009] Based on the sorting results of the nodes corresponding to the N state messages, the node states corresponding to the N consensus nodes are determined, and consensus nodes with abnormal node states are deleted from the consensus network.

[0010] One embodiment of this application provides a blockchain-based data processing device, which operates on a target consensus node and includes:

[0011] The first acquisition module is used to acquire the set of state message pairs corresponding to N consensus nodes; N is a positive integer greater than 1; the set of N state message pairs includes consensus node Z. y The corresponding status message pair set X y ; y is a positive integer and y is less than or equal to N; the status message pair set X y Including status messages for A b The status message for A b Including consensus node Z b The first state message C broadcast to the consensus network b and the consensus node Z y Regarding the first status message C b The generated second state message C y b is a positive integer and b is less than or equal to N; the N consensus nodes include the target consensus node and the consensus node Z. b and the consensus node Z y ;

[0012] The first determining module is used to determine the consensus node Z. b In the status message pair A b The state score in the context; the state message pair A b The corresponding state score is used to characterize the first state message C. b and the second status message C y The differences in state between them;

[0013] The sorting node module is used to sort set X according to the status message. y For each state message pair, a corresponding state score is assigned. The N consensus nodes are then sorted to obtain the set X of state message pairs. y The corresponding node sorting results;

[0014] The second determining module is used to determine the node status corresponding to each of the N consensus nodes based on the node sorting results corresponding to the N status messages, and to delete the consensus nodes whose node status is abnormal in the consensus network.

[0015] The first acquisition module includes:

[0016] The first acquisition unit is used for the target consensus node to acquire consensus node Z. e The first status message C broadcast when the system time reaches the status verification period. e Consensus node Z e It belongs to N-1 consensus nodes; N-1 consensus nodes include all consensus nodes except the target consensus node; first state message C e Including consensus node Z e Corresponding node signature I e e is a positive integer and e is less than or equal to N-1;

[0017] The second acquisition unit is used to acquire consensus node Z. e The corresponding node public key, based on consensus node Z e The corresponding node public key is used to sign the node I. e The visa was verified, and the first verification result was obtained.

[0018] The first generation unit is used to generate a signature for consensus node Z based on the first signature verification result. e Status message pairs;

[0019] The second generation unit is used to generate a target state message pair set based on the state message pairs corresponding to N-1 consensus nodes.

[0020] The first determining unit is used to obtain the set of state message pairs broadcast by N-1 consensus nodes respectively, and determine the N-1 set of state message pairs and the target set of state message pairs as the N set of state message pairs.

[0021] Among them, the first state message C e It also includes consensus node Z e Node identifier, consensus node Z e Corresponding block height G e and block height Ge The corresponding block hash;

[0022] The first generation unit includes:

[0023] The first acquisition subunit is used to acquire the target block height when the first signature verification result is a successful signature verification result; the target block height refers to the block height corresponding to the target consensus node;

[0024] The first generation subunit is used to generate based on the target block height and the block height G. e Generate the first state message C e The corresponding second state message F e ;

[0025] The second generation subunit is used to generate the first state message C. e and the second state message F e Combined into a consensus node Z e The pending signature status message pair;

[0026] The third generation subunit is used to sign the unsigned state message pair based on the target node's private key to obtain the consensus node Z. e The corresponding status message pair carrying the first message signature; the target node private key refers to the node private key corresponding to the target consensus node.

[0027] The first generation subunit is specifically used to obtain the target node identifier; the target node identifier refers to the node identifier corresponding to the target consensus node.

[0028] The first generating sub-unit is also specifically used to generate the target block height and the block height G. e Compare;

[0029] The first generating sub-unit is also specifically used if the target block height is equal to or greater than the block height G. e Then, the block hash corresponding to the first block is determined as the target block hash. Based on the target node identifier, the target block height, and the target block hash, a first state message C is generated. e The corresponding second state message F e The block height corresponding to the first block is equal to the block height G. e The first block belongs to the ledger corresponding to the target consensus node.

[0030] The first generation sub-unit is also specifically used if the target block height is less than the block height G. e Then, the block hash corresponding to the second block is determined as the target block hash. Based on the target node identifier, the target block height, and the target block hash, a first state message C is generated. e The corresponding second state message F eThe height of the second block is equal to the height of the target block; the second block belongs to the ledger corresponding to the target consensus node.

[0031] Among them, the status message is for A b It also includes the first state message C b and the second state message C y The second message signature; the first status message C b Including consensus node Z b The first block height, and for consensus node Z b The first block hash associated with the first block height; second state message C y Including consensus node Z y The second block height, and for consensus node Z y The hash of the second block that is highly correlated with the first block height;

[0032] The first determining module includes:

[0033] The third acquisition unit is used to invoke the governance consensus committee contract to obtain the consensus node Z. y The node's public key;

[0034] The third generation unit is used based on consensus node Z. y The node's public key is used to verify the signature of the second message, and the second verification result is obtained.

[0035] The first comparison unit is used to compare the height of the first block and the height of the second block when the second verification result is a successful verification result;

[0036] The second determining unit is used to determine the first target value as consensus node Z if the height of the first block is greater than the height of the second block. b In status message pair A b The state score in the data; the first target value is used to characterize that the height of the first block is greater than the height of the second block;

[0037] The third determining unit is used to determine consensus node Z based on the first block height, the second block height, the first block hash, and the second block hash if the first block height is equal to or less than the second block height. b In status message pair A b The state score in the data.

[0038] The third determining unit includes:

[0039] The comparison hash sub-unit is used to compare the hash of the first block with the hash of the second block;

[0040] The first determining subunit is used to determine the second target value as consensus node Z if the first block hash and the second block hash are different. b In status message pair A b The state score in the data; the second target value is less than the first target value, and the second target value is used to indicate that the hash of the first block belongs to abnormal data;

[0041] The second determining subunit is used to determine the block height difference between the first block height and the second block height as the consensus node Z if the first block hash and the second block hash are the same. b In status message pair A b The state score in the data; the block height difference is greater than the first target value.

[0042] The third generation unit includes:

[0043] The fourth generation subunit is used based on consensus node Z. y The node's public key is used to decrypt the second message signature to obtain the first digital digest;

[0044] The second acquisition subunit is used to acquire the first status message C. b and the second state message C y The second digital digest compares the first and second digital digests.

[0045] The third determining subunit is used to determine the second signature verification result as a successful signature verification result if the first digital digest and the second digital digest are the same.

[0046] The fourth determining subunit is used to determine the second signature verification result as a signature verification failure result if the first digital digest and the second digital digest are different.

[0047] Among them, the node sorting results corresponding to the N status message pairs in the set include the node sorting result H. j j is a positive integer and j is less than or equal to N;

[0048] The second determining module includes:

[0049] The fourth acquisition unit is used to sort the result H from the nodes. j In the process, S consecutive consensus nodes are obtained in sequence, which are used as consensus nodes to be identified; S is a positive integer greater than 1 and S is less than N;

[0050] The statistical unit is used to count the number of node ranking results with the same consensus node to be identified in S consecutive positions among N node ranking results, and use it as the target number.

[0051] The second comparison unit is used to obtain the maximum target quantity, compare the maximum target quantity with the quantity threshold, and obtain the comparison result.

[0052] The fourth determining unit is used to determine the node status corresponding to each of the N consensus nodes based on the comparison results.

[0053] The fourth determining unit includes:

[0054] The fifth determining subunit is used to determine the node state of the consensus node to be identified corresponding to the largest target number as the normal state if the comparison result is that the largest target number is equal to or greater than the number threshold.

[0055] The sixth determining subunit is used to determine the consensus nodes other than the consensus node to be identified corresponding to the largest target number among the N consensus nodes as the remaining consensus nodes;

[0056] The seventh determining subunit is used to determine the node status of the remaining consensus nodes based on the status scores of the remaining consensus nodes in the target node ranking result; the target node ranking result is the node ranking result corresponding to the maximum target number.

[0057] The seventh determining subunit is specifically used to compare the state score of the remaining consensus nodes in the target node sorting result with the state score threshold.

[0058] The seventh determining sub-unit is also specifically used to determine the node state of the remaining consensus node as an abnormal node state if the state score of the remaining consensus node in the target node sorting result is less than or equal to the state score threshold.

[0059] The seventh determining sub-unit is also specifically used to determine the node state of the remaining consensus node as the normal node state if the state score of the remaining consensus node in the target node sorting result is greater than the state score threshold.

[0060] The blockchain-based data processing device also includes:

[0061] The second acquisition module is used to acquire the target node identifier, the height of the block to be verified, and the hash of the block to be verified. The target node identifier refers to the node identifier corresponding to the target consensus node. The height of the block to be verified refers to the block height corresponding to the target consensus node when the system time reaches the state verification cycle. The block height corresponding to the hash of the block to be verified is equal to the height of the block to be verified, and the block corresponding to the hash of the block to be verified belongs to the block in the target ledger. The target ledger refers to the ledger corresponding to the target consensus node.

[0062] The signature message module is used to sign the target node identifier, the height of the block to be verified, and the hash of the block to be verified based on the target node's private key, to obtain a first state message carrying a third message signature; the target node's private key refers to the node's private key corresponding to the target consensus node.

[0063] The broadcast message module is used to broadcast the first state message carrying a third message signature to the consensus network.

[0064] This application provides a computer device, including: a processor, a memory, and a network interface;

[0065] The processor is connected to the memory and the network interface, wherein the network interface is used to provide data communication functions, the memory is used to store computer programs, and the processor is used to call the computer programs so that the computer device executes the methods in the embodiments of this application.

[0066] One aspect of this application provides a computer-readable storage medium storing a computer program adapted for loading by a processor and executing the methods described in this application.

[0067] One aspect of this application provides a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium; a processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the method described in this application.

[0068] In this embodiment, the target consensus node can determine the state score of the consensus node broadcasting the first state message in the state message pair by the state difference between the first state message and the second state message. Further, based on the state score, the consensus nodes in the state message pair set including the state message pair can be sorted, thus obtaining the node sorting result corresponding to the state message pair set. Further, by using the node sorting results corresponding to the N state message pair sets respectively, the node states corresponding to the N consensus nodes can be determined. Further, consensus nodes with abnormal node states are deleted from the consensus network. As can be seen above, this embodiment determines the node states of N consensus nodes based on the N node sorting results, thus improving the accuracy of node state identification. Furthermore, by deleting consensus nodes with abnormal node states, abnormal consensus nodes (i.e., consensus nodes with abnormal node states) can be avoided as block-producing nodes; that is, normal consensus nodes (i.e., consensus nodes with normal node states) are used as block-producing nodes, thus improving the throughput of the blockchain network. Attached Figure Description

[0069] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0070] Figure 1 This is a schematic diagram of a system architecture provided in an embodiment of this application;

[0071] Figure 2 This is a schematic diagram of a data processing scenario provided in an embodiment of this application;

[0072] Figure 3 This is a flowchart illustrating a blockchain-based data processing method provided in an embodiment of this application;

[0073] Figure 4 This is a schematic diagram illustrating a data processing scenario based on blockchain, provided in an embodiment of this application.

[0074] Figure 5 This is a schematic diagram of a data processing scenario based on blockchain provided in an embodiment of this application;

[0075] Figure 6 This is a schematic diagram of a data processing scenario based on blockchain provided in an embodiment of this application;

[0076] Figure 7 This is a flowchart illustrating a blockchain-based data processing method provided in an embodiment of this application;

[0077] Figure 8 This is a schematic diagram of the structure of a blockchain-based data processing device provided in an embodiment of this application;

[0078] Figure 9 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation

[0079] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.

[0080] To facilitate understanding, the following brief explanations are provided for some of the terms:

[0081] 1. Blockchain: In a narrow sense, blockchain is a chain-like data structure with blocks as the basic unit. Blocks use digital digests to verify previously obtained transaction history, making it suitable for the tamper-proof and scalable requirements of distributed ledger scenarios. In a broader sense, blockchain also refers to the distributed ledger technology implemented using the blockchain structure, including distributed consensus, privacy and security protection, peer-to-peer communication technology, network protocols, and smart contracts. The goal of blockchain is to implement a distributed data record ledger that only allows additions, not deletions. The underlying basic structure of the ledger is a linear linked list. The linked list consists of a series of "blocks," with each subsequent block recording the hash value of the previous block. The validity of each block (and the transactions within it) can be quickly verified by calculating the hash value. If a node in the network proposes to add a new block, the block must be confirmed through a consensus mechanism.

[0082] 2. Blockchain Nodes: Blockchain networks divide nodes into consensus nodes (also known as core nodes) and synchronization nodes (which can include data nodes and light nodes). Consensus nodes are responsible for the consensus process across the entire blockchain network; synchronization nodes are responsible for synchronizing the ledger information of the consensus nodes, i.e., synchronizing the latest block data. Both consensus and synchronization nodes include network communication components in their internal structure, because a blockchain network is essentially a peer-to-peer (P2P) network, requiring communication with other nodes in the blockchain network through P2P components. Resources and services in the blockchain network are distributed across various nodes; information transmission and service implementation occur directly between nodes, without the need for intermediaries or centralized servers (third parties).

[0083] 3. Public Key and Private Key: A public key and a private key are a key pair (one public key and one private key) obtained through an algorithm. The public key is the publicly known part of the key pair, while the private key is the private key. Public keys are typically used for encrypting data, verifying digital signatures, etc. This algorithm ensures that the resulting key pair is unique. When using this key pair, if data is encrypted with one key, it must be decrypted with the other key. For example, data encrypted with the public key must be decrypted with the private key, and vice versa; otherwise, decryption will fail.

[0084] 4. Block: A block is a data packet carrying transaction data on a blockchain network. It is a data structure marked with a timestamp and the hash value of the previous block. A block is verified and confirmed by the network's consensus mechanism. A block consists of a block header and a block body. The block header records the metadata of the current block, including the current version number, the hash value of the previous block, the timestamp, a random number, and the hash value of the Merkle root. The block body records detailed data generated over a period of time, including all verified transactions and other information generated during the block creation process; it can be understood as a form of ledger representation.

[0085] 5. Hash Value: Also known as an information feature value or characteristic value, a hash value is generated by converting input data of arbitrary length into cryptographic data and producing a fixed output using a hash algorithm. The original input data cannot be retrieved by decrypting the hash value; it is a one-way cryptographic function. In a blockchain, each block (except the initial block) contains the hash value of its predecessor block, which is called the parent block of the current block. The hash value is a core and crucial aspect of blockchain technology, preserving the authenticity of recorded and viewed data, as well as the integrity of the blockchain as a whole.

[0086] 6. Smart Contract: A smart contract is a computer protocol designed to disseminate, verify, or execute contracts in an information-based manner. In a blockchain system, a smart contract (or simply contract) is code that all nodes on the blockchain can understand and execute, capable of performing arbitrary logic and obtaining results. In practical applications, smart contracts are managed and tested through transactions on the blockchain. Each transaction is equivalent to a Remote Procedure Call (RPC) request to the blockchain system. If a smart contract is like an executable program, the blockchain is like an operating system providing the runtime environment. A blockchain can contain multiple contracts, distinguished by contract identity (ID), identifier, or name. The governance consensus committee contract described below is a smart contract provided in this application embodiment, used to manage consensus nodes, and may include recording the node status of consensus nodes, dynamically adding consensus nodes, and removing abnormal consensus nodes, etc.

[0087] Please see Figure 1 , Figure 1 This is a schematic diagram of a system architecture provided in an embodiment of this application. For example... Figure 1As shown, the system architecture can be a blockchain network, which may include a consensus network 101 and a synchronization network 102. Nodes in the synchronization network 102 can be called synchronization nodes. Synchronization nodes primarily perform business execution and do not participate in the accounting consensus process. They obtain block data from the consensus network 101 through identity authentication. The consensus network 101 can also be called the core network, and its nodes are called consensus nodes. Consensus nodes possess all the data. The consensus network 101 and the synchronization network 102 can reside in different network environments. Typically, the consensus network 101 is in a private network, while the synchronization network 102 is in a public network, and the two interact through routing boundaries.

[0088] It is understood that the consensus network 101 described above may include one or more consensus nodes; there is no limit to the number of consensus nodes here. Please see also Figure 1 Consensus network 101 may include consensus node 1011, consensus node 1012, ..., consensus node 1013.

[0089] It is understood that the aforementioned synchronization network 102 may include one or more synchronization nodes; the number of synchronization nodes will not be limited here. Please refer to [link to previous document]. Figure 1 The synchronization network 102 may include synchronization node 1021, synchronization node 1022, synchronization node 1023, ..., synchronization node 1024 and synchronization node 1025.

[0090] Each node (including the consensus node in consensus network 101 and the synchronization node in synchronization network 102) can receive transaction data sent by the client during normal operation, generate blocks based on the received transaction data, and then perform block on-chain processing. It is understood that in the specific embodiments of this application, data related to user information (such as node public keys) is involved. When the embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use, and processing of related data must comply with the relevant laws, regulations, and standards of the relevant countries and regions.

[0091] To ensure data communication between nodes, data connections can exist between each node. For example, there is a data connection between consensus node 1011 and consensus node 1012, a data connection between consensus node 1011 and consensus node 1013, a data connection between synchronization node 1021 and synchronization node 1023, and so on. Furthermore, there are data connections between consensus network 101 and synchronization network 102, such as a data connection between consensus node 1011 and synchronization node 1022, a data connection between consensus node 1012 and synchronization node 1023, and so on.

[0092] It is understandable that nodes can transmit data or blocks through the aforementioned data connections. These data connections can be based on node identifiers. Each node in the blockchain network has a corresponding node identifier, and each node can store the node identifiers of other nodes connected to it. This allows it to broadcast acquired data or generated blocks to other nodes based on their node identifiers. For example, consensus node 1011 can maintain a list of node identifiers, which stores the node names and identifiers of other nodes, as shown in Table 1.

[0093] Table 1

[0094]

[0095]

[0096] The node identifier can be an Internet Protocol (IP) address or any other information that can be used to identify a node in a blockchain network. Table 1 only uses IP addresses as an example.

[0097] Assuming the node identifier of consensus node 1011 is 117.116.156.425, then consensus node 1011 can send a data synchronization request to synchronization node 1021 through node identifier 117.114.151.183. Synchronization node 1021 can recognize that the data synchronization request was sent by consensus node 1011 through node identifier 117.116.156.425. Similarly, synchronization node 1023 can send transaction data A to consensus node 1011 through node identifier 117.116.156.425. Consensus node 1011 can recognize that transaction data A was sent by synchronization node 1023 through node identifier 119.250.485.362. Data transmission between other nodes is also in the same manner, so it will not be elaborated further.

[0098] It is understood that the above data connection is not limited to the connection method. It can be connected directly or indirectly through wired communication, or directly or indirectly through wireless communication, or through other connection methods. This application does not impose any restrictions on this.

[0099] Understandable, Figure 1The blockchain nodes in the blockchain network include, but are not limited to, terminal devices or servers. These servers can be independent physical servers, server clusters or distributed systems composed of multiple physical servers, or cloud servers providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The terminal devices include, but are not limited to, mobile phones, computers, smart voice interaction devices, smart home appliances, and in-vehicle terminals. The terminal devices and servers can be connected directly or indirectly via wired or wireless means; this embodiment of the application does not impose any limitations on this.

[0100] For ease of description and understanding, this application names a block with a block height of P as block P, and describes a block height of P as block height P, where P is a positive integer. For example, a block with a block height of 1 is named block 1, and a block height of 1 is described as block height 1; a block with a block height of 98 is named block 98, and a block height of 98 is described as block height 98, and so on for other block heights. These details will not be elaborated upon here.

[0101] Further, please see Figure 2 , Figure 2 This is a schematic diagram of a data processing scenario provided in an embodiment of this application. The target consensus node 20a can be any consensus node in the consensus network; for ease of description and understanding, N is exemplified as 4 in this embodiment, meaning the consensus network contains 4 consensus nodes. Figure 2 The examples given are consensus nodes Z1, Z2, Z3, and Z4. It is understood that if N equals any other value, the node states corresponding to the N consensus nodes can be determined as described below.

[0102] like Figure 2As shown, the target consensus node 20a obtains the state message pair sets generated by the four consensus nodes, including state message pair set X1 generated by consensus node Z1, state message pair set X2 generated by consensus node Z2, state message pair set X3 generated by consensus node Z3, and state message pair set X4 generated by consensus node Z4. Among them, state message pair set X1 includes three state message pairs: state message pair (C21, C12), state message pair (C31, C12), and state message pair (C41, C13). For ease of description and understanding, the first element of a state message pair can represent the first state message broadcast to the consensus network when the system time reaches the state verification period, and the second character of this first element can represent the consensus node that generated and broadcast the first state message; the second element of a state message pair can represent the second state message generated in response to the first state message, and the second character of this second element can represent the consensus node that generated the second state message and generated the state message pair based on the first and second state messages; for example, state message pair (C21, C12, C31, C4 ... The first element in (C21, C12) can represent the first state message C21 generated and broadcast by consensus node Z2, and the second element can represent the second state message C12 generated by consensus node Z1 in response to the first state message C21. The second character (i.e., 1) in the second element can indicate that the state message pair (C21, C12) was generated by consensus node Z1. For example, the first element in the state message pair (C41, C13) can represent the first state message C41 generated and broadcast by consensus node Z4, and the second element can represent the second state message C13 generated by consensus node Z1 in response to the first state message C41. The second character (i.e., 1) in the second element can indicate that the state message pair (C41, C13) was generated by consensus node Z1.

[0103] Please see again. Figure 2 The set of state message pairs X2 includes three state message pairs: state message pair (C11, C23), state message pair (C31, C23), and state message pair (C41, C23). In state message pair (C11, C23), the first element represents the first state message C11 generated and broadcast by consensus node Z1, and the second element represents the second state message C23 generated by consensus node Z2 in response to the first state message C11. The second character (i.e., 2) in the second element indicates that state message pair (C11, C23) was generated by consensus node Z2. The meanings of the other state message pairs can be understood from the above description and will not be elaborated on one by one.

[0104] Please see again. Figure 2The set of state message pairs X3 includes three state message pairs: state message pair (C11, C31), state message pair (C21, C31), and state message pair (C41, C31); the set of state message pairs X4 includes three state message pairs: state message pair (C11, C42), state message pair (C21, C42), and state message pair (C31, C42).

[0105] In this embodiment, the second state message is generated based on the current state of the consensus node after receiving the first state message. Therefore, for the same consensus node, the generated second state messages can be the same (because they are in the same state). For example... Figure 2 In the example shown, consensus node Z2 generates the same second state message C23 based on the same current state for first state messages C11, C31, and C41. Optionally, the second state messages generated by the same consensus node can be different (because they are in different states). For example, the second state message C12 generated by consensus node Z1 for first state message C21 is different from the second state message C13 generated by it for first state message C41. For example, consensus node Z1 obtains the first state message C21 broadcast by consensus node Z2 in a state where the maximum block height is block height 2, while when it obtains the first state message C41 broadcast by consensus node Z4, its maximum block height is block height 3.

[0106] Understandably, in a healthy blockchain network, because the consensus network is executing block production tasks normally, the maximum block height corresponding to the generation of the second state message by the consensus node should be equal to or greater than the maximum block height corresponding to the generation of the first state message. For example... Figure 2 When consensus node Z2 generates the second state message C23, its maximum block height is equal to block height 3. When consensus node Z2 generates the first state message C21, its maximum block height is equal to block height 1.

[0107] Optionally, this application embodiment does not limit the time when the consensus node generates the second state message. In addition to the examples mentioned above, the second state message can also be generated based on the state of the consensus node when the system time reaches the state verification period. In this case, the same consensus node generates the same second state message for the first state messages broadcast by different consensus nodes. Furthermore, conditions for the consensus node to generate the second state message can be set according to the actual application scenario, including but not limited to generating the second state message based on the current state after obtaining the first first state message, generating the second state message based on the current state after obtaining the first state message broadcast by a specific consensus node (a pre-defined consensus node), and generating the second state message based on the current state after obtaining the last first state message.

[0108] Please see again. Figure 2 If the target consensus node 20a is consensus node Z1, then the set of state message pairs X1 is generated by the target consensus node 20a after it obtains the first state message C21 broadcast by consensus node Z2, the first state message C31 broadcast by consensus node Z3, and the first state message C41 broadcast by consensus node Z4. The set of remaining state message pairs is obtained by the target consensus node 20a from the consensus network after the remaining consensus nodes broadcast it to the consensus network. For example, consensus node Z2 generates the set of state message pairs X2 and broadcasts it to the consensus network.

[0109] After obtaining the set of state message pairs, the target consensus node 20a calls the governance consensus committee contract to execute the obtained set of state message pairs and obtain the state score of the consensus node in the state message pairs. This application embodiment does not limit the order in which the state message pairs are executed. For example, the target consensus node 20a can run the governance consensus committee contract on the state message pairs obtained first to obtain the node ranking result corresponding to the state message pairs; or it can run the governance consensus committee contract after obtaining a preset number of state message pairs to obtain the node ranking result.

[0110] The target consensus node 20a, by running the governance consensus committee contract, first determines the state score of the consensus node broadcasting the first state message in the state message pair, such as... Figure 2 As shown, the target consensus node 20a invokes the governance consensus committee contract, executes the state message pair set X1, and determines that the state difference between the first state message C21 and the second state message C12 is 1. Therefore, it can be determined that the state score of consensus node Z2 in the state message pair (C21, C12) is -1, and correspondingly, the state score of consensus node Z1 in the state message pair (C21, C12) is 0. The target consensus node 20a determines that the state difference between the first state message C31 and the second state message C12 is 999. Therefore, it can be determined that the state score of consensus node Z3 in the state message pair (C31, C12) is 0. The state score in 12) is -999, correspondingly, the state score of consensus node Z1 in the state message pair (C31, C12) is determined to be 0; the target consensus node 20a determines that the state difference between the first state message C41 and the second state message C13 is 3, so the state score of consensus node Z4 in the state message pair (C41, C13) can be determined to be -3, correspondingly, the state score of consensus node Z1 in the state message pair (C41, C13) is determined to be 0; then the target consensus node 20a can obtain the state score corresponding to each state message pair in the state message pair set X1, such as Figure 2The example shows a state score list 201c. Further, by running the governance consensus committee contract, the target consensus node 20a can sort the four consensus nodes according to the state score list 201a. This embodiment uses a descending order sorting example, thus obtaining the node sorting result 201d corresponding to the state message set X1, where consensus node Z1 is in the first position, consensus node Z2 in the second position, consensus node Z4 in the third position, and consensus node Z3 in the fourth position. This embodiment does not describe in detail the determination of the state differences between the first and second state messages; please refer to the following text. Figure 3 The description in step S102 of the corresponding embodiment.

[0111] Understandably, in practical applications, the target consensus node 20a can sort the N consensus nodes in ascending order based on the state score corresponding to each state message pair in the state message pair set, or it can sort them in other ordering methods. This application does not limit this.

[0112] Similarly, through the governance consensus committee contract, the target consensus node 20a can determine that consensus node Z1 has a state score of -2 in the state message pair (C11, C23), consensus node Z3 has a state score of -999 in the state message pair (C31, C23), consensus node Z4 has a state score of -3 in the state message pair (C41, C23), and consensus node Z2 has a state score of 0 in the state message pair set X2, such as... Figure 2 The example state score list 202c; according to the state score of each consensus node in the state message pair set X2, the four consensus nodes are sorted to obtain the node sorting result 202d corresponding to the state message pair set X2, that is, consensus node Z2 is in the first position, consensus node Z1 is in the second position, consensus node Z4 is in the third position, and consensus node Z3 is in the fourth position.

[0113] Similarly, through the governance consensus committee contract, the target consensus node 20a can determine that consensus node Z1 has a state score of -1 in the state message pair (C11, C31), consensus node Z2 has a state score of -1 in the state message pair (C21, C31), consensus node Z4 has a state score of -2 in the state message pair (C41, C31), and consensus node Z3 has a state score of 0 in the state message pair set X3, such as... Figure 2The example state score list 203c; according to the state score of each consensus node in the state message pair set X3, the four consensus nodes are sorted to obtain the node sorting result 203d corresponding to the state message pair set X3, that is, consensus node Z3 is ranked in the first position, consensus nodes Z1 and Z2 are ranked in the second position, and consensus node Z4 is ranked in the third position.

[0114] Similarly, through the governance consensus committee contract, the target consensus node 20a can determine that consensus node Z1 has a state score of 0 in the state message pair (C11, C42), consensus node Z2 has a state score of 0 in the state message pair (C21, C42), consensus node Z3 has a state score of -99 in the state message pair (C31, C42), and consensus node Z4 has a state score of 0 in the state message pair set X4, as follows. Figure 2 The example state score list 204c; according to the state score of each consensus node in the state message pair set X4, the four consensus nodes are sorted to obtain the node sorting result 204d corresponding to the state message pair set X4, that is, consensus node Z4, consensus node Z1 and consensus node Z2 are ranked in the first position, and consensus node Z3 is ranked in the second position.

[0115] Furthermore, the target consensus node 20a determines the node status of the above four consensus nodes based on the node sorting results corresponding to the set according to N status messages (four in this embodiment). For example, node sorting results 201d, 202d, 203d, and 204d in this embodiment can be used to sort the nodes respectively. Obviously, in the four node sorting results, consensus node Z3 is ranked at the end three times, and the status scores of consensus node Z3 in status score list 201c, status score list 202c, and status score list 204c are all very low. Here, a status score threshold can be set according to the actual application scenario. If there is a status score less than the status score threshold among the three status scores corresponding to consensus node Z3, then the node status of consensus node Z3 can be determined to be an abnormal node status. Since consensus nodes Z1, Z2, and Z4 are ranked early and none have a state score lower than the threshold, it can be determined that the node states corresponding to consensus nodes Z1, Z2, and Z4 are all in a normal state. Subsequently, the target consensus node 20a can delete consensus nodes in an abnormal state from the consensus network or cancel their block production function, for example... Figure 2 The consensus node Z3 is shown in the example.

[0116] As mentioned above, a blockchain network includes a consensus network and a synchronization network. However, the consensus nodes in the consensus network are not fixed and can be dynamically added or deleted. For example, if the consensus network determines that a certain consensus node is in an abnormal state, then that consensus node can be identified as an abnormal consensus node and deleted. Furthermore, the consensus process of a consensus network can be divided into consensus cycles. In each consensus cycle, a subset of blockchain nodes (i.e., the consensus nodes of the current consensus cycle) participate in the consensus process, while other blockchain nodes act as synchronization nodes. When the block height generated in the current consensus cycle meets the conditions for consensus node switching, a new consensus node will be selected for the next consensus cycle to participate in the consensus operations of that cycle.

[0117] In summary, consensus nodes periodically broadcast their first state message to the consensus network. Upon receiving first state messages from other consensus nodes, they compare these messages with their own second state message to detect consensus nodes in an abnormal state. When a majority of consensus nodes identify a node as abnormal, it can be removed from the consensus network. Subsequently, when the removed node recovers to a normal state, it can be added back to the consensus network, thus ensuring that all nodes in the consensus network are healthy. Therefore, this application improves the accuracy of node state identification. Furthermore, by removing consensus nodes in an abnormal state, malicious nodes can be prevented from forging information, thereby enhancing the security of the blockchain network.

[0118] Further, please see Figure 3 , Figure 3 This is a flowchart illustrating a blockchain-based data processing method provided in an embodiment of this application. The target consensus node can be any consensus node in the consensus network, such as... Figure 3 As shown, the data processing method may include at least the following steps S101-S104.

[0119] Step S101: The target consensus node obtains the state message pair sets corresponding to N consensus nodes; N is a positive integer greater than 1; the N state message pair sets include consensus node Z. y The corresponding status message pair set X y ; y is a positive integer and y is less than or equal to N; the set of status messages is X. y Including status messages for A b Status message for A b Including consensus node Z b The first state message C broadcast to the consensus network b and consensus node Z y Regarding the first state message C bThe generated second state message C y b is a positive integer and b is less than or equal to N; N consensus nodes include the target consensus node and consensus node Z. b and consensus node Z y .

[0120] Specifically, the target consensus node obtains consensus node Z. e The first status message C broadcast when the system time reaches the status verification period. e Consensus node Z e It belongs to N-1 consensus nodes; N-1 consensus nodes include all consensus nodes except the target consensus node; first state message C e Including consensus node Z e Corresponding node signature I e e is a positive integer and e is less than or equal to N-1; obtain consensus node Z. e The corresponding node public key, based on consensus node Z e The corresponding node public key is used to sign the node I. e Perform signature verification to obtain the first signature verification result; based on the first signature verification result, generate a signature for consensus node Z. e The state message pairs are generated based on the state message pairs corresponding to the N-1 consensus nodes. The target state message pair set is generated based on the state message pairs corresponding to the N-1 consensus nodes. The state message pair sets broadcast by the N-1 consensus nodes are obtained, and the N-1 state message pair sets and the target state message pair set are determined as the N state message pair set.

[0121] Among them, the first state message C e It also includes consensus node Z e Node identifier, consensus node Z e Corresponding block height G e and block height G e The corresponding block hash; based on the first signature verification result, generate a hash for consensus node Z. e The specific process of the status message pair may include: when the first signature verification result is a successful signature verification result, obtaining the target block height; the target block height refers to the block height corresponding to the target consensus node; based on the target block height and the block height G... e Generate the first state message C e The corresponding second state message F e ; the first state message C e and the second state message F e Combined into a consensus node Z e The pending signature status message pair; based on the target node's private key, the pending signature status message pair is signed to obtain the consensus node Z. eThe corresponding status message pair carrying the first message signature; the target node private key refers to the node private key corresponding to the target consensus node.

[0122] Among them, the first state message C is generated. e The corresponding second state message F e The specific process may include: obtaining the target node identifier; the target node identifier refers to the node identifier corresponding to the target consensus node; and setting the target block height and block height G. e Perform a comparison; if the target block height is equal to or greater than the block height G e Then, the block hash corresponding to the first block is determined as the target block hash. Based on the target node identifier, the target block height, and the target block hash, a first state message C is generated. e The corresponding second state message F e The block height corresponding to the first block is equal to the block height G. e The first block belongs to the ledger corresponding to the target consensus node; if the target block height is less than the block height G. e Then, the block hash corresponding to the second block is determined as the target block hash. Based on the target node identifier, the target block height, and the target block hash, a first state message C is generated. e The corresponding second state message F e The height of the second block is equal to the height of the target block; the second block belongs to the ledger corresponding to the target consensus node.

[0123] When the system time reaches the state verification period, each consensus node in the consensus network generates a first state message based on its own state. For ease of description and understanding, this application embodiment uses N=4 as an example, that is, the consensus network includes 4 consensus nodes. Please refer to [link to previous document]. Figure 4 , Figure 4 This is a schematic diagram illustrating a blockchain-based data processing scenario provided in an embodiment of this application. The four consensus nodes respectively include... Figure 4 The consensus nodes Z1, Z2, Z3, and Z4 shown in the examples are, as is understood, unless otherwise specified, references to these nodes in this application. Figure 2 , Figure 4 And the labels described below, if the same label is used, it indicates the same object.

[0124] In this embodiment of the application, it is assumed that the target consensus node is consensus node Z2. Figure 4 As shown, consensus node Z2 obtains the first state message 30a broadcast by consensus node Z1 when the system time reaches the state verification period. This first state message 30a can be equivalent to... Figure 2 The first state message C11 in the consensus node includes the node identifier of consensus node Z1 (e.g., ...). Figure 4 The example identifier 1), the maximum block height of consensus node Z1 when the system time reaches the state verification period ( Figure 4 Abbreviated as block height G1, meaning the maximum block height is block height G1), the block hash corresponding to the maximum block height ( Figure 4 Abbreviated as block hash 1), and node signature (such as Figure 4 The example signature I1).

[0125] After receiving the first state message 30a, consensus node Z2 obtains the public key 30b of consensus node Z1. Based on the public key 30b, it verifies the signature I1 and obtains the first verification result. If the first verification result is a verification failure, consensus node Z2 can determine that consensus node Z1 is not the node that signed the identifier 1, block height G1, and block hash 1, and rejects the first state message 30a. If the first verification result is a verification success, the maximum block height in the ledger is used as the target block height. Figure 4 Abbreviated as target block height.

[0126] Furthermore, consensus node Z2 compares the target block height with the block height G1 in the first state message 30a. If the target block height is greater than or equal to the block height G1, consensus node Z2 can obtain the block hash corresponding to the block height G1 from the ledger and use it as the target block hash. At this time, the target node identifier ( Figure 4 The abbreviation is "target identifier"), the block hash corresponding to block height G1 in the ledger, and the target block height generates the second state message 30c (equivalent to...). Figure 2 The second state message C23 in the first state message; further, consensus node Z2 combines the first state message 30a and the second state message 30c into a state message pair to be signed, and signs the state message pair to be signed based on the target node's private key 30d, to obtain a state message pair (C11, 23) carrying the signature of the first message.

[0127] If the target block height is less than the block height G1, then consensus node Z2 cannot confirm the validity of block hash 1. Therefore, it obtains the block hash corresponding to the target block height from the ledger and uses it as the target block hash. It then generates a second state message 30c with the target node identifier, the block hash corresponding to the target block height in the ledger, and the target block height. The subsequent process is the same as above, so it will not be repeated here. Please refer to the above.

[0128] Understandable Figure 4Taking consensus node Z1 as an example, it broadcasts the first state message. As described above, consensus node Z2 can generate the second state message C23 based on the first state message C31 broadcast by consensus node Z3, and generate a state message pair (C31, C23); similarly, it can generate the second state message C23 based on the first state message C41 broadcast by consensus node Z4, and generate a state message pair (C41, C23); For example... Figure 4 As shown, consensus node Z2 combines the state message pairs corresponding to the three consensus nodes into a target state message pair set, i.e. Figure 4 The target state message pair set X2 is generated and broadcast to the consensus network.

[0129] Similarly, consensus node Z2 can obtain the set of state message pairs broadcast by consensus nodes Z1, Z3, and Z4 respectively, such as... Figure 2 The example sets of state message pairs X1, X3, and X4 can be used to obtain N (N=4 in this example) sets of state message pairs.

[0130] Step S102, determine consensus node Z b In status message pair A b The state score in the context; state message pair A b The corresponding state score is used to represent the first state message C. b and the second state message C y The differences in state between them.

[0131] Specifically, the status message for A b It also includes the first state message C b and the second state message C y The second message signature; the first status message C b Including consensus node Z b The first block height, and for consensus node Z b The first block hash associated with the first block height; second state message C y Including consensus node Z y The second block height, and for consensus node Z y The hash of the second block, which is highly correlated with the first block; invoking the governance consensus committee contract to obtain consensus node Z through the governance consensus committee contract. y The node's public key; based on consensus node Z y The node's public key verifies the signature of the second message, obtaining a second verification result. When the second verification result is successful, the heights of the first and second blocks are compared. If the height of the first block is greater than the height of the second block, the first target value is determined as the consensus node Z.b In status message pair A b The state score in the block; the first target value is used to indicate that the height of the first block is greater than the height of the second block; if the height of the first block is equal to or less than the height of the second block, then the consensus node Z is determined based on the height of the first block, the height of the second block, the hash of the first block, and the hash of the second block. b In status message pair A b The state score in the data.

[0132] Among them, consensus node Z is determined. b In status message pair A b The specific process of determining the state score may include: comparing the hash of the first block and the hash of the second block; if the hash of the first block and the hash of the second block are different, then the second target value is determined as the consensus node Z. b In status message pair A b The state score is determined by the following criteria: the second target value is less than the first target value, and the second target value is used to indicate that the first block hash is abnormal data; if the first block hash and the second block hash are the same, then the difference in block height between the first block height and the second block height is determined as the consensus node Z. b In status message pair A b The state score in the data; the block height difference is greater than the first target value.

[0133] Among them, based on consensus node Z y The specific process of verifying the second message signature using the public key of the consensus node Z to obtain the second verification result may include: based on the consensus node Z y The node's public key is used to decrypt the second message signature to obtain the first digital digest; the first state message C is then obtained. b and the second state message C y The second digital digest is compared with the first digital digest; if the first digital digest and the second digital digest are the same, the second verification result is determined to be a successful verification result; if the first digital digest and the second digital digest are different, the second verification result is determined to be a failed verification result.

[0134] For ease of understanding, this application uses a state message pair set X1 as an example to describe how to generate state scores for each state message pair in other state message pair sets. Please refer to the following description; detailed explanations are omitted here. Please also refer to... Figure 4 as well as Figure 5 , Figure 5 This is a schematic diagram illustrating a blockchain-based data processing scenario provided in an embodiment of this application. For example... Figure 5As shown, the state message pair set X1 includes three state message pairs: state message pair (C21, C12, second message signature 1), state message pair (C31, C12, second message signature 2), and state message pair (C41, C13, second message signature 3). Second message signature 1 is used by the target consensus node 20a to confirm the identity of consensus node Z1, and also to confirm the legitimacy of the first state message C21 and the second state message C12. Similarly, second message signature 2 is used by the target consensus node 20a to confirm the identity of consensus node Z1, and also to confirm the legitimacy of the first state message C31 and the second state message C12. Second message signature 3 is used by the target consensus node 20a to confirm the identity of consensus node Z1, and also to confirm the legitimacy of the first state message C41 and the second state message C13.

[0135] The target consensus node 20 invokes the governance consensus committee contract to obtain the node public key of the consensus node that generated the state message pair set X1, i.e., the node public key 30b of consensus node Z1. Similarly, for ease of description, the second verification result is exemplified here using the state message pair (C21, C12, second message signature 1). The second verification results for other state message pairs can be referred to the description below. The target consensus node 20a decrypts the second message signature 1 based on the node public key 30b to obtain the first digital digest corresponding to the second message signature 1. Further, it obtains the second digital digests of the first state message C21 and the second state message C12 based on a hash algorithm, and compares the first digital digest corresponding to the second message signature 1 with the second digital digest. If the two digital digests are the same, the second verification result is determined to be a successful verification result; if the first digital digest and the second digital digest are different, the second verification result is determined to be a failed verification result.

[0136] If the second signature verification result is a verification failure, the target consensus node 20a can determine that the state message pair (C21, C12, second message signature 1) is forged data and will delete the state message pair; if the second signature verification result is a verification success, the first block height in the first state message C21 and the second block height in the second state message C12 are compared. If the first block height is greater than the second block height, that is, the maximum block height in the ledger of the consensus node Z2 broadcasting the first state message C21 is greater than that of the consensus node Z1 receiving the first state message C21, then... The maximum block height in the ledger (i.e., the second block height) is such that the target consensus node 20a cannot determine the legitimacy of the first state message C21 based on the second state message C12. Therefore, the first target value is determined as the state score of the consensus node Z2 in the state message pair (C21, C12, second message signature 1). It is understood that the first target value can be set according to the actual application scenario. This application embodiment does not limit this. It is only necessary to ensure that the absolute value corresponding to the first target value is greater than N, so as to ensure that the first target value is less than the minimum block height difference.

[0137] If the height of the first block is less than or equal to the height of the second block, meaning that when consensus node Z1 receives the first state message C21, the maximum block height in its ledger (i.e., the height of the second block) is greater than or equal to the height of the first block (which is the maximum block height in consensus node Z2's ledger when the system time reaches the state verification period), then the blocks in consensus node Z1's ledger can verify the blocks in consensus node Z2's ledger. Figure 5 As shown, for the state message pair (C21, C12, second message signature 1), the collecting node V (the node that obtains the first state message C21) is the consensus node Z1, and the reporting node W (the node that broadcasts the first state message C21) is the consensus node Z2. The first block height is 10, and the second block height is 11, so the block height difference is 1. The first block hash is equal to the block hash 10, and the second block hash is equal to the block hash 10, so the two block hashes are the same. At this time, the state scores of consensus node Z2 and consensus node Z1 in the state message pair (C21, C12, second message signature 1) are determined according to the block height difference. For ease of sorting, the state score of the collecting node is set to 0, so the state score of consensus node Z2 in the state message pair (C21, C12, second message signature 1) is equal to -1.

[0138] Please see again. Figure 5For the state message pair (C31, C12, second message signature 2), the collecting node V is the consensus node Z1, and the reporting node W is the consensus node Z3. The height of the first block is 11, and the height of the second block is 11, so the difference in block height is 0. The hash of the first block is equal to the block hash 10, and the hash of the second block is equal to the block hash 11. Obviously, the two block hashes are different. Therefore, based on the second state message, the first state message is determined to be an abnormal state message. Thus, the target consensus node 20a determines that the state score of consensus node Z3 in the state message pair (C31, C12, second message signature 1) is equal to the second target value. This second target value can indicate that the first block hash belongs to abnormal data. It is understood that the second target value can be set according to the actual application scenario. This embodiment of the application does not limit this, as long as the second target value is much smaller than the first target value. Figure 5 The second target value is denoted as -999.

[0139] For the state message pair (C41, C13, second message signature 3), the collecting node V is the consensus node Z1, and the reporting node W is the consensus node Z4. The first block height is 9, and the second block height is 12, so the block height difference is 3. The first block hash is equal to the block hash 9, and the second block hash is equal to the block hash 9, so the two block hashes are the same. At this time, the target consensus node 20a determines the state score of consensus node Z4 in the state message pair (C41, C13, second message signature 3) to be -3 based on the block height difference.

[0140] Step S103, adjust set X according to the status message. y For each state message pair, a corresponding state score is assigned. These scores are then sorted across the N consensus nodes to obtain a set X of state message pairs. y The corresponding node sorting results.

[0141] Specifically, in conjunction with step S102, the target consensus node 20a can obtain a list 201c of state scores corresponding to the state message pair set X1. Further, based on the state scores corresponding to each consensus node, the four consensus nodes can be sorted, such as... Figure 5 As shown, if the nodes are sorted in descending order, the sorted result is 201d.

[0142] This application uses a scoring and sorting system, which can ensure correctness and fairness, thereby ensuring smooth block production in the blockchain network and improving system performance and throughput.

[0143] Step S104: Based on the sorting results of the nodes corresponding to the N status messages, determine the node status corresponding to the N consensus nodes, and delete the consensus nodes whose node status is abnormal in the consensus network.

[0144] Specifically, the node sorting results corresponding to the N status message pairs in the set include the node sorting result H. j j is a positive integer and j is less than or equal to N; sort the nodes according to the result H j In the process, the consensus nodes corresponding to the S consecutive positions are obtained in sequence as consensus nodes to be identified; S is a positive integer greater than 1 and S is less than N; among the N node sorting results, the number of node sorting results with the same consensus node to be identified at the S consecutive positions is counted as the target number; the maximum target number is obtained, and the maximum target number is compared with the number threshold to obtain the comparison result; the node state corresponding to the N consensus nodes is determined according to the comparison result.

[0145] The specific process of determining the node states corresponding to the N consensus nodes based on the comparison results may include: if the comparison result shows that the maximum target number is equal to or greater than the number threshold, then the node state of the consensus node to be identified corresponding to the maximum target number is determined as the normal node state; the consensus nodes among the N consensus nodes other than the consensus node to be identified corresponding to the maximum target number are determined as the remaining consensus nodes; the node state of the remaining consensus nodes is determined according to the state score of the remaining consensus nodes in the target node ranking result; the target node ranking result is the node ranking result corresponding to the maximum target number.

[0146] The specific process of determining the node status of the remaining consensus nodes based on their status scores in the target node ranking results may include: comparing the status scores of the remaining consensus nodes in the target node ranking results with a status score threshold; if the status scores of the remaining consensus nodes in the target node ranking results are less than or equal to the status score threshold, then the node status of the remaining consensus nodes is determined to be an abnormal node status; if the status scores of the remaining consensus nodes in the target node ranking results are greater than the status score threshold, then the node status of the remaining consensus nodes is determined to be a normal node status.

[0147] For ease of description and understanding, N is exemplified as 4 in the embodiments of this application. Please refer to [the relevant documentation / reference]. Figure 6 , Figure 6 This is a schematic diagram illustrating a blockchain-based data processing scenario provided in an embodiment of this application. For example... Figure 6 As shown, the target consensus node obtains the node sorting results corresponding to the four state message pairs, including... Figure 6The node sorting results are 601b, 602b, 603b, and 604b. Assuming this embodiment sorts the consensus nodes in descending order, the earlier a consensus node appears, the higher its state score. Specifically, the sorting order in node sorting result 601b is consensus node 1, consensus node 2, consensus node 4, and consensus node 3; the sorting order in node sorting result 602b is consensus node 2, consensus node 1, consensus node 4, and consensus node 3; the sorting order in node sorting result 603b is consensus node 3, consensus node 2, consensus node 1, and consensus node 4; and the sorting order in node sorting result 604b is consensus node 4, consensus node 1, consensus node 2, and consensus node 3.

[0148] The target consensus node sequentially obtains S consecutive consensus nodes from the node sorting result 601b as consensus nodes to be identified. It is understood that S can be set according to the actual application scenario, and this application does not limit it. In this embodiment, S=2. Then, the target consensus node obtains the consensus nodes corresponding to the first two positions (whose state scores are greater than the state scores of the subsequent consensus nodes) from the node sorting result 601b, thus obtaining consensus node 601a, which includes consensus node 1 and consensus node 2; obtains the consensus nodes corresponding to the first two positions from the node sorting result 602b, thus obtaining consensus node 602a, which includes consensus node 2 and consensus node 1; obtains the consensus nodes corresponding to the first two positions from the node sorting result 603b, thus obtaining consensus node 603a, which includes consensus node 3 and consensus node 2; obtains the consensus nodes corresponding to the first two positions from the node sorting result 604b, thus obtaining consensus node 604a, which includes consensus node 4 and consensus node 1.

[0149] Among the four consensus nodes to be identified, the target consensus node counts the number of identical consensus nodes. Specifically, it counts the number of node ranking results where the same consensus node appears in two consecutive positions. Figure 6 As shown in the example, it can be confirmed that consensus nodes 601a and 602a are the same consensus nodes, while consensus nodes 603a and 604a are different from other consensus nodes. Thus, three target quantities are obtained: 2 (consensus nodes 601a and 602a are the same), 1 (which can represent the quantity corresponding to consensus node 603a), and 1 (which can represent the quantity corresponding to consensus node 604a).

[0150] Please see again. Figure 6 The target consensus node obtains the maximum target quantity, which is 2. This maximum target quantity is compared with a quantity threshold. If the quantity threshold is greater than 2, the comparison result shows the maximum target quantity is less than the quantity threshold, and the target consensus node determines this node sorting is invalid. If the quantity threshold is equal to 2, the comparison result shows the maximum target quantity is equal to the quantity threshold, and the node state of the consensus node to be identified, 601a, is determined to be a normal node state. That is, the node states corresponding to consensus node 1 and consensus node 2 are both in a normal node state. It is understood that the quantity threshold should be set according to the actual application scenario; this embodiment is set to 2 only for illustrative purposes.

[0151] The target consensus node determines the node sorting results corresponding to consensus nodes 601a and 602a to be identified as the target node sorting results, such as... Figure 6 The node sorting results 601b and 602b are shown in the table. The target consensus node identifies the remaining consensus nodes from the N consensus nodes, excluding the consensus node corresponding to the largest target number. For example... Figure 6 Consensus nodes 3 and 4 are the remaining consensus nodes. The target consensus node obtains the state scores of consensus nodes 3 and 4 in the node sorting result 601b, for example... Figure 6 The state score 601c indicates that the state score of consensus node 4 is -2 and the state score of consensus node 3 is -5. Similarly, the target consensus node obtains the state scores of consensus node 3 and consensus node 4 in the node ranking result 602b, for example... Figure 6 The state score 602c indicates that the state score of consensus node 4 is -1 and the state score of consensus node 3 is -5.

[0152] Furthermore, the target consensus node compares the two state scores (i.e., -5) corresponding to consensus node 3 with the state score threshold. Clearly, both state scores are less than the state score threshold. Figure 6 If the example value is -2, then the node state of consensus node 3 can be determined to be an abnormal node state. Similarly, the target consensus node compares the two state scores (i.e., -2 and -1) corresponding to consensus node 4 with the state score thresholds respectively. Where the state score (i.e., -2) in node sorting result 601b is equal to the state score threshold, and the state score (i.e., -1) in node sorting result 602b is greater than the state score threshold, then the node state of consensus node 4 can be determined to be an abnormal node state. It is understood that the state score thresholds can be set according to the actual application scenario, and this embodiment does not limit this.

[0153] Optionally, when the maximum target number is equal to or greater than the number threshold, for the target node ranking result, the target consensus node can determine the node state of the consensus node located at the target position as the normal node state. The target position can be set according to the actual application scenario, and its corresponding state score is greater than the state scores corresponding to the remaining positions. The remaining positions refer to the positions in the target node ranking result other than the target position. Figure 6 For example, if the maximum target number (i.e., 2) is equal to the number threshold, then the node state corresponding to the consensus node at the target position can be determined as the normal node state. For example, if the target position is the first 3 positions, then the node states corresponding to consensus node 1, consensus node 2 and consensus node 3 in the target consensus node determination node sorting result 601b are respectively the normal node state. The remaining position is the 4th position. At this time, the node state of the consensus node at the remaining position needs to be determined according to the above method.

[0154] If the four consensus nodes are sorted in ascending order, the interpretation is the opposite of the above description, so it will not be elaborated further.

[0155] In this embodiment, the target consensus node can determine the state score of the consensus node broadcasting the first state message in the state message pair by the state difference between the first state message and the second state message. Further, based on the state score, the consensus nodes in the state message pair set including the state message pair can be sorted, thus obtaining the node sorting result corresponding to the state message pair set. Further, by using the node sorting results corresponding to the N state message pair sets respectively, the node states corresponding to the N consensus nodes can be determined. Further, consensus nodes with abnormal node states are deleted from the consensus network. As can be seen above, this embodiment determines the node states of N consensus nodes based on the N node sorting results, thus improving the accuracy of node state identification. Furthermore, by deleting consensus nodes with abnormal node states, abnormal consensus nodes (i.e., consensus nodes with abnormal node states) can be avoided as block-producing nodes; that is, normal consensus nodes (i.e., consensus nodes with normal node states) are used as block-producing nodes, thus improving the throughput of the blockchain network.

[0156] Further, please see Figure 7 , Figure 7 This is a flowchart illustrating a blockchain-based data processing method provided in an embodiment of this application. The target consensus node can be any consensus node in the consensus network, such as... Figure 7 As shown, the method may include at least the following steps.

[0157] Step S201: Obtain the target node identifier, the block height to be verified, and the hash of the block to be verified; the target node identifier refers to the node identifier corresponding to the target consensus node; the block height to be verified refers to the block height corresponding to the target consensus node when the system time reaches the state verification cycle; the block height corresponding to the hash of the block to be verified is equal to the block height to be verified, and the block corresponding to the hash of the block to be verified belongs to the block in the target ledger; the target ledger refers to the ledger corresponding to the target consensus node.

[0158] Step S202: Sign the target node identifier, the height of the block to be verified, and the hash of the block to be verified based on the target node's private key to obtain a first state message carrying a third message signature; the target node's private key refers to the node's private key corresponding to the target consensus node.

[0159] Step S203: Broadcast the first state message carrying the third message signature to the consensus network.

[0160] Specifically, in conjunction with steps S201-S203, when the system time reaches the state verification period, each consensus node in the consensus network generates a first state message based on its own state. The state of the node itself may include the target node identifier, the height of the block to be verified, and the hash of the block to be verified. In addition, the node signs the state data to be broadcast based on the target node's private key to obtain a first state message carrying a third primary message signature, and then broadcasts the first state message carrying the third message signature to the consensus network.

[0161] Step S204: The target consensus node obtains the state message pair sets corresponding to N consensus nodes; N is a positive integer greater than 1; the N state message pair sets include consensus node Z. y The corresponding status message pair set X y ; y is a positive integer and y is less than or equal to N; the set of status messages is X. y Including status messages for A b Status message for A b Including consensus node Z b The first state message C broadcast to the consensus network b and consensus node Z y Regarding the first state message C b The generated second state message C y b is a positive integer and b is less than or equal to N; N consensus nodes include the target consensus node and consensus node Z. b and consensus node Z y .

[0162] Step S205: Determine consensus node Z b In status message pair A b The state score in the context; state message pair Ab The corresponding state score is used to represent the first state message C. b and the second state message C y The differences in state between them.

[0163] Step S206, adjust set X according to the status message. y For each state message pair, a corresponding state score is assigned. These scores are then sorted across the N consensus nodes to obtain a set X of state message pairs. y The corresponding node sorting results.

[0164] Step S207: Based on the sorting results of the nodes corresponding to the N status messages, determine the node status corresponding to the N consensus nodes, and delete the consensus nodes whose node status is abnormal in the consensus network.

[0165] For details on the implementation of steps S204-S207, please refer to the above text. Figure 3 Steps S101-S103 in the corresponding embodiments will not be described in detail here.

[0166] In this embodiment, the target consensus node can determine the state score of the consensus node broadcasting the first state message in the state message pair by the state difference between the first state message and the second state message. Further, based on the state score, the consensus nodes in the state message pair set including the state message pair can be sorted, thus obtaining the node sorting result corresponding to the state message pair set. Further, by using the node sorting results corresponding to the N state message pair sets respectively, the node states corresponding to the N consensus nodes can be determined. Further, consensus nodes with abnormal node states are deleted from the consensus network. As can be seen above, this embodiment determines the node states of N consensus nodes based on the N node sorting results, thus improving the accuracy of node state identification. Furthermore, by deleting consensus nodes with abnormal node states, abnormal consensus nodes (i.e., consensus nodes with abnormal node states) can be avoided as block-producing nodes; that is, normal consensus nodes (i.e., consensus nodes with normal node states) are used as block-producing nodes, thus improving the throughput of the blockchain network.

[0167] Further, please see Figure 8 , Figure 8 This is a schematic diagram of the structure of a blockchain-based data processing device provided in an embodiment of this application. The aforementioned blockchain-based data processing device can be a computer program (including program code) running on a computer device; for example, the blockchain-based data processing device is an application software. This device can be used to execute the corresponding steps in the method provided in the embodiments of this application. Figure 8As shown, the blockchain-based data processing device 1 may include: a first acquisition module 11, a first determination module 12, a sorting node module 13, and a second determination module 14.

[0168] The first acquisition module 11 is used to acquire the set of state message pairs corresponding to N consensus nodes respectively; N is a positive integer greater than 1; the set of N state message pairs includes consensus node Z. y The corresponding status message pair set X y ; y is a positive integer and y is less than or equal to N; the status message pair set X y Including status messages for A b The status message for A b Including consensus node Z b The first state message C broadcast to the consensus network b and the consensus node Z y Regarding the first status message C b The generated second state message C y b is a positive integer and b is less than or equal to N; the N consensus nodes include the target consensus node and the consensus node Z. b and the consensus node Z y ;

[0169] The first determining module 12 is used to determine the consensus node Z. b In the status message pair A b The state score in the context; the state message pair A b The corresponding state score is used to characterize the first state message C. b and the second status message C y The differences in state between them;

[0170] The sorting node module 13 is used to sort the set X according to the status message. y For each state message pair, a corresponding state score is assigned. The N consensus nodes are then sorted to obtain the set X of state message pairs. y The corresponding node sorting results;

[0171] The second determining module 14 is used to determine the node status corresponding to each of the N consensus nodes based on the node sorting results corresponding to the N status messages, and to delete the consensus nodes whose node status is abnormal in the consensus network.

[0172] The specific functional implementations of the first acquisition module 11, the first determination module 12, the sorting node module 13, and the second determination module 14 can be found above. Figure 3 Steps S101-S104 in the corresponding embodiment will not be described again here.

[0173] Please see again Figure 8 The first acquisition module 11 may include: a first acquisition unit 111, a second acquisition unit 112, a first generation unit 113, a second generation unit 114, and a first determination unit 115.

[0174] The first acquisition unit 111 is used for the target consensus node to acquire consensus node Z. e The first status message C broadcast when the system time reaches the status verification period. e Consensus node Z e It belongs to N-1 consensus nodes; N-1 consensus nodes include all consensus nodes except the target consensus node; first state message C e Including consensus node Z e Corresponding node signature I e e is a positive integer and e is less than or equal to N-1;

[0175] The second acquisition unit 112 is used to acquire consensus node Z. e The corresponding node public key, based on consensus node Z e The corresponding node public key is used to sign the node I. e The visa was verified, and the first verification result was obtained.

[0176] The first generation unit 113 is used to generate a signature for consensus node Z based on the first signature verification result. e Status message pairs;

[0177] The second generation unit 114 is used to generate a target state message pair set based on the state message pairs corresponding to N-1 consensus nodes.

[0178] The first determining unit 115 is used to obtain the set of state message pairs broadcast by N-1 consensus nodes respectively, and determine the N-1 set of state message pairs and the target set of state message pairs as the N set of state message pairs.

[0179] The specific functional implementation methods of the first acquisition unit 111, the second acquisition unit 112, the first generation unit 113, the second generation unit 114, and the first determination unit 115 can be found above. Figure 3 Step S101 in the corresponding embodiment will not be described again here.

[0180] Please see again Figure 8 First state message C e It also includes consensus node Z e Node identifier, consensus node Z e Corresponding block height G e and block height G eThe corresponding block hash;

[0181] The first generation unit 113 may include: a first acquisition subunit 1131, a first generation subunit 1132, a second generation subunit 1133, and a third generation subunit 1134.

[0182] The first acquisition subunit 1131 is used to acquire the target block height when the first signature verification result is a successful signature verification result; the target block height refers to the block height corresponding to the target consensus node;

[0183] The first generation subunit 1132 is used to generate based on the target block height and the block height G. e Generate the first state message C e The corresponding second state message F e ;

[0184] The second generation subunit 1133 is used to generate the first state message C e and the second state message F e Combined into a consensus node Z e The pending signature status message pair;

[0185] The third generation subunit 1134 is used to sign the pending signature state message pair based on the target node's private key to obtain the consensus node Z. e The corresponding status message pair carrying the first message signature; the target node private key refers to the node private key corresponding to the target consensus node.

[0186] The specific functional implementations of the first acquisition subunit 1131, the first generation subunit 1132, the second generation subunit 1133, and the third generation subunit 1134 can be found above. Figure 3 Step S101 in the corresponding embodiment will not be described again here.

[0187] Please see again Figure 8 The first generation subunit 1132 is specifically used to obtain the target node identifier; the target node identifier refers to the node identifier corresponding to the target consensus node.

[0188] The first generating subunit 1132 is also specifically used to generate the target block height and the block height G. e Compare;

[0189] The first generating subunit 1132 is also specifically used if the target block height is equal to or greater than the block height G. e Then, the block hash corresponding to the first block is determined as the target block hash. Based on the target node identifier, the target block height, and the target block hash, a first state message C is generated. e The corresponding second state message F eThe block height corresponding to the first block is equal to the block height G. e The first block belongs to the ledger corresponding to the target consensus node.

[0190] The first generating subunit 1132 is also specifically used if the target block height is less than the block height G. e Then, the block hash corresponding to the second block is determined as the target block hash. Based on the target node identifier, the target block height, and the target block hash, a first state message C is generated. e The corresponding second state message F e The height of the second block is equal to the height of the target block; the second block belongs to the ledger corresponding to the target consensus node.

[0191] The specific functional implementation of the first generating subunit 1132 can be found in the above description. Figure 3 Step S101 in the corresponding embodiment will not be described again here.

[0192] Please see again Figure 8 Status message for A b It also includes the first state message C b and the second state message C y The second message signature; the first status message C b Including consensus node Z b The first block height, and for consensus node Z b The first block hash associated with the first block height; second state message C y Including consensus node Z y The second block height, and for consensus node Z y The hash of the second block that is highly correlated with the first block height;

[0193] The first determining module 12 may include: a third obtaining unit 121, a third generating unit 122, a first comparing unit 123, a second determining unit 124, and a third determining unit 125.

[0194] The third acquisition unit 121 is used to invoke the governance consensus committee contract and obtain the consensus node Z through the governance consensus committee contract. y The node's public key;

[0195] The third generation unit 122 is used for generation based on consensus node Z. y The node's public key is used to verify the signature of the second message, and the second verification result is obtained.

[0196] The first comparison unit 123 is used to compare the height of the first block and the height of the second block when the second verification result is a successful verification result;

[0197] The second determining unit 124 is used to determine the first target value as consensus node Z if the height of the first block is greater than the height of the second block. b In status message pair A b The state score in the data; the first target value is used to characterize that the height of the first block is greater than the height of the second block;

[0198] The third determining unit 125 is used to determine the consensus node Z based on the first block height, the second block height, the first block hash, and the second block hash if the height of the first block is equal to or less than the height of the second block. b In status message pair A b The state score in the data.

[0199] The specific functional implementation methods of the third acquisition unit 121, the third generation unit 122, the first comparison unit 123, the second determination unit 124, and the third determination unit 125 can be found above. Figure 3 Step S102 in the corresponding embodiment will not be described again here.

[0200] Please see again Figure 8 The third determining unit 125 may include: a comparison hash subunit 1251, a first determining subunit 1252, and a second determining subunit 1253.

[0201] Comparison hash subunit 1251 is used to compare the hash of the first block and the hash of the second block;

[0202] The first determining subunit 1252 is used to determine the second target value as consensus node Z if the first block hash and the second block hash are different. b In status message pair A b The state score in the data; the second target value is less than the first target value, and the second target value is used to indicate that the hash of the first block belongs to abnormal data;

[0203] The second determining subunit 1253 is used to determine the block height difference between the first block height and the second block height as the consensus node Z if the first block hash and the second block hash are the same. b In status message pair A b The state score in the data; the block height difference is greater than the first target value.

[0204] The specific functional implementation methods of the comparison hash subunit 1251, the first determination subunit 1252, and the second determination subunit 1253 can be found above. Figure 3 Step S102 in the corresponding embodiment will not be described again here.

[0205] Please see again Figure 8The third generation unit 122 may include: a fourth generation subunit 1221, a second acquisition subunit 1222, a third determination subunit 1223, and a fourth determination subunit 1224.

[0206] The fourth generation subunit 1221 is used for consensus node Z. y The node's public key is used to decrypt the second message signature to obtain the first digital digest;

[0207] The second acquisition subunit 1222 is used to acquire the first status message C. b and the second state message C y The second digital digest compares the first and second digital digests.

[0208] The third determining subunit 1223 is used to determine the second signature verification result as a successful signature verification result if the first digital digest and the second digital digest are the same.

[0209] The fourth determining subunit 1224 is used to determine the second signature verification result as a signature verification failure result if the first digital digest and the second digital digest are different.

[0210] The specific functional implementation methods of the fourth generation subunit 1221, the second acquisition subunit 1222, the third determination subunit 1223, and the fourth determination subunit 1224 can be found above. Figure 3 Step S102 in the corresponding embodiment will not be described again here.

[0211] Please see again Figure 8 The set of N status messages contains the node sorting results corresponding to each node, including the node sorting result H. j j is a positive integer and j is less than or equal to N;

[0212] The second determining module 14 may include: a fourth acquisition unit 141, a statistical quantity unit 142, a second comparison unit 143, and a fourth determining unit 144.

[0213] The fourth acquisition unit 141 is used to sort the node result H. j In the process, S consecutive consensus nodes are obtained in sequence, which are used as consensus nodes to be identified; S is a positive integer greater than 1 and S is less than N;

[0214] The statistical unit 142 is used to count the number of node ranking results with the same consensus node to be identified in S consecutive positions among N node ranking results, and use it as the target number.

[0215] The second comparison unit 143 is used to obtain the maximum target quantity, compare the maximum target quantity with the quantity threshold, and obtain the comparison result.

[0216] The fourth determining unit 144 is used to determine the node status corresponding to each of the N consensus nodes based on the comparison results.

[0217] The specific functional implementation methods of the fourth acquisition unit 141, the statistical quantity unit 142, the second comparison unit 143, and the fourth determination unit 144 can be found above. Figure 3 Step S104 in the corresponding embodiment will not be described again here.

[0218] Please see again Figure 8 The fourth determining unit 144 may include: a fifth determining subunit 1441, a sixth determining subunit 1442, and a seventh determining subunit 1443.

[0219] The fifth determining subunit 1441 is used to determine the node state of the consensus node to be identified corresponding to the largest target number as the normal state if the comparison result is that the largest target number is equal to or greater than the number threshold.

[0220] The sixth determining subunit 1442 is used to determine the consensus nodes other than the consensus node to be identified corresponding to the largest target number among the N consensus nodes as the remaining consensus nodes;

[0221] The seventh determining subunit 1443 is used to determine the node status of the remaining consensus nodes based on the status scores of the remaining consensus nodes in the target node sorting result; the target node sorting result is the node sorting result corresponding to the maximum target number.

[0222] The specific functional implementation methods of the fifth determining subunit 1441, the sixth determining subunit 1442, and the seventh determining subunit 1443 can be found above. Figure 3 Step S104 in the corresponding embodiment will not be described again here.

[0223] Please see again Figure 8 The seventh subunit 1443 is specifically used to compare the state score of the remaining consensus nodes in the target node sorting result with the state score threshold.

[0224] The seventh determining sub-unit is also specifically used to determine the node state of the remaining consensus node as an abnormal node state if the state score of the remaining consensus node in the target node sorting result is less than or equal to the state score threshold.

[0225] The seventh determining subunit 1443 is also specifically used to determine the node state of the remaining consensus node as the normal node state if the state score of the remaining consensus node in the target node sorting result is greater than the state score threshold.

[0226] The specific functional implementation of the seventh determining subunit 1443 can be found in the above description. Figure 3 Step S104 in the corresponding embodiment will not be described again here.

[0227] Please see again Figure 8 The blockchain-based data processing device 1 may further include: a second acquisition module 15, a signature message module 16, and a broadcast message module 17.

[0228] The second acquisition module 15 is used to acquire the target node identifier, the height of the block to be verified, and the hash of the block to be verified. The target node identifier refers to the node identifier corresponding to the target consensus node. The height of the block to be verified refers to the block height corresponding to the target consensus node when the system time reaches the state verification cycle. The block height corresponding to the hash of the block to be verified is equal to the height of the block to be verified, and the block corresponding to the hash of the block to be verified belongs to the block in the target ledger. The target ledger refers to the ledger corresponding to the target consensus node.

[0229] The signature message module 16 is used to sign the target node identifier, the height of the block to be verified, and the hash of the block to be verified based on the target node's private key, to obtain a first state message carrying a third message signature; the target node's private key refers to the node private key corresponding to the target consensus node.

[0230] Broadcast message module 17 is used to broadcast a first state message carrying a third message signature to the consensus network.

[0231] The specific functional implementations of the second acquisition module 15, the signature message module 16, and the broadcast message module 17 can be found above. Figure 7 Steps S201-S203 in the corresponding embodiment will not be described again here.

[0232] In this embodiment, the target consensus node can determine the state score of the consensus node broadcasting the first state message in the state message pair by the state difference between the first state message and the second state message. Further, based on the state score, the consensus nodes in the state message pair set including the state message pair can be sorted, thus obtaining the node sorting result corresponding to the state message pair set. Further, by using the node sorting results corresponding to the N state message pair sets respectively, the node states corresponding to the N consensus nodes can be determined. Further, consensus nodes with abnormal node states are deleted from the consensus network. As can be seen above, this embodiment determines the node states of N consensus nodes based on the N node sorting results, thus improving the accuracy of node state identification. Furthermore, by deleting consensus nodes with abnormal node states, abnormal consensus nodes (i.e., consensus nodes with abnormal node states) can be avoided as block-producing nodes; that is, normal consensus nodes (i.e., consensus nodes with normal node states) are used as block-producing nodes, thus improving the throughput of the blockchain network.

[0233] Further, please see Figure 9 , Figure 9 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Figure 9 As shown, the computer device 1000 may include: at least one processor 1001, such as a CPU; at least one network interface 1004; a user interface 1003; a memory 1005; and at least one communication bus 1002. The communication bus 1002 is used to enable communication between these components. The user interface 1003 may include a display screen and a keyboard. The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface). The memory 1005 may be high-speed RAM or non-volatile memory, such as at least one disk drive. Optionally, the memory 1005 may also be at least one storage device located remotely from the aforementioned processor 1001. Figure 9 As shown, the memory 1005, which serves as a computer storage medium, may include an operating system, a network communication module, a user interface module, and a device control application program.

[0234] exist Figure 9 In the computer device 1000 shown, the network interface 1004 provides network communication functionality; the user interface 1003 is mainly used to provide an input interface for the user; and the processor 1001 can be used to call the device control application stored in the memory 1005 to achieve:

[0235] The target consensus node obtains a set of state message pairs corresponding to N consensus nodes; N is a positive integer greater than 1; the set of N state message pairs includes consensus node Z. y The corresponding status message pair set X y ; y is a positive integer and y is less than or equal to N; the set of status messages is X. y Including status messages for A b Status message for A b Including consensus node Z b The first state message C broadcast to the consensus network b and consensus node Z y Regarding the first state message C b The generated second state message C y b is a positive integer and b is less than or equal to N; N consensus nodes include the target consensus node and consensus node Z. b and consensus node Z y ;

[0236] Determine consensus node Z b In status message pair A b The state score in the context; state message pair A b The corresponding state score is used to represent the first state message C. b and the second state message C y The differences in state between them;

[0237] Based on the status message, set X y For each state message pair, a corresponding state score is assigned. These scores are then sorted across the N consensus nodes to obtain a set X of state message pairs. y The corresponding node sorting results;

[0238] Based on the sorting results of the nodes corresponding to the N state messages, the node states corresponding to the N consensus nodes are determined, and consensus nodes with abnormal node states are deleted from the consensus network.

[0239] It should be understood that the computer device 1000 described in the embodiments of this application can execute the foregoing text. Figure 3 as well as Figure 7 The description of the blockchain-based data processing method in the corresponding embodiments can also be performed as described above. Figure 8 The description of the blockchain-based data processing device 1 in the corresponding embodiments will not be repeated here. Furthermore, the beneficial effects of using the same method will also not be repeated.

[0240] This application also provides a computer-readable storage medium storing a computer program, the computer program including program instructions, which are implemented when executed by a processor. Figure 3as well as Figure 7 The blockchain-based data processing methods provided in each step are detailed above. Figure 3 as well as Figure 7 The implementation methods provided for each step will not be elaborated here. Furthermore, the beneficial effects of using the same method will also not be described in detail.

[0241] The aforementioned computer-readable storage medium can be the internal storage unit of the blockchain-based data processing apparatus provided in any of the foregoing embodiments or the computer device, such as the hard drive or memory of the computer device. The computer-readable storage medium can also be an external storage device of the computer device, such as a plug-in hard drive, smart media card (SMC), secure digital (SD) card, flash card, etc., provided on the computer device. Furthermore, the computer-readable storage medium can include both internal and external storage units of the computer device. The computer-readable storage medium is used to store the computer program and other programs and data required by the computer device. The computer-readable storage medium can also be used to temporarily store data that has been output or will be output.

[0242] This application also provides a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the aforementioned... Figure 3 as well as Figure 7 The description of the blockchain-based data processing method in the corresponding embodiments will not be repeated here. Furthermore, the beneficial effects of using the same method will also not be repeated.

[0243] The terms "first," "second," etc., in the specification, claims, and drawings of this application are used to distinguish different objects, not to describe a specific order. Furthermore, the term "comprising," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, apparatus, product, or device that includes a series of steps or units is not limited to the listed steps or modules, but may optionally include steps or modules not listed, or may optionally include other step units inherent to these processes, methods, apparatuses, products, or devices.

[0244] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this application.

[0245] The methods and related apparatuses provided in this application are described with reference to the method flowcharts and / or structural diagrams provided in this application. Specifically, each block of the method flowchart and / or structural diagram, as well as combinations of blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing device to create a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing device, generate instructions for implementing the process. Figure 1 A schematic diagram of one or more processes and / or structures. Figure 1 The computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 A schematic diagram of one or more processes and / or structures. Figure 1 The functions specified in one or more boxes. These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable apparatus for implementing the process. Figure 1 A process or multiple processes and / or structures illustrate the steps of the functions specified in one or more boxes.

[0246] The above-disclosed embodiments are merely preferred embodiments of this application and should not be construed as limiting the scope of this application. Therefore, any equivalent variations made in accordance with the claims of this application shall still fall within the scope of this application.

Claims

1. A data processing method based on blockchain, characterized in that, include: The target consensus node obtains a set of state message pairs corresponding to N consensus nodes; N is a positive integer greater than 1; The set of N state message pairs includes consensus node Z. y The corresponding status message pair set X y ; y is a positive integer and y is less than or equal to N; the status message pair set X y Including status messages for A b The status message for A b Including consensus node Z b The first state message C broadcast to the consensus network b and the consensus node Z y Regarding the first status message C b The generated second state message C y b is a positive integer and b is less than or equal to N; the N consensus nodes include the target consensus node and the consensus node Z. b and the consensus node Z y ; Determine the consensus node Z b In the status message pair A b The state score in the context; the state message pair A b The corresponding state score is used to characterize the first state message C. b and the second status message C y The differences in state between them; According to the status message, set X y For each state message pair, a corresponding state score is assigned. The N consensus nodes are then sorted to obtain the set X of state message pairs. y The corresponding node sorting results; Based on the node sorting results corresponding to the N status messages, the node status corresponding to the N consensus nodes is determined, and consensus nodes whose node status is abnormal are deleted from the consensus network.

2. The method according to claim 1, characterized in that, The target consensus node obtains a set of state message pairs corresponding to N consensus nodes, including: The target consensus node obtains consensus node Z. e The first status message C broadcast when the system time reaches the status verification period. e The consensus node Z e Belongs to N-1 consensus nodes; the N-1 consensus nodes include all consensus nodes other than the target consensus node; the first state message C e Including the consensus node Z e Corresponding node signature I e e is a positive integer and e is less than or equal to N-1; Obtain the consensus node Z e The corresponding node public key, based on the consensus node Z e The corresponding node public key is used to sign the node I. e The visa was verified, and the first verification result was obtained. Based on the first signature verification result, a consensus node Z is generated. e Status message pairs; Based on the state message pairs corresponding to the N-1 consensus nodes, generate a target state message pair set; Obtain the set of state message pairs broadcast by the N-1 consensus nodes respectively, and determine the N-1 state message pair set and the target state message pair set as the N state message pair set.

3. The method according to claim 2, characterized in that, The first status message C e It also includes the consensus node Z. e The node identifier, the consensus node Z e Corresponding block height G e and the block height G e The corresponding block hash; Based on the first signature verification result, a consensus node Z is generated. e Status message pairs include: When the first signature verification result is a successful signature verification result, the target block height is obtained; the target block height refers to the block height corresponding to the target consensus node; Based on the target block height and the block height G e Generate the first status message C e The corresponding second state message F e ; The first status message C e and the second status message F e Combined for the consensus node Z e The pending signature status message pair; The unsigned state message pair is signed based on the target node's private key to obtain the consensus node Z. e The corresponding status message pair carrying the first message signature; the target node private key refers to the node private key corresponding to the target consensus node.

4. The method according to claim 3, characterized in that, The target block height and the block height G are used as the basis for this. e Generate the first status message C e The corresponding second state message F e ,include: Obtain the target node identifier; the target node identifier refers to the node identifier corresponding to the target consensus node. The target block height and the block height G e Compare; If the target block height is equal to or greater than the block height G e Then, the block hash corresponding to the first block is determined as the target block hash, and the first status message C is generated based on the target node identifier, the target block height, and the target block hash. e The corresponding second status message F e The block height corresponding to the first block is equal to the block height G. e The first block belongs to the block in the ledger corresponding to the target consensus node; If the target block height is less than the block height G e Then, the block hash corresponding to the second block is determined as the target block hash, and the first status message C is generated based on the target node identifier, the target block height, and the target block hash. e The corresponding second status message F e The block height corresponding to the second block is equal to the target block height; the second block belongs to the block in the ledger corresponding to the target consensus node.

5. The method according to claim 1, characterized in that, The status message is for A b It also includes the first status message C b and the second status message C y The second message signature; the first status message C b Including for the consensus node Z b The first block height, and for the consensus node Z b The first block hash associated with the first block height; the second status message C y Including for the consensus node Z y The second block height, and for the consensus node Z y The hash of the second block associated with the height of the first block; The consensus node Z is determined. b In the status message pair A b The state scores in the data include: Invoke the governance consensus committee contract to obtain the consensus node Z. y The node's public key; Based on the consensus node Z y The node's public key is used to verify the signature of the second message, and the second verification result is obtained. When the second verification result is a successful verification result, the height of the first block and the height of the second block are compared; If the height of the first block is greater than the height of the second block, then the first target value is determined as the consensus node Z. b In the status message pair A b The state score in the data; the first target value is used to characterize that the height of the first block is greater than the height of the second block; If the height of the first block is equal to or less than the height of the second block, then the consensus node Z is determined based on the height of the first block, the height of the second block, the hash of the first block, and the hash of the second block. b In the status message pair A b The state score in the data.

6. The method according to claim 5, characterized in that, The consensus node Z is determined based on the first block height, the second block height, the first block hash, and the second block hash. b In the status message pair A b The state scores in the data include: Compare the hash of the first block and the hash of the second block; If the first block hash and the second block hash are different, then the second target value is determined to be the consensus node Z. b In the status message pair A b The state score in the data; the second target value is less than the first target value, and the second target value is used to indicate that the first block hash belongs to abnormal data; If the first block hash and the second block hash are the same, then the difference in block height between the first block height and the second block height is determined as the consensus node Z. b In the status message pair A b The state score in the data; the block height difference is greater than the first target value.

7. The method according to claim 5, characterized in that, The consensus node Z y The node's public key verifies the signature of the second message to obtain a second verification result, including: Based on the consensus node Z y The node's public key is used to decrypt the second message signature to obtain the first digital digest; Obtain the first status message C b and the second status message C y The second digital digest is compared with the first digital digest and the second digital digest; If the first digital digest and the second digital digest are the same, then the second verification result is determined to be the successful verification result; If the first digital digest and the second digital digest are different, then the second verification result is determined to be a verification failure result.

8. The method according to claim 1, characterized in that, The node sorting results corresponding to the N status message pairs respectively include node sorting results H. j j is a positive integer and j is less than or equal to N; The step of determining the node status of each of the N consensus nodes based on the node sorting results corresponding to the N status messages includes: The sorting result H from the nodes j In the process, S consecutive consensus nodes are obtained in sequence, which are used as consensus nodes to be identified; S is a positive integer greater than 1 and S is less than N; Among the N node ranking results, the number of node ranking results with the same consensus node to be identified in the S consecutive positions is counted and used as the target number. Obtain the maximum target quantity, compare the maximum target quantity with the quantity threshold, and obtain the comparison result; The node status corresponding to each of the N consensus nodes is determined based on the comparison results.

9. The method according to claim 8, characterized in that, The step of determining the node status corresponding to the N consensus nodes based on the comparison results includes: If the comparison result is that the maximum target number is equal to or greater than the number threshold, then the node status of the consensus node to be identified corresponding to the maximum target number is determined as the node normal status. The consensus nodes among the N consensus nodes, excluding the consensus node to be identified corresponding to the largest target number, are determined as the remaining consensus nodes; The node status of the remaining consensus nodes is determined based on their status scores in the target node ranking result; the target node ranking result is the node ranking result corresponding to the maximum target number.

10. The method according to claim 9, characterized in that, The step of determining the node state of the remaining consensus nodes based on their state scores in the target node ranking results includes: The state scores of the remaining consensus nodes in the target node ranking result are compared with the state score threshold. If the state score of the remaining consensus node in the ranking result of the target node is less than or equal to the state score threshold, then the node state of the remaining consensus node is determined to be an abnormal node state. If the state score of the remaining consensus node in the ranking result of the target node is greater than the state score threshold, then the node state of the remaining consensus node is determined to be a normal node state.

11. The method according to claim 1, characterized in that, The method further includes: Obtain the target node identifier, the height of the block to be verified, and the hash of the block to be verified; the target node identifier refers to the node identifier corresponding to the target consensus node; the height of the block to be verified refers to the block height corresponding to the target consensus node when the system time reaches the state verification cycle; the block height corresponding to the hash of the block to be verified is equal to the height of the block to be verified, and the block corresponding to the hash of the block to be verified belongs to the block in the target ledger; the target ledger refers to the ledger corresponding to the target consensus node; The target node identifier, the height of the block to be verified, and the hash of the block to be verified are signed based on the target node's private key to obtain a first state message carrying a third message signature; the target node's private key refers to the node's private key corresponding to the target consensus node. The first state message carrying the third message signature is broadcast to the consensus network.

12. A data processing device based on blockchain, characterized in that, The blockchain-based data processing device operates on the target consensus node and includes: The first acquisition module is used to acquire the set of state message pairs corresponding to N consensus nodes; N is a positive integer greater than 1; the set of N state message pairs includes consensus node Z. y The corresponding status message pair set X y ; y is a positive integer and y is less than or equal to N; the status message pair set X y Including status messages for A b The status message for A b Including consensus node Z b The first state message C broadcast to the consensus network b and the consensus node Z y Regarding the first status message C b The generated second state message C y b is a positive integer and b is less than or equal to N; the N consensus nodes include the target consensus node and the consensus node Z. b and the consensus node Z y ; The first determining module is used to determine the consensus node Z. b In the status message pair A b The state score in the context; the state message pair A b The corresponding state score is used to characterize the first state message C. b and the second status message C y The differences in state between them; The sorting node module is used to sort set X according to the status message. y For each state message pair, a corresponding state score is assigned. The N consensus nodes are then sorted to obtain the set X of state message pairs. y The corresponding node sorting results; The second determining module is used to determine the node status corresponding to each of the N consensus nodes based on the node sorting results corresponding to the N status messages, and to delete the consensus nodes whose node status is abnormal in the consensus network.

13. A computer device, characterized in that, include: The processor, memory, and network interface are connected to the memory and the network interface, wherein the network interface is used to provide data communication functions, the memory is used to store computer programs, and the processor is used to invoke the computer programs to cause the computer device to perform the method according to any one of claims 1 to 11.

14. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program adapted to be loaded and executed by a processor to cause a computer device having the processor to perform the method of any one of claims 1-11.

15. A computer program product, characterized in that, The computer program product includes computer instructions stored in a computer-readable storage medium, the computer instructions being adapted to be read and executed by a processor to cause a computer device having the processor to perform the method as claimed in any one of claims 1-11.