With more and more application scenarios landing at the national and enterprise levels,blockchain technology shows its powerful vitality and infinite possibilities.As a representative of the emerging blockchain,ethereum has created a more diverse community and platform by integrating smart contract solutions.However,the use of smart contracts has caused numerous security incidents against contract vulnerabilities.In response to this problem,many well-performing detection methods have emerged from the academic community.But attack contracts and detection methods are dynamic,and the shortcomings of traditional and deep learning methods are becoming apparent as Ethernet applications continue to evolve.The first challenge is that as smart contract application scenarios spread,the diversity of contract functions and the complexity of source code contradict the user’s need to quickly locate vulnerabilities in the contract.The second challenge is the uneven distribution of vulnerability risk among different functional contracts,which is currently of little concern to the industry.To address these issues,this thesis proposes a multi-task detection model for smart contracts based on graph embedding category feature enhancement,including smart contract vulnerability detection and risk function vulnerability detection methods in smart contracts.Firstly,for the input data problem of the model,the semantic graph of smart contract syntax and the semantic graph of smart contract risk function syntax are constructed for unsupervised clustering of contract functional categories.An expert mode slicing method oriented to source code is designed,and the syntax and semantic features of contracts and functions are generated through the message propagation model and the multiple convolution kernel TextCNN model,and the variable call relationship in the contract and the row-level features in the function are preserved.Considering the correlation between contract categories and vulnerabilities,the linking relationship between nodes is used to generate the functional similarity between contracts and functions through the identifier sequence maximum matching and semantic similarity,and the contracts and functions with similar functions are clustered.Based on the syntactic semantic graph,a multi-task vulnerability detection model for smart contracts based on graph-embedded category feature enhancement is constructed using category feature extraction and data enhancement layers.After augmenting the data with its corresponding contract category features and function category features,two types of task detection results are obtained by multitask learning.While detecting contract vulnerabilities,it helps users to locate contract vulnerabilities quickly.The experiments in this thesis are set up on a dataset consisting of 9,742 smart contracts,and the effectiveness of this method is discussed through ablation experiments as well as comparison experiments.Several commonly used contract detection models are selected,which include both traditional and machine learning methods,and it is demonstrated in contract detection that the vulnerability detection method based on graph embedding category enhancement in this thesis achieves a better recall of 92.82%and reduces the probability of missing a contract compared to traditional methods.Compared with the machine learning method,the combined detection accuracy for both types of vulnerabilities reaches 89.53%,which improves the accuracy of existing methods,and the detection accuracy for vulnerabilities in functions reaches 96.86%with high reliability.After ablation experiments,it is verified that the introduction of smart contract category features improves the detection accuracy of the model by an average of 3.42%for both types of tasks,compared to the model without category augmentation. |