Open Access iconOpen Access

ARTICLE

GRATDet: Smart Contract Vulnerability Detector Based on Graph Representation and Transformer

Peng Gong1,2,3, Wenzhong Yang2,3,*, Liejun Wang2,3, Fuyuan Wei2,3, KeZiErBieKe HaiLaTi2,3, Yuanyuan Liao2,3

1 College of Information Science and Engineering, Xinjiang University, Urumqi, 830000, China
2 Key Laboratory of Signal Detection and Processing in Xinjiang Uygur Autonomous Region, Xinjiang University, Urumqi, 830000, China
3 Key Laboratory of Multilingual Information Technology in Xinjiang Uygur Autonomous Region, Xinjiang University, Urumqi, 830000, China

* Corresponding Author: Wenzhong Yang. Email: email

Computers, Materials & Continua 2023, 76(2), 1439-1462. https://doi.org/10.32604/cmc.2023.038878

Abstract

Smart contracts have led to more efficient development in finance and healthcare, but vulnerabilities in contracts pose high risks to their future applications. The current vulnerability detection methods for contracts are either based on fixed expert rules, which are inefficient, or rely on simplistic deep learning techniques that do not fully leverage contract semantic information. Therefore, there is ample room for improvement in terms of detection precision. To solve these problems, this paper proposes a vulnerability detector based on deep learning techniques, graph representation, and Transformer, called GRATDet. The method first performs swapping, insertion, and symbolization operations for contract functions, increasing the amount of small sample data. Each line of code is then treated as a basic semantic element, and information such as control and data relationships is extracted to construct a new representation in the form of a Line Graph (LG), which shows more structural features that differ from the serialized presentation of the contract. Finally, the node information and edge information of the graph are jointly learned using an improved Transformer–GP model to extract information globally and locally, and the fused features are used for vulnerability detection. The effectiveness of the method in reentrancy vulnerability detection is verified in experiments, where the F1 score reaches 95.16%, exceeding state-of-the-art methods.

Keywords


Cite This Article

APA Style
Gong, P., Yang, W., Wang, L., Wei, F., HaiLaTi, K. et al. (2023). Gratdet: smart contract vulnerability detector based on graph representation and transformer. Computers, Materials & Continua, 76(2), 1439-1462. https://doi.org/10.32604/cmc.2023.038878
Vancouver Style
Gong P, Yang W, Wang L, Wei F, HaiLaTi K, Liao Y. Gratdet: smart contract vulnerability detector based on graph representation and transformer. Comput Mater Contin. 2023;76(2):1439-1462 https://doi.org/10.32604/cmc.2023.038878
IEEE Style
P. Gong, W. Yang, L. Wang, F. Wei, K. HaiLaTi, and Y. Liao, “GRATDet: Smart Contract Vulnerability Detector Based on Graph Representation and Transformer,” Comput. Mater. Contin., vol. 76, no. 2, pp. 1439-1462, 2023. https://doi.org/10.32604/cmc.2023.038878



cc Copyright © 2023 The Author(s). Published by Tech Science Press.
This work is licensed under a Creative Commons Attribution 4.0 International License , which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.
  • 1010

    View

  • 373

    Download

  • 0

    Like

Share Link