Clone Detection for Smart Contracts: How Far Are We?
Zuobin Wang, Zhiyuan Wan, Yujing Chen, Yun Zhang, David Lo, Difan Xie, Xiaohu Yang
Abstract
In smart contract development, practitioners frequently reuse code to reduce development effort and avoid reinventing the wheel. This reused code, whether identical or similar to its original source, is referred to as a code clone. Unintentional code cloning can propagate flaws and vulnerabilities, potentially undermining the reliability and maintainability of software systems. Previous studies have identified a significant prevalence of code clones in Solidity smart contracts on the Ethereum blockchain. To mitigate the risks posed by code clones, clone detection has emerged as an active field of research and practice in software engineering. Recent studies have extended existing techniques or proposed novel techniques tailored to the unique syntactic and semantic features of Solidity. Nonetheless, the evaluations of existing techniques, whether conducted by their original authors or independent researchers, involve codebases in various programming languages and utilize different versions of the corresponding tools. The resulting inconsistency makes direct comparisons of the evaluation results impractical, and hinders the ability to derive meaningful conclusions across the evaluations. There remains a lack of clarity regarding the effectiveness of these techniques in detecting smart contract clones, and whether it is feasible to combine different techniques to achieve scalable yet accurate detection of code clones in smart contracts. To address this gap, we conduct a comprehensive empirical study that evaluates the effectiveness and scalability of five representative clone detection techniques on 33,073 verified Solidity smart contracts, along with a benchmark we curate, in which we manually label 72,010 pairs of Solidity smart contracts with clone tags. Moreover, we explore the potential of combining different techniques to achieve optimal performance of code clone detection for smart contracts, and propose SourceREClone, a framework designed for the refined integration of different techniques, which achieves a 36.9% improvement in F1 score compared to a straightforward combination of the state of the art. Based on our findings, we discuss implications, provide recommendations for practitioners, and outline directions for future research.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext 4d2e2866-e528-4988-ad5e-7dac3c1902c3Cited by top-tier papers1
Ask how each one uses itBuilds on5
- TokenScope: Automatically Detecting Inconsistent Behaviors of Cryptocurrency Tokens in EthereumTing Chen, Yufei Zhang, Zihao Li, Xiapu Luo et al.CCS 2019 · 140 citations
- Smart Contract Security: a Practitioners' PerspectiveZhiyuan Wan, Xin Xia, David Lo, Jiachi Chen et al.ICSE 2021 · 58 citations
- Demystifying the Composition and Code Reuse in Solidity Smart ContractsKairan Sun, Zhengzi Xu, Chengwei Liu, Kaixuan Li et al.FSE 2023 · 25 citations
- Comparison and Evaluation of Clone Detection Techniques with Different Code RepresentationsYuekun Wang, Yuhang Ye, Yueming Wu, Weiwei Zhang et al.ICSE 2023 · 15 citations
- SmartCoCo: Checking Comment-Code Inconsistency in Smart Contracts via Constraint Propagation and BindingSicheng Hao, Yuhong Nan, Zibin Zheng, Xiaohui LiuASE 2023 · 7 citations
Related papers
- Code Cloning in Solidity Smart Contracts: Prevalence, Evolution, and Impact on DevelopmentRan Mo, Haopeng Song, Wei Ding, Chaochao WuICSE 2025 · 1 citation
- Towards Understanding the Bugs in Solidity CompilerHaoyang Ma, Wuqi Zhang, Qingchao Shen, Yongqiang Tian et al.ISSTA 2024 · 9 citations
- Abusing the Ethereum Smart Contract Verification Services for Fun and ProfitPengxiang Ma, Ningyu He, Yuhua Huang, Haoyu Wang et al.NDSS 2024
- Copy-and-Paste? Identifying EVM-Inequivalent Code Smells in Multi-chain Reuse ContractsZexu Wang, Jiachi Chen, Tao Zhang, Yu Zhang et al.ISSTA 2025
- Empirical review of automated analysis tools on 47, 587 Ethereum smart contractsThomas Durieux, João F. Ferreira, Rui Abreu, Pedro CruzICSE 2020 · 373 citations
