Situational awareness method and related device based on blockchain privacy transaction
The plaintext instructions of blockchain transactions are obtained through decryption by the group leader node, and the situation awareness nodes vote to determine abnormal transactions, which solves the problem of abnormal situation awareness at the blockchain data layer and improves the stability and reliability of the system.
Patent Information
- Application Number
- CN202210468569.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-29
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2042-04-29
AI Technical Summary
Existing technologies are unable to effectively perceive abnormal situations in the blockchain data layer, resulting in insufficient stability and reliability of the blockchain system.
The group master node decrypts the block to obtain plaintext instructions. The situational awareness client node matches the situational awareness node with abnormal transaction rules and votes to determine the abnormality of the transaction. Group signatures and smart contracts are used to ensure the privacy and accuracy of transaction information.
It achieves effective situational awareness of abnormal transactions in the blockchain data layer, improves the stability and reliability of the blockchain system, and ensures the privacy and accuracy of transaction information.
Smart Images

Figure CN114884968B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to a blockchain system, and in particular to a situational awareness method and related devices based on blockchain privacy transactions. Background Art
[0002] From top to bottom, the blockchain system generally includes the application layer, contract layer, incentive layer, consensus layer, network layer and data layer. Currently, in the blockchain system, abnormal transaction situation awareness based on user privacy is mainly aimed at abnormal situation awareness at the application layer, and it is impossible to obtain abnormal situation awareness at the blockchain data layer.
[0003] However, there is currently no corresponding solution for how to achieve abnormal situation awareness in the blockchain data layer. Summary of the Invention
[0004] The embodiments of the present application provide a situational awareness method and related devices based on blockchain privacy transactions, which are used to achieve situational awareness of abnormal transactions in the blockchain data layer, thereby ensuring the stability and reliability of blockchain operation.
[0005] In a first aspect, an embodiment of the present application provides a situational awareness method based on blockchain privacy transactions, which is applied to a blockchain system. The blockchain system includes multiple group nodes, and the multiple group nodes include at least a group master node, a pre-selected situational awareness client node, and a pre-selected situational awareness node. The method includes:
[0006] The group leader node decrypts the block to obtain the plaintext instructions corresponding to all transaction information in the block;
[0007] The situation awareness client node obtains the plaintext instructions corresponding to all transaction information in the block and a pre-set smart contract, wherein the smart contract is set with matching rules for abnormal transactions;
[0008] The situation awareness client node sends the plaintext instructions corresponding to all transaction information and the smart contract to all situation awareness nodes, so that all situation awareness nodes match the plaintext instructions corresponding to each transaction information with the matching rules of abnormal transactions in the smart contract, and vote on whether each transaction information is an abnormal transaction based on the matching results;
[0009] If, within a preset time period, the number of nodes with consistent voting results for each transaction information exceeds a preset number of the total number of all situational awareness nodes, the situational awareness client node determines whether each transaction information is an abnormal transaction based on the voting results for each transaction information.
[0010] Optionally, the voting result includes whether the transaction is a normal transaction or an abnormal transaction;
[0011] The situation awareness client node determines whether each transaction information is an abnormal transaction based on the voting result of each transaction information, including:
[0012] If the number of nodes of all situation awareness nodes that each transaction information belongs to a normal transaction exceeds a preset number of the total number of all situation awareness nodes, the situation awareness client node determines that each transaction belongs to a normal transaction;
[0013] and / or,
[0014] If the number of nodes among all situational awareness nodes that each transaction information belongs to a normal transaction does not exceed a preset number of the total number of all situational awareness nodes, or the number of nodes among all situational awareness nodes that each transaction information belongs to an abnormal transaction exceeds a preset number of the total number of all situational awareness nodes, then the situational awareness client node determines that each transaction is an abnormal transaction.
[0015] Optionally, the plurality of group nodes further include a pre-selected verification node, wherein the method of pre-selecting the situation awareness node, the situation awareness client node, and the verification node includes:
[0016] The group leader node sorts the nodes in the node candidate pool according to resource configuration;
[0017] The group leader node selects multiple verification nodes and multiple situation awareness nodes with matching resource configurations from the node candidate pool at one time according to the sorting result;
[0018] The group leader node selects a first preset number of situation awareness client nodes from the multiple situation awareness nodes.
[0019] Optionally, the group leader node selects multiple verification nodes and multiple situation awareness nodes with matching resource configurations from the node candidate pool at one time according to the sorting result, including:
[0020] The group leader node selects a plurality of verification nodes and a plurality of situation awareness nodes with matching resource configurations from the node candidate pool at one time according to the parity order of the nodes in the node candidate pool.
[0021] Optionally, the group leader node is an independent node different from the situation awareness node, the situation awareness client node and the verification node.
[0022] Optionally, after the situation awareness client node determines an abnormal transaction in a block, the method further includes:
[0023] The situation awareness client node sends abnormal transactions to the verification node, causing the verification node to call the corresponding defense contract.
[0024] Optionally, after the situation awareness client node determines whether each transaction information is an abnormal transaction based on a voting result of each transaction information, the method further includes:
[0025] The situation awareness client node updates the weight of each situation awareness node according to the voting result of each transaction information;
[0026] The situation awareness client node sorts all situation awareness nodes according to the updated weights;
[0027] After the preset number of rounds of voting are completed, the situation awareness client node eliminates a second preset number of situation awareness nodes according to the sorting results.
[0028] Optionally, after the situation awareness client node eliminates a second preset number of situation awareness nodes according to the sorting result, the method further includes:
[0029] The group leader node selects a second preset number of new situation awareness nodes with the highest ranking from the node candidate pool according to the ranking result of the candidate node resource configuration.
[0030] Optionally, the smart contract is pre-set by the group master node, and the group master node stores the pre-set smart contract locally on the group master node, or locally on the situation awareness client node.
[0031] Optionally, the block uses a group signature to verify the consensus, wherein the group signature is associated with at least a group parameter and a group private key, and the group parameter of each block is different;
[0032] The group leader node decrypts the block, including:
[0033] The group master node uses the group parameters and group private key in the group signature to restore the partial user private key corresponding to each transaction information in the block;
[0034] The group leader node uses the partial user private key corresponding to each transaction information to obtain the complete user private key corresponding to each transaction information from the local encrypted database;
[0035] The group leader node uses the complete user private key corresponding to each transaction information to decrypt each transaction information in the block.
[0036] Optionally, the group master node uses the group parameters and the group private key in the group signature to restore the partial user private key corresponding to each transaction information in the block, including:
[0037] The group master node deduces the partial user private key corresponding to each transaction information in the block based on an association function formula, the group parameter in the group signature, and the group private key parameter, wherein the association function formula records the functional relationship between the partial user private key, the group parameter, and the group private key parameter.
[0038] Optionally, the plurality of group nodes further include a plurality of user nodes, and the method further includes:
[0039] The group leader node receives the registration information sent by the user node and allocates a corresponding user private key to each user node according to the registration information, wherein the registration information is associated with the unique identity identification code of the user node;
[0040] The group leader node associates and stores the unique identity identification code of each user node and the corresponding user private key in a local encrypted database.
[0041] Optionally, before the group leader node decrypts the block, the method further includes:
[0042] The group master node presets system parameters and generates a group public key and a group private key according to the system parameters;
[0043] The group master node stores the group public key and the group private key in a local encrypted database.
[0044] Optionally, the matching rules for abnormal transactions include:
[0045] At least one of reentrancy attack, permission control, integer overflow, unchecked call return value, transaction order dependency, timestamp dependency, race condition, short address attack, and predictable random processing events.
[0046] A second aspect of an embodiment of the present application provides a blockchain system, the blockchain system comprising a plurality of group nodes, the plurality of group nodes comprising at least a group master node, a pre-selected situation awareness client node, and a pre-selected situation awareness node;
[0047] The group master node is used to decrypt the block to obtain the plaintext instructions corresponding to all transaction information in the block;
[0048] The situation awareness client node is used to obtain the plaintext instructions corresponding to all transaction information in the block and the pre-set smart contract, wherein the smart contract is set with matching rules for abnormal transactions;
[0049] The situation awareness client node is further configured to send the plaintext instructions corresponding to all transaction information and the smart contract to all situation awareness nodes, so that all situation awareness nodes match the plaintext instructions corresponding to each transaction information with the matching rules for abnormal transactions in the smart contract, and vote on whether each transaction information is an abnormal transaction based on the matching results;
[0050] The situation awareness client node is also used to determine whether each transaction information is an abnormal transaction based on the voting results of each transaction information if the number of nodes with consistent voting results for each transaction information exceeds a preset number of the total number of all situation awareness nodes within a preset time period.
[0051] Optionally, the voting result includes whether the transaction is a normal transaction or an abnormal transaction;
[0052] The situation awareness client node is specifically used to:
[0053] If the number of nodes in all situation awareness nodes that determine that each transaction information is a normal transaction exceeds a preset number of the total number of all situation awareness nodes, then each transaction is determined to be a normal transaction;
[0054] and / or,
[0055] If the number of nodes among all situational awareness nodes that determine that each transaction information is a normal transaction does not exceed a preset number of the total number of all situational awareness nodes, or the number of nodes among all situational awareness nodes that determine that each transaction information is an abnormal transaction exceeds a preset number of the total number of all situational awareness nodes, then each transaction is determined to be an abnormal transaction.
[0056] Optionally, the plurality of group nodes further include pre-selected verification nodes;
[0057] The group master node is also used to:
[0058] Sort the nodes in the node candidate pool according to resource allocation;
[0059] According to the sorting results, multiple verification nodes and multiple situation awareness nodes with matching resource configurations are selected from the node candidate pool at one time;
[0060] A first preset number of situation awareness client nodes are selected from the plurality of situation awareness nodes.
[0061] Optionally, the group leader node is specifically used to:
[0062] According to the parity order of the nodes in the node candidate pool, a plurality of verification nodes and a plurality of situation awareness nodes with matching resource configurations are selected from the node candidate pool at one time.
[0063] Optionally, the group leader node is an independent node different from the situation awareness node, the situation awareness client node and the verification node.
[0064] Optionally, the situational awareness client node is also used to:
[0065] After determining the abnormal transaction in the block, the abnormal transaction is sent to the verification node, so that the verification node calls the corresponding defense contract.
[0066] Optionally, the situational awareness client node is also used to:
[0067] After determining whether each transaction information is an abnormal transaction based on the voting result of each transaction information, the weight of each situation awareness node is updated based on the voting result of each transaction information;
[0068] Sort all situation awareness nodes according to the updated weights;
[0069] After the preset number of rounds of voting are completed, a second preset number of situation awareness nodes are eliminated based on the sorting results.
[0070] Optionally, the group leader node is further used to:
[0071] After the situation awareness client node eliminates a second preset number of situation awareness nodes according to the sorting result, the situation awareness client node selects a second preset number of new situation awareness nodes with higher sorting from the node candidate pool according to the sorting result of the candidate node resource configuration.
[0072] Optionally, the smart contract is pre-set by the group owner node, and the group owner node is used to:
[0073] The pre-set smart contract is stored locally on the group master node, or locally on the situation awareness client node.
[0074] Optionally, the block uses a group signature to verify the consensus, wherein the group signature is associated with at least a group parameter and a group private key, and the group parameter of each block is different;
[0075] The group master node is specifically used for:
[0076] Restore the partial user private key corresponding to each transaction information in the block using the group parameters and group private key in the group signature;
[0077] Using the partial user private key corresponding to each transaction information, obtain the complete user private key corresponding to each transaction information from the local encrypted database;
[0078] Each transaction information in the block is decrypted using the complete user private key corresponding to each transaction information.
[0079] Optionally, the group leader node is specifically used to:
[0080] The partial user private key corresponding to each transaction information in the block is deduced according to an association function formula, the group parameter in the group signature, and the group private key parameter, wherein the association function formula records the functional relationship between the partial user private key, the group parameter, and the group private key parameter.
[0081] Optionally, the multiple group nodes further include multiple user nodes, and the group master node is further configured to:
[0082] receiving registration information sent by the user node, and assigning a corresponding user private key to each user node according to the registration information, wherein the registration information is associated with a unique identification code of the user node;
[0083] The unique identification code of each user node and the corresponding user private key are associated and stored in a local encrypted database.
[0084] Optionally, the group leader node is further used to:
[0085] Before decrypting the block, presetting system parameters and generating a group public key and a group private key based on the system parameters;
[0086] The group public key and the group private key are stored in a local encrypted database.
[0087] Optionally, the matching rules for abnormal transactions include:
[0088] At least one of reentrancy attack, permission control, integer overflow, unchecked call return value, transaction order dependency, timestamp dependency, race condition, short address attack, and predictable random processing events.
[0089] A third aspect of an embodiment of the present application provides a computer device, including a processor, which, when executing a computer program stored in a memory, is used to implement the situational awareness method based on blockchain privacy transactions provided in the first aspect of an embodiment of the present application.
[0090] The fourth aspect of the embodiments of the present application provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, it is used to implement the situational awareness method based on blockchain privacy transactions provided in the first aspect of the embodiments of the present application.
[0091] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages:
[0092] An embodiment of the present application provides a situational awareness method based on blockchain privacy transactions, which is applied to a blockchain system, wherein the blockchain system includes multiple group nodes, the multiple group nodes including at least a group master node, a pre-selected situational awareness client node, and a pre-selected situational awareness node. The method includes: the group master node decrypting a block to obtain plaintext instructions corresponding to all transaction information in the block; the situational awareness client node obtaining the plaintext instructions corresponding to all transaction information in the block and a pre-set smart contract, wherein the smart contract is provided with a matching rule for abnormal transactions; the situational awareness client node sending the plaintext instructions corresponding to all transaction information and the smart contract to all situational awareness nodes, so that all situational awareness nodes match the plaintext instructions corresponding to each transaction information with the matching rule for abnormal transactions in the smart contract, and vote on whether each transaction information is an abnormal transaction based on the matching result; if within a preset time period, the number of nodes with the same voting result for each transaction information exceeds a preset number of the total number of all situational awareness nodes, then the situational awareness client node determines whether each transaction information is an abnormal transaction based on the voting result for each transaction information.
[0093] Because the group leader node in the embodiment of the present application can decrypt the transaction information in the block into corresponding plaintext instructions, the situational awareness node in the blockchain system can identify abnormal transactions in the block based on the plaintext instructions of the transaction information and the matching rules of abnormal transactions in the smart contract, thereby ensuring the stability and reliability of the blockchain operation. BRIEF DESCRIPTION OF THE DRAWINGS
[0094] Figure 1 This is a schematic diagram of the architecture of a situational awareness system based on blockchain privacy transactions in an embodiment of the present application;
[0095] Figure 2 This is a schematic diagram of an embodiment of a situational awareness method based on blockchain privacy transactions in an embodiment of the present application;
[0096] Figure 3 for Figure 2 A refinement of step 201 in the embodiment;
[0097] Figure 4 Schematic diagram of the process of selecting a situation awareness node, a situation awareness client node, and a verification node in an embodiment of the present application;
[0098] Figure 5 This is a schematic diagram of an embodiment of the group initialization process in the embodiment of the present application:
[0099] Figure 6 This is a schematic diagram of another embodiment of the situational awareness method based on blockchain privacy transactions in an embodiment of the present application;
[0100] Figure 7 This is a schematic diagram of an embodiment of the blockchain system in the embodiments of this application. DETAILED DESCRIPTION
[0101] The embodiments of the present application provide a situational awareness method and related devices based on blockchain privacy transactions, which are used to achieve situational awareness of abnormal transactions in the blockchain data layer, thereby ensuring the stability and reliability of blockchain operation.
[0102] In order to enable those skilled in the art to better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of this application.
[0103] The terms "first," "second," "third," "fourth," and the like in the specification and claims of this application and in the accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a particular order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" and "having," and any variations thereof, are intended to cover non-exclusive inclusions, e.g., a process, method, system, product, or apparatus comprising a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such process, method, product, or apparatus.
[0104] In order to better implement the above-mentioned situational awareness solution based on blockchain privacy transactions, the embodiment of this application provides a situational awareness system based on blockchain privacy transactions, please refer to Figure 1 , Figure 1This is a schematic diagram of the architecture of a situational awareness system based on blockchain privacy transactions, provided in an embodiment of the present application. The situational awareness system based on blockchain privacy transactions may include at least one terminal device 101 and at least one server 102; the terminal device may be a smartphone, tablet computer, laptop computer, desktop computer, smart car, etc. Server 102 may be a standalone physical server, a server cluster or distributed system consisting of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.
[0105] The blockchain system in this application can be fully deployed on multiple terminal devices 101 or fully deployed on multiple servers 102. Of course, some nodes in the blockchain system (such as group owner nodes, situational awareness nodes and / or verification nodes) can also be deployed on the server 102, and some nodes in the blockchain system (such as user nodes) can be deployed on the terminal device 101 to complete the situational awareness solution based on blockchain privacy transactions in this application.
[0106] Specifically, the above-mentioned situational awareness scheme based on blockchain privacy transactions can be executed by multiple terminal devices 101 or multiple servers 102. For example, when the blockchain system is completely deployed on multiple terminal devices 101, the above-mentioned situational awareness scheme based on blockchain privacy transactions is executed by multiple terminal devices 101, and when the blockchain system is completely deployed on multiple servers 102, the above-mentioned situational awareness scheme based on blockchain privacy transactions is executed by multiple servers 102; further, when some nodes in the blockchain system are deployed on at least one terminal device 101, and some nodes are deployed on at least one server 102, the above-mentioned situational awareness scheme based on blockchain privacy transactions is interactively executed by the terminal devices and servers.
[0107] Based on the situational awareness system based on blockchain privacy transactions provided above, please refer to Figure 2 , Figure 2The flowchart of the situational awareness method based on blockchain privacy transactions in an embodiment of the present application is shown. The situational awareness system based on blockchain privacy transactions can be executed by a blockchain system, which includes multiple group nodes, wherein the multiple group nodes include at least a group master node, a pre-selected situational awareness client node, and a pre-selected situational awareness node. When the blockchain system is deployed on a terminal device 101, the multiple group nodes are all corresponding terminal devices; when the blockchain system is deployed on a server 102, the multiple group nodes are all corresponding servers; and when the blockchain system is partially deployed on the terminal device 101 and partially deployed on the server 102, the group master node can be deployed on the server 102, while the situational awareness client node and the situational awareness node can be deployed on the terminal device 101.
[0108] Specifically, an embodiment of a situational awareness method based on blockchain privacy transactions in the embodiments of the present application includes:
[0109] 201. The group leader node decrypts the block to obtain the plaintext instructions corresponding to all transaction information in the block;
[0110] In layman's terms, blockchain is a chain of blocks composed of some data (such as transaction information), and then multiple blocks are strung together to form a chain of blocks.
[0111] In a conventional blockchain, when a validator receives new transaction data, it packages it into a block and broadcasts it to all other validators. After all validators reach consensus on the block, each verifier records it in the blockchain. In private transactions, to ensure the privacy of transaction data, users typically encrypt their transaction data using their private key. Only after encryption is the transaction data packaged into the block, the validators are unable to access the actual transaction data.
[0112] In order to promptly identify abnormal transactions in each block, the group leader node in the embodiment of the present application can decrypt the block to obtain the plaintext instructions corresponding to all transaction information in the block.
[0113] As for the specific process of the group leader node decrypting the block, it will be described in the following embodiments and will not be repeated here.
[0114] It should be noted here that the block in this application can be a block after consensus verification, that is, the block is first verified and agreed upon, and after the consensus is verified, the group leader node decrypts the block to obtain the plaintext instructions corresponding to all transaction information in the block for situational awareness of the block; it can also be a block before consensus verification, that is, the group leader node first decrypts the block to perform subsequent situational awareness, and after the situation awareness determines that the transaction in the block is a normal transaction, the block is verified and agreed upon.
[0115] 202. The situation awareness client node obtains the plaintext instructions corresponding to all transaction information in the block and a pre-set smart contract, wherein the smart contract is set with matching rules for abnormal transactions;
[0116] After the group leader node in the blockchain system obtains the plaintext instructions corresponding to all transaction information in the block, it can send the obtained plaintext instructions of all transaction information to the situation awareness client node in the blockchain system, or the situation awareness client node can actively obtain the plaintext instructions of all transaction information in the block from the group leader node. There is no specific restriction on the process of the situation awareness client node obtaining the plaintext instructions of all transaction information in the block.
[0117] After the situational awareness client node obtains the plaintext instructions of all transaction information in the block, it further obtains the pre-set smart contract, in which the matching rules for abnormal transactions are set.
[0118] As a specific implementation method, the smart contract is generally set by the group owner node and then stored locally on the group owner node, or stored locally on the situation awareness client node. Therefore, in the embodiment of the present application, the situation awareness client node can obtain the pre-set smart contract from the group owner node, or obtain the pre-set smart contract from the situation awareness client node locally.
[0119] Furthermore, the group leader node in the present application is an independent node that is different from the pre-selected situational awareness client node and the pre-selected situational awareness node, that is, the group leader node in the present application can no longer serve as the situational awareness node client and situational awareness node, because the group leader node in the present application is used to set up smart contracts, and the situational awareness node is used to vote on whether the transaction information is normal according to plain text instructions and smart contracts. Therefore, the group leader node in the present application is set as an independent node that is different from the situational awareness client node and the situational awareness node, which can ensure the fairness and impartiality of the judgment of transaction information to prevent the occurrence of falsification of the judgment results of transaction information.
[0120] 203. The situation awareness client node sends the plaintext instructions and smart contracts corresponding to all transaction information to all situation awareness nodes, so that all situation awareness nodes match the plaintext instructions corresponding to each transaction information with the matching rules for abnormal transactions in the smart contract, and vote on whether each transaction information is an abnormal transaction based on the matching results;
[0121] After the situation awareness client node obtains the plaintext instructions and smart contracts corresponding to all transaction information, it sends the plaintext sum smart contract of all transaction information to all situation awareness nodes, so that all situation awareness nodes match the plaintext instructions corresponding to each transaction information with the matching rules of abnormal transactions in the smart contract, and vote on whether each transaction information is an abnormal transaction based on the matching results.
[0122] Specifically, the smart contract records the matching rules for abnormal transactions, where the matching rules include at least one of reentrancy attacks, permission control, integer overflow, unchecked call return values, transaction order dependency, timestamp dependency, conditional competition, short address attacks, and predictable random processing events.
[0123] Each situational awareness node determines whether the plaintext instructions of each transaction information contain the matching rules for abnormal transactions recorded in the smart contract, and votes on whether each transaction information is an abnormal transaction based on the final matching results.
[0124] 204. If, within a preset time period, the number of nodes with consistent voting results for each transaction information exceeds a preset number of the total number of all situation awareness nodes, the situation awareness client node determines whether each transaction information is an abnormal transaction based on the voting results for each transaction information.
[0125] If, within a preset time period, the number of nodes with consistent voting results for each transaction information exceeds a preset number of the total number of all situational awareness nodes, the situational awareness client node determines whether each transaction information is an abnormal transaction based on the voting results for each transaction information.
[0126] Specifically, if within 30 seconds, the number of nodes that vote consistently for each transaction information exceeds a preset number of the total number of all situational awareness nodes (such as more than half of the total number of all situational awareness nodes), the situational awareness client node determines whether each transaction information is an abnormal transaction based on the voting results for each transaction information.
[0127] It is easy to understand that the voting results for each transaction information include whether the transaction is a normal transaction or an abnormal transaction. As a possible implementation method, if the number of nodes that determine that the target transaction is a normal transaction exceeds half of the total number of all situational awareness nodes within a preset time period, then the transaction information is determined to be a normal transaction; or if the number of nodes that determine that the target transaction is an abnormal transaction exceeds half of the total number of all situational awareness nodes within a preset time period, then the transaction information is determined to be an abnormal transaction; or if the number of nodes that determine that the target transaction is a normal transaction does not exceed half of the total number of all situational awareness nodes within a preset time period, then the transaction information is determined to be an abnormal transaction, so as to improve the accuracy of normal transaction judgment and reduce the omission rate of abnormal transaction identification.
[0128] In an embodiment of the present application, multiple group nodes are set in a blockchain system, wherein the multiple group nodes include at least a group master node, a pre-selected situational awareness client node and a pre-selected situational awareness node, wherein the group master node is used to decrypt the block to obtain the plaintext instructions corresponding to all transaction information in the block; the situational awareness client node is used to obtain the plaintext instructions corresponding to all transaction information in the block and a pre-set smart contract, wherein the smart contract is set with a matching rule for abnormal transactions, and the plaintext instructions and smart contract corresponding to all transaction information are sent to all situational awareness nodes, so that all situational awareness nodes match the plaintext instructions corresponding to each transaction information with the matching rule for abnormal transactions in the smart contract, and vote on whether each transaction information is an abnormal transaction based on the matching result. If, within a preset time period, the number of nodes with the same voting result for each transaction information exceeds a preset number of the total number of all situational awareness nodes, the situational awareness client node determines whether each transaction information is an abnormal transaction based on the voting result for each transaction information.
[0129] Because in the embodiment of the present application, the group leader node can decrypt the block to obtain the plaintext instructions corresponding to all transaction information in the block, the situational awareness node can match the plaintext instructions corresponding to each transaction information with the matching rules of abnormal transactions in the smart contract, and vote on whether each transaction information is an abnormal transaction based on the matching results. Finally, the situational awareness client node determines whether each transaction is an abnormal transaction based on the voting results of each transaction information, thereby realizing situational awareness of abnormal transactions in the blockchain data layer and ensuring the stability and reliability of blockchain operation.
[0130] based on Figure 2 The embodiment described above will now be described in detail in step 201. Figure 3 , Figure 3 for Figure 2 The detailed steps of step 201 in the embodiment are as follows:
[0131] 301. The group master node uses the preset group parameters and group private key in the group signature to restore the partial user private key corresponding to each transaction information in the block;
[0132] It is easy to understand that when a block is generated, in order to ensure the privacy of the data in the block, users participating in the transaction generally use their own user private keys to encrypt each transaction information in the block to prevent transaction data leakage.
[0133] In the embodiments of this application, blocks use group signatures for consensus verification. The group signature is associated with at least group parameters and a group private key, and the group parameters are unique for each block. Specifically, the group master node uses the group parameters and group private key in the group signature to recover the partial user private key corresponding to each transaction in the block, and then uses the partial user private key corresponding to each transaction to execute step 302.
[0134] As a specific implementation method, the group master node can deduce the partial user private key corresponding to each transaction information in the block based on the association function formula, the group parameters in the group signature, and the group private key parameters, wherein the association function formula records the functional relationship between the partial user private key, the group parameters, and the group private key parameters.
[0135] For easier understanding, the following example illustrates:
[0136] Assuming that the group parameters in the group signature of each block are A1, A2 and A3 (where the group parameters in the group signature corresponding to each block are different), the group private key = (a1, a2 and λ), and the user private key = (idi, xi), the correlation function formula is Under the premise of knowing the correlation function formula, group parameters and group private key, the group master node can deduce the idi in the user's private key according to the correlation function formula.
[0137] 302. The group leader node uses the partial user private key corresponding to each transaction information to obtain the complete user private key corresponding to each exchange from the local encrypted database;
[0138] After the group leader node obtains the partial user private key corresponding to each transaction information, it uses the partial user private key corresponding to each transaction information to obtain the complete user private key corresponding to each exchange from the local encrypted database.
[0139] It is understandable that the complete user private key, group public key and group private key of each user node are pre-stored in the local encrypted database.
[0140] 303. The group leader node uses the complete user private key corresponding to each exchange to decrypt each transaction information in the block.
[0141] After the group leader node obtains the complete user private key corresponding to each transaction information, it uses the complete user private key to decrypt each transaction information to obtain the plaintext instructions corresponding to each transaction information.
[0142] In the embodiment of the present application, the process of decrypting a block by the group leader node is described in detail, thereby improving the reliability of the process in which the group leader node obtains the plaintext instructions corresponding to all transaction information in the block in the embodiment of the present application.
[0143] based on Figure 2 In the embodiment described above, after determining whether each transaction information is abnormal transaction information, the following steps may be performed to ensure fairness of the situation awareness node during the voting process.
[0144] Specifically, after determining whether each transaction information is an abnormal transaction, the situational awareness client node can also update the weight of each situational awareness node based on the voting results of each transaction information, and then sort all situational awareness nodes according to the updated weight. After the preset number of rounds of voting are completed, a second preset number of situational awareness nodes are eliminated from all situational awareness nodes based on the sorting results of all situational awareness nodes.
[0145] Furthermore, after the situational awareness node client node eliminates a second preset number of situational awareness nodes based on the sorting results, the group leader node selects a second preset number of new situational awareness nodes with the highest ranking from the node candidate pool according to the sorting results of the candidate node resource configurations. The node candidate pool pre-stores multiple candidate nodes, and each candidate node has a different resource configuration (e.g., CPU, memory, and bandwidth). To facilitate the subsequent selection of new situational awareness nodes, the candidate nodes in the candidate pool can be pre-sorted according to the candidate node resource configurations.
[0146] The following example illustrates this:
[0147] Assuming that the block contains 3 transaction data, and there are 10 situational awareness nodes in the group node, after the voting for the first transaction information ends, assuming that 7 situational awareness nodes (1, 3, 4, 5, 6, 7 and 8 situational awareness nodes) vote that the transaction information is a normal transaction, 2 situational awareness nodes vote that the transaction is an abnormal transaction, and 9 and 10 situational awareness nodes fail to vote due to network reasons, the situational awareness client node can update the weights of the 1st to 10th situational awareness nodes after the voting for the first transaction information ends, such as the weight of the normal voting situational awareness node +1, the weight of the malicious voting situational awareness node -2, and the weight of the voting failed situational awareness node -1, so as to obtain the weight ranking of the 10 situational awareness nodes after the voting for the first transaction information ends. The voting results for the second and third transaction information are updated in the same way, so as to obtain the latest weight ranking of each situational awareness node after the voting for each transaction information ends.
[0148] The situational awareness client node can eliminate 3 situational awareness nodes from the 10 situational awareness nodes according to the latest ranking of each situational awareness node after 20 rounds of voting, and then the group master node selects 3 new situational awareness nodes with high ranking from the node candidate pool according to the ranking of the resource configuration of the candidate nodes in the candidate pool, so as to ensure the non-centralized distribution of the situational awareness nodes in the embodiment of the application, and improve the fairness of the voting results of the situational awareness nodes.
[0149] It should be noted that the above examples are only exemplary explanations of the selection process of the new situational awareness nodes, and do not constitute any limitation on the number of specific transactions and the number of new situational awareness nodes.
[0150] Further, the plurality of group nodes in the embodiment of the application also include pre-selected verification nodes, and the process of selecting situational awareness nodes, situational awareness client nodes and verification nodes by the group master node is described below. Please refer to Figure 4 , Figure 4 The process of selecting situational awareness nodes, situational awareness client nodes and verification nodes in the embodiment of the application is as follows:
[0151] 401、The group master node sorts the nodes in the node candidate pool according to the resource configuration;
[0152] In order to select nodes with superior resource configuration to serve as situational awareness nodes and verification nodes, the group master node can sort the nodes in the node candidate pool according to the resource configuration (such as the network bandwidth of the node, the CPU performance of the node and the memory of the node, etc.) in advance.
[0153] It is easy to understand that a plurality of candidate nodes are pre-placed in the node candidate pool, which can be an idle mobile phone, an idle computer or an idle server of a user.
[0154] 402、the group master node selects a plurality of verification nodes and a plurality of situation awareness nodes with matching resource configurations from the node candidate pool at one time according to the sorting result;
[0155] After the group master node sorts the nodes in the node candidate pool according to the resource configuration, the group master node can also select a plurality of verification nodes and a plurality of situation awareness nodes with matching resource configurations from the node candidate pool at one time.
[0156] Because in the process of verifying and situation awareness of transaction information, if the resource configurations of the verification nodes and the situation awareness nodes are too different, the verification nodes may have completed the verification of the transaction information, while the situation awareness nodes may be slow in the situation awareness process due to the difference in computing power, or the verification nodes may be slow in the verification process of the transaction information, while the situation awareness nodes may be fast in the situation awareness process, that is, the difference in computing power between the two is large, thereby affecting the block output speed.
[0157] Therefore, in the selection of verification nodes and situation awareness nodes, the embodiments of the present application can select a plurality of verification nodes and a plurality of situation awareness nodes with matching resource configurations from the node candidate pool according to the resource configuration sorting result. At the same time, in order to improve the selection efficiency, the embodiments of the present application can also select verification nodes and situation awareness nodes from the candidate pool at one time, thereby improving the selection efficiency of the verification nodes and the situation awareness nodes.
[0158] As a specific implementation, the group master node can select a plurality of verification nodes and a plurality of situation awareness nodes with matching resource configurations from the candidate pool at one time according to the odd-even sorting of the plurality of candidate nodes in the node candidate pool.
[0159] For example, assuming that there are 100 candidate nodes in the node candidate pool, and the group master node needs to select 20 verification nodes and 20 situation awareness nodes from the candidate pool, the group master node can set the top 20 odd-numbered candidate nodes in the sorting as verification nodes, and set the top 20 even-numbered candidate nodes in the sorting as situation awareness nodes according to the odd-even sorting of the plurality of candidate nodes.
[0160] Of course, in the process of selecting the verification node and the situational awareness node, the group master node can also sort the candidate nodes, select the top N1 candidate nodes from the candidate nodes N2 according to the total number N1 of the verification node and the situational awareness node, and then select the verification node and the situational awareness node according to the random drawing method. Here, as long as the verification node and the situational awareness node that match the resource configuration can be selected, and the process of selecting the verification node and the situational awareness node is not specifically limited.
[0161] 403、The group master node selects a first preset number of situational awareness client nodes from the plurality of situational awareness nodes.
[0162] After the group master node selects the plurality of verification nodes and the plurality of situational awareness nodes from the node candidate pool, the group master node can further select a first preset number of situational awareness client nodes from the plurality of situational awareness nodes, where the total number of the situational awareness client nodes is less than the total number of the situational awareness nodes.
[0163] Based on the above Figure 4 According to the embodiment, before the group master node selects the verification node, the situational awareness node, and the situational awareness client node, the group master node needs to complete the group initialization process. The group initialization process is described below. Please refer to Figure 5 , Figure 5 An embodiment of the group initialization process in the present application is shown in the following figure:
[0164] 501、The group master node presets system parameters, and generates a group public key and a group private key according to the system parameters.
[0165] During the initialization of the group, the group master node presets system parameters, and then generates a group public key and a group private key according to the system parameters, and performs step 502.
[0166] The generation process of the group public key and the group private key in the present application is described below:
[0167] Suppose that the system parameters preset by the group master node are para=(S1, s1, p), where p is a prime number, the group master node selects two secure hash functions H1 and H2, where H1 maps to the integer ring Z, and H2 maps to S1. The group master node randomly selects non-zero numbers a1, a2, and λ from the integer ring Z, and then sets the group public key gpk=(S1, s1, p, H1, H2), and sets the group private key gsk=(a1, a2, and λ).
[0168] 502、The group master node saves the group public key and the group private key in a local encrypted database.
[0169] The group master node stores the group public key and the group private key in a local encrypted database after generating the group public key and the group private key, for taking out when needed.
[0170] 503. The group master node receives registration information sent by the user node, and allocates a corresponding user private key to each user node according to the registration information, wherein the registration information is associated with a unique identity code of the user node.
[0171] It is easy to understand that the user node is also included in the group node for generating block data in the blockchain. In order to realize the management of the group node, the user node in the embodiment of the application needs to complete group registration for generating a user private key and completing the encryption of block data by using the user private key.
[0172] Specifically, the group master node receives registration information sent by the user node, and allocates a corresponding private key to each user node according to the registration information, wherein the registration information is associated with a unique identity code of the user node.
[0173] For the sake of understanding, the generation process of the user private key is described as follows:
[0174] Suppose that the user node sends its unique identity code (such as an identity card number, a mobile phone number, biological identification information, etc.) to the group master node. The group master node can pre-connect with the database of the public security organ and verify the unique identity code of the user node. If the unique identity code of the user node is true and has not been registered in the group before, the group master node allocates a unique user private key to the user node.
[0175] Specifically, suppose that the user private key upk=(idi, xi), wherein idi can be calculated according to the association function formula , wherein A1, A2 and A3 are group parameters in each block group signature (the group parameters of each block are different), and a1 and a2 are part of the parameters in the group private key.
[0176] And xi is a non-zero number different from a1, a2 and λ selected by the group master node from the integer ring Z, and xi corresponding to each user node is different from each other.
[0177] 504. The group master node stores the unique identity code of each user node and the corresponding user private key in the local encrypted database.
[0178] The group master node stores the unique identity code of each user node and the corresponding user private key in the local encrypted database.
[0179] In the embodiments of the present application, a detailed description is given of the process of completing the initialization of the group nodes and the process of allocating user private keys to the user nodes, thereby improving the reliability of the group initialization process.
[0180] Based on the above embodiment, the situation awareness method based on blockchain privacy transaction in the embodiment of the present application is described below. The method is applied to the blockchain system, wherein the blockchain system includes a group leader node, a situation awareness client node, a situation awareness node, a verification node and a user node. For details, please refer to Figure 6 Another embodiment of the situational awareness method based on blockchain privacy transactions in the embodiments of the present application includes:
[0181] 601. The verification node obtains at least one transaction information of the user node;
[0182] When a user node in a group of nodes completes a user transaction, the verification node is responsible for verifying the user transaction data of the user node. After the verification is passed, the user transaction data is packaged and uploaded to the chain to generate a block in the blockchain.
[0183] Specifically, after obtaining at least one transaction information of the user node, the verification node executes step 602 on the transaction.
[0184] 602. The verification node verifies the validity of the at least one transaction information using a preset verification method;
[0185] After obtaining at least one transaction information of the user node, the verification node verifies the at least one transaction information using a preset verification method, and executes step 603 after the verification is passed.
[0186] Specifically, the verification node verifies at least one transaction information in at least one of the following two ways:
[0187] (1) The verification node verifies whether the group signature of the at least one transaction information is recorded in the blockchain. If not, the verification node determines that the at least one transaction information is a valid transaction; otherwise, the verification node determines that the at least one transaction information is an invalid transaction.
[0188] It is easy to understand that after each user node completes at least one user transaction (one or more user transactions), it uses its own user private key to encrypt each of its own user transactions. After encryption is completed, multiple user transactions are further packaged and signed with a group signature. The group signature is at least associated with the group parameters and the group private key, and the group parameters of each block are different.
[0189] Therefore, the verification node can verify whether the group signature of at least one transaction information is recorded in the blockchain. If the group signature has been recorded in the blockchain, it indicates that the block may have been recorded before, and the at least one transaction information is determined to be an invalid transaction. If the group signature is not recorded in the blockchain, the at least one transaction information is determined to be a valid transaction.
[0190] (2) The verification node verifies whether the at least one transaction information is valid based on the knowledge proof. If the knowledge proof is valid, the transaction is determined to be a valid transaction; otherwise, it is determined to be an invalid transaction.
[0191] Specifically, proof of knowledge involves pre-agreed rules, or questions and answers, between the verification node and the user node. For example, when verifying the validity of at least one transaction from a user node, the verification node can send a question to the user node. If the user node can provide a pre-agreed answer, the transaction is proven valid; otherwise, the transaction is invalid.
[0192] Furthermore, in order to prevent a pre-agreed rule or answer from being leaked, the group leader node can preset multiple rules or multiple questions and answers, and then the verification node randomly selects a rule and a question to perform knowledge proof on the user node to ensure the privacy of the knowledge proof.
[0193] 603. If the at least one transaction information is verified to be valid, the at least one transaction information is packaged and the resulting block is broadcast to other verification nodes, so that the other verification nodes vote to verify the at least one transaction in the block.
[0194] If any verification node verifies that at least one transaction information is valid, it will package the at least one transaction information and broadcast the generated block to other verification nodes, so that other verification nodes can vote to verify at least one transaction in the block to ensure the validity of the block.
[0195] Specifically, the verification process of at least one transaction information in the block by other verification nodes is similar to the verification method in step 602 and will not be repeated here.
[0196] 604. If more than a preset number of verification nodes among the other verification nodes vote to verify that at least one transaction information in the block is valid, the block is recorded in the blockchain;
[0197] When other verification nodes verify at least one transaction information in a block, if more than a preset number of verification nodes (such as more than half of the verification nodes) vote to verify that the transaction is valid, the block will be recorded in the blockchain; otherwise, the block will be abandoned and refused to be recorded in the blockchain.
[0198] 605. The group leader node decrypts the block to obtain the plaintext instructions corresponding to all transaction information in the block;
[0199] 606. The situation awareness client node obtains the plaintext instructions corresponding to all transaction information in the block and a pre-set smart contract, wherein the smart contract is configured with matching rules for abnormal transactions.
[0200] 607. The situation awareness client node sends the plaintext instructions and smart contracts corresponding to all transaction information to all situation awareness nodes, so that all situation awareness nodes match the plaintext instructions corresponding to each transaction information with the matching rules for abnormal transactions in the smart contract, and vote on whether each transaction information is an abnormal transaction based on the matching results.
[0201] 608. If, within a preset time period, the number of nodes with consistent voting results for each transaction information exceeds a preset number of the total number of all situation awareness nodes, the situation awareness client node determines whether each transaction information is an abnormal transaction based on the voting results for each transaction information.
[0202] It should be noted that the description of steps 605 to 608 in the embodiment of the present application is similar to the description of steps 101 to 104 in the embodiment of the present application, and will not be repeated here.
[0203] In the embodiment of the present application, the process of generating blocks in the blockchain is described in detail. In the process of generating blocks, multiple verification nodes are used to vote on the transaction data in the blocks, thereby ensuring the authenticity and validity of the transaction data in the blocks.
[0204] based on Figure 6 In order to ensure fairness and impartiality of verification nodes in block voting, the embodiment of the present application can also periodically update verification nodes to prevent verification nodes from falsifying voting results. Specifically:
[0205] After the verification node completes voting on at least one transaction in the block, the group leader node updates the node weight of each verification node in each round of voting based on the voting results of each verification node on at least one transaction information in the block, and then sorts the multiple verification nodes based on the latest node weight of each verification node in each round of voting. After the preset number of rounds of voting are completed, the group leader node eliminates a third preset number of verification nodes based on the sorting results, and then selects a third preset number of new verification nodes from the node candidate pool according to the sorting of the candidate node resource configuration.
[0206] The following example illustrates this:
[0207] Suppose a block contains three transactions, and there are 10 validators in the group. After voting on the first transaction, suppose seven validators (1, 3, 4, 5, 6, 7, and 8) vote for the transaction as valid, while validator 2 votes it as invalid. Validators 9 and 10 fail to vote due to network issues. The group leader can then update the weights of validators 1 through 10 after voting on the first transaction, such as adding +1 to the weight of validators who voted normally, -2 to the weight of validators who voted maliciously, and -1 to the weight of validators who failed to vote. This results in a weight ranking of the ten validators after voting on the first transaction. The same method is used to update the weights of the ten validators for the second and third transactions, resulting in a current weight ranking for each validator after voting on each transaction.
[0208] After 10 rounds of voting, the group leader node can eliminate a third preset number (such as 5) of verification nodes from the 10 verification nodes according to the latest ranking of each verification node, and then re-select 5 new verification nodes from the node candidate pool according to the ranking of the candidate node resource configuration, thereby ensuring the decentralized distribution of the verification nodes in the embodiment of the present application and improving the fairness of the verification nodes in the voting results.
[0209] It should be noted that the above examples are only illustrative explanations of the new verification node selection process and do not impose any restrictions on the number of specific transactions or the number of new verification nodes.
[0210] Furthermore, based on the above embodiment, if the situational awareness client node determines an abnormal transaction in a block, it sends the abnormal transaction to the verification node, so that the verification node calls the corresponding defense contract to ensure the reliability and validity of the blockchain data.
[0211] The above describes the situational awareness method based on blockchain privacy transactions in the embodiment of this application. The following describes the blockchain system in this application. Figure 7 :
[0212] The blockchain system is used to implement the situational awareness method based on private transactions in the embodiment of the present application. Specifically, the blockchain system includes at least a group leader node 701, a pre-selected situational awareness client node 702, and a pre-selected situational awareness node 703, wherein:
[0213] The group master node 701 is used to decrypt the block to obtain the plaintext instructions corresponding to all transaction information in the block;
[0214] The situation awareness client node 702 is used to obtain the plaintext instructions corresponding to all transaction information in the block and the pre-set smart contract, wherein the smart contract is set with matching rules for abnormal transactions;
[0215] The situation awareness client node 702 is further configured to send the plaintext instructions corresponding to all transaction information and the smart contract to all situation awareness nodes, so that all situation awareness nodes 703 match the plaintext instructions corresponding to each transaction information with the matching rules for abnormal transactions in the smart contract, and vote on whether each transaction information is an abnormal transaction based on the matching results;
[0216] The situation awareness client node 702 is also used to determine whether each transaction information is an abnormal transaction based on the voting result of each transaction information if the number of nodes with consistent voting results for each transaction information exceeds a preset number of the total number of all situation awareness nodes within a preset time period.
[0217] Optionally, the voting result includes whether the transaction is a normal transaction or an abnormal transaction;
[0218] The situation awareness client node 702 is specifically used to:
[0219] If the number of nodes in all situation awareness nodes that determine that each transaction information is a normal transaction exceeds a preset number of the total number of all situation awareness nodes, then each transaction is determined to be a normal transaction;
[0220] and / or,
[0221] If the number of nodes among all situational awareness nodes that determine that each transaction information is a normal transaction does not exceed a preset number of the total number of all situational awareness nodes, or the number of nodes among all situational awareness nodes that determine that each transaction information is an abnormal transaction exceeds a preset number of the total number of all situational awareness nodes, then each transaction is determined to be an abnormal transaction.
[0222] Optionally, the plurality of group nodes further include a pre-selected verification node 704;
[0223] The group master node 701 is also used to:
[0224] Sort the nodes in the node candidate pool according to resource allocation;
[0225] According to the sorting results, multiple verification nodes and multiple situation awareness nodes with matching resource configurations are selected from the node candidate pool at one time;
[0226] A first preset number of situation awareness client nodes are selected from the plurality of situation awareness nodes.
[0227] Optionally, the group leader node 701 is specifically used to:
[0228] According to the parity order of the nodes in the node candidate pool, a plurality of verification nodes and a plurality of situation awareness nodes with matching resource configurations are selected from the node candidate pool at one time.
[0229] Optionally, the group leader node 701 is an independent node different from the situation awareness node, the situation awareness client node and the verification node.
[0230] Optionally, the situation awareness client node 702 is further configured to:
[0231] After determining the abnormal transaction in the block, the abnormal transaction is sent to the verification node, so that the verification node calls the corresponding defense contract.
[0232] Optionally, the situation awareness client node 702 is further configured to:
[0233] After determining whether each transaction information is an abnormal transaction based on the voting result of each transaction information, the weight of each situation awareness node is updated based on the voting result of each transaction information;
[0234] Sort all situation awareness nodes according to the updated weights;
[0235] After the preset number of rounds of voting are completed, a second preset number of situation awareness nodes are eliminated based on the sorting results.
[0236] Optionally, the group leader node 701 is further configured to:
[0237] After the situation awareness client node eliminates a second preset number of situation awareness nodes according to the sorting result, the situation awareness client node selects a second preset number of new situation awareness nodes with higher sorting from the node candidate pool according to the sorting result of the candidate node resource configuration.
[0238] Optionally, the smart contract is pre-set by the group master node, and the group master node 701 is configured to:
[0239] store the pre-set smart contract locally on the group master node or locally on the situational awareness client node.
[0240] Optionally, the block is verified by consensus using a group signature, wherein the group signature is associated with at least a group parameter and a group private key, and the group parameters of each block are different from each other;
[0241] The group master node 701 is specifically configured to:
[0242] restore the partial user private key corresponding to each transaction information in the block using the group parameter and the group private key in the group signature;
[0243] Obtain the complete user private key corresponding to each transaction information from the local encrypted database using the partial user private key corresponding to each transaction information;
[0244] Decrypt each transaction information in the block using the complete user private key corresponding to each transaction information.
[0245] Optionally, the group master node 701 is specifically configured to:
[0246] deduce the partial user private key corresponding to each transaction information in the block according to an association function formula, the group parameter and the group private key parameter in the group signature, wherein the association function formula records the functional relationship between the partial user private key, the group parameter and the group private key parameter.
[0247] Optionally, the plurality of group nodes further comprise a plurality of user nodes 705, and the group master node 701 is further configured to:
[0248] receive registration information sent by the user nodes, and allocate a corresponding user private key to each user node according to the registration information, wherein the registration information is associated with a unique identity code of the user node;
[0249] associate and store the unique identity code of each user node and the corresponding user private key in the local encrypted database.
[0250] Optionally, the group master node 701 is further configured to:
[0251] preset a system parameter before decrypting the block, and generate a group public key and a group private key according to the system parameter;
[0252] save the group public key and the group private key in the local encrypted database.
[0253] Optionally, the matching rules for abnormal transactions include:
[0254] At least one of reentrancy attack, permission control, integer overflow, unchecked call return value, transaction order dependency, timestamp dependency, race condition, short address attack, and predictable random processing events.
[0255] It should be noted that the role of each node in the embodiment of the present application is the same as Figures 1 to 6 The description in the embodiment is similar and will not be repeated here.
[0256] Because in the embodiment of the present application, the group leader node 701 can decrypt the block to obtain the plaintext instructions corresponding to all transaction information in the block, the situation awareness node 703 can match the plaintext instructions corresponding to each transaction information with the matching rules of abnormal transactions in the smart contract, and vote on whether each transaction information is an abnormal transaction based on the matching results. Finally, the situation awareness client node 702 determines whether each transaction is an abnormal transaction based on the voting results of each transaction information, thereby realizing situation awareness of abnormal transactions in the blockchain data layer and ensuring the stability and reliability of blockchain operation.
[0257] The blockchain system in the embodiment of the present application is described above from the perspective of modular functional entities. The computer device in the embodiment of the present application is described below from the perspective of hardware processing:
[0258] The computer device is used to implement the functions of a group master node, a situation awareness client node, and a situation awareness node in a blockchain. In one embodiment of the present application, the computer device includes:
[0259] processor and memory;
[0260] The memory is used to store computer programs, and when the processor is used to execute the computer programs stored in the memory, the following steps can be implemented:
[0261] The group leader node decrypts the block to obtain the plaintext instructions corresponding to all transaction information in the block;
[0262] The situation awareness client node obtains the plaintext instructions corresponding to all transaction information in the block and a pre-set smart contract, wherein the smart contract is set with matching rules for abnormal transactions;
[0263] The situation awareness client node sends the plaintext instructions corresponding to all transaction information and the smart contract to all situation awareness nodes, so that all situation awareness nodes match the plaintext instructions corresponding to each transaction information with the matching rules of abnormal transactions in the smart contract, and vote on whether each transaction information is an abnormal transaction based on the matching results;
[0264] If, within a preset time period, the number of nodes with consistent voting results for each transaction information exceeds a preset number of the total number of all situational awareness nodes, the situational awareness client node determines whether each transaction information is an abnormal transaction based on the voting results for each transaction information.
[0265] In some embodiments of the present application, the voting result includes whether the transaction is a normal transaction or an abnormal transaction. The processor may further be configured to implement the following steps:
[0266] If the number of nodes in all situation awareness nodes that determine that each transaction information is a normal transaction exceeds a preset number of the total number of all situation awareness nodes, the situation awareness client node determines that each transaction is a normal transaction;
[0267] and / or,
[0268] If the number of nodes among all situational awareness nodes that determine that each transaction information belongs to a normal transaction does not exceed a preset number of the total number of all situational awareness nodes, or the number of nodes among all situational awareness nodes that determine that each transaction information belongs to an abnormal transaction exceeds a preset number of the total number of all situational awareness nodes, then the situational awareness client node determines that each transaction is an abnormal transaction.
[0269] In some embodiments of the present application, the plurality of group nodes further include a pre-selected verification node, and the processor is specifically configured to implement the following steps:
[0270] The group leader node sorts the nodes in the node candidate pool according to resource configuration;
[0271] The group leader node selects multiple verification nodes and multiple situation awareness nodes with matching resource configurations from the node candidate pool at one time according to the sorting result;
[0272] The group leader node selects a first preset number of situation awareness client nodes from the multiple situation awareness nodes.
[0273] In some embodiments of the present application, the processor is specifically configured to implement the following steps:
[0274] The group leader node selects a plurality of verification nodes and a plurality of situation awareness nodes with matching resource configurations from the node candidate pool at one time according to the parity order of the nodes in the node candidate pool.
[0275] In some embodiments of the present application, the group leader node is an independent node different from the situation awareness node, the situation awareness client node and the verification node.
[0276] In some embodiments of the present application, after the situation awareness client node determines an abnormal transaction in a block, the processor is further configured to implement the following steps:
[0277] The situation awareness client node sends abnormal transactions to the verification node, causing the verification node to call the corresponding defense contract.
[0278] In some embodiments of the present application, after the situation awareness client node determines whether each transaction information is an abnormal transaction based on the voting result of each transaction information, the processor is further configured to implement the following steps:
[0279] The situation awareness client node updates the weight of each situation awareness node according to the voting result of each transaction information;
[0280] The situation awareness client node sorts all situation awareness nodes according to the updated weights;
[0281] After the preset number of rounds of voting are completed, the situation awareness client node eliminates a second preset number of situation awareness nodes according to the sorting results.
[0282] In some embodiments of the present application, after the situation awareness client node eliminates a second preset number of situation awareness nodes according to the sorting result, the processor is further configured to implement the following steps:
[0283] The group leader node selects a second preset number of new situation awareness nodes with the highest ranking from the node candidate pool according to the ranking result of the candidate node resource configuration.
[0284] In some embodiments of the present application, the smart contract is pre-set by the group master node, and the group master node stores the pre-set smart contract locally on the group master node, or locally on the situation awareness client node.
[0285] In some embodiments of the present application, the block uses a group signature to verify the consensus, wherein the group signature is at least associated with a group parameter and a group private key, and the group parameter of each block is different. The processor is further configured to implement the following steps:
[0286] The group master node uses the group parameters and group private key in the group signature to restore the partial user private key corresponding to each transaction information in the block;
[0287] The group leader node uses the partial user private key corresponding to each transaction information to obtain the complete user private key corresponding to each transaction information from the local encrypted database;
[0288] The group leader node uses the complete user private key corresponding to each transaction information to decrypt each transaction information in the block.
[0289] In some embodiments of the present application, the processor is further configured to implement the following steps:
[0290] The group master node deduces the partial user private key corresponding to each transaction information in the block based on an association function formula, the group parameter in the group signature, and the group private key parameter, wherein the association function formula records the functional relationship between the partial user private key, the group parameter, and the group private key parameter.
[0291] In some embodiments of the present application, the plurality of group nodes further include a plurality of user nodes, and the processor is further configured to implement the following steps:
[0292] The group leader node receives the registration information sent by the user node and allocates a corresponding user private key to each user node according to the registration information, wherein the registration information is associated with the unique identity identification code of the user node;
[0293] The group leader node associates and stores the unique identity identification code of each user node and the corresponding user private key in a local encrypted database.
[0294] In some embodiments of the present application, before the group leader node decrypts the block, the processor is further configured to implement the following steps:
[0295] The group master node presets system parameters and generates a group public key and a group private key according to the system parameters;
[0296] The group master node stores the group public key and the group private key in a local encrypted database.
[0297] In some embodiments of the present application, the matching rules for abnormal transactions include:
[0298] At least one of reentrancy attack, permission control, integer overflow, unchecked call return value, transaction order dependency, timestamp dependency, race condition, short address attack, and predictable random processing events.
[0299] It is understandable that when the processor in the computer device described above executes the computer program, it can also implement the functions of the various units in the corresponding device embodiments described above, and no further details are given here. Exemplarily, the computer program can be divided into one or more modules / units, and the one or more modules / units are stored in the memory and executed by the processor to complete this application. The one or more modules / units can be a series of computer program instruction segments that can perform specific functions, and the instruction segments are used to describe the execution process of the computer program in the blockchain system. For example, the computer program can be divided into the various units in the above-mentioned blockchain system, and each unit can implement the specific functions described in the corresponding blockchain system described above.
[0300] The computer device may be a computing device such as a desktop computer, laptop, PDA, or cloud server. The computer device may include, but is not limited to, a processor and memory. Those skilled in the art will appreciate that a processor and memory are merely examples of computer devices and do not constitute a limitation of the computer device. The computer device may include more or fewer components, or a combination of certain components, or different components. For example, the computer device may also include input and output devices, network access devices, buses, and the like.
[0301] The processor may be a central processing unit (CPU), other general-purpose processors, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), an off-the-shelf programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc. The processor is the control center of the computer device, connecting various parts of the entire computer device using various interfaces and lines.
[0302] The memory can be used to store the computer programs and / or modules, and the processor implements various functions of the computer device by running or executing the computer programs and / or modules stored in the memory, and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application required for a function, etc.; the data storage area can store data created based on the use of the terminal, etc. In addition, the memory can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage device.
[0303] The present application also provides a computer-readable storage medium, which is used to implement the functions of a group leader node, a situation awareness client node, and a situation awareness node in a blockchain, respectively. A computer program is stored on the computer-readable storage medium. When the computer program is executed by a processor, the processor can be used to perform the following steps:
[0304] The group leader node decrypts the block to obtain the plaintext instructions corresponding to all transaction information in the block;
[0305] The situation awareness client node obtains the plaintext instructions corresponding to all transaction information in the block and a pre-set smart contract, wherein the smart contract is set with matching rules for abnormal transactions;
[0306] The situation awareness client node sends the plaintext instructions corresponding to all transaction information and the smart contract to all situation awareness nodes, so that all situation awareness nodes match the plaintext instructions corresponding to each transaction information with the matching rules of abnormal transactions in the smart contract, and vote on whether each transaction information is an abnormal transaction based on the matching results;
[0307] If, within a preset time period, the number of nodes with consistent voting results for each transaction information exceeds a preset number of the total number of all situational awareness nodes, the situational awareness client node determines whether each transaction information is an abnormal transaction based on the voting results for each transaction information.
[0308] In some embodiments of the present application, the voting result includes whether the transaction is a normal transaction or an abnormal transaction. When the computer program is executed by a processor, the processor may further be configured to implement the following steps:
[0309] If the number of nodes in all situation awareness nodes that determine that each transaction information is a normal transaction exceeds a preset number of the total number of all situation awareness nodes, the situation awareness client node determines that each transaction is a normal transaction;
[0310] and / or,
[0311] If the number of nodes among all situational awareness nodes that determine that each transaction information belongs to a normal transaction does not exceed a preset number of the total number of all situational awareness nodes, or the number of nodes among all situational awareness nodes that determine that each transaction information belongs to an abnormal transaction exceeds a preset number of the total number of all situational awareness nodes, then the situational awareness client node determines that each transaction is an abnormal transaction.
[0312] In some embodiments of the present application, the plurality of group nodes further include a pre-selected verification node. When the computer program is executed by a processor, the processor is specifically configured to implement the following steps:
[0313] The group leader node sorts the nodes in the node candidate pool according to resource configuration;
[0314] The group leader node selects multiple verification nodes and multiple situation awareness nodes with matching resource configurations from the node candidate pool at one time according to the sorting result;
[0315] The group leader node selects a first preset number of situation awareness client nodes from the multiple situation awareness nodes.
[0316] In some embodiments of the present application, when the computer program is executed by a processor, the processor is specifically configured to implement the following steps:
[0317] The group leader node selects a plurality of verification nodes and a plurality of situation awareness nodes with matching resource configurations from the node candidate pool at one time according to the parity order of the nodes in the node candidate pool.
[0318] In some embodiments of the present application, the group leader node is an independent node different from the situation awareness node, the situation awareness client node and the verification node.
[0319] In some embodiments of the present application, after the situation awareness client node determines an abnormal transaction in a block, when the computer program is executed by a processor, the processor is further configured to implement the following steps:
[0320] The situation awareness client node sends abnormal transactions to the verification node, causing the verification node to call the corresponding defense contract.
[0321] In some embodiments of the present application, after the situation awareness client node determines whether each transaction information is an abnormal transaction based on the voting result of each transaction information, when the computer program is executed by the processor, the processor is further configured to implement the following steps:
[0322] The situation awareness client node updates the weight of each situation awareness node according to the voting result of each transaction information;
[0323] The situation awareness client node sorts all situation awareness nodes according to the updated weights;
[0324] After the preset number of rounds of voting are completed, the situation awareness client node eliminates a second preset number of situation awareness nodes according to the sorting results.
[0325] In some embodiments of the present application, after the situation awareness client node eliminates a second preset number of situation awareness nodes according to the sorting result, when the computer program is executed by the processor, the processor is further configured to implement the following steps:
[0326] The group leader node selects a second preset number of new situation awareness nodes with the highest ranking from the node candidate pool according to the ranking result of the candidate node resource configuration.
[0327] In some embodiments of the present application, the smart contract is pre-set by the group master node, and the group master node stores the pre-set smart contract locally on the group master node, or locally on the situation awareness client node.
[0328] In some embodiments of the present application, the block uses a group signature to verify consensus, wherein the group signature is associated with at least a group parameter and a group private key, and the group parameter of each block is different. When the computer program is executed by a processor, the processor is further configured to implement the following steps:
[0329] The group master node uses the group parameters and group private key in the group signature to restore the partial user private key corresponding to each transaction information in the block;
[0330] The group leader node uses the partial user private key corresponding to each transaction information to obtain the complete user private key corresponding to each transaction information from the local encrypted database;
[0331] The group leader node uses the complete user private key corresponding to each transaction information to decrypt each transaction information in the block.
[0332] In some embodiments of the present application, when the computer program is executed by a processor, the processor is further configured to implement the following steps:
[0333] The group master node deduces the partial user private key corresponding to each transaction information in the block based on an association function formula, the group parameter in the group signature, and the group private key parameter, wherein the association function formula records the functional relationship between the partial user private key, the group parameter, and the group private key parameter.
[0334] In some embodiments of the present application, the plurality of group nodes further include a plurality of user nodes. When the computer program is executed by a processor, the processor is further configured to implement the following steps:
[0335] The group leader node receives the registration information sent by the user node and allocates a corresponding user private key to each user node according to the registration information, wherein the registration information is associated with the unique identity identification code of the user node;
[0336] The group leader node associates and stores the unique identity identification code of each user node and the corresponding user private key in a local encrypted database.
[0337] In some embodiments of the present application, before the group leader node decrypts the block, when the computer program is executed by the processor, the processor is further configured to implement the following steps:
[0338] The group master node presets system parameters and generates a group public key and a group private key according to the system parameters;
[0339] The group master node stores the group public key and the group private key in a local encrypted database.
[0340] In some embodiments of the present application, the matching rules for abnormal transactions include:
[0341] At least one of reentrancy attack, permission control, integer overflow, unchecked call return value, transaction order dependency, timestamp dependency, race condition, short address attack, and predictable random processing events.
[0342] It is understood that if the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a corresponding computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned corresponding embodiment methods, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and when the computer program is executed by the processor, it can implement the steps of the above-mentioned various method embodiments. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device that can carry the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0343] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0344] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0345] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0346] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the above embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A situational awareness method based on blockchain privacy transactions, characterized in that: Applied to a blockchain system, the blockchain system includes multiple group nodes, the multiple group nodes include at least a group master node, a pre-selected situation awareness client node and a pre-selected situation awareness node, the method includes: The group leader node decrypts the block to obtain the plaintext instructions corresponding to all transaction information in the block; The situation awareness client node obtains the plaintext instructions corresponding to all transaction information in the block and a pre-set smart contract, wherein the smart contract is set with matching rules for abnormal transactions; The situation awareness client node sends the plaintext instructions corresponding to all transaction information and the smart contract to all situation awareness nodes, so that all situation awareness nodes match the plaintext instructions corresponding to each transaction information with the matching rules of abnormal transactions in the smart contract, and vote on whether each transaction information is an abnormal transaction based on the matching results; If, within a preset time period, the number of nodes that voted consistently for each transaction information exceeds a preset number of the total number of all situation awareness nodes, the situation awareness client node determines whether each transaction information is an abnormal transaction based on the voting results for each transaction information; The block uses a group signature to verify the consensus, wherein the group signature is associated with at least a group parameter and a group private key, and the group parameter of each block is different; The group leader node decrypts the block, including: The group master node uses the group parameters and group private key in the group signature to restore the partial user private key corresponding to each transaction information in the block; The group leader node uses the partial user private key corresponding to each transaction information to obtain the complete user private key corresponding to each transaction information from the local encrypted database; The group leader node decrypts each transaction information in the block using the complete user private key corresponding to each transaction information; The group master node uses the group parameters and the group private key in the group signature to restore the partial user private key corresponding to each transaction information in the block, including: The group master node deduces the partial user private key corresponding to each transaction information in the block based on an association function formula, the group parameters in the group signature, and the group private key, wherein the association function formula records a functional relationship between the partial user private key, the group parameters, and the group private key.
2. The method according to claim 1, wherein: The voting results include whether the transaction is a normal transaction or an abnormal transaction; The situation awareness client node determines whether each transaction information is an abnormal transaction based on the voting result of each transaction information, including: If the number of nodes in all situation awareness nodes that determine that each transaction information is a normal transaction exceeds a preset number of the total number of all situation awareness nodes, the situation awareness client node determines that each transaction is a normal transaction; and / or, If the number of nodes among all situational awareness nodes that determine that each transaction information belongs to a normal transaction does not exceed a preset number of the total number of all situational awareness nodes, or the number of nodes among all situational awareness nodes that determine that each transaction information belongs to an abnormal transaction exceeds a preset number of the total number of all situational awareness nodes, then the situational awareness client node determines that each transaction is an abnormal transaction.
3. The method according to claim 1, characterized in that The plurality of group nodes further include a pre-selected verification node, wherein the method of pre-selecting the situation awareness node, the situation awareness client node, and the verification node includes: The group leader node sorts the nodes in the node candidate pool according to resource configuration; The group leader node selects multiple verification nodes and multiple situation awareness nodes with matching resource configurations from the node candidate pool at one time according to the sorting result; The group leader node selects a first preset number of situation awareness client nodes from the multiple situation awareness nodes.
4. The method according to claim 3, characterized in that The group leader node selects multiple verification nodes and multiple situation awareness nodes with matching resource configurations from the node candidate pool at one time according to the sorting result, including: The group leader node selects a plurality of verification nodes and a plurality of situation awareness nodes with matching resource configurations from the node candidate pool at one time according to the parity order of the nodes in the node candidate pool.
5. The method according to claim 3, characterized in that The group leader node is an independent node different from the situation awareness node, the situation awareness client node and the verification node.
6. The method according to claim 1, characterized in that The group nodes also include pre-selected verification nodes; The block is the block after the verification node verifies the consensus; or, The block is the block before the verification node verifies the consensus.
7. The method according to claim 6, characterized in that After the situation awareness client node determines an abnormal transaction in a block, the method further includes: The situation awareness client node sends abnormal transactions to the verification node, causing the verification node to call the corresponding defense contract.
8. The method according to claim 1, characterized in that After the situation awareness client node determines whether each transaction information is an abnormal transaction based on a voting result of each transaction information, the method further includes: The situation awareness client node updates the weight of each situation awareness node according to the voting result of each transaction information; The situation awareness client node sorts all situation awareness nodes according to the updated weights; After the preset number of rounds of voting are completed, the situation awareness client node eliminates a second preset number of situation awareness nodes according to the sorting results.
9. The method according to claim 8, characterized in that After the situation awareness client node eliminates a second preset number of situation awareness nodes according to the sorting result, the method further includes: The group leader node selects a second preset number of new situation awareness nodes with the highest ranking from the node candidate pool according to the ranking result of the candidate node resource configuration.
10. The method according to claim 1, characterized in that The smart contract is pre-set by the group master node, and the group master node stores the pre-set smart contract locally on the group master node, or locally on the situation awareness client node.
11. The method according to claim 1, wherein The plurality of group nodes further include a plurality of user nodes, and the method further includes: The group leader node receives the registration information sent by the user node and allocates a corresponding user private key to each user node according to the registration information, wherein the registration information is associated with the unique identity identification code of the user node; The group leader node associates and stores the unique identity identification code of each user node and the corresponding user private key in a local encrypted database.
12. The method according to claim 1, characterized in that Before the group leader node decrypts the block, the method further includes: The group master node presets system parameters and generates a group public key and a group private key according to the system parameters; The group master node stores the group public key and the group private key in a local encrypted database.
13. The method according to any one of claims 1 to 12, characterized in that The matching rules for abnormal transactions include: At least one of reentrancy attack, permission control, integer overflow, unchecked call return value, transaction order dependency, timestamp dependency, race condition, short address attack, and predictable random processing events.
14. A computer device comprising a processor, characterized in that: When executing the computer program stored in the memory, the processor is used to implement the situational awareness method based on the blockchain system as described in any one of claims 1 to 13.
15. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, it is used to implement the situational awareness method based on the blockchain system as described in any one of claims 1 to 13.
Citation Information
Patent Citations
Transaction monitoring method, device and equipment based on block chain and storage medium
CN109670950A
Transaction consensus method and device, electronic equipment and readable storage medium
CN112037062A
Electronic voting method and device based on group signatures, electronic equipment and storage medium
CN112600675A