GasAgent: A Multi-Agent Framework for Automated Gas Optimization in Smart Contracts
Jingyi Zheng, Zifan Peng, Yule Liu, Junfeng Wang, Yifan Liao, Wenhan Dong, Xinlei He

TL;DR
GasAgent is a multi-agent system that automates smart contract Gas optimization by discovering, validating, and applying Gas-saving patterns, significantly improving efficiency and compatibility with existing tools.
Contribution
It introduces the first multi-agent framework for automated Gas optimization that combines pattern compatibility with new pattern discovery and validation.
Findings
Optimized 82 real-world contracts with 9.97% average Gas savings.
Achieved 79.8% optimization rate on LLM-generated contracts with up to 13.93% savings.
Validated compatibility with existing tools and effectiveness of each module.
Abstract
Smart contracts are trustworthy, immutable, and automatically executed programs on the blockchain. Their execution requires the Gas mechanism to ensure efficiency and fairness. However, due to non-optimal coding practices, many contracts contain Gas waste patterns that need to be optimized. Existing solutions mostly rely on manual discovery, which is inefficient, costly to maintain, and difficult to scale. Recent research uses large language models (LLMs) to explore new Gas waste patterns. However, it struggles to remain compatible with existing patterns, often produces redundant patterns, and requires manual validation/rewriting. To address this gap, we present GasAgent, the first multi-agent system for smart contract Gas optimization that combines compatibility with existing patterns and automated discovery/validation of new patterns, enabling end-to-end optimization. GasAgent…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
