Lightweight honeypot contract detection method based on tree pruning and graph auto-encoder
Youwei Wang, Yudong Hou, Lizhou Feng · Blockchain Research and Applications · 2025
To address the high complexity of current honeypot contract detection methods, a lightweight honeypot contract detection method based on pruning and graph auto-encoder (called CSSDetector) is proposed. First, the contract source code is converted into an XML parse tree, and the tree is pruned using term frequency-inverse document frequency (TF-IDF) to reduce the number of nodes. Then, to improve training efficiency while guaranteeing detection accuracy, the pruned XML parse tree is converted into a graph, and the Solidity source code is learned using the Word2vec model and the graph auto-encoder to reduce the node dimension. Finally, to reduce the impact of the dataset imbalance problem, three data augmentation methods that can improve model robustness and classification accuracy are used to increase the diversity of the training samples. The experimental results show that the CSSDetector significantly reduces the model training time and storage space while ensuring honeypot contract detection performance. Compared with the CSGDetector, the CSSDetector reduces the temporal cost by more than 70% and the spatial cost by more than 90%, verifying the execution efficiency and classification accuracy of the proposed method.