Skip to content
Open access

GasGAT: a graph attention network framework for smart contract gas optimization

Sep 2026 · Frontiers in Blockchain · Vol 9 · 0 citations · 29 references

TL;DR

GasGAT is a deep learning framework that models smart contracts as semantic graphs and leverages a Graph Attention Network (GAT) to detect gas-intensive code patterns and represents a paradigm shift from traditional detection methods toward explainable, graph-based reasoning for gas optimization, enabling developers to design more efficient, scalable, and secure decentralized applications.

Abstract

The optimization of gas consumption in Ethereum smart contracts is critical for enhancing the economic viability, scalability, and security of blockchain applications. Existing tools, however, are largely limited to static heuristics or local pattern matching, failing to capture the complex, non-local dependencies that drive gas inefficiency. To address this limitation, this paper introduces GasGAT, a deep learning framework that models smart contracts as semantic graphs and leverages a Graph Attention Network (GAT) to detect gas-intensive code patterns. By capturing intricate dependencies between functions, state variables, and control flows, GasGAT is able to identify non-local and inter-procedural inefficiencies that are often missed by rule-based or purely local static analysis tools. Unlike existing approaches, which focus primarily on local code patterns or rule-based detection, GasGAT explicitly reasons about long-range execution paths within smart contracts. We evaluate our method on a dataset of 40,000 verified Ethereum smart contracts (Solidity ≥0.8.0, labeled via Slither static analysis), including both a polarized subset (excluding ambiguous cases) and a full, non-filtered setting. Under 5-fold cross-validation, GasGAT achieves an accuracy of 94.92% (±1.04%) and a macro F1-score of 88.69% (±2.70%), with a McNemar statistic of 633.12 (p ≪ 0.05) confirming statistical significance. Crucially, GasGAT is the only model whose performance remains stable when correlated node features are removed (Δ = 0.00%), demonstrating that its attention mechanism learns genuine structural patterns rather than label-feature correlations. The primary contribution of GasGAT lies not in marginal accuracy improvements, but in its ability to provide interpretable, structural insights through attention mechanisms. This represents a paradigm shift from traditional detection methods toward explainable, graph-based reasoning for gas optimization, enabling developers to design more efficient, scalable, and secure decentralized applications.

Read PDF

Similar papers

Book Open access Apr 2026

RAGas: Retrieval Augmented Gas Optimization for Smart Contracts with Continuous Knowledge Integration

This work systematically analyzed the grammatical and semantic features that lead to excessive Gas consumption and proposes RAGas, a three-stage retrieval enhancement generation framework that utilizes large language models to locate and automatically fix Gas inefficiency issues.

Yishun Wang, Wenjin Yi, Wen-Kai Li et al. · 1 citation
Sep 2026

SE4SC-LLM: an LLM-Augmented symbolic execution framework for smart contracts

SE4SC-LLM, an LLM-augmented symbolic execution framework for smart contracts that achieves 95.1% average CFG coverage, a 6.5 percentage point improvement over the strongest baseline, and detects 11.2% more vulnerabilities.

Tian-Huan Miao, Yang Liu · 0 citations
Open access Sep 2026

TCRNet: Topology-Guided Contextual Representation Network for Smart Contract Vulnerability Detection

Results indicate that integrating semantic richness and structural awareness within a Contextual Encoding Network architecture enhances both detection reliability and generalization capability, making the framework suitable for practical smart contract security analysis.

R. S, Mahantesh Mathapati · 0 citations
Sep 2026

Solidity Meets LLMs: A Transformer-Based Approach to Smart Contract Vulnerability Detection

The growing adoption of blockchain technologies, particularly the Ethereum platform, has amplified the critical role of smart contracts in decentralized applications. However, the increasing complexity and financial value of these contracts make them prime targets for cyber attacks. In this work, we present a transform...

Djamel Eddine Hakim Ghorab, Farid Mokhati, Mostafa Anouar Ghorab · 0 citations
Aug 2026

Tetris for Gas: State Variable Mutation for Reducing Smart Contract Deployment Costs

Smart contract deployment costs constitute an economic consideration in blockchain ecosystems, yet existing gas optimization approaches primarily focus on execution efficiency while neglecting deployment gas reduction. We analyze Solidity storage internals and identify that conventional variable packing–despite reducin...

Charalambos Mitropoulos, Dimitrios Vlachos, Vaggelis Saroukos et al. · 0 citations
Sep 2026

A Unified Framework for Function-Level Vulnerability Detection and Explanation in Smart Contracts

A unified framework combining a novel Hierarchical Cross-Attention Subgraph Neural Network for detection with Large Language Models for explanation form a comprehensive framework that significantly enhances both the technical accuracy and operational usability of smart contract analysis.

Ngoc Minh Nguyen, Le-Minh Nguyen · 0 citations

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.