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

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Liu, Zhenguang, Ma, Lixun, Mu, Zhongzheng, Wei, Chengkun, Xu, Xiaojun, Jiao, Yingying, Ren, Kui
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866918139428601856
author Liu, Zhenguang
Ma, Lixun
Mu, Zhongzheng
Wei, Chengkun
Xu, Xiaojun
Jiao, Yingying
Ren, Kui
author_facet Liu, Zhenguang
Ma, Lixun
Mu, Zhongzheng
Wei, Chengkun
Xu, Xiaojun
Jiao, Yingying
Ren, Kui
contents 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 SmartDetector, a novel approach for computing similarity between smart contract functions, explainable at the fine-grained statement level. Technically, SmartDetector 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, SmartDetector 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 SmartDetector 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%.
format Preprint
id arxiv_https___arxiv_org_abs_2509_09630
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle I Know Who Clones Your Code: Interpretable Smart Contract Similarity Detection
Liu, Zhenguang
Ma, Lixun
Mu, Zhongzheng
Wei, Chengkun
Xu, Xiaojun
Jiao, Yingying
Ren, Kui
Software Engineering
Cryptography and Security
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 SmartDetector, a novel approach for computing similarity between smart contract functions, explainable at the fine-grained statement level. Technically, SmartDetector 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, SmartDetector 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 SmartDetector 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%.
title I Know Who Clones Your Code: Interpretable Smart Contract Similarity Detection
topic Software Engineering
Cryptography and Security
url https://arxiv.org/abs/2509.09630