Enhancing blockchain network security: A targetable machine learning model for effective vulnerability repair
Smart contracts have been widely used on blockchain to automate financial and business transactions. While they are susceptible to attacks because of their involvement in operations like asset transfers. Researchers have suggested various methods to address vulnerabilities in these contracts and improve their reliability. Nevertheless, when the contract code is excessively lengthy, redundant contextual information may adversely affect repair performance. To address this problem, we propose a localizable machine learning model to repair long contracts. Firstly, we extract a data collection that includes code structure information from the abstract syntax tree of the smart contract source code. Then we leverage a pre-trained BERT model to generate code embeddings and use BiLSTM for training the vulnerability localization model. Finally, the vulnerable code lines in the contract are localized based on statistical thresholding of the model’s output values. On this basis, we construct the corresponding code extraction algorithms to generate code repair fragments and use machine learning techniques to repair contracts. We compare our method with existing approaches using public datasets. The results demonstrate a significant improvement in performance over direct repair methods, effectively addressing the challenges associated with the repair of long-code smart contracts. • Presents a locatable ML repair model for long smart contracts: integrates BERT+BiLSTM to spot vulnerabilities, then uses T5 for repair. • Logical pipeline design: separates localization/repair tasks to boost performance via focused, smaller repair contexts. • Domain-relevant metrics: evaluates repair rate/time, gas consumption and code volume; outperforms existing methods. • Targets smart contract specifics: tailored for lengthy contract scenarios, addressing practical vulnerability repair needs.
Authors
- Jian Jiao (ORCID: https://orcid.org/0000-0003-2442-1275)
- Han Cao (ORCID: https://orcid.org/0000-0001-6444-3503)
- Jiao Shi (ORCID: https://orcid.org/0000-0003-1124-6738)
- Li Yu (ORCID: https://orcid.org/0000-0003-3889-3863)
Institutions
- Beijing Founder Electronics (China) (CN)
- Shanxi Transportation Research Institute (CN)
- Beijing Information Science & Technology University (CN)
Publication Details
- Journal
- International Journal of Intelligent Networks
- Published
- 2025-12-01
- DOI
- https://doi.org/10.1016/j.ijin.2025.11.005
- Primary Topic
- Blockchain Technology Applications and Security
- Type
- article
- Field-Weighted Citation Impact
- 0.00