I Know Who Clones Your Code: Interpretable Smart Contract Similarity Detection

Widespread reuse of open-source code in smart contract development boosts programming efficiency but significantly amplifies bug propagation across contracts, while dedicated methods for detecting similar smart contract functions remain very limited. Conventional abstract-syntax-tree (AST) based methods for smart contract similarity detection face challenges in handling intricate tree structures, which impedes detailed semantic comparison of code. Recent deep-learning based approaches tend to overlook code syntax and detection interpretability, resulting in suboptimal performance. To fill this research gap, we introduce <sc xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">SmartDetector</small>, a novel approach for computing similarity between smart contract functions, explainable at the fine-grained statement level. Technically, <sc xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">SmartDetector</small> decomposes the AST of a smart contract function into a series of smaller statement trees, each reflecting a structural element of the source code. Then, <sc xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">SmartDetector</small> uses a classifier to compute the similarity score of two functions by comparing each pair of their statement trees. To address the infinite hyperparameter space of the classifier, we mathematically derive a cosine-wise diffusion process to efficiently search optimal hyperparameters. Extensive experiments conducted on three large real-world datasets demonstrate that <sc xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">SmartDetector</small> outperforms current state-of-the-art methods by an average improvement of 14.01% in F1-score, achieving an overall average F1-score of 95.88%.

Authors

Institutions

Publication Details

Journal
IEEE Transactions on Dependable and Secure Computing
Published
2025-08-14
DOI
https://doi.org/10.1109/tdsc.2025.3598985
Citations
1
Primary Topic
Artificial Intelligence in Law
Type
article
Field-Weighted Citation Impact
8.52
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

I Know Who Clones Your Code: Interpretable Smart Contract Similarity Detection

Chengkun Wei, Yingying Jiao, Xiaojun Xu, Zhenguang Liu et al.
1 citations
IEEE Transactions on Dependable and Secure Computing
Artificial Intelligence in Law
8.52
article

I Know Who Clones Your Code: Interpretable Smart Contract Similarity Detection

Chengkun Wei, Yingying Jiao, Xiaojun Xu, Zhenguang Liu, Kui Ren, Lixun Ma, Zhongzheng Mu
article en
1 citations

Abstract

Widespread reuse of open-source code in smart contract development boosts programming efficiency but significantly amplifies bug propagation across contracts, while dedicated methods for detecting similar smart contract functions remain very limited. Conventional abstract-syntax-tree (AST) based methods for smart contract similarity detection face challenges in handling intricate tree structures, which impedes detailed semantic comparison of code. Recent deep-learning based approaches tend to overlook code syntax and detection interpretability, resulting in suboptimal performance. To fill this research gap, we introduce <sc xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">SmartDetector</small>, a novel approach for computing similarity between smart contract functions, explainable at the fine-grained statement level. Technically, <sc xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">SmartDetector</small> decomposes the AST of a smart contract function into a series of smaller statement trees, each reflecting a structural element of the source code. Then, <sc xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">SmartDetector</small> uses a classifier to compute the similarity score of two functions by comparing each pair of their statement trees. To address the infinite hyperparameter space of the classifier, we mathematically derive a cosine-wise diffusion process to efficiently search optimal hyperparameters. Extensive experiments conducted on three large real-world datasets demonstrate that <sc xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">SmartDetector</small> outperforms current state-of-the-art methods by an average improvement of 14.01% in F1-score, achieving an overall average F1-score of 95.88%.

IEEE Transactions on Dependable and Secure ComputingVol. 22(6)
Zhejiang University of Science and Technology (CN), Zhejiang University of Technology (CN), Zhejiang Gongshang University (CN), Zhejiang University (CN)
Openalex Percentile: Top 3%
Artificial Intelligence in Law
8.52
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.