Research Article

Research on Security Vulnerability Detection of Blockchain Smart Contracts Based on Machine Learning

Yinuo Wu*
Nanjing University of Aeronautics and Astronautics, Liyang City, Jiangsu Province, 213300, China

* Corresponding author: [email protected]

Abstract

Blockchain technology, characterized by its immutability, decentralization, transparency, security, and traceability, has shown vast potential for applications in secure IoT communications and data protection through its deployed smart contracts. While machine learning-based code generation systems aim to automate high-quality programming solutions, they face significant challenges when addressing blockchain-related issues. This paper analyzes the limitations of machine learning in identifying vulnerabilities within blockchain smart contracts and proposes robust solutions. To achieve this, this paper suggests organizing multiple security experts for labeling, developing efficient labeling tools, employing semi-supervised learning to reduce dependency on labeled data, and establishing a continuous update mechanism for labeled datasets to adapt to evolving threat landscapes. To address the scarcity of training samples in the blockchain domain, this paper introduces a method for generating additional Solidity smart contract training samples using data augmentation techniques. Given that traditional data augmentation methods are not suitable for Solidity, the approach involves converting Solidity contracts into Python code for processing, then reverting them back to Solidity post-augmentation, with provided code examples. Furthermore, leveraging established non-blockchain code to train blockchain-related models enhances model performance and generalization capabilities. These strategies effectively tackle the issue of insufficient training samples in the blockchain field and offer new perspectives on the conversion between Solidity and Python.

Keywords: Blockchain; machine learning; semi-supervised learning; data augmentation techniques
Published: February 14, 2025
DOI: 10.54254/2755-2721/2025.20839
Volume: ACE Vol.108
pp. 146-155
Download PDF

References

  1. YIN, M., MALKHI, D., REITER, M. K., & et al. (2019). HotStuff: BFT Consensus in the Lens of Blockchain. arXiv:1803.05069.
  2. Chen, W., & Zheng, Z. (2018). Blockchain data analysis: status, trend and challenges. Journal of Computer Research and Development, 55(9), 29-46.
  3. Bartoletti, M., & Pompianu, L. (2017). An empirical analysis of smart contracts: Platforms, applications and design patterns. In Financial Cryptography and Data Security (pp. 494-509). Cham, Switzerland: Springer, vol. 10323.
  4. FU, M. L., WU, L. F., HONG, Z. L., & et al. (2019). Research on mining technology of smart contract security vulnerabilities. Journal of Computer Applications, 39(7), 1959-1966.
  5. Xu, Q., Jin, C., Rasid, M.F.B.M., Veeravalli, B., & Aung, K.M.M. (2017). Blockchain-based decentralized content trust for docker images. Multimedia Tools and Applications, 126.
  6. Dorri, A., Kanhere, S.S., Jurdak, R., & Gauravaram, P. (2017). Blockchain for IoT security and privacy: The case study of a smart home. In Proceedings - 2017 IEEE International Conference on Pervasive Computing and Communications Workshops (PerCom Workshops), 618-623.
  7. Li, C., & Zhang, L.J. (2017). A blockchain based new secure multi-layer network model for the Internet of Things. In Proceedings - 2017 IEEE 2nd International Congress on Internet of Things (ICIOT 2017), 3341.
  8. Zylmaz, K.R., & Yurdakul, A. (2017). Integrating low-power IoT devices to a blockchain-based infrastructure. In Proceedings of the Thirteenth ACM International Conference on Embedded Software (EMSOFT 17) Companion, 12.