Smart Contract Defect Detection Method Based on Multi-Feature Fusion
Smart contracts are one of the most successful applications of the blockchain technology.Owing to their widespread application,the security issues of smart contracts have attracted widespread attention from researchers.Although some studies have been conducted on defect detection in smart contracts,mining of code features in smart contracts remains insufficient.This paper introduces a smart contract defect detection method that employs a multi-feature fusion approach.First,the smart contract code undergoes preprocessing,including color labeling,vocabulary extraction,ASCII character conversion,and extraction of inheritance relationships between contracts.The processing information obtained from the first three steps is then input into a fusion model constructed using Bidirectional Encoder Representations from Transformers(BERT),Convolutional Neural Network(CNN),and Bidirectional Long Short Term Memory(BiLSTM)network for feature extraction.Simultaneously,the information on inheritance relationship between contracts is input into the node2vec random walk algorithm to obtain the feature vector of the contract relationship.Finally,all feature vectors are connected and input into the classifier for defect classification.The multi-feature fusion model is validated using a real Solidity smart contract dataset,and experimental results show that compared with other models,it achieves 6%-12%and 4%-11%improvements in the Fl value and accuracy,respectively.This method can comprehensively explore the inherent characteristics of smart contract code,improve defect detection performance,and find potential applications in preserving the security of smart contracts.