{"title":"A smart contract vulnerability detection method based on deep learning with opcode sequences","authors":"Peiqiang Li, Guojun Wang, Xiaofei Xing, Jinyao Zhu, Wanyi Gu, Guangxin Zhai","doi":"10.1007/s12083-024-01750-7","DOIUrl":null,"url":null,"abstract":"<p>Ethereum is a blockchain network that allows developers to create smart contracts and programs that run on the blockchain. Smart contracts contain logic to transfer assets based on pre-defined conditions. With over 100,000 new smart contracts being deployed every day, the potential for coding errors is high, making the contracts vulnerable to exploits. A key limitation is that once deployed, smart contracts are immutable and cannot be updated, even if flaws are found. This inflexibility puts funds at risk of theft and loss. The rapid pace of deployment outpaces security audits, increasing vulnerabilities that put users’ cryptocurrency at risk. To reduce the risk caused by smart contract vulnerabilities, we applied deep learning techniques. To develop a deep learning model capable of detecting vulnerabilities, we first created a dataset by replaying real transactions on the Ethereum Mainnet, collecting opcode sequences from real Ethereum contracts, and labeling them using the SODA plugin. We pre-processed this opcode data by removing duplicates, normalizing sequence lengths, simplifying opcodes into representative groups, and converting sequences into numerical vectors to ultimately obtain an optimal representation of the data. We then trained and evaluated three different neural network architectures on this dataset. Our best-performing model achieved an average accuracy of 88% in detecting seven types of vulnerabilities. Further analysis showed that the model was effective at identifying potential problems in smart contracts, which was an important capability for securing funds and executing logic in live contracts.</p>","PeriodicalId":49313,"journal":{"name":"Peer-To-Peer Networking and Applications","volume":"29 1","pages":""},"PeriodicalIF":3.3000,"publicationDate":"2024-06-27","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Peer-To-Peer Networking and Applications","FirstCategoryId":"94","ListUrlMain":"https://doi.org/10.1007/s12083-024-01750-7","RegionNum":4,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"Q2","JCRName":"COMPUTER SCIENCE, INFORMATION SYSTEMS","Score":null,"Total":0}
引用次数: 0
Abstract
Ethereum is a blockchain network that allows developers to create smart contracts and programs that run on the blockchain. Smart contracts contain logic to transfer assets based on pre-defined conditions. With over 100,000 new smart contracts being deployed every day, the potential for coding errors is high, making the contracts vulnerable to exploits. A key limitation is that once deployed, smart contracts are immutable and cannot be updated, even if flaws are found. This inflexibility puts funds at risk of theft and loss. The rapid pace of deployment outpaces security audits, increasing vulnerabilities that put users’ cryptocurrency at risk. To reduce the risk caused by smart contract vulnerabilities, we applied deep learning techniques. To develop a deep learning model capable of detecting vulnerabilities, we first created a dataset by replaying real transactions on the Ethereum Mainnet, collecting opcode sequences from real Ethereum contracts, and labeling them using the SODA plugin. We pre-processed this opcode data by removing duplicates, normalizing sequence lengths, simplifying opcodes into representative groups, and converting sequences into numerical vectors to ultimately obtain an optimal representation of the data. We then trained and evaluated three different neural network architectures on this dataset. Our best-performing model achieved an average accuracy of 88% in detecting seven types of vulnerabilities. Further analysis showed that the model was effective at identifying potential problems in smart contracts, which was an important capability for securing funds and executing logic in live contracts.
期刊介绍:
The aim of the Peer-to-Peer Networking and Applications journal is to disseminate state-of-the-art research and development results in this rapidly growing research area, to facilitate the deployment of P2P networking and applications, and to bring together the academic and industry communities, with the goal of fostering interaction to promote further research interests and activities, thus enabling new P2P applications and services. The journal not only addresses research topics related to networking and communications theory, but also considers the standardization, economic, and engineering aspects of P2P technologies, and their impacts on software engineering, computer engineering, networked communication, and security.
The journal serves as a forum for tackling the technical problems arising from both file sharing and media streaming applications. It also includes state-of-the-art technologies in the P2P security domain.
Peer-to-Peer Networking and Applications publishes regular papers, tutorials and review papers, case studies, and correspondence from the research, development, and standardization communities. Papers addressing system, application, and service issues are encouraged.