IET Blockchain (Dec 2023)

SCGformer: Smart contract vulnerability detection based on control flow graph and transformer

  • KeXin Gong,
  • Xiangmei Song,
  • Na Wang,
  • Chunyang Wang,
  • Huijuan Zhu

DOI
https://doi.org/10.1049/blc2.12046
Journal volume & issue
Vol. 3, no. 4
pp. 213 – 221

Abstract

Read online

Abstract The security of smart contract has always been one of the significant problems in blockchain. As shown in previous studies, vulnerabilities in smart contracts can lead to unpredictable losses. With the rapid growth of the number of smart contracts, more and more data driven detection technologies based on machine learning have been proposed. However, some state‐of‐the‐art approaches mainly rely on the source code of smart contract. These methods are limited by the openness of the source code and the version of the programming language. To address this problem, we propose a novel vulnerability detection method based on transformer by constructing the control flow graph (CFG) of smart contracts operation codes (opcodes), which shields the difference of various versions of program language. Extensive experiments are conducted to evaluate the effectiveness of the proposed method on the authors' own collected dataset. The experimental results show that the proposed method achieves 94.36% accuracy in vulnerability detection, which performs better than other state‐of‐the‐art methods.

Keywords