Optimizing Gas Efficiency in Ethereum Smart Contracts using Design Pattern Refinement and Complexity Reduction
Date
2025-12-09
Journal Title
Journal ISSN
Volume Title
Publisher
Institute of Electrical and Electronics Engineers Inc.
Abstract
Smart contracts on the Ethereum blockchain enable automation and transparency in decentralized applications; however, their scalability is often constrained by high gas costs resulting from inefficient code design. This research investigates the relationship between cyclomatic code complexity and gas consumption, proposing a design pattern-based approach to optimize gas efficiency in Ethereum smart contracts. Three common Solidity patterns Factory, Registry, and State Machine were optimized using both existing and novel techniques, including variable packing, the use of fixed-size data types (uint256, bytes32), immutable variables, and mapping simplification. These optimizations were implemented and tested within a real-world coco peat supply chain management system to measure their impact on gas usage. Experimental results showed that deployment gas costs decreased by approximately 19% and runtime execution gas by around 14%, confirming that design-level optimization can significantly reduce costs without affecting functionality. The findings demonstrate that structured refinement of contract design can enhance scalability, making blockchain-based enterprise solutions more efficient and economically sustainable.
Description
Keywords
Blockchain, Ethereum Smart Contracts, Gas Fee Optimization, Solidity Design Patterns, Supply Chain Management
Citation
K. S. Weedagamaarachchi, H. D. Vithanage, H. M. S. N. Dehipola, K. D. R. Manditha, V. Jayasinghearachchi and J. Perera, "Optimizing Gas Efficiency in Ethereum Smart Contracts Using Design Pattern Refinement and Complexity Reduction," 2025 7th International Conference on Advancements in Computing (ICAC), Colombo, Sri Lanka, 2025, pp. 1-6, doi: 10.1109/ICAC69156.2025.11361528.
