{"title":"DBESN: A novel model for detecting and identifying malicious code in a smart contract","authors":"Punam Bedi , Vinita Jindal , Ningyao Ningshen , Pushkar Gole","doi":"10.1016/j.bcra.2025.100304","DOIUrl":null,"url":null,"abstract":"<div><div>Smart contracts represent a predefined set of rules invoked when specific conditions are met within blockchain networks, eliminating the need for a centralized authority to validate the transactions. The absence of a central authority can potentially expose smart contracts to fraudulent behavior. Moreover, implementation flaws in smart contracts can be exploited to cause unintended behavior, resulting in security or financial risks. Traditionally, the identification of vulnerabilities in smart contracts has relied on methods such as pattern matching, data flow analysis, and input testing. While these techniques are foundational, they are constrained by human limitations and may not comprehensively address the full spectrum of potential issues. This necessitates more advanced approaches to ensure robust security and reliability. Therefore, in the literature, numerous researchers have leveraged different machine learning (ML) and deep learning (DL) techniques to classify normal and malicious smart contracts. However, the existing literature either grapples with class imbalance issues or relies on conventional methods. Moreover, the existing research often falls short of locating the exact location of malicious code within the smart contracts. Therefore, to address these gaps, this paper proposes a novel model called the dual-branch encoder Siamese network (DBESN) for detecting malicious smart contracts. Furthermore, this model is extended to precisely identify the region of the vulnerable code fragment within the smart contract using the local interpretable model-agnostic explanations (LIME) algorithm. Experimental results demonstrated a performance accuracy of 98.62% and an F1-score of 99.30% with an inference time of 0.296 s. Given the high performance coupled with the low inference time of the proposed DBESN model, it is suitable for deployment within blockchain networks to detect and identify malicious smart contracts effectively and efficiently.</div></div>","PeriodicalId":53141,"journal":{"name":"Blockchain-Research and Applications","volume":"6 4","pages":"Article 100304"},"PeriodicalIF":6.5000,"publicationDate":"2025-12-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Blockchain-Research and Applications","FirstCategoryId":"1093","ListUrlMain":"https://www.sciencedirect.com/science/article/pii/S2096720925000314","RegionNum":3,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"2025/5/7 0:00:00","PubModel":"Epub","JCR":"Q1","JCRName":"COMPUTER SCIENCE, INFORMATION SYSTEMS","Score":null,"Total":0}
引用次数: 0
Abstract
Smart contracts represent a predefined set of rules invoked when specific conditions are met within blockchain networks, eliminating the need for a centralized authority to validate the transactions. The absence of a central authority can potentially expose smart contracts to fraudulent behavior. Moreover, implementation flaws in smart contracts can be exploited to cause unintended behavior, resulting in security or financial risks. Traditionally, the identification of vulnerabilities in smart contracts has relied on methods such as pattern matching, data flow analysis, and input testing. While these techniques are foundational, they are constrained by human limitations and may not comprehensively address the full spectrum of potential issues. This necessitates more advanced approaches to ensure robust security and reliability. Therefore, in the literature, numerous researchers have leveraged different machine learning (ML) and deep learning (DL) techniques to classify normal and malicious smart contracts. However, the existing literature either grapples with class imbalance issues or relies on conventional methods. Moreover, the existing research often falls short of locating the exact location of malicious code within the smart contracts. Therefore, to address these gaps, this paper proposes a novel model called the dual-branch encoder Siamese network (DBESN) for detecting malicious smart contracts. Furthermore, this model is extended to precisely identify the region of the vulnerable code fragment within the smart contract using the local interpretable model-agnostic explanations (LIME) algorithm. Experimental results demonstrated a performance accuracy of 98.62% and an F1-score of 99.30% with an inference time of 0.296 s. Given the high performance coupled with the low inference time of the proposed DBESN model, it is suitable for deployment within blockchain networks to detect and identify malicious smart contracts effectively and efficiently.
期刊介绍:
Blockchain: Research and Applications is an international, peer reviewed journal for researchers, engineers, and practitioners to present the latest advances and innovations in blockchain research. The journal publishes theoretical and applied papers in established and emerging areas of blockchain research to shape the future of blockchain technology.