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

Yishun Wang, Wenjin Yi, Wenkai Li, Zongwei Li, Xiaoqi Li
8/16/2026
cs.AI
rag

No confident code implementation found for this paper.

Abstract

Ethereum is now integral to mission-critical sectors, including finance, healthcare, and supply chain management. Execution fees, commonly referred to as Gas, scale with the computational complexity of their functions.

Show full abstract

Smart contracts on Ethereum incur execution fees, known as Gas, which increase with computational complexity. Thus, optimizing Gas-intensive code while preserving functional equivalence significantly lowers deployment costs. No existing system continuously exploits evolving Gas usage patterns. We systematically analyze syntactic and semantic constructs that drive excessive Gas use. This yields six high-level categories covering twelve fine-grained antipatterns underpinning a curated knowledge base. We operationalize these insights with RAGas, a three-stage retrieval-augmented generation framework that uses a large language model to pinpoint and automatically fix Gas inefficiencies. Experiments on deployed contracts demonstrate that RAGas reduces Gas usage by up to 11% and achieves high precision and recall in detecting code snippets exhibiting Gas wastage.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{wang2026ragas,
  title  = {RAGas: Retrieval-Augmented Gas Optimization for Smart Contracts with Continuous Knowledge Integration},
  author = {Yishun Wang and Wenjin Yi and Wenkai Li and Zongwei Li and Xiaoqi Li},
  year   = {2026},
  eprint = {2608.15857},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2608.15857v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2608.15857.svg)](https://codeofpaper.com/paper/2608.15857)

Discussion