Method for automatically sensing DeFi security event in advance

By building an automated identification model framework on the Discord platform, detangling and characterizing user discussion data, positioning DeFi security events and providing early warnings, the problems of information loss and lag in DeFi security events are solved, and the security of the DeFi market and user asset protection are improved. .

CN118887016AActive Publication Date: 2024-11-01ZHEJIANG UNIV
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411006213.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-25
Publication Date
2024-11-01
Estimated Expiration
2044-07-25

AI Technical Summary

Technical Problem

The existing technology cannot effectively locate and extract relevant DeFi security incident information in Discord user communication, resulting in information loss and lag, making it difficult to prevent and resolve DeFi attack incidents.

Method used

Build an automated identification model framework, process user discussion data through dialogue de-entanglement and characterization, build a binary classification model using small sample learning method, locate DeFi security events and provide early warning notifications.

Benefits of technology

It realizes early perception and early warning of DeFi security incidents, reduces the risk of information lag, and improves the security of the DeFi market and user asset protection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118887016A_ABST
    Figure CN118887016A_ABST
Patent Text Reader

Abstract

The invention discloses a method for automatically perceiving a DeFi security event in advance, which comprises the following steps of: collecting the DeFi security event and Flashbots community dialogue data, further identifying discussion related to the DeFi security event, constructing and training a classification model, and realizing automatic prediction of the discussion related to the DeFi security event. In the modeling process, a small sample learning method is adopted to construct a dichotomy model, dialogue data is used as input, whether a dialogue is related to a DeFi security event or not is judged, and the content of the related DeFi security event is further positioned. And based on the acquired DeFi security event, the solution thereof and the like, issuing vulnerability early warning push through a community, and informing all users through emails or short messages and the like. By designing the DeFi event early warning method, advanced perception and disclosure functions of the DeFi event are realized, and the attack risk caused by information lag is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method for automating early perception of DeFi security events. Background Art

[0002] Decentralized Finance (DeFi) based on blockchain refers to a new software ecosystem built on smart contract blockchains such as Ethereum. It builds software applications through technologies such as smart contracts to provide open and transparent financial services and products. As the DeFi ecosystem gradually develops and grows, attacks on the DeFi ecosystem are frequent, covering different levels such as networks, consensus, smart contracts and protocols. These DeFi security incidents are likely to cause serious economic losses. Therefore, how to effectively identify and timely obtain DeFi security incidents and their attribute information is extremely important for preventing the adverse effects of DeFi security incidents and maintaining the healthy development of the DeFi ecosystem.

[0003] For DeFi developers and users, online communication is an important way to share DeFi ecosystem information, including the use of communication platforms such as Twitter and Discord. Among them, the Discord platform has gradually attracted more and more blockchain users to actively participate in the Discord community due to its support for voice and video communication functions, community and channel establishment mechanisms, and real-time communication. These user discussions contain a wealth of information related to DeFi security incidents, including the content of DeFi security incidents, the time of occurrence, potential impacts, and response strategies.

[0004] Miner Extractable Value (MEV) refers to the behavior of miners to generate additional income on blocks in a way that is beneficial to them by reordering transactions in each block. Due to the differences in consensus, sorting, and block creation mechanisms in blockchain networks, the optimal MEV extraction strategy will lead to MEV games. This MEV game will produce negative externalities, including user loss of benefits, a sharp increase in network load, waste of blockchain resources and quality decline, the emergence of centralization effects, and other negative effects.

[0005] In order to eliminate the negative externalities associated with MEV and support the healthy development of the DeFi ecosystem, third-party services are booming. Flashbots is one of the representative MEV service providers, cooperating with more than 80% of miners in Ethereum. It supports traders to submit transactions without broadcasting, and attackers can only obtain transaction information after the block is announced, making it impossible to perform attacks, thereby helping traders to conduct safe transactions. The emergence of Flashbots has reduced the attack rate to a certain extent, protected traders' transactions, and played an important role in promoting the development of the DeFi market and improving the security of the DeFi ecosystem.

[0006] As an open source project, in order to promote information exchange and synchronization, Flashbots has established a community on Discord specifically for discussing DeFi-related information, including DeFi security incidents. Therefore, the user discussions in this community contain a large amount of valuable information that can be mined, and how to extract content related to DeFi security incidents from it is one of the important goals that need to be achieved. However, existing technologies cannot locate discussions related to DeFi security incidents in Discord user exchanges, that is, it is difficult to extract information related to DeFi security incidents in Discord, which may lead to the loss of information about DeFi security incidents and difficulty in comprehensively collecting methods to prevent and resolve DeFi attacks. At the same time, it will also cause DeFi users to lag behind in obtaining DeFi events and increase the difficulty of obtaining them. Automatic extraction of DeFi security events and early warning can effectively protect user assets and improve the security of the DeFi market. Summary of the invention

[0007] In response to the above problems, the present invention proposes a method for automated early perception of DeFi security events. Based on user discussions in the Flashbots community in Discord, an automated identification model framework is constructed to locate discussions related to DeFi security events, and to warn users of DeFi events, including SMS notifications, to effectively prevent the impact of DeFi events from expanding.

[0008] The present invention adopts the following technical scheme, a method for automatic extraction and early warning of DeFi security events; after characterizing the user discussions that appear in the Flashbots community of Discord, they are automatically classified to extract conversations related to DeFi security events. Thereby locating potential DeFi events and warning of potential risks in user transactions. Specifically, user discussions are first separated through dialogue disentanglement to obtain independent dialogue data sets; the communication information contained in the dialogue is characterized, and information such as text content and dialogue structure are encoded and converted into vectors; the dialogue characterization results are used as the input of the model to analyze whether it is a discussion related to DeFi security events. Potential DeFi security events and solutions are located from the discussion, users are automatically warned, and protection is provided for user transactions.

[0009] Furthermore, a method for automating the early perception of DeFi security events includes the following steps:

[0010] Step 1: Construct a DeFi security incident dataset and a DeFi security incident discussion dataset;

[0011] Step 2: Combine the small sample learning method to build a binary classification model. The binary classification model uses the conversation after the user discussion message is disentangled as the input of the binary classification model, and the output classification result is whether the independent conversation is related to the DeFi security incident;

[0012] Step 3: Use the DeFi security incident discussion dataset obtained in step 1 to build a training set, perform end-to-end training on the binary classification model, adjust the model parameters, optimize the model evaluation indicators, complete the tuning of the binary classification model, and obtain the DeFi security incident perception model;

[0013] Step 4: Input the target conversation into the DeFi security incident perception model to predict whether the target conversation is related to the DeFi security incident. If the conversation is a discussion related to the DeFi security incident, further find the DeFi security incident contained in the conversation from the DeFi security incident dataset obtained in step 1, complete the positioning of the DeFi security incident, and complete the early perception of the DeFi security incident in the user discussion message;

[0014] Step 5: Publish vulnerability warning push notifications based on the located DeFi security incidents.

[0015] In the present invention, a model framework is constructed to automatically identify discussions related to DeFi security incidents in the Flashbots community in Discord. Then, the community discussion content is regularly monitored and analyzed to automatically identify potential DeFi risk events, solving the problem of lagging vulnerability notification caused by the lack of a unified disclosure platform for DeFi events; by designing a DeFi event warning method, the early perception and disclosure function of DeFi events is realized, avoiding the risk of attack caused by information lag. The method includes: collecting DeFi security events and Flashbots community dialogue data, further identifying discussions related to DeFi security events, and constructing and training classification models to achieve automatic prediction of discussions related to DeFi security events. In the modeling process, a binary classification model is constructed using a small sample learning method, and dialogue data is used as input to determine whether the dialogue is related to DeFi security events, and further locate the content of related DeFi security events. Based on the acquired DeFi security events and their solutions, vulnerability warning push is released through the community, and all users are notified by email or text message. This method can automatically extract user discussions involving DeFi security incidents and notify users, providing an effective solution for early perception and early warning of DeFi security incidents.

[0016] In step 1, a DeFi security event dataset is constructed, including:

[0017] Based on various DeFi security incident audit websites, relevant security incident information is collected, and the event name, event time, event description, loss amount, attack method, event notification link, and attack target characteristic attributes of DeFi security incidents are extracted to construct a DeFi security incident dataset.

[0018] In step 1, a DeFi security incident discussion dataset is constructed, including:

[0019] The Flashbots community of the Discord platform was selected as the data source. The user discussion messages of each channel were collected and preprocessed. The robot messages were removed and disentangled according to the context of the user discussion messages to obtain independent conversations. According to the event time, event name and event description in the DeFi security event dataset, independent conversations and labels related to DeFi security events were obtained to construct a DeFi security event discussion dataset.

[0020] In step 1, independent conversations and labels related to DeFi security events are obtained based on the event time, event name, and event description in the DeFi security event dataset, including:

[0021] The correlation between independent conversations and various DeFi security events is manually judged, labels related / unrelated to DeFi security events are identified, and manual annotation of conversations is completed.

[0022] In step 2, the binary classification model adopts a dialogue semantics and structure encoding module, and the dialogue semantics and structure encoding module includes:

[0023] The input layer is used to segment the sentence into basic vocabulary units and initialize them into uniformly distributed random vectors;

[0024] A sentence embedding layer that includes the TextCNN model (a text encoding and classification algorithm based on convolutional neural networks), which is used to concatenate random vectors into a matrix and embed them through the TextCNN model to obtain sentence representation;

[0025] A dialogue embedding layer that includes a BiLSTM model (bidirectional long short-term memory network), which is used to encode sentence representations through the BiLSTM model to obtain a bidirectional dialogue embedding vector;

[0026] The output layer is used to concatenate the two-way conversation embedding vectors and output the conversation embedding vector.

[0027] In step 4, if the conversation is about a DeFi security incident, the DeFi security incidents contained in the conversation from the DeFi security incident dataset obtained in step 1 are further found to complete the location of the DeFi security incident, including:

[0028] If the conversation is a discussion about DeFi security incidents, the embedding vector of the conversation output by the DeFi security incident perception model is similar to the event description of the DeFi security incident in the DeFi security incident dataset obtained in step 1. If the similarity is higher than the threshold, the DeFi security incident is located.

[0029] Specifically, the method comprises the following steps:

[0030] Step 1: Construction of DeFi security incident discussion dataset. The present invention first collects relevant security incident information based on various DeFi security incident audit websites, and extracts the event name, event occurrence time, event description, loss amount, attack method, event notification link, and attack target characteristic attributes to construct a DeFi security incident dataset. The present invention constructs a DeFi security conversation dataset for model training, selects the Flashbots community of the Discord platform as the data source, collects and preprocesses user discussion messages in each channel, removes interference information such as robot messages, and performs disentanglement operations based on the message context to obtain independent conversations. Based on the DeFi security incident data, including attributes such as time and content, it is determined whether the conversation is related to the DeFi security incident, and a DeFi security incident discussion dataset is constructed.

[0031] Step 2: DeFi-related conversation model training and prediction. First, a binary classification model is constructed in combination with the small sample learning method. The de-entangled conversation of the real-time monitored community discussion is used as the input of the model, and the output classification result is whether the conversation is related to the DeFi security incident. For the model training process, the DeFi security incident discussion dataset obtained in step 1 is used to build a training set, the model is trained end-to-end, and the parameters of the model are adjusted to optimize the model evaluation indicators to complete the tuning of the automated classification model. After completing the model tuning, the trained model is used to predict whether a given conversation is related to the DeFi security incident. If the conversation is a discussion related to the DeFi security incident, the DeFi security incident content it contains is further judged to complete the positioning of the DeFi security incident.

[0032] Step 3: Automatic warning and disclosure of DeFi events. When a project is detected to have potential risks, such as smart contract vulnerabilities, developers withdrawing liquidity and other security threats, the system will automatically trigger the warning mechanism to inform users and the community, avoiding potential risks of attacks. The event notification operation is pushed through the community to release vulnerability warnings, and users are informed by email or SMS, so as to promptly inform users to stop trading on the affected DeFi projects. In addition, this method is highly automated, reduces the need for manual intervention, improves the applicability and response speed of automatic warnings of DeFi security events, and can promptly notify users of warnings and protections about DeFi security events.

[0033] Compared with the prior art, the present invention has the following advantages:

[0034] (1) Rich and diverse data sets: The present invention collects data from multiple DeFi security event audit websites, deduplicates and aggregates them, and obtains a rich and complete set of DeFi security events. In addition, the present invention also collects multi-channel user discussion data from the Flashbots community of Discord, which can cover a rich and diverse range of conversation content.

[0035] (2) Use small sample learning methods to reduce the workload of data annotation: The present invention uses a small sample learning method to overcome the problem of limited scale of manually labeled training data. By setting sample pairs, based on limited labeled data, the feature representation of new sample classification can be effectively learned and accurate classification can be achieved, thereby reducing the burden of data annotation.

[0036] (3) Automatically detect user discussions related to DeFi security incidents: The present invention establishes a model framework for automatically identifying discussions related to DeFi security incidents, and realizes efficient positioning of DeFi security incident discussions in a large number of user discussion messages. An independent conversation data set is obtained by decomposing user communication statements, and the user's discussion behavior on DeFi security incidents is extracted from the conversation level. The security incident discussion recognition model implemented by the present invention achieved an accuracy rate of 84.72% on the test set.

[0037] (4) Automatically warn users about potential DeFi security incidents and provide protection: The present invention provides a DeFi security incident location and warning method, which automatically identifies potential risk events by regularly monitoring and analyzing community discussion content, and solves the problem of delayed vulnerability notification caused by the lack of a unified disclosure platform for DeFi incidents. By designing a DeFi incident response system, the early perception and disclosure functions of DeFi incidents are realized, avoiding the expansion of the impact of DeFi incidents due to information lags. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] Figure 1 The overall process of data collection, model training and prediction of the present invention is shown;

[0039] Figure 2 The process of the present invention for marking the discussion related to DeFi security incidents is shown.

[0040] Figure 3 This is a flow chart of the method for automating the early perception of DeFi security events in the present invention. DETAILED DESCRIPTION

[0041] In order to facilitate those skilled in the art to understand and implement the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and implementation examples. It should be understood that the implementation examples are only used to illustrate and explain the present invention and should not limit the scope of the present invention.

[0042] The present invention proposes a method for automatic extraction and early warning of DeFi security events. The method uses DeFi events and user discussion messages of the Flashbots community on the Discord platform as data sets, and manually constructs a conversation data set related to DeFi events. Based on these data, the present invention uses a small sample learning method to construct a classification model that can automatically locate conversations related to DeFi events. Through this method, the present invention can effectively extract DeFi security events from discussions in the Flashbots community and accurately locate the conversation content related to them.

[0043] like Figure 1 and Figure 3 As shown, the method of the present invention comprises the following steps:

[0044] Step 1: Construction of DeFi security incident discussion dataset

[0045] Step 1.1: Construction of DeFi security event dataset.

[0046] The present invention collects data based on three DeFi security incident disclosure websites (Rekt News; Slowmist; Cryptosec), and collects DeFi security incidents that occurred on Ethereum and BSC in the six years from June 4, 2018 to June 4, 2024, including information such as attack targets, attack events, and event disclosure links. After completing the data collection task, the present invention organizes and summarizes the DeFi security incident data collected from different data sources, including the following steps: Data deduplication: The same DeFi event may be collected by different data sources at the same time. Since there is no unique identifier for DeFi security events and different DeFi security events are expressed differently in different data sources, it is necessary to use manual means to determine whether there is duplicate data. The present invention determines whether it belongs to the same security incident based on comparing the security incidents between data sources, the names of DeFi projects affected, and the time of the attack. Data proofreading: The DeFi security incident disclosure website completes the summary by extracting relevant information from the security incident disclosure link. The data fields provided by different websites are different, and there are data extraction errors. To ensure the quality of the data set, the present invention proofreads the collected DeFi security incident data. The verification events include: (1) whether it is a DeFi security event; (2) whether the event-related attributes (such as the time of the event, the target of the attack, the loss, etc.) are correct; (3) the missing data is completed. For data with inconsistent verification results, the final result is reached through negotiation between the annotators.

[0047] For each DeFi security incident, this patent collects the following features: (1) Attack target, the attacked object in the security incident; (2) Attack time, the specific time when the security incident occurred; (3) Attack event identifier, which consists of the attack target and the attack event; (4) Event description, the specific content of the security incident; (5) Event loss, the direct monetary loss caused by the attack event (the present invention collects the total monetary losses reported by the above data sources, and the victims can be users, liquidity providers, speculators or protocol operators); (6) Attack means, how malicious attackers use DeFi project design defects to achieve attack purposes, such as contract vulnerabilities, etc.; (7) Data source: For each security incident, the present invention collects the disclosed data source, including web links, etc., to provide verification of data accuracy.

[0048] Step 1.2: Discord’s Flashbots community conversation dataset construction.

[0049] To ensure the validity of the communication messages and the analyzability of the text, the present invention filters the collected message sentences, deletes the sentences generated by the robot and the sentences containing only pictures. In addition, the present invention also replaces the emoticons in the user messages with spaces to filter out the non-textual information.

[0050] Discord supports many-to-many / one-to-many real-time communication, which causes the communication statements belonging to different conversations to be intertwined, so they need to be disentangled to obtain independent conversation data sets for subsequent analysis. The present invention uses a decision tree-based supervision model to segment user discussions on the Discord platform to obtain a large-scale independent conversation data set, which contains 19,477 conversations in the past three years after disentanglement. The model not only considers the time frame between message pairs, but also considers the characteristic attributes such as user similarity, prompt words, similar word usage and technical expressions between message pairs to improve the accuracy of conversation separation.

[0051] Step 1.3: Construction of DeFi security incident discussion dataset.

[0052] In order to determine whether the conversation discussion is related to the DeFi event, the present invention manually annotates the large-scale independent conversation data set obtained in step 1.2. Taking into account the factors of time and cost, the original data set is too large and needs to be processed. Therefore, the present invention adopts a random sampling method to extract a certain number of conversations as a research sample of the characteristics of the entire conversation group. Through this sampling method, the present invention can effectively and representatively annotate the data set, thereby completing the annotation work under the premise of controlling time and cost. During the sampling process, the present invention also excludes conversations with non-English descriptions, a large number of syntactic errors, or too many code snippets to ensure that the selected conversations are of high quality and reliability.

[0053] The present invention focuses on manual annotation of sampled dialogues (e.g. Figure 2 ), that is, manually judge whether the conversation is related to a specific DeFi event, in order to obtain the DeFi security incident discussion dataset, which is a real dataset for method definition and performance evaluation. In the process of annotating whether the conversation is related to the DeFi event, a coding manual was first developed to guide the entire annotation process. The manual is divided into three main parts. In the initial stage, two annotators annotated the same conversation separately and recorded it in their respective coding books. Subsequently, the same annotator was responsible for merging the two coding books in the merging stage, limiting the search scope to the conversation level to avoid overly coarse or overly fine annotations. As part of the iterative update of the manual, the annotators developed a series of criteria for judging the content of the conversation related / unrelated to the DeFi event. These criteria may include using speculative language or providing reasons to prove the correctness of the statements made. Finally, a detailed coding manual was written to ensure the consistency and accuracy of the annotation process. Based on the completed coding manual, the present invention conducts multiple rounds of annotation and discussion around the classification of whether the conversation is related to the DeFi event to eliminate differences and reach consensus.

[0054] Step 2: DeFi-related conversation recognition model training and prediction

[0055] Step 2.1: Model construction. In order to build an automated classification model to determine whether a conversation is related to a DeFi event, the present invention first builds a semantic and structural encoding module, and then implements conversation classification through a classification network.

[0056] (1) Dialogue semantics and structure encoding module: This module adopts a hierarchical structure and can capture the contextual information and structural features of each sentence in the dialogue. It consists of four layers: input layer, sentence embedding layer, dialogue embedding layer, and output layer.

[0057] Input layer: The input layer segments sentences into basic vocabulary units. In order to obtain better performance, the present invention uses a pre-trained 50-dimensional GloVe model (word embedding with global vectors) as the initial vector of the corresponding words, and adds part-of-speech tagging information to the word representation to enhance its characteristics. Specifically, each type of part-of-speech tag will be initialized as a uniformly distributed random vector and optimized during the training process.

[0058] Embedding layer: The embedding layer implements semantic and structural encoding from both the sentence level and the dialogue level. For sentence-level embedding, the present invention converts the original sentence into a matrix of word embedding and POS tag embedding stacks, and then inputs the embedding matrix into TextCNN to obtain sentence representation; for dialogue-level embedding, the present invention uses each embedded sentence as a tag when inputting the BiLSTM encoder according to their sequence in the dialog box. After encoding the BiLSTM, the bidirectional context information of the dialogue is learned.

[0059] Output layer: In the output layer, the present invention combines the two directional representations generated by BiLSTM encoding into an output vector of the dialog box.

[0060] (2) Siamese dialogue classification network (Twin neural network): To solve the problem of limited dataset size for manually labeled data, this paper combines small sample learning methods to construct a Siamese dialogue classification network, which can enhance the dataset by reconverting the traditional text classification task of mapping a single dialogue to its class into the task of determining whether two dialogues belong to the same class or different classes.

[0061] Step 2.2: Model training. The present invention takes the following two steps to train the Siamese dialogue classification network:

[0062] (1) Dataset division: First, the present invention randomly divides the DeFi security event discussion dataset obtained by manual annotation in step 1.3 into a training dataset and a test dataset. The original dataset contains conversation items with labels "related to DeFi events" or "not related to DeFi events".

[0063] (2) Data enhancement: In general, the number of labeled conversations may not be sufficient to train an effective supervised learning-based model. To solve this problem, the present invention extracts two conversations from the original data and combines them, and assigns a "same" or "different" label to this combination based on whether their labels are the same, to form a conversation pair dataset to achieve a natural balance of the data. Assuming that there are m "DeFi event-related" conversations and n "unrelated to DeFi events" conversations in the conversation pair dataset, the present invention can increase the size of the source dataset to (m 2 )+(n 2 )+m*n to expand the data set.

[0064] (3) Category inference: Since each pair of conversations is labeled as "same" or "different", a 2-dimensional output vector is obtained through the Siamese conversation classification network, which represents the scores of the two categories respectively. Finally, the present invention performs Softmax processing on this output vector to obtain the final classification result of similarity or not. However, what the present invention needs is the probability of indicating whether a conversation is related to the DeFi security incident. Therefore, we need to infer the label of the conversation based on the probability and the actual label of the other conversation in the conversation pair instance. For example, we sample a pair of conversations <Conversation 1, Conversation 2>, where Conversation 1 is sampled in the training data set with the label "not related to DeFi incident", and Conversation 2 is the unknown conversation to be predicted. We input this pair of conversations into the Siamese conversation classification network and then predict whether the two conversations are the same or different. If the prediction result is difference, then we can infer that the category of conversation 2 is "related to DeFi incident" conversation. If the actual label of conversation 2 is "related to DeFi incident" conversation, it means that the prediction made by our model is a true positive prediction. Otherwise, we will get a false positive prediction result. In order to obtain more reliable prediction results, we adopt a voting strategy when predicting conversations. For each unknown dialogue, we construct k pairing instances by extracting k different sample dialogues. After passing these pairing instances into the model, we can get p instances indicating that the unknown dialogue is a feature dialogue and kp instances indicating that the unknown dialogue is a non-feature dialogue based on the model's prediction results and the labels of the paired dialogues. If p is greater than Then we assign the predicted conversation the label "related to DeFi events".

[0065] Through the above sub-steps, the present invention can effectively utilize the information in the data set and expand the data set through data enhancement methods to solve the problem of insufficient labeled data, thereby improving the performance and generalization ability of model prediction.

[0066] Step 2.3: Model prediction. After completing the classification model training, this project monitors the model effect and uses it for subsequent prediction steps.

[0067] Based on the classification model obtained in step 2.1 and step 2.2, for the community discussion dialogues monitored in real time, the present invention disentangles the dialogues, and then predicts through the classification model to determine whether it is a discussion "related to DeFi events". The present invention constructs a test set to test the performance of the classification model in real situations. The test set contains 12 discussions related to DeFi events, 60 discussions unrelated to DeFi events, and various types of attacks in the discussions related to DeFi events, such as contract vulnerabilities, flash loan attacks, etc., to verify the effectiveness of the model when facing different types of DeFi events. After balancing the samples, the test set contains 72 discussion samples related to DeFi and 72 discussion samples unrelated to DeFi. In the test set, this model successfully detected 62 discussions related to the DeFi event (TP, positive samples predicted by the model as positive). For discussions unrelated to the DeFi event, this model successfully judged that 63 discussions were unrelated to the DeFi event (TN, negative samples predicted by the model as negative). In the discussion related to DeFi in the test set, this model incorrectly judged 10 discussions as unrelated to the DeFi event (FP, negative samples predicted by the model as positive), and 9 discussions unrelated to DeFi were judged to be related to the DeFi event (FN, negative samples predicted by the model as negative). The accuracy of the model represents the proportion of correctly judged data (TP+TN) to the total data, and the calculation formula is (TP+TN) / (TP+TN+FP+FN). The accuracy of this model on the test set is 86.81%; the precision of the model represents the proportion of true positive examples (TP) among all positive examples (TP+FP) judged by the model, and the calculation formula is TP / (TP+FP). The accuracy of this model on the test set is 87.32%; the recall rate of the model represents the proportion of positive examples (TP) correctly judged by the model to all positive examples in the data set (TP+FN), and the calculation formula is TP / (TP+FN). The recall rate of this model on the test set is 86.11%, which is in line with the expected classification effect, indicating that the model has high accuracy and robustness in the DeFi-related discussion identification task.

[0068] If a conversation is judged to be a conversation "related to DeFi events", the present invention further predicts the specific DeFi events discussed in it to determine whether the event is a known DeFi event. For new events, the most similar events are matched among known events. By calculating the similarity between the target conversation embedding vector and the embedding vectors of various event descriptions in the DeFi security event dataset, the most relevant DeFi event is located as the prediction result. After locating, it is determined whether the event discussed in the conversation is an existing event. If it is determined to be an existing event, no subsequent response is made; if it is determined to be a discussion related to a new DeFi event, a response is made to the DeFi event to achieve early perception and disclosure of security events.

[0069] Step 3: Automatic warning and disclosure of DeFi events

[0070] Step 3.1: Identify the attack method

[0071] In step 2.3, this patent implements the task of locating the most relevant event of the discussed DeFi event in the known DeFi event database. During the data collection process, the attack methods of existing DeFi events have been manually annotated and confirmed. In this step, the attack methods of the most relevant DeFi events will be obtained and used to guide subsequent event disclosure work.

[0072] Step 3.2: DeFi event notification

[0073] When a potential risk is detected in a DeFi project transaction, such as smart contract vulnerabilities, developers withdrawing liquidity and other security threats, the system will automatically trigger the early warning mechanism. The specific notification process is as follows: Early warning trigger: When the system detects a potential risk, the early warning mechanism is triggered immediately. Community announcement: Release vulnerability warning push through the community, describing the detected risks and their potential impact in detail. User notification: Inform all users of relevant security threats in a timely manner through email or SMS. Feedback collection: Collect user feedback and questions to further improve the risk assessment and notification mechanism.

Claims

1. A method for automating the early perception of DeFi security events, characterized in that: The following steps are involved: Step 1: Construct a DeFi security incident dataset and a DeFi security incident discussion dataset; Step 2: Combine the small sample learning method to build a binary classification model. The binary classification model uses the conversation after the user discussion message is disentangled as the input of the binary classification model, and the output classification result is whether the independent conversation is related to the DeFi security incident; Step 3: Use the DeFi security incident discussion dataset obtained in step 1 to build a training set, perform end-to-end training on the binary classification model, adjust the model parameters, optimize the model evaluation indicators, complete the tuning of the binary classification model, and obtain the DeFi security incident perception model; Step 4: Input the target conversation into the DeFi security incident perception model to predict whether the target conversation is related to the DeFi security incident. If the conversation is a discussion related to the DeFi security incident, further find the DeFi security incident contained in the conversation from the DeFi security incident dataset obtained in step 1, complete the positioning of the DeFi security incident, and complete the early perception of the DeFi security incident in the user discussion message; Step 5: Publish vulnerability warning push notifications based on the located DeFi security incidents.

2. The method for automated DeFi security event early perception according to claim 1, characterized in that: In step 1, a DeFi security event dataset is constructed, including: Based on various DeFi security incident audit websites, relevant security incident information is collected, and the event name, event time, event description, loss amount, attack method, event notification link, and attack target characteristic attributes of DeFi security incidents are extracted to construct a DeFi security incident dataset.

3. The method for automated DeFi security event early perception according to claim 1, characterized in that: In step 1, a DeFi security incident discussion dataset is constructed, including: The Flashbots community of the Discord platform was selected as the data source. The user discussion messages of each channel were collected and preprocessed. The robot messages were removed and disentangled according to the context of the user discussion messages to obtain independent conversations. According to the event time, event name and event description in the DeFi security event dataset, independent conversations and labels related to DeFi security events were obtained to construct a DeFi security event discussion dataset.

4. The method for automated DeFi security event early perception according to claim 3, characterized in that: In step 1, independent conversations and labels related to DeFi security events are obtained based on the event time, event name, and event description in the DeFi security event dataset, including: The correlation between independent conversations and various DeFi security events is manually judged, labels related / unrelated to DeFi security events are identified, and manual annotation of conversations is completed.

5. The method for automated DeFi security event early perception according to claim 1, characterized in that: In step 2, the binary classification model adopts a dialogue semantics and structure encoding module, and the dialogue semantics and structure encoding module includes: The input layer is used to segment the sentence into basic vocabulary units and initialize them into uniformly distributed random vectors; The sentence embedding layer of the TextCNN model is used to concatenate random vectors into a matrix and embed them through the TextCNN model to obtain sentence representation; Contains the conversation embedding layer of the BiLSTM model, which is used to encode the sentence representation through the BiLSTM model to obtain a bidirectional conversation embedding vector; The output layer is used to concatenate the two-way conversation embedding vectors and output the conversation embedding vector.

6. The method for automated DeFi security event early perception according to claim 1, characterized in that: In step 4, if the conversation is about a DeFi security incident, the DeFi security incidents contained in the conversation from the DeFi security incident dataset obtained in step 1 are further found to complete the location of the DeFi security incident, including: If the conversation is a discussion about DeFi security incidents, the embedding vector of the conversation output by the DeFi security incident perception model is similar to the event description of the DeFi security incident in the DeFi security incident dataset obtained in step 1. If the similarity is higher than the threshold, the DeFi security incident is located.

Citation Information

Patent Citations

  • Large-scale network security event analysis system

    CN117749409A

  • Baby Carrier

    KR1020230111476A

  • System and method for crime risk forecasting using cyber security and deep learning

    US20230088328A1

  • Device for automatically sorting cyber attack based on artificial intelligence using security event of different kinds of security devices

    US20240154990A1