An intelligent contract knowledge graph adaptive immune pruning targeted auditing method based on artificial intelligence technology

By constructing a knowledge graph for cybersecurity level protection of blockchain smart contracts, and combining graph neural networks and artificial immune algorithms, adaptive immune pruning targeted auditing of smart contracts was achieved. This solved the problems of high false alarm rate and low automation in smart contract detection technology, and improved the accuracy and adaptability of detection.

CN122241711APending Publication Date: 2026-06-19THE THIRD RES INST OF MIN OF PUBLIC SECURITY
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
THE THIRD RES INST OF MIN OF PUBLIC SECURITY
Filing Date
2026-03-05
Publication Date
2026-06-19

AI Technical Summary

Technical Problem

Existing smart contract security detection technologies suffer from high false alarm rates, incomplete detection, and low automation, making it difficult to balance accuracy and adaptability.

Method used

We construct a cybersecurity level protection knowledge graph for blockchain smart contracts, and combine graph neural networks and artificial immune algorithms to perform adaptive pruning and deep semantic verification, thereby achieving intelligent targeted security auditing.

Benefits of technology

It improves the professional efficiency and coverage of smart contract vulnerability detection, reduces the professional skill requirements, enhances the accuracy and adaptability of detection, and generates interpretable audit reports.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122241711A_ABST
    Figure CN122241711A_ABST
Patent Text Reader

Abstract

This invention discloses an adaptive immune pruning targeted auditing method for smart contracts based on artificial intelligence technology. The method first constructs a cybersecurity level protection knowledge graph for blockchain smart contracts. Based on the knowledge graph, a graph neural network model oriented towards security auditing tasks is built. Through neighborhood information aggregation and representation learning, the complex code graph structure is transformed into a low-dimensional vector representation. An adaptive pruning model is constructed based on an artificial immune algorithm to quickly scan and match the contract code represented by the GNN, rapidly "pruning" a large batch of secure smart contract code to extract high-risk code fragments of y types and m defects. A large model is introduced to determine vulnerabilities in the extracted code based on prompt word engineering and context construction strategies, thus improving the interpretability of intelligent targeted security auditing of smart contracts. This solution enables intelligent smart contract vulnerability detection, reduces the professional skill requirements for detection and assessment personnel, and improves the professional efficiency and coverage of smart contract vulnerability detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to network security technology, specifically to smart contract detection technology. Background Technology

[0002] Due to the immutability of smart contracts, their security is crucial for the stable operation of the blockchain ecosystem. In recent years, security incidents caused by smart contract vulnerabilities have been frequent, such as the Ethereum The DAO attack, the Poly Network attack, and the huge losses suffered by multiple DeFi projects due to flash loan attacks and logical flaws, exposing the limitations of existing smart contract security detection technologies. Currently, research on smart contract security detection has entered a new stage centered on deep learning.

[0003] Internationally, research has evolved from traditional methods such as static analysis, formal verification, and fuzz testing to data-driven intelligent methods. Researchers are actively exploring the use of graph neural networks to model code control flow and data flow dependencies, and leveraging large language models trained on code corpora to deeply understand contract semantic logic. While existing methods have shown potential on specific datasets, current smart contract security detection technologies still face the bottleneck of balancing accuracy and adaptability. Summary of the Invention

[0004] To address the limitations of current smart contract detection methods, such as high false positive rates, incomplete detection, and low automation, this invention aims to provide a knowledge graph-based adaptive immune pruning targeted auditing scheme for blockchain smart contracts. This scheme enables intelligent smart contract vulnerability detection, reduces the professional skill requirements for detection and evaluation personnel, and improves the professional efficiency and coverage of smart contract vulnerability detection.

[0005] To achieve the above objectives, this invention provides an adaptive immune pruning targeted auditing method for smart contract knowledge graphs based on artificial intelligence technology, the method comprising:

[0006] Constructing a cybersecurity level protection knowledge graph for blockchain smart contracts;

[0007] A knowledge graph for cybersecurity level protection based on blockchain smart contracts is constructed to build a graph neural network model for security auditing tasks. Through neighborhood information aggregation and representation learning, the complex code graph structure is transformed into a low-dimensional vector representation.

[0008] An adaptive pruning model is constructed based on an artificial immune algorithm to quickly scan and match contract code represented by GNN, and to quickly "prune" a large number of secure smart contract codes to extract high-risk code fragments with y types and m defects.

[0009] A large model is introduced to determine vulnerabilities in extracted code based on prompt word engineering and context construction strategies, thereby improving the interpretability of intelligent targeted security auditing of smart contracts.

[0010] In some embodiments of the present invention, when constructing a knowledge graph for cybersecurity level protection of blockchain smart contracts, the method employs natural language processing technology to extract computable compliance rules from relevant standards; extracts code entities through static analysis to achieve semantic mapping between regulations and code, and constructs a complete knowledge graph for cybersecurity level protection of blockchain smart contracts.

[0011] In some embodiments of the present invention, when the method performs representation learning based on a graph neural network model, the symbolic nodes in the graph are transformed into structured semantic vectors. The vector dimension is aligned with the feature dimension of y types of m smart contract defects, so that the high-weight dimension in the vector corresponds to the core feature of a specific defect.

[0012] In some embodiments of the present invention, when the method extracts high-risk code fragments based on an adaptive pruning model, the feature patterns of m types of defects are defined as an "antigen pool". An "antibody" is constructed based on the node risk vector output by the GNN to perform initial screening of the code, pruning to filter out most of the safe code, and ensuring that the subgraph retained after pruning focuses on suspicious code fragments.

[0013] In some embodiments of the present invention, when the method introduces a large model for vulnerability determination, based on the suspicious code fragments obtained by pre-pruning, a large model is introduced to achieve deep semantic verification. By fusing suspicious code, GNN risk vectors and defect association subgraphs, and combining natural language auditing requirements, code logic consistency verification, variant vulnerability verification and context association analysis are completed, and an audit report is generated.

[0014] In some embodiments of the present invention, the method also establishes a feedback-driven closed-loop optimization mechanism, uses the validation results of the large model as a standard to incrementally train the GNN, adds vulnerability samples to the loss function, optimizes the defect sensitivity of node representation, and updates the immune detector set.

[0015] This invention provides an adaptive immune pruning targeted auditing method for smart contracts based on artificial intelligence technology. According to the compliance requirements of cybersecurity level protection, it constructs a cybersecurity level protection compliance knowledge graph for blockchain smart contracts using graph neural networks, establishing knowledge graphs of key smart contract code, vulnerability patterns, and attack vectors. Based on this, it introduces an attention-based graph neural network to perform deep representation learning on the knowledge graph, transforming symbolic nodes into semantic structure vectors. Next, it constructs an adaptive immune pruning algorithm for blockchain smart contract security vulnerabilities, combining it with an artificial immune algorithm. It defines the compliance violation features corresponding to smart contract defects (such as Sybil attacks and reentrancy attacks) as antigens, uses the vectors output by the GNN as antibodies, and finally integrates the deep semantic understanding capabilities of a pre-trained large-scale code model to perform context-aware deep analysis on the selected high-risk targets, generating an interpretable audit report with complete vulnerability location, logical analysis, and remediation suggestions, thus improving the understanding and analytical capabilities of targeted auditing security for smart contracts.

[0016] The knowledge graph adaptive immune pruning targeted auditing method for smart contracts based on artificial intelligence technology provided by this invention can automatically identify and analyze security risks in smart contracts. It can extract more security risk features from the source code of smart contracts and use a large language model to conduct in-depth analysis of the logic and semantics of smart contracts. This multimodal, deep learning approach can make up for the shortcomings of traditional methods, improve the accuracy and adaptability of compliance auditing, help realize intelligent targeted auditing of smart contracts, and improve the efficiency of security auditing and assessment of blockchain smart contracts. Attached Figure Description

[0017] The present invention will be further described below with reference to the accompanying drawings and specific embodiments.

[0018] Figure 1 This is a schematic diagram of the security protection niche for blockchain smart contracts in this invention.

[0019] Figure 2 This is a schematic diagram of the network security level protection knowledge graph for blockchain smart contracts in this invention.

[0020] Figure 3 This is an example diagram of adaptive immune pruning targeted auditing of blockchain smart contracts in this invention.

[0021] Figure 4 This is a technical schematic diagram of the knowledge graph adaptive immune pruning targeted auditing method for smart contracts based on artificial intelligence technology in this invention. Detailed Implementation

[0022] To make the technical means, creative features, objectives and effects of this invention easier to understand, the invention will be further described below with reference to specific illustrations.

[0023] Smart contracts are programs written in computer code that automatically execute contracts and permanently record the results on the blockchain; however, if smart contracts have security vulnerabilities, they will seriously threaten the security and stability of the entire blockchain system.

[0024] In response, this invention provides an adaptive immune pruning targeted auditing scheme for smart contracts based on knowledge graphs using artificial intelligence technology, thereby enabling efficient and accurate auditing of smart contracts.

[0025] See Figure 1 In this invention, blockchain security is first divided into blockchain platform security and blockchain application security. Blockchain components with specific functions such as consensus mechanisms and smart contracts, which can run independently, are defined as blockchain nodes, and a graded protection niche operating environment for blockchain smart contracts is constructed.

[0026] Furthermore, within the niche of graded protection for blockchain smart contracts, the following three types of security risks for smart contracts will be covered:

[0027] 1. Logical design flaws. This type of security risk is high-risk and can paralyze the entire protocol. These include reentrancy attacks (recursive calls leading to inconsistent states), privilege escalation (access control logic flaws), business logic errors (economic model design vulnerabilities), and state management errors (state transition logic flaws).

[0028] 2. Coding implementation errors: This type of security risk is classified as medium-risk and can lead to some functional abnormalities. These include integer overflow (numerical calculation boundary issues), unchecked return values ​​(unhandled external call failures), and function visibility errors (improper access permission settings).

[0029] 3. External Interaction Risks: These security risks are of low to medium risk and can lead to conditional exploitation. They include front-end runtime attacks (exploitation of maximum extractable value and transaction ordering), oracle manipulation (malicious manipulation of external data resources), and timestamp dependency (manipulation of block timestamps by miners).

[0030] Meanwhile, the cybersecurity level protection system for blockchain smart contracts covers the following four types of security attack surfaces:

[0031] 1. The attack surface of the protocol design includes defects in the economic model, vulnerabilities in the governance mechanism, and defects in the business process design.

[0032] 2. Contract code attack surface: including programming vulnerabilities, state management defects, external call risks, etc.

[0033] 3. Attack surface of runtime environment: including EVM execution exceptions, bytecode security, transaction ordering attacks, etc.

[0034] 4. Infrastructure attack surface: including network consensus attacks, network protocol vulnerabilities, cross-chain bridge security, etc.

[0035] Accordingly, the present invention constructs a knowledge graph for network security level protection of blockchain smart contracts to solve the problems of semantic alignment and knowledge fusion of multi-source data, and to build a structured knowledge foundation that supports compliance auditing of smart contracts.

[0036] The present invention specifically employs natural language processing technology to extract computable compliance rules from relevant standards, extracts code entities through static analysis, realizes semantic mapping between regulations and code, constructs a complete knowledge graph of network security level protection for blockchain smart contracts, and realizes the structuring and graphing of the compliance knowledge system of smart contracts (including knowledge of blockchain smart contract vulnerabilities and defects), providing a knowledge foundation with both structural features and regulatory constraints for subsequent intelligent analysis.

[0037] For example, see Figure 2 This invention is based on the "Guidelines for Classification of Cybersecurity Level Protection" (GB / T22240—2020), "Basic Requirements for Cybersecurity Level Protection" (GB / T 22239—2019), "Evaluation Requirements for Cybersecurity Level Protection" (GB / T 28448—2019), "Technical Requirements for Security Design of Cybersecurity Level Protection" (GB / T 25070—2019), and "Information Security Risk Assessment Methods" (GB / T 20984—2022). It also incorporates the technical form and application scenarios of blockchain, and is further supported by "Information Security Technology: Basic Requirements for Cybersecurity Level Protection Part 9: Blockchain Security Extension Requirements" (GA / T 1390.9-2025), "Information Security Technology: Blockchain Security Extension Requirements for Cybersecurity Level Protection" (T / ISEAA 003—2023), and "Information Security Technology: Blockchain Security Evaluation Extension Requirements for Cybersecurity Level Protection" (T / ISEAA). (009—2024), which gathers multi-source data such as smart contract source code and vulnerability databases, uses static analysis tools to analyze the code, and constructs a knowledge graph of network security level protection for blockchain smart contracts.

[0038] Furthermore, based on Figure 2 The knowledge graph of cybersecurity level protection for blockchain smart contracts shown shows that the smart contract security development lifecycle is divided into five stages, including: design stage (threat modeling, architecture design), development stage (secure coding, unit testing), testing stage (vulnerability scanning, penetration testing), auditing stage (third-party auditing, remediation verification), and deployment stage (mainnet deployment, continuous monitoring).

[0039] Smart contract security threats are categorized into three types, including:

[0040] 1. Internal threats (code defects), including logical errors (business process design defects, state management errors, etc.) and coding errors (including integer overflow, unchecked return values, storage conflicts, etc.).

[0041] 2. External threats (environmental attacks), including oracle manipulation (malicious impact on external data sources) and front-end operation (maximum extractable value attacks, transaction ranking exploitation, etc.).

[0042] 3. Combined threats (composite attacks), such as the combined use of flash loans, price manipulation, and reentrancy attacks.

[0043] Based on the aforementioned knowledge graph of network security level protection for blockchain smart contracts, this invention provides an adaptive immune pruning targeted auditing method for blockchain smart contracts.

[0044] This adaptive immune pruning targeted auditing method for blockchain smart contracts introduces a graph neural network with an attention mechanism to perform deep representation learning on the knowledge graph, transforming symbolic nodes into semantic structure vectors. Combined with an artificial immune algorithm, it defines the compliance features corresponding to smart contract defects (such as Sybil attacks and reentrancy attacks) as antigens, uses the vectors output by the GNN as antibodies, and finally integrates the deep semantic understanding capabilities of a pre-trained code model to perform context-aware deep analysis on the selected high-risk targets, generating an interpretable audit report with complete vulnerability location, logical analysis, and remediation suggestions, thereby improving the understanding and analytical capabilities of targeted auditing security for smart contracts.

[0045] For details, see Figure 3 This adaptive immune pruning targeted auditing method for blockchain smart contracts utilizes multi-dimensional filtering, taint analysis, and screening functions, combined with scenario-based, attribute-based, threshold-based, and graph-based threat analysis of niche environments under the graded protection system, to achieve full code path coverage of blockchain smart contracts. It quickly identifies syntax errors and structural vulnerabilities, as well as runtime vulnerabilities and state dependency issues, accurately verifying attack feasibility. Furthermore, it performs complex attribute and key invariant analysis on high-value and high-risk critical smart contracts, achieving adaptive immune pruning targeted auditing through static analysis, dynamic analysis, and formal verification. This addresses technical limitations such as smart contract business logic vulnerabilities, test coverage dependence on test case design, and long verification times.

[0046] The following details the implementation scheme of the knowledge graph adaptive immune pruning targeted auditing method for smart contracts based on artificial intelligence technology, as presented in this invention.

[0047] See Figure 4The diagram shown is an example of the overall principle of the knowledge graph adaptive immune pruning targeted auditing method for smart contracts based on artificial intelligence technology, as presented in this invention.

[0048] Based on the diagram, this AI-based adaptive immune pruning targeted auditing method for smart contracts first constructs a knowledge graph for network security level protection of blockchain smart contracts.

[0049] Next, based on the knowledge graph of network security level protection based on blockchain smart contracts, a graph neural network model for security auditing tasks is constructed. Through neighborhood information aggregation and representation learning, the complex code graph structure is transformed into a low-dimensional vector representation.

[0050] Next, an adaptive pruning model is constructed based on the artificial immune algorithm to quickly scan and match the contract code represented by GNN, thereby achieving rapid "pruning" of a large number of secure smart contract codes, and focusing on high-risk code segments with y types of m defects (including Sybil attacks, long chain attacks, transaction replay, transaction tampering, reentrancy attacks, etc.).

[0051] Finally, a large-scale model is introduced based on prompt word engineering and context construction strategies to determine vulnerabilities in the extracted code, thereby enhancing the interpretability of intelligent targeted security audits of smart contracts and overcoming the shortcomings of immune algorithms in deep logical reasoning. Simultaneously, audit feedback (including newly discovered vulnerabilities and false positives) is used to optimize the GNN representation and automatically update the immune detector set, continuously improving its ability to detect novel and mutated vulnerabilities over time.

[0052] The construction scheme for the cybersecurity level protection knowledge graph of blockchain smart contracts in this method is as described above and will not be repeated here.

[0053] In implementing the adaptive pruning algorithm model, this method first constructs a knowledge graph of blockchain smart contract security and compliance requirements. When performing representation learning based on a graph neural network model, the symbolic nodes in the graph are transformed into structured semantic vectors. The vector dimension is aligned with the feature dimension of y types of m smart contract defects (such as reentrancy attacks, Sybil attacks, etc.), so that the high-weight dimension in the vector corresponds to the core feature of the specific defect.

[0054] Next, an artificial immune algorithm is introduced. When extracting high-risk code fragments based on the adaptive pruning model, the feature patterns of m types of defects are defined as the "antigen pool". "Antibodies" are constructed based on the node risk vectors output by GNN to perform initial screening of the code. Pruning filters out most of the safe code, ensuring that the subgraph retained after pruning focuses on suspicious code fragments, providing accurate targets for in-depth analysis.

[0055] The following example illustrates the implementation scheme of the adaptive pruning algorithm model in this solution.

[0056] In this example, the knowledge graph of network security level protection for blockchain smart contracts is represented by graph G=(V,E), where V is the set of nodes (representing symbolic entities of smart contract code), |V|=n; and E is the set of edges (representing relationships between entities).

[0057] Furthermore, the graph neural network (GNN) representation learning in this example:

[0058] From the GNN function f GNN Map the graph G to a node feature matrix , where d is the vector dimension, aligned with the defect feature dimension.

[0059] For nodes Its vector representation is h v =f GNN (G, v; ) , These are GNN parameters.

[0060] Furthermore, the characteristics of the smart contract defects in this example are as follows:

[0061] Suppose there are m types of defects (such as reentrancy attacks, Sybil attacks, etc.), and their characteristic patterns are defined as an antigen pool, represented as a matrix. , each line (i=1, 2, ..., m) corresponds to the core feature vector of a defect. The dimension d is obtained by uniformly aligning the features of m defects of class y, ensuring that the high-weight dimension of the node vector is mapped to a specific defect.

[0062] Furthermore, the artificial immune algorithm in this example constructs antibodies based on the node risk vectors output by the GNN, and performs matching and pruning.

[0063] Antibody definition: For node v, its antibody .

[0064] Antigen-antibody matching: Calculating the similarity matrix between node antibodies and defective antigens. , of which elements , representing the matching degree between node v and defect i, the similarity function is often represented by the dot product:

[0065] ;

[0066] Node Risk Score: Defines the overall risk score for each node. This reflects the highest degree of defect matching:

[0067] ;

[0068] Pruning Filtering: Set Threshold To filter security codes. The threshold can be determined through statistical distribution:

[0069] ;

[0070] in This represents the α quantile of the risk score set (α is small, such as 0.1, to ensure that a small number of suspicious nodes are retained after pruning). The set of retained nodes is:

[0071] ;

[0072] Subgraph extraction: Extract a subgraph G′=(V′, E′) from the original graph G, where the edge set is...

[0073] ;

[0074] Focusing on suspicious code snippets provides precise targets for in-depth analysis.

[0075] Based on the above techniques, the overall implementation process of the adaptive pruning model in this example is as follows:

[0076] (1) Knowledge graph construction: Given smart contract code, construct the knowledge graph.

[0077] (2) GNN representation learning:

[0078] for The Line. Defect Feature Alignment: Preset Defect Antigen Pool Training GNNs Dimensions and Alignment (can be achieved through supervised loss, such as...) This applies to relevant nodes, but the focus here is on application.

[0079] (3) Artificial immunization screening:

[0080] Antibody construction: ;

[0081] Matching calculation: ;

[0082] Risk Score: ;

[0083] Pruning threshold: ;

[0084] Subgraph generation: ;

[0085] This formalized expression transforms textual descriptions into a mathematical framework, covering the entire process from graph construction to pruning output.

[0086] In this method, when introducing a large model for multi-model collaborative optimization, the suspicious code fragments obtained from pre-pruning are introduced into the large model to achieve deep semantic verification. By fusing suspicious code, GNN risk vectors and defect association subgraphs, and combining natural language auditing requirements, code logic consistency verification, variant vulnerability verification and context association analysis are completed, generating accurate and interpretable audit reports.

[0087] Furthermore, based on this, a feedback-driven closed-loop optimization mechanism is established. The validation results of the large model are used as the standard to incrementally train the GNN, add vulnerability samples to the loss function, optimize the defect sensitivity of node representation, update the immune detector set, and continuously learn from auditing practices to have the ability to dynamically evolve, thereby achieving continuous and adaptive defense against new and mutated vulnerabilities.

[0088] The following example illustrates the implementation scheme of multi-model collaborative optimization in this approach.

[0089] In this example, the pre-pruning output is: Suspicious Code Subgraph. ,in Node feature matrix , Represents a node The risk vector of the GNN.

[0090] Large Model: Set as the large language model function Its input is a prompt text that integrates information from multiple sources, and its output is the verification result and audit report.

[0091] Input fusion for deep semantic verification:

[0092] Suspicious code snippet: for node Its code text is ;

[0093] GNN risk vector: ;

[0094] Defect Relationship Subgraph: adjacency matrix and node features .

[0095] Natural Language Auditing Requirements: Set as Text .

[0096] The fusion is represented as the input sequence Or image-text pair The specific form depends on the overall model architecture. For example, code, vectors, and graph structure information can be encoded as prompt text:

[0097] ;

[0098] in, Convert vectors into natural language descriptions. Convert the subgraph structure to text.

[0099] Among them, the large model validation task is:

[0100] Code logic consistency verification: Output consistency score With explanation ;

[0101] Mutation vulnerability verification: Outputs the probability of the existence of mutation vulnerabilities. With explanation ;

[0102] Contextual analysis: Outputs the correlation analysis vector With explanation ;

[0103] The overall output of the large model can be expressed as:

[0104] ;

[0105] For all nodes, we get the set:

[0106] ;

[0107] Audit report generation: based on And interpret the text to generate structured reports. It includes vulnerability location, risk assessment, and remediation recommendations.

[0108] Feedback-driven closed-loop optimization mechanism:

[0109] The large model validation results serve as the standard: the set of nodes that the large model classifies as high-confidence vulnerabilities is denoted as... Corresponding defect tags (May expand to include new defect types). This constitutes the new training set:

[0110] ;

[0111] GNN Incremental Training:

[0112] The original GNN loss function is (Node classification cross-entropy loss).

[0113] Increase vulnerability sample loss by using weighted cross-entropy or focal loss to enhance vulnerability sensitivity:

[0114] ;

[0115] in For defect category weights, This is the defective antigen vector.

[0116] The total loss function is:

[0117] ;

[0118] in To balance the hyperparameters, the GNN parameters are updated via backpropagation. .

[0119] Update the immune detector set (antigen pool):

[0120] For known defect types Update antigen vector Moving average:

[0121] ;

[0122] in , The item is the attenuation factor.

[0123] For new or mutated vulnerabilities, expand the antigen pool: if a new defect type j appears, add a new antigen vector:

[0124] ;

[0125] And update the total number of defect types (e.g., from 30 to 31).

[0126] Dynamic evolution capability: By iteratively executing the above process, the system achieves continuous adaptive defense against novel and mutated vulnerabilities. Let the time step be t, then the GNN parameters and antigen pool are updated in the (t+1)th iteration as follows:

[0127] ;

[0128] ;

[0129] in For learning rate, ( (Total number of current defect types).

[0130] Therefore, the overall process of multi-model collaborative optimization in this example is as follows:

[0131] Input: Suspicious subgraph Node features Code text Audit requirements .

[0132] Large-scale model deep semantic verification:

[0133] ;

[0134] Closed-loop optimization:

[0135] Collect new vulnerability samples: ( (For threshold).

[0136] Incremental training of GNN:

[0137] ;

[0138] Update the antigen pool:

[0139] ;

[0140] Aggregate is an aggregation function based on defect categories (such as the mean).

[0141] Output: Audit Report Updated GNN parameters and antigen pool This enables dynamic evolutionary defense.

[0142] This formalized expression transforms deep semantic verification and closed-loop optimization mechanisms into a mathematical framework, emphasizing the key characteristics of feedback-driven, incremental learning, and adaptive scaling.

[0143] In the multi-model collaborative optimization stage, this method constructs a context-aware prompt word generation technology to transform the risk labels of GNN structural features and immune algorithms into semantically meaningful audit instructions, guiding the large model to perform deep semantic auditing. A feedback-driven optimization mechanism is established, using the audit results of the large model as a standard. On the one hand, the GNN graph representation capability is optimized through a comparative learning strategy, and on the other hand, the immune detector set is updated, forming a closed-loop learning mechanism that runs through representation learning, targeted detection, and semantic verification. This mechanism has the ability to continuously evolve and adapt to new threats in real-world scenarios.

[0144] The adaptive immune pruning targeted auditing method for smart contract knowledge graphs based on artificial intelligence technology provided by this invention has the following technical features compared with the prior art:

[0145] First, a knowledge graph for cybersecurity level protection of blockchain smart contracts was constructed. Based on cybersecurity level protection theory and blockchain cybersecurity level protection standards, an innovative knowledge graph for cybersecurity level protection of blockchain smart contracts was proposed.

[0146] Secondly, an adaptive immune pruning targeted auditing method is presented. By combining graph neural networks and artificial immune algorithms, and integrating verification, penetration testing, and security auditing techniques, an adaptive immune pruning algorithm for smart contracts is constructed. This achieves efficient pruning of secure code and precise focusing on defects, demonstrating a targeted auditing model.

[0147] Secondly, it enables the dynamic evolution of the auditing method. The adaptive pruning algorithm of this invention is not a static model. By combining the audit results of a large model and through a feedback loop, it absorbs newly discovered vulnerabilities and corrects false alarms, dynamically updating its detection knowledge base. This allows its detection capabilities to autonomously evolve along with the rapid evolution of the smart contract ecosystem, effectively addressing the threats of unknown and variant vulnerabilities.

[0148] Based on the above-mentioned adaptive immune pruning targeted auditing method for smart contract knowledge graphs based on artificial intelligence technology, this embodiment of the invention also provides a computer-readable storage medium storing a program thereon, which, when executed by a processor, implements the steps of the above-mentioned adaptive immune pruning targeted auditing method for smart contract knowledge graphs.

[0149] This invention also provides a processor for running a program, wherein the program executes the steps of the above-described smart contract knowledge graph adaptive immune pruning targeted auditing method during runtime.

[0150] This invention also provides a terminal device, which includes a processor, a memory, and a program stored in the memory and executable on the processor. The program code is loaded and executed by the processor to implement the steps of the above-described adaptive immune pruning targeted auditing method for smart contract knowledge graphs.

[0151] The present invention also provides a computer program product, which, when executed on a data processing device, is adapted to perform the steps of the above-described smart contract knowledge graph adaptive immune pruning targeted auditing method.

[0152] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.

[0153] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and modules described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0154] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0155] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0156] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0157] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0158] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0159] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0160] Computer-readable media, including both permanent and non-permanent, removable and non-removable media, can store information using any method or technology. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transfer medium that can be used to store information accessible by a computing device.

[0161] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0162] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0163] The method, specific system unit, or part thereof of the present invention described above is a pure software architecture. It can be deployed via program code on physical media, such as hard disks, optical discs, or any electronic device (such as smartphones or computer-readable storage media). When a machine loads and executes the program code (e.g., a smartphone loads and executes it), the machine becomes a device for implementing the present invention. The method and device of the present invention can also be transmitted in program code form via transmission media, such as cables, optical fibers, or any other transmission method. When the program code is received, loaded, and executed by a machine (e.g., a smartphone), the machine becomes a device for implementing the present invention.

[0164] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely illustrative of the principles of the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the present invention as claimed. The scope of protection of this invention is defined by the appended claims and their equivalents.

Claims

1. An intelligent contract knowledge graph adaptive immune pruning targeted auditing method based on artificial intelligence technology, characterized in that, The method includes: Constructing a cybersecurity level protection knowledge graph for blockchain smart contracts; A knowledge graph for cybersecurity level protection based on blockchain smart contracts is constructed to build a graph neural network model for security auditing tasks. Through neighborhood information aggregation and representation learning, the complex code graph structure is transformed into a low-dimensional vector representation. An adaptive pruning model is constructed based on an artificial immune algorithm to quickly scan and match contract code represented by GNN, and to quickly "prune" a large number of secure smart contract codes to extract high-risk code fragments with y types and m defects. A large model is introduced to determine vulnerabilities in extracted code based on prompt word engineering and context construction strategies, thereby improving the interpretability of intelligent targeted security auditing of smart contracts.

2. The smart contract knowledge graph adaptive immune pruning targeted auditing method based on artificial intelligence technology according to claim 1, characterized in that, The method employs natural language processing technology to extract computable compliance rules from relevant standards when constructing a knowledge graph for cybersecurity level protection of blockchain smart contracts; it extracts code entities through static analysis to achieve semantic mapping between regulations and code, thereby constructing a complete knowledge graph for cybersecurity level protection of blockchain smart contracts.

3. The smart contract knowledge graph adaptive immune pruning targeted auditing method based on artificial intelligence technology according to claim 1, characterized in that, When performing representation learning based on a graph neural network model, the method transforms symbolic nodes in the graph into structured semantic vectors. The vector dimensions are aligned with the feature dimensions of m types of smart contract defects of type y, so that the high-weight dimensions in the vector correspond to the core features of specific defects.

4. The smart contract knowledge graph adaptive immune pruning targeted auditing method based on artificial intelligence technology according to claim 3, characterized in that, When extracting high-risk code fragments based on the adaptive pruning model, the method defines the feature patterns of m types of defects as an "antigen pool" and constructs "antibodies" based on the node risk vectors output by the GNN to perform initial screening of the code, pruning and filtering out most of the safe code, ensuring that the subgraph retained after pruning focuses on suspicious code fragments.

5. The smart contract knowledge graph adaptive immune pruning targeted auditing method based on artificial intelligence technology according to claim 1, characterized in that, When the method introduces a large model for vulnerability determination, it uses suspicious code fragments obtained from pre-pruning to implement deep semantic verification. By fusing suspicious code, GNN risk vectors, and defect association subgraphs, and combining them with natural language auditing requirements, it completes code logic consistency verification, variant vulnerability verification, and context association analysis, and generates an audit report.

6. The adaptive immune pruning targeted auditing method for smart contract knowledge graphs based on artificial intelligence technology according to claim 1, characterized in that, The method also establishes a feedback-driven closed-loop optimization mechanism, using the validation results of the large model as a standard to incrementally train the GNN, adding vulnerability samples to the loss function, optimizing the defect sensitivity of node representation, and updating the immune detector set.