Abnormality detection model training method and device, anomaly detection method and device, medium and equipment

By performing fault injection and abnormal analysis on the blockchain system, combined with training of deep learning models, the problem of abnormal detection of blockchain systems in the existing technology is solved, efficient detection of various abnormal scenarios is achieved, and the stability of the system is ensured. Sex and reliability.

CN118964149APending Publication Date: 2024-11-15TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310541414.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-05-15
Publication Date
2024-11-15

AI Technical Summary

Technical Problem

The existing blockchain system abnormality detection methods are difficult to effectively train and detect models for various abnormal scenarios, resulting in difficulty in ensuring system stability and reliability.

Method used

By obtaining pre-arranged information of multiple fault scenarios, the blockchain system is injected, the blockchain status information is obtained, the exception analysis and hierarchical sampling is performed, the deep learning model is input for abnormal detection and processing, and the model is adjusted based on the detection information. , build a trained anomaly detection model.

Benefits of technology

It improves the detection accuracy and generalization capabilities of the model, can efficiently detect abnormalities in various fault scenarios, and ensures the reliability and stability of the blockchain system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118964149A_ABST
    Figure CN118964149A_ABST
Patent Text Reader

Abstract

The invention discloses an anomaly detection model training method and device, an anomaly detection method and device, a medium and equipment, and relates to the technical field of blockchains, and the anomaly detection model training method comprises the steps: carrying out the fault injection of a plurality of blockchain systems based on a plurality of pieces of fault scene information, and obtaining a plurality of pieces of blockchain state information; performing exception analysis on the plurality of block chain systems according to the plurality of pieces of block chain state information, and determining exception reference information corresponding to each piece of block chain state information in the plurality of pieces of block chain state information; stratified sampling is carried out on the state information of each block chain to obtain at least one piece of corresponding state feature information; inputting the corresponding at least one piece of state feature information into a deep learning model for anomaly detection processing to obtain anomaly detection information; and adjusting the deep learning model based on the corresponding anomaly reference information and anomaly detection information to obtain a trained anomaly detection model. The anomaly detection model obtained by the invention can effectively detect anomalies in various fault scenes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of blockchain technology, and specifically to the training of anomaly detection models and anomaly detection methods, devices, media and equipment. Background Art

[0002] The growing demand for secure, transparent and efficient data exchange and information management has promoted the widespread application of blockchain technology, and the testing requirements for blockchain systems have also been continuously improved. In the related technologies, there is no effective means to train and detect models for various abnormal scenarios based on artificial intelligence technology, making it difficult to ensure the stability and reliability of blockchain systems. Summary of the invention

[0003] In order to effectively detect anomalies in blockchain systems, this application provides anomaly detection model training and anomaly detection method, device, medium and equipment. The technical solution is as follows:

[0004] In a first aspect, the present application provides a method for training an anomaly detection model, the method comprising:

[0005] Get information about multiple pre-programmed fault scenarios;

[0006] Based on the multiple fault scenario information, fault injection is performed on multiple blockchain systems to obtain multiple blockchain status information; the multiple blockchain systems, the multiple fault scenario information and the multiple blockchain status information correspond one to one;

[0007] According to the multiple blockchain state information, perform abnormal analysis on the multiple blockchain systems to determine abnormal reference information corresponding to each blockchain state information in the multiple blockchain state information;

[0008] Performing layered sampling on each blockchain state information in the plurality of blockchain state information to obtain at least one state feature information corresponding to each blockchain state information;

[0009] Input at least one state feature information corresponding to each blockchain state information into a deep learning model, perform anomaly detection processing, and obtain anomaly detection information;

[0010] Based on the abnormal reference information corresponding to each blockchain status information and the abnormal detection information, the deep learning model is adjusted to obtain a trained abnormal detection model.

[0011] In a second aspect, the present application provides an anomaly detection method, the method comprising:

[0012] Obtain the blockchain status information corresponding to the blockchain system;

[0013] Performing layered sampling on the blockchain state information to obtain at least one state feature information;

[0014] The at least one state information is input into an anomaly detection model to perform anomaly detection processing to obtain anomaly detection information. The anomaly detection model is obtained by training a deep learning model using the training method of the anomaly detection model described in the first aspect.

[0015] In a third aspect, the present application provides a training device for an anomaly detection model, the device comprising:

[0016] A fault scenario information acquisition module is used to acquire multiple pre-arranged fault scenario information;

[0017] A fault injection module, used to perform fault injection on multiple blockchain systems based on the multiple fault scenario information to obtain multiple blockchain status information; the multiple blockchain systems, the multiple fault scenario information and the multiple blockchain status information correspond one to one;

[0018] An abnormality analysis module is used to perform abnormality analysis on the multiple blockchain systems according to the multiple blockchain status information, and determine abnormal reference information corresponding to each blockchain status information in the multiple blockchain status information;

[0019] A stratified sampling module, used to perform stratified sampling on each blockchain state information in the plurality of blockchain state information to obtain at least one state feature information corresponding to each blockchain state information;

[0020] A model detection module, used to input at least one state feature information corresponding to each blockchain state information into a deep learning model, perform anomaly detection processing, and obtain anomaly detection information;

[0021] The model adjustment module is used to adjust the deep learning model based on the abnormal reference information corresponding to each blockchain state information and the abnormal detection information to obtain a trained abnormal detection model.

[0022] In a fourth aspect, the present application provides an abnormality detection device, the device comprising:

[0023] The blockchain status information acquisition module is used to obtain the blockchain status information corresponding to the blockchain system;

[0024] A state characteristic information determination module, used to perform layered sampling on the blockchain state information to obtain at least one state characteristic information;

[0025] The anomaly detection module is used to input the at least one state information into the anomaly detection model, perform anomaly detection processing, and obtain anomaly detection information.

[0026] In a fifth aspect, the present application provides a computer-readable storage medium, which stores at least one instruction or at least one program, and the at least one instruction or at least one program is loaded and executed by a processor to implement a training method for an anomaly detection model as described in the first aspect or an anomaly detection method as described in the second aspect.

[0027] In a sixth aspect, the present application provides a computer device, comprising a processor and a memory, wherein the memory stores at least one instruction or at least one program, and the at least one instruction or at least one program is loaded and executed by the processor to implement a training method for an anomaly detection model as described in the first aspect or an anomaly detection method as described in the second aspect.

[0028] In a seventh aspect, the present application provides a computer program product, which includes computer instructions, and when the computer instructions are executed by a processor, they implement a training method for an anomaly detection model as described in the first aspect or an anomaly detection method as described in the second aspect.

[0029] The training of the anomaly detection model and the anomaly detection method, device, medium and equipment provided in this application have the following technical effects:

[0030] The solution provided by the present application uses an anomaly detection model based on deep learning to perform anomaly detection on the blockchain system. In the model training stage, multiple pre-arranged fault scenario information is injected into multiple blockchain systems for chaos testing, and multiple blockchain status information of multiple blockchain systems after multiple fault scenario information is injected is obtained; based on multiple blockchain status information, multiple blockchain systems are analyzed for anomalies, and the abnormal reference information corresponding to each blockchain status information is determined; at the same time, each blockchain status information is layered sampled to obtain at least one state feature information corresponding to each blockchain status information; at least one state feature information corresponding to each blockchain status information is input as training data into the deep learning model, so that the deep learning model performs anomaly detection processing based on the state feature information to obtain anomaly detection information; finally, the deep learning model can be adjusted according to the abnormal detection information as the predicted value and the abnormal reference information as the label value to obtain a trained anomaly detection model. In the solution provided in the present application, based on multiple fault scenario information and multiple blockchain status information in the chaos testing process, model training data is constructed, including status feature information and abnormal reference information, which can improve the fault scenario coverage of the training data, thereby improving the detection accuracy and generalization ability of the model, and can efficiently detect anomalies in various fault scenarios; in the solution provided in the present application, by performing stratified sampling on each blockchain status information to obtain more representative training data, the accuracy and reliability of the model are further improved, and then the anomaly detection model can be used to ensure the reliability and stability of the blockchain system.

[0031] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present application or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0033] Figure 1 It is a schematic diagram of a blockchain system provided by an embodiment of the present application;

[0034] Figure 2 It is a flowchart of a training method for an anomaly detection model provided in an embodiment of the present application;

[0035] Figure 3 This is a schematic diagram of a fault injection process provided by an embodiment of the present application;

[0036] Figure 4 It is a schematic diagram of a process of abnormal analysis provided by an embodiment of the present application;

[0037] Figure 5 It is a schematic diagram of a stratified sampling process provided in an embodiment of the present application;

[0038] Figure 6 It is a schematic diagram of a model verification process provided by an embodiment of the present application;

[0039] Figure 7 This is a schematic diagram of a fault reproduction process provided by an embodiment of the present application;

[0040] Figure 8 It is a schematic diagram of an implementation in a specific application scenario provided by an embodiment of the present application;

[0041] Fig. 9 This is a schematic diagram of implementing fault injection in a specific application scenario provided by an embodiment of the present application;

[0042] Fig.10 It is a schematic diagram of implementing state detection and abnormality analysis in a specific application scenario provided by an embodiment of the present application;

[0043] Fig.11 It is a schematic diagram of implementing model verification in a specific application scenario provided by an embodiment of the present application;

[0044] Fig.12 It is a flowchart of an anomaly detection method provided in an embodiment of the present application;

[0045] Fig.13 is a schematic diagram of a training device for an anomaly detection model provided in an embodiment of the present application;

[0046] Fig.14 is a schematic diagram of an abnormality detection device provided in an embodiment of the present application;

[0047] Fig.15 It is a schematic diagram of the hardware structure of a device for implementing a training method for an anomaly detection model or an anomaly detection method provided in an embodiment of the present application. DETAILED DESCRIPTION

[0048] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work belong to the scope of protection of this application. Examples of the embodiments are shown in the drawings, where the same or similar reference numerals throughout represent the same or similar elements or elements with the same or similar functions.

[0049] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or server that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0050] It is understandable that in the specific implementation of this application, related data such as user information is involved. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.

[0051] The cross-chain transaction processing method of the embodiment of the present application involves blockchain technology. Blockchain is a new application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, the platform product service layer, and the application service layer.

[0052] The underlying blockchain platform can include processing modules such as user management, basic services, smart contracts, and operational detection. Among them, the user management module is responsible for the identity information management of all blockchain participants. Including maintaining public and private key generation (account management), key management, and maintaining the correspondence between the user's real identity and the blockchain address (authority management), etc., and under authorization, supervising and auditing the transactions of certain real identities, and providing risk control rule configuration (risk control audit): The basic service module is deployed on all blockchain node devices to verify the validity of business requests, and record the valid requests to the storage after consensus is reached. For a new business request, the basic service first adapts the interface to parse and authenticate (interface adaptation), and then encrypts the business information through the consensus algorithm (consensus management), and transmits the complete and consistent information after encryption. The smart contract module is responsible for the registration and issuance of contracts, as well as contract triggering and contract execution. Developers can define the contract logic in a programming language and publish it to the blockchain (contract registration). According to the logic of the contract terms, the key or other events are called to trigger the execution and complete the contract logic. It also provides the function of contract upgrade and cancellation. The operation detection module is mainly responsible for the deployment, configuration modification, contract setting, cloud adaptation and real-time status visualization output of the product during the product release process, such as alarm, network status detection, node equipment health status detection, etc.

[0053] The platform product service layer provides the basic capabilities and implementation framework of typical applications. Developers can superimpose business features based on these basic capabilities to complete the blockchain implementation of business logic. The application service layer provides application services based on blockchain solutions for business participants to use.

[0054] The system involved in the embodiment of the present invention may be a distributed system formed by connecting a client and multiple nodes (any form of computing devices in the access network, such as a server and a user terminal) through network communication. Figure 1 , Figure 1 This is an optional structural diagram of the distributed system 100 provided by the embodiment of the present invention applied to the blockchain system. It is formed by multiple nodes (any form of computing devices in the access network, such as servers and user terminals) and clients, and the nodes form a peer-to-peer (P2P, PeerToPeer) network. The P2P protocol is an application layer protocol running on the Transmission Control Protocol (TCP, Transmission Control Protocol) protocol. In a distributed system, any machine such as a server or a terminal can join and become a node. The node includes a hardware layer, an intermediate layer, an operating system layer, and an application layer.

[0055] See also Figure 1 The functions of each node in the blockchain system shown include:

[0056] 1) Routing: a basic function of a node, used to support communication between nodes.

[0057] 2) Applications are deployed in the blockchain to implement specific businesses based on actual business needs, record data related to the implementation of functions to form record data, carry digital signatures in the record data to indicate the source of the task data, and send the record data to other nodes in the blockchain system for other nodes to add the record data to a temporary block when they successfully verify the source and integrity of the record data.

[0058] For example, the services implemented by the application include:

[0059] 2.1) Wallet, used to provide the function of conducting electronic currency transactions, including initiating transactions (i.e., sending the transaction record of the current transaction to other nodes in the blockchain system. After the other nodes successfully verify the transaction, as a response to acknowledge the validity of the transaction, the transaction record data is stored in the temporary block of the blockchain; of course, the wallet also supports querying the remaining electronic currency in the electronic currency address;

[0060] 2.2) Shared ledger, which is used to provide functions such as storage, query and modification of account data. The record data of the operation on the account data is sent to other nodes in the blockchain system. After other nodes verify the validity, as a response to acknowledging the validity of the account data, the record data is stored in a temporary block, and a confirmation can also be sent to the node that initiated the operation.

[0061] 2.3) Smart contracts are computerized protocols that can execute the terms of a contract. They are implemented by deploying code on a shared ledger that is executed when certain conditions are met. The code is used to complete automated transactions based on actual business needs, such as querying the logistics status of the goods purchased by the buyer and transferring the buyer's electronic currency to the merchant's address after the buyer signs for the goods. Of course, smart contracts are not limited to executing contracts for transactions, but can also execute contracts for processing received information.

[0062] 3) Blockchain, including a series of blocks that are connected to each other in the order of their generation. Once a new block is added to the blockchain, it will not be removed. The block records the record data submitted by the nodes in the blockchain system.

[0063] The embodiments of the present application can also be implemented in combination with cloud technology. Cloud technology refers to a hosting technology that unifies a series of resources such as hardware, software and network in a wide area network or a local area network to realize data calculation, storage, processing and sharing. It can also be understood as a general term for network technology, information technology, integration technology, management platform technology and application technology based on cloud computing business model applications. Cloud technology needs to be supported by cloud computing. Cloud computing is a computing model that distributes computing tasks on a resource pool composed of a large number of computers, so that various application systems can obtain computing power, storage space and information services as needed. The network that provides resources is called a "cloud".

[0064] Figure 2 It is a flowchart of a training method for an anomaly detection model provided in an embodiment of the present application. The present application provides method operation steps as described in the embodiment or flowchart, but may include more or fewer operation steps based on conventional or non-creative labor. The order of steps listed in the embodiment is only one way of executing the steps among many orders, and does not represent the only order of execution. When the actual system or server product is executed, it can be executed in sequence or in parallel according to the method shown in the embodiment or the accompanying drawings (for example, in a parallel processor or multi-threaded processing environment). Please refer to Figure 2 , a training method for an anomaly detection model provided in an embodiment of the present application may include the following steps:

[0065] S210: Acquire multiple pre-arranged fault scenario information.

[0066] In an embodiment of the present application, fault scenario information of each of the pre-arranged multiple fault scenarios is obtained. Each fault scenario may include at least one exception type, such as network exceptions generated by the server, disk read and write exceptions, DNS (Domain Name System) exceptions, blockchain node crashes, node data loss, new consensus nodes, blockchain consensus exceptions, version compatibility issues, etc. The fault scenario information is a specific description of the included exception types, and is also the information to be used to add disturbances to the blockchain system.

[0067] S220: Based on the multiple fault scenario information, fault injection is performed on the multiple blockchain systems to obtain multiple blockchain status information.

[0068] In the embodiment of the present application, a fault test is performed based on a chaos engineering method and multiple blockchain status information generated during the fault test is obtained. Multiple blockchain systems, multiple fault scenario information and multiple blockchain status information correspond one to one. Multiple blockchain systems can have different blockchain applications, different consensus types or different numbers of nodes. Among them, Chaos Engineering is a systematic stability guarantee method that actively introduces abnormal states (disturbances) of software or hardware into the system, creates fault scenarios, and determines the system optimization strategy based on the behavior of the system under various pressures. That is, in the embodiment of the present application, multiple fault scenario information is used to inject faults into multiple blockchain systems, and the system performance of the blockchain system after the fault is injected is used as the corresponding blockchain status information. The blockchain status information may include system operation status information and business processing status information. The system operation status information represents the performance of the blockchain system's software and hardware, and the business processing status information represents the processing performance of the blockchain system for the business and applications it carries.

[0069] In one embodiment of the present application, specifically, Figure 3 As shown, step S220 may include:

[0070] S310: Determine the correspondence between multiple blockchain systems and multiple fault scenario information.

[0071] That is, the corresponding fault scenario information to be injected is determined for each blockchain system, so as to perform chaos testing on a blockchain system based on a fault scenario information. Multiple blockchain systems can be blockchain systems in the test environment to avoid affecting the blockchain system in the production environment.

[0072] S320: Based on the corresponding relationship and the fault injection conditions corresponding to the multiple fault scenario information, the multiple fault scenario information are respectively injected into the corresponding blockchain system.

[0073] The fault injection conditions corresponding to the fault scenario information can specify the injection objects, such as a single node, multiple nodes, clients, etc. of the blockchain, and can also specify the time of each injection.

[0074] S330: Obtain multiple blockchain status information corresponding to multiple blockchain systems within a target time period before and after the injection of multiple fault scenario information.

[0075] Implement status detection on multiple blockchain systems in advance. For example, you can use GRPC (Google Remote Procedure Call) to perform real-time detection on the nodes in the blockchain system and collect relevant information of the nodes, such as memory status information, disk status information, network status information, node consensus status information, blockchain configuration information, etc.

[0076] The target time period refers to the time from a certain moment before the fault scenario information is injected to a certain moment after the fault scenario is injected. The appropriate time length can collect more valid status information.

[0077] In the above embodiment, based on the one-to-one correspondence between the fault scenario information and the blockchain system, the fault scenario information is injected into the corresponding blockchain system, and the blockchain status information before and after the injection is obtained, so that the blockchain status information can be used to indicate the impact of the injection of the fault scenario information on the corresponding blockchain system, so as to extract the anomaly caused by the injection of the fault scenario information from the blockchain status information.

[0078] In one embodiment of the present application, the multiple blockchain status information corresponding to the multiple blockchain systems includes the business processing status information of the multiple blockchain systems and the system operation status information of the multiple blockchain systems, wherein the business processing status information can be obtained by means of traffic playback. Specifically, the following steps may be included:

[0079] S331: within the target time period, batch simulated business requests are sent to multiple blockchain systems to obtain business processing status information of the multiple blockchain systems.

[0080] The batch simulated business requests are used as the playback traffic, so that multiple blockchain systems respond to the batch simulated business requests to perform business processing, thereby obtaining business processing status information in the business processing process of multiple blockchain systems, wherein the business processing status information may include business records, business types, processing time, generated block identifiers and volumes, etc. It is feasible that the batch simulated business request may include multiple business request sets, each of which has the same business type, and the business request set is sent to the blockchain system corresponding to the business type.

[0081] S331: Obtain system operation status information of multiple blockchain systems within a target time period.

[0082] Implement status detection on multiple blockchain systems in advance. For example, you can use GRPC (Google Remote Procedure Call) to perform real-time detection on the nodes in the blockchain system and collect relevant information about the nodes. You can also obtain system operation status information of the blockchain system by reading server hardware information, network information, and log information.

[0083] In the above embodiment, business processing status information and system operation status information are obtained by means of traffic playback, so as to achieve comprehensive and effective detection of blockchain system status information before and after the injection of fault scenario information. The obtained blockchain status information can accurately and effectively indicate the impact of the injection of fault scenario information on the blockchain series, thereby making the model training data constructed according to the blockchain status information more effective and accurate.

[0084] S230: Perform an abnormality analysis on multiple blockchain systems according to multiple blockchain status information, and determine abnormal reference information corresponding to each blockchain status information in the multiple blockchain status information.

[0085] In an embodiment of the present application, any blockchain status information includes system operation status information and business processing status information of the corresponding blockchain system within a target time period, and the target time period is a period of time before and after the corresponding fault scenario information is injected.

[0086] In one embodiment of the present application, the abnormal reference information corresponding to the blockchain state information is determined according to the time series changes of the blockchain state information within the target time period. Figure 4 As shown, step S230 may include the following steps:

[0087] S410: Determine the first system operation status information corresponding to each blockchain status information and the second system operation status information corresponding to each blockchain status information.

[0088] The first system operation status information represents the system operation status of the corresponding blockchain system before the corresponding fault scenario information is injected; the second system operation status information represents the system operation status of the corresponding blockchain system after the corresponding fault scenario information is injected.

[0089] S420: Compare and analyze the first system operation status information corresponding to each blockchain status information and the second system operation status information corresponding to each blockchain status information to determine the first abnormal reference information corresponding to each blockchain status information.

[0090] For example, after comparing the first system operation status information corresponding to the blockchain status information and the corresponding first system operation status information, it is found that the difference between the memory occupancy rate of the same node before and after the injection of the fault scenario information exceeds the preset threshold, then it can be determined that the injection of the fault scenario information has caused the memory occupancy abnormality of the node, then the first exception reference information may include the node identifier of the node and the exception type of the node is memory occupancy abnormality.

[0091] S430: Determine the first business processing status information corresponding to each blockchain status information and the second business processing status information corresponding to each blockchain status information.

[0092] The first business processing status information represents the business processing status of the corresponding blockchain system before the corresponding fault scenario information is injected; the second business processing status information represents the business processing status of the corresponding blockchain system after the corresponding fault scenario information is injected.

[0093] S440: Compare and analyze the first business processing status information corresponding to each blockchain status information and the second business processing status information corresponding to each blockchain status information to determine the second abnormal reference information corresponding to each blockchain status information.

[0094] For example, after comparing the first business processing status information corresponding to the blockchain status information and the corresponding business processing status information, it is found that the difference in block volume generated by processing businesses of the same business type before and after the injection of the fault scenario information exceeds a preset threshold, then it can be determined that the injection of the fault scenario information has caused an abnormality in the generation of blocks in the blockchain system, and the second abnormality reference information may include the block identifier of the block and the abnormality type of the block is a block volume abnormality.

[0095] The above-mentioned abnormal reference information includes first abnormal reference information and second abnormal reference information.

[0096] In the above embodiment, by comparing the system operation status information before and after the injection of the fault scenario information and comparing the business processing status information before and after the injection of the fault scenario information, the system operation anomaly and business processing anomaly caused by the injection of the fault scenario information can be determined. At the same time, the abnormal reference information including the first abnormal reference information and the second abnormal reference information can be used as annotation information for model training to guide the model to perform supervised learning.

[0097] In another embodiment of the present application, anomaly detection of information data can also be performed based on statistical methods. Generally, a data model is learned and constructed based on system operation status information and business processing status information, respectively, and data in a low-probability area of ​​the data model is taken as abnormal data, and information such as abnormal objects and abnormal types is further determined based on the abnormal data.

[0098] S240: Perform layered sampling on each blockchain state information in the multiple blockchain state information to obtain at least one state feature information corresponding to each blockchain state information.

[0099] In the embodiment of the present application, considering that the blockchain state information contains multiple types of data information, but not all data information can indicate abnormal situations, if all blockchain states are directly used as input data for model training, there will be a lot of data redundancy, low model training efficiency, and poor accuracy. Therefore, by performing stratified sampling on each blockchain state information, state feature information that can better indicate abnormal situations can be obtained, and using the state feature information as training data can further improve the accuracy and reliability of model training.

[0100] In one embodiment of the present application, specifically, Figure 5 As shown, step S240 may include:

[0101] S510: Determine at least one sampling dimension, at least one sub-sampling dimension corresponding to each sampling dimension, and at least one sampling attribute corresponding to each sub-sampling dimension.

[0102] S520: Based on at least one sampling dimension, divide each blockchain state information to obtain at least one first state information set corresponding to each blockchain state information.

[0103] S530: Based on at least one sub-sampling dimension corresponding to each sampling dimension, divide at least one first state information set corresponding to each blockchain state information to obtain at least one second state information set corresponding to each blockchain state information.

[0104] S540: Based on at least one sampling attribute corresponding to each sub-sampling dimension, divide at least one second state information set corresponding to each blockchain state information to obtain at least one third state information set corresponding to each blockchain state information.

[0105] S550: Randomly sample from at least one third state information set to obtain at least one state characteristic sub-information corresponding to each blockchain state information.

[0106] Feasibly, a random number of samples can be taken from each third state information set, or the number of samples can be determined based on the proportion of the third state information set in the entire blockchain state information, and the sampled number of information can be randomly extracted from the third state information set.

[0107] S560: Based on at least one sampling attribute, concatenate at least one corresponding state feature sub-information to obtain a state feature information corresponding to each blockchain state information.

[0108] Among them, the sampling dimension may include but is not limited to the system hardware dimension, business dimension, protocol dimension, time dimension, etc. The sub-sampling dimension corresponding to the hardware dimension may include but is not limited to the server, client, etc. The business dimension may include but is not limited to the business type, business quantity, business processing time, etc. The protocol dimension may include but is not limited to the consensus type, consensus status, etc.; illustratively, the sampling attributes corresponding to the server may include but are not limited to memory, network, disk, and the sampling attributes corresponding to the business type may include but are not limited to transfer business, contract business, etc. It can be understood that the sampling dimension, sub-sampling dimension and sampling attribute constitute a multi-level data classification method. Based on the multi-level data classification method, at least one third state information set corresponding to each blockchain state information is obtained, and then sampling is performed from the third state information set to obtain a corresponding state feature information that is more representative.

[0109] In the above embodiment, by performing stratified sampling on each blockchain state information, state feature information that can better indicate abnormal situations is obtained, and using the state feature information as training data can further improve the accuracy and reliability of model training.

[0110] S250: Input at least one state feature information corresponding to each blockchain state information into the deep learning model, perform anomaly detection processing, and obtain anomaly detection information.

[0111] In an embodiment of the present application, a suitable deep learning model structure can be selected based on requirements such as the dimension corresponding to the state feature information, the dimension of the model output, and whether the state feature information has time series. For example, a multi-layer convolutional neural network and a recurrent neural network can be combined to adaptively process different types of state feature information.

[0112] In the embodiment of the present application, the anomaly detection information is the abnormal result predicted by the deep learning model based on each state feature information, which can indicate the abnormal object, abnormal type, abnormal cause, etc. In the model training stage, the anomaly detection information is a predicted value, which is the same type and composition of data as the abnormal reference information as the annotation value.

[0113] S260: Based on the abnormal reference information and abnormal detection information corresponding to each blockchain status information, the deep learning model is adjusted to obtain a trained abnormal detection model.

[0114] In the embodiment of the present application, the loss value is calculated based on the anomaly detection information obtained based on at least one state feature information corresponding to each blockchain state information and the anomaly reference information corresponding to each blockchain state information, and the model parameters are continuously adjusted based on the loss value and the back propagation algorithm. When the loss value meets the preset threshold condition, the training is completed to obtain the anomaly detection model. Since multiple blockchain state information covers multiple fault scenarios, the training data constructed based on multiple blockchain state information has a high fault scenario coverage rate, so that the trained anomaly detection model has high detection accuracy and generalization ability, and can efficiently detect anomalies in various fault scenarios.

[0115] After deploying the anomaly detection models to the production environment, such as Figure 6 As shown, the method provided in the embodiment of the present application may also include:

[0116] S610: Determine a test data set from at least one state feature information corresponding to each blockchain state information, where the test data set includes at least one test case.

[0117] S620: Based on at least one test case, verify the anomaly detection model to obtain a verification result of the anomaly detection model.

[0118] S630: Optimize the anomaly detection model according to the verification result to obtain a target anomaly detection model adapted to the production environment.

[0119] Before the model is applied, the trained anomaly detection model needs to be verified, also known as model testing, to better measure the model performance. Model verification can measure the accuracy of data analysis, the rationality of model design, the effectiveness and stability of the development process and results, and whether the model conforms to business logic and regulatory requirements.

[0120] When determining the test data set, you can select matching state feature information as test cases based on the number of nodes, consensus type, business type, etc. corresponding to the blockchain system in the production environment, and optimize the anomaly detection model based on the verification results corresponding to the test cases, such as adjusting the model structure, adjusting the model learning rate, increasing regularization, etc., so that the optimized target anomaly detection model can better meet the anomaly detection needs of the blockchain system in the production environment.

[0121] In the above embodiment, by performing model verification in a production environment, the detection performance of the model can be improved, anomaly detection can be better performed for the blockchain system in the production environment, and the stability of the system can be ensured.

[0122] The embodiment of the present application uses the failure test based on chaos engineering to build model training data. Conversely, the anomaly detection information of the model training process can also be used to measure the effectiveness of the failure test and mark the failure test that needs to be retried. Specifically, Figure 7 As shown, the method provided in the embodiment of the present application may also include:

[0123] S710: Perform difference analysis based on the abnormal reference information and abnormal detection information corresponding to each blockchain status information to obtain the abnormal detection analysis information corresponding to each blockchain status information.

[0124] S720: Based on the anomaly detection and analysis information corresponding to each blockchain state information and the preset difference conditions, determine the target blockchain state information and the target fault scenario information corresponding to the target blockchain state information, and the anomaly detection and analysis information corresponding to the target blockchain state information meets the preset difference conditions.

[0125] The anomaly detection analysis information can characterize the degree of consistency between the anomaly reference information and the anomaly detection information. The preset difference condition defines the minimum consistency level that must be met between the anomaly reference information and the anomaly detection information. When the anomaly detection analysis information does not meet the minimum level defined by the preset difference condition, the target fault scenario information corresponding to the corresponding target blockchain state information is used as the fault scenario information that requires re-fault injection.

[0126] S730: Reset the target blockchain system corresponding to the target blockchain state information.

[0127] Resetting the target blockchain system may include restoring the system software and hardware configuration to the initial state, clearing the business data generated by the previous round of fault testing, and replaying the business traffic in the current round of fault testing.

[0128] S740: Re-inject the target fault scenario information into the corresponding target blockchain system to update the target blockchain status information.

[0129] In the above embodiment, the effectiveness of the fault test is measured by using the abnormal reference information and abnormal detection information in the model training phase, so that the fault test can be reproduced in a targeted manner and the data accuracy of the fault test can be improved.

[0130] Figure 8 is a schematic diagram of a specific application scenario provided by an embodiment of the present application, such as Figure 8As shown, multiple fault scenario information is pre-arranged, and the fault types corresponding to the fault scenario information can be data tampering, AWS (Amazon Web Services, a network service) fault, network fault, process fault, etc. Different fault scenario information is injected into multiple pre-deployed blockchain systems. Different blockchain systems can be composed of different numbers of nodes, and the node consensus types can also be different. The injected faults can be specified in an orchestrated manner, such as Fig. 9 As shown, the fault scenario information can be sent to a single node in the blockchain system, to multiple nodes in the blockchain system, to a server in the blockchain system, etc. Before and after the fault scenario information is injected, each blockchain system also processes the simulated business request accordingly. Fig.10 As shown in the figure, according to the injection method of fault scenario information, the status information of single node, multiple nodes and server is detected as the blockchain status information of the corresponding blockchain system, and then the blockchain status information is analyzed abnormally and the characteristic information is sampled, and the following is obtained: Figure 8 The abnormal reference information corresponding to each blockchain state information and at least one state feature information corresponding to each blockchain state information are shown. Taking the business processing state information in the blockchain state information as an example, stratified sampling can be performed according to the height of the generated block, the business type, and the business processing time in the business processing process. For example, the blockchain business is stratified according to the block height, and divided into business data sets corresponding to the first 100 blocks, the 100th-200th blocks, and the 200th-300th blocks. The higher the block height, the closer it is to the current business situation; if stratified according to the business type, it can be divided into business data sets corresponding to the transfer business, the accounting business, the contract business, etc., and sampling is performed from each business data set; it can also be stratified according to the business processing time, and multiple business data sets can be divided according to hours, days or weeks. Through stratified sampling, we can better understand the business processing situation before and after the fault scenario is injected, and can effectively mine the abnormal situation, so that the state feature information used as the input of the model training is more representative, and the problem of too many or too few samples of training data is avoided. Finally, based on at least one state feature information corresponding to each blockchain state information, the deep learning model deployed in the blockchain system is trained to obtain the required anomaly detection model. The specific training process can be referred to the above embodiment and will not be described here. Fig.11 As shown, test data sets can also be extracted from training data, and the trained anomaly detection model can be verified and optimized on multiple blockchains in the production environment to improve the performance of the anomaly detection model. A batch of effective test cases can also be precipitated during the verification process.

[0131] Fig.12This is a flowchart of an anomaly detection method provided in an embodiment of the present application. The present application provides method operation steps as described in the embodiment or flowchart, but may include more or fewer operation steps based on conventional or non-creative labor. The order of steps listed in the embodiment is only one way of executing the steps among many orders, and does not represent the only order of execution. When the actual system or server product is executed, it can be executed in sequence or in parallel according to the method shown in the embodiment or the accompanying drawings (for example, in a parallel processor or multi-threaded processing environment). Please refer to Fig.12 , an abnormality detection method provided in an embodiment of the present application may include the following steps:

[0132] S1210: Obtain blockchain status information corresponding to the blockchain system.

[0133] It is feasible to implement status detection on the blockchain system in the production environment. For example, the nodes in the blockchain system can be detected in real time through GRPC (Google Remote Procedure Call), and the relevant information of the nodes and the status information of the blockchain business processed on the nodes can be collected; the system operation status information of the blockchain system can also be obtained by reading the server hardware information, network information and log information.

[0134] S1220: Perform layered sampling on the blockchain status information to obtain at least one status feature information.

[0135] In one embodiment of the present application, the blockchain state information can be regarded as the overall state information of the current blockchain system. In order to match the input of the deployed anomaly detection model, it is necessary to perform targeted stratified sampling on the blockchain state information to extract at least one representative state feature information;

[0136] In another embodiment of the present application, the blockchain status information is specifically acquired according to the input requirements of the deployed anomaly detection model, and there is no need to perform stratified sampling, and the blockchain status information can be directly used as the input of the model.

[0137] S1230: Input at least one state information into an anomaly detection model, perform anomaly detection processing, and obtain anomaly detection information.

[0138] The anomaly detection model is obtained by training the deep learning model using the above-mentioned anomaly detection model training method. The anomaly detection information can indicate the abnormal objects (such as nodes, clients, etc.), abnormal types, abnormal causes, etc. that may exist in the current blockchain system.

[0139] In the above embodiment, the trained anomaly detection model is deployed in the production environment, which can detect anomalies caused by various fault scenarios in a timely and accurate manner, thereby ensuring the stability and accuracy of the operation of the blockchain system in the production environment.

[0140] The acquisition of blockchain status information, stratified sampling and model prediction involved in the above embodiments can be referred to the previous embodiments and will not be repeated here.

[0141] It can be seen from the above embodiments that the solution provided by the present application uses an anomaly detection model based on deep learning to perform anomaly detection on the blockchain system. In the model training stage, multiple pre-arranged fault scenario information is injected into multiple blockchain systems for chaos testing to obtain multiple blockchain status information of multiple blockchain systems after multiple fault scenario information is injected; multiple blockchain status information is analyzed for anomalies to determine the abnormal reference information corresponding to each blockchain status information; at the same time, each blockchain status information is layered sampled to obtain at least one state feature information corresponding to each blockchain status information; at least one state feature information corresponding to each blockchain status information is input as training data into the deep learning model, so that the deep learning model performs anomaly detection processing based on the state feature information to obtain anomaly detection information; finally, the deep learning model can be trained according to the abnormal detection information as the predicted value and the abnormal reference information as the label value to obtain the anomaly detection model. In the solution provided in the present application, based on multiple fault scenario information and multiple blockchain status information in the chaos testing process, model training data is constructed, including status feature information and abnormal reference information, which can improve the fault scenario coverage of the training data, thereby improving the detection accuracy and generalization ability of the model, and can efficiently detect anomalies in various fault scenarios; in the solution provided in the present application, by performing stratified sampling on each blockchain status information to obtain more representative training data, the accuracy and reliability of the model are further improved, and then the anomaly detection model can be used to ensure the reliability and stability of the blockchain system.

[0142] The present application embodiment also provides a training device 1300 for anomaly detection model, such as Fig.13 As shown, the device may include:

[0143] The fault scenario information acquisition module 1310 is used to acquire a plurality of pre-arranged fault scenario information;

[0144] A fault injection module 1320 is used to perform fault injection on multiple blockchain systems based on the multiple fault scenario information to obtain multiple blockchain status information; the multiple blockchain systems, the multiple fault scenario information and the multiple blockchain status information correspond one to one;

[0145] The abnormality analysis module 1330 is used to perform abnormality analysis on the multiple blockchain systems according to the multiple blockchain state information, and determine abnormal reference information corresponding to each blockchain state information in the multiple blockchain state information;

[0146] A stratified sampling module 1340 is used to perform stratified sampling on each blockchain state information in the plurality of blockchain state information to obtain at least one state feature information corresponding to each blockchain state information;

[0147] A model detection module 1350 is used to input at least one state feature information corresponding to each blockchain state information into a deep learning model, perform anomaly detection processing, and obtain anomaly detection information;

[0148] The model adjustment module 1360 is used to adjust the deep learning model based on the abnormal reference information corresponding to each blockchain state information and the abnormal detection information to obtain a trained abnormal detection model.

[0149] In one embodiment of the present application, any blockchain status information includes system operation status information and business processing status information of the corresponding blockchain system within a target time period, and the target time period is a period of time before and after the corresponding fault scenario information is injected. The abnormality analysis module 1330 may include:

[0150] A system operation status information determination unit, used to determine first system operation status information corresponding to each blockchain status information and second system operation status information corresponding to each blockchain status information; the first system operation status information represents the system operation status of the corresponding blockchain system before the corresponding fault scenario information is injected; the second system operation status information represents the system operation status of the corresponding blockchain system after the corresponding fault scenario information is injected;

[0151] A first comparison and analysis unit is used to compare and analyze the first system operation status information corresponding to each blockchain state information and the second system operation status information corresponding to each blockchain state information, and determine the first abnormal reference information corresponding to each blockchain state information;

[0152] A business processing status information determination unit, used to determine first business processing status information corresponding to each blockchain status information and second business processing status information corresponding to each blockchain status information; the first business processing status information represents the business processing status of the corresponding blockchain system before the corresponding fault scenario information is injected; the second business processing status information represents the business processing status of the corresponding blockchain system after the corresponding fault scenario information is injected;

[0153] A second comparison and analysis unit is used to compare and analyze the first business processing state information corresponding to each blockchain state information and the second business processing state information corresponding to each blockchain state information, and determine the second abnormal reference information corresponding to each blockchain state information;

[0154] The exception reference information includes the first exception reference information and the second exception reference information.

[0155] In one embodiment of the present application, the stratified sampling module 1340 may include:

[0156] A dimension attribute determination unit, used to determine at least one sampling dimension, at least one sub-sampling dimension corresponding to each sampling dimension, and at least one sampling attribute corresponding to each sub-sampling dimension;

[0157] A first division unit, configured to divide each blockchain state information based on the at least one sampling dimension to obtain at least one first state information set corresponding to each blockchain state information;

[0158] A second division unit is used to divide at least one first state information set corresponding to each blockchain state information based on at least one sub-sampling dimension corresponding to each sampling dimension to obtain at least one second state information set corresponding to each blockchain state information;

[0159] A third division unit is used to divide the at least one second state information set corresponding to each blockchain state information based on at least one sampling attribute corresponding to each sub-sampling dimension to obtain at least one third state information set corresponding to each blockchain state information;

[0160] A sampling unit, configured to randomly sample from the at least one third state information set to obtain at least one state characteristic sub-information corresponding to each blockchain state information;

[0161] The merging unit is used to splice the corresponding at least one state characteristic sub-information based on the at least one sampling attribute to obtain a state characteristic information corresponding to each blockchain state information.

[0162] In one embodiment of the present application, the device may further include:

[0163] A test case determination unit, configured to determine a test data set from at least one state feature information corresponding to each blockchain state information, wherein the test data set includes at least one test case;

[0164] A model verification unit, configured to verify the anomaly detection model based on the at least one test case to obtain a verification result of the anomaly detection model;

[0165] A model optimization unit is used to optimize the anomaly detection model according to the verification result to obtain a target anomaly detection model adapted to the production environment.

[0166] In one embodiment of the present application, the device may further include:

[0167] A difference analysis unit, configured to perform a difference analysis based on the abnormal reference information corresponding to each blockchain state information and the abnormal detection information, to obtain the abnormal detection analysis information corresponding to each blockchain state information;

[0168] A target fault scenario information determination unit, configured to determine target blockchain state information and target fault scenario information corresponding to the target blockchain state information based on the anomaly detection and analysis information corresponding to each blockchain state information and a preset difference condition, wherein the anomaly detection and analysis information corresponding to the target blockchain state information satisfies the preset difference condition;

[0169] A system resetting unit, used to reset the target blockchain system corresponding to the target blockchain state information;

[0170] A fault re-injection unit is used to re-inject the target fault scenario information into the corresponding target blockchain system to update the target blockchain status information.

[0171] In one embodiment of the present application, the fault injection module 1320 may include:

[0172] An injection relationship determination unit, used to determine the corresponding relationship between the multiple blockchain systems and the multiple fault scenario information;

[0173] A fault scenario information injection unit, configured to inject the multiple fault scenario information into the corresponding blockchain system respectively based on the corresponding relationship and the fault injection conditions corresponding to the multiple fault scenario information;

[0174] A status information acquisition unit is used to obtain the multiple blockchain status information corresponding to the multiple blockchain systems within a target time period before and after the multiple fault scenario information is injected.

[0175] In one embodiment of the present application, the multiple blockchain status information corresponding to the multiple blockchain systems includes business processing status information of the multiple blockchain systems and system operation status information of the multiple blockchain systems, and the status information acquisition unit may include:

[0176] A first acquisition unit is used to send batch simulated business requests to the multiple blockchain systems within the target time period to obtain business processing status information of the multiple blockchain systems;

[0177] The second acquisition unit is used to acquire the system operation status information of the multiple blockchain systems within the target time period.

[0178] It should be noted that the device provided in the above embodiment, when implementing its functions, is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.

[0179] The present application embodiment also provides an abnormality detection device 1400, such as Fig.14 As shown, the device may include:

[0180] The blockchain status information acquisition module 1410 is used to obtain the blockchain status information corresponding to the blockchain system;

[0181] A state characteristic information determination module 1420, configured to perform layered sampling on the blockchain state information to obtain at least one state characteristic information;

[0182] The anomaly detection module 1430 is used to input the at least one state information into an anomaly detection model, perform anomaly detection processing, and obtain anomaly detection information.

[0183] It should be noted that the device provided in the above embodiment, when implementing its functions, is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.

[0184] An embodiment of the present application provides a computer device, which includes a processor and a memory, wherein the memory stores at least one instruction or at least one program, and the at least one instruction or the at least one program is loaded and executed by the processor to implement the training method or the anomaly detection method of the anomaly detection model provided in the above method embodiment.

[0185] Fig.15 A schematic diagram of the hardware structure of a device for implementing the training method of the anomaly detection model or the anomaly detection method provided in the embodiment of the present application is shown, and the device may participate in or include the apparatus or system provided in the embodiment of the present application. Fig.15As shown, the device 10 may include one or more (1002a, 1002b, ..., 1002n are used to illustrate) processors 1002 (the processor 1002 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 1004 for storing data, and a transmission device 1006 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the I / O interface), a network interface, a power supply and / or a camera. It can be understood by those skilled in the art that Fig.15 The structure shown is for illustration only and does not limit the structure of the electronic device. Fig.15 More or fewer components as shown, or with Fig.15 Different configurations are shown.

[0186] It should be noted that the one or more processors 1002 and / or other data processing circuits described above may generally be referred to herein as "data processing circuits". The data processing circuits may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. In addition, the data processing circuit may be a single independent processing module, or may be incorporated in whole or in part into any of the other components in the device 10 (or mobile device). As involved in the embodiments of the present application, the data processing circuit acts as a processor control (e.g., selection of a variable resistor terminal path connected to an interface).

[0187] The memory 1004 can be used to store software programs and modules of application software, such as program instructions / data storage devices corresponding to the methods in the embodiments of the present application. The processor 1002 executes various functional applications and data processing by running the software programs and modules stored in the memory 1004, that is, the training method or the abnormality detection method of the above-mentioned abnormality detection model is realized. The memory 1004 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 1004 may further include a memory remotely arranged relative to the processor 1002, and these remote memories may be connected to the device 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0188] The transmission device 1006 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the device 10. In one example, the transmission device 1006 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 1006 can be a radio frequency (Radio Frequency, RF) module, which is used to communicate with the Internet wirelessly.

[0189] The display may be, for example, a touch screen liquid crystal display (LCD) that may enable a user to interact with a user interface of device 10 (or mobile device).

[0190] An embodiment of the present application also provides a computer-readable storage medium, which can be set in a server to store at least one instruction or at least one program related to the training method of the anomaly detection model or the anomaly detection method in the method embodiment, and the at least one instruction or the at least one program is loaded and executed by the processor to implement the training method of the anomaly detection model or the anomaly detection method provided in the above-mentioned method embodiment.

[0191] Optionally, in this embodiment, the storage medium may be located in at least one of the multiple network servers of the computer network. Optionally, in this embodiment, the storage medium may include, but is not limited to, various media that can store program codes, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.

[0192] The embodiment of the present invention further provides a computer program product or a computer program, wherein the computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the training method of the anomaly detection model or the anomaly detection method provided in the above various optional embodiments.

[0193] It should be noted that the above-mentioned sequence of the embodiments of the present application is for description only and does not represent the advantages and disadvantages of the embodiments. The above-mentioned specific embodiments of the present application are described. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0194] Each embodiment in this application is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device, equipment and storage medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0195] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.

[0196] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.

Claims

1. A training method for an anomaly detection model, characterized in that: The method comprises: Get information about multiple pre-programmed fault scenarios; Based on the multiple fault scenario information, fault injection is performed on multiple blockchain systems to obtain multiple blockchain status information; the multiple blockchain systems, the multiple fault scenario information and the multiple blockchain status information correspond one to one; According to the multiple blockchain state information, perform abnormal analysis on the multiple blockchain systems to determine abnormal reference information corresponding to each blockchain state information in the multiple blockchain state information; Performing layered sampling on each blockchain state information in the plurality of blockchain state information to obtain at least one state feature information corresponding to each blockchain state information; Input at least one state feature information corresponding to each blockchain state information into a deep learning model, perform anomaly detection processing, and obtain anomaly detection information; Based on the abnormal reference information corresponding to each blockchain status information and the abnormal detection information, the deep learning model is adjusted to obtain a trained abnormal detection model.

2. The method according to claim 1, characterized in that Any blockchain status information includes system operation status information and business processing status information of the corresponding blockchain system within a target time period, and the target time period is a period of time before and after the corresponding fault scenario information is injected. The abnormality analysis of the multiple blockchain systems is performed based on the multiple blockchain status information to determine the abnormal reference information corresponding to each blockchain status information in the multiple blockchain status information, including: Determine the first system operation status information corresponding to each blockchain status information and the second system operation status information corresponding to each blockchain status information; the first system operation status information represents the system operation status of the corresponding blockchain system before the corresponding fault scenario information is injected; the second system operation status information represents the system operation status of the corresponding blockchain system after the corresponding fault scenario information is injected; Compare and analyze the first system operation status information corresponding to each blockchain status information and the second system operation status information corresponding to each blockchain status information, and determine the first abnormal reference information corresponding to each blockchain status information; Determine the first business processing state information corresponding to each blockchain state information and the second business processing state information corresponding to each blockchain state information; the first business processing state information represents the business processing state of the corresponding blockchain system before the corresponding fault scenario information is injected; the second business processing state information represents the business processing state of the corresponding blockchain system after the corresponding fault scenario information is injected; Compare and analyze the first business processing state information corresponding to each blockchain state information and the second business processing state information corresponding to each blockchain state information to determine the second abnormal reference information corresponding to each blockchain state information; The exception reference information includes the first exception reference information and the second exception reference information.

3. The method according to claim 1, characterized in that The step of performing layered sampling on each blockchain state information in the plurality of blockchain state information to obtain at least one state feature information corresponding to each blockchain state information includes: Determine at least one sampling dimension, at least one sub-sampling dimension corresponding to each sampling dimension, and at least one sampling attribute corresponding to each sub-sampling dimension; Based on the at least one sampling dimension, each blockchain state information is divided to obtain at least one first state information set corresponding to each blockchain state information; Based on at least one sub-sampling dimension corresponding to each sampling dimension, at least one first state information set corresponding to each blockchain state information is divided to obtain at least one second state information set corresponding to each blockchain state information; Based on at least one sampling attribute corresponding to each sub-sampling dimension, at least one second state information set corresponding to each blockchain state information is divided to obtain at least one third state information set corresponding to each blockchain state information; Random sampling is performed from the at least one third state information set to obtain at least one state characteristic sub-information corresponding to each blockchain state information; Based on the at least one sampling attribute, the corresponding at least one state characteristic sub-information is spliced ​​to obtain a state characteristic information corresponding to each blockchain state information.

4. The method according to claim 1, characterized in that: After the anomaly detection models are deployed to the production environment respectively, the method further includes: Determine a test data set from at least one state feature information corresponding to each blockchain state information, wherein the test data set includes at least one test case; Based on the at least one test case, verify the anomaly detection model to obtain a verification result of the anomaly detection model; The anomaly detection model is optimized according to the verification result to obtain a target anomaly detection model adapted to the production environment.

5. The method according to claim 1, characterized in that The method further comprises: Perform difference analysis based on the abnormal reference information corresponding to each blockchain state information and the abnormal detection information to obtain the abnormal detection analysis information corresponding to each blockchain state information; Based on the anomaly detection and analysis information corresponding to each blockchain state information and the preset difference condition, determine the target blockchain state information and the target fault scenario information corresponding to the target blockchain state information, and the anomaly detection and analysis information corresponding to the target blockchain state information satisfies the preset difference condition; Resetting the target blockchain system corresponding to the target blockchain state information; The target fault scenario information is re-injected into the corresponding target blockchain system to update the target blockchain status information.

6. The method according to claim 1, characterized in that Based on the multiple fault scenario information, multiple blockchain systems are injected with faults to obtain multiple blockchain status information, including: Determine a correspondence between the multiple blockchain systems and the multiple fault scenario information; Based on the corresponding relationship and the fault injection conditions corresponding to the multiple fault scenario information, the multiple fault scenario information are respectively injected into the corresponding blockchain system; Obtain the multiple blockchain status information corresponding to the multiple blockchain systems within a target time period before and after the multiple fault scenario information is injected.

7. The method according to claim 6, characterized in that The acquiring of the multiple blockchain status information corresponding to the multiple blockchain systems within a target time period before and after the multiple fault scenario information is injected includes: Sending batches of simulated business requests to the multiple blockchain systems within the target time period to obtain business processing status information of the multiple blockchain systems; Acquire system operation status information of the multiple blockchain systems within the target time period; The multiple blockchain status information corresponding to the multiple blockchain systems include business processing status information of the multiple blockchain systems and system operation status information of the multiple blockchain systems.

8. An anomaly detection method, characterized in that: The method comprises: Obtain the blockchain status information corresponding to the blockchain system; Performing layered sampling on the blockchain state information to obtain at least one state feature information; The at least one state information is input into an anomaly detection model to perform anomaly detection processing to obtain anomaly detection information. The anomaly detection model is obtained by training a deep learning model using the training method of the anomaly detection model described in claim 1.

9. A training device for an anomaly detection model, characterized in that: The device comprises: A fault scenario information acquisition module is used to acquire multiple pre-arranged fault scenario information; A fault injection module, used to perform fault injection on multiple blockchain systems based on the multiple fault scenario information to obtain multiple blockchain status information; the multiple blockchain systems, the multiple fault scenario information and the multiple blockchain status information correspond one to one; An abnormality analysis module is used to perform abnormality analysis on the multiple blockchain systems according to the multiple blockchain status information, and determine abnormal reference information corresponding to each blockchain status information in the multiple blockchain status information; A stratified sampling module, used to perform stratified sampling on each blockchain state information in the plurality of blockchain state information to obtain at least one state feature information corresponding to each blockchain state information; A model detection module, used to input at least one state feature information corresponding to each blockchain state information into a deep learning model, perform anomaly detection processing, and obtain anomaly detection information; The model adjustment module is used to adjust the deep learning model based on the abnormal reference information corresponding to each blockchain state information and the abnormal detection information to obtain a trained abnormal detection model.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores at least one instruction or at least one program, and the at least one instruction or the at least one program is loaded and executed by the processor to implement the training method of the anomaly detection model described in any one of claims 1 to 7 or the anomaly detection method described in claim 8.

11. A computer device, characterized in that: The computer device includes a processor and a memory, wherein the memory stores at least one instruction or at least one program, and the at least one instruction or at least one program is loaded and executed by the processor to implement the training method of the anomaly detection model described in any one of claims 1 to 7 or the anomaly detection method described in claim 8.