Skip to main navigation Skip to search Skip to main content

Gas-expensive patterns detection to optimize smart contracts

  • Jiliang Li*
  • , Ziyi Zhao
  • , Zhou Su
  • , Weizhi Meng
  • *Corresponding author for this work
  • Xi'an Jiaotong University

Research output: Contribution to journalJournal articleResearchpeer-review

Abstract

Smart contracts are programmable protocols that run on Ethereum and require gas to be deployed and used. Gas-expensive operations in some smart contracts can cause users to consume extra gas in transactions. There are already several methods to detect gas-expensive patterns in smart contracts. However, some problems still need to be solved: most static analysis methods are based on specialist knowledge, and the patterns used to detect gas-expensive patterns must be manually summarized before the detection methods can be applied. Furthermore, due to the explosive growth of smart contracts, which generate a large amount of data, it is challenging to reuse these methods across different patterns. To address these issues, this work first proposes a new learning-based method, ExpenGas, based on the idea of evolutionary computation-based machine learning to detect Expensive Operation patterns of smart contracts through pre-trained techniques and multi-crucial data flow graphs. The low complexity of the multi-crucial data flow graph enables the model to focus on key features. Finally, by testing on 21981 smart contract files, ExpenGas has 83.05% accuracy and 91.96% recall in detecting the Expensive Operation patterns of gas-expensive patterns, which is significantly more optimal than the current state-of-the-art methods.

Original languageEnglish
Article number110542
JournalApplied Soft Computing
Volume145
Number of pages10
ISSN1568-4946
DOIs
Publication statusPublished - 2023

Keywords

  • Code optimization
  • Expensive Operation
  • Pre-trained model
  • Smart contract

Fingerprint

Dive into the research topics of 'Gas-expensive patterns detection to optimize smart contracts'. Together they form a unique fingerprint.

Cite this