MARATTO

article

Syntactic analysis and modification of smart contract code using an adapted version aimed at optimizing gas consumption in for loops

Abstract

A smart contract is a program deployed on a blockchain network. It is secure, transparent, and immutable after deployment. Executing a smart contract requires gas to function. Gas is consumed during both deployment and transaction on the network. Optimizing gas consumption is one of the most difficult challenges to master. Many approaches have been proposed; however, it remains a significant a challenge. The purpose of this article is to explain gas consumption in the blockchain network and to present an approach for optimizing gas usage in a For() loop. This work was carried out in several stages, including: parsing solidity code according to its version, implementing a Control Flow Graph to identify loops to be optimized, and finally applying a smart contract code optimization algorithm. Our approach is robust, scalable, and easily adaptable. Experiments show that any syntactic or version change to a smart contract impacts gas consumption. The approach is practical and has distinctive characteristics. Its strength lies in its ability to optimize smart contracts across all solidity version from 0.5.x to 0.8.x.

Research topics

  • Power Line Communications and Noise
  • Formal Methods in Verification
  • Logic, programming, and type systems

Read the original research

This page summarises published work. The authoritative version sits with the publisher.

DOI: 10.1109/icecer65523.2025.11401079

Is something wrong with this record? Report it or request removal.

Discussion

Discuss this research

Have you built on this work, tried to replicate it, or seen it applied in practice? Share what you know. Verified researchers and MARATTO™ domain experts can open a discussion, and any member can reply. Contributions are reviewed before they appear.

No discussion yet. Open the first thread.