header

The Role of Artificial Intelligence and Machine Learning in Optimizing Smart Contract Gas Consumption and Resource Allocation on Banking DLTs

Authors
  • Abbas Ahsun

    Texas University
    Author
Keywords:
Smart contract optimization, Gas consumption prediction, Machine learning, Banking distributed ledger technology
Abstract

Banking distributed ledger technologies (DLTs) increasingly rely on smart contracts for settlement, collateral management, and tokenized asset servicing, yet gas consumption remains a material operational cost and scalability constraint. Existing rule-based optimization tools and general-purpose large language models exhibit limited accuracy in predicting gas-intensive functions, with pilot evaluations showing ChatGPT achieving only 56.6% accuracy and Gemini 46.5% on Solidity function-level gas prediction tasks (Cimitile et al., 2026). This study develops and validates a hybrid machine learning framework combining static code metrics, code embeddings, and gradient-boosted ensemble methods to predict high-gas functions and optimize resource allocation in banking-oriented smart contracts. Using a curated dataset of 4,356 functions from 1,769 deployed contracts, the Random Forest classifier with combined static and embedding features achieved 89.4% accuracy and an F1-score of 85.35% in identifying expensive functions, substantially outperforming zero-shot LLM baselines. Feature importance analysis identified identifier length, cyclomatic complexity, and state variable write frequency as dominant predictors. The framework provides a replicable, pre-deployment screening methodology that enables banking DLT architects to reduce gas overhead by an estimated 11–35% depending on contract complexity. The findings contribute a validated predictive instrument for smart contract resource governance and establish a foundation for AI-assisted cost optimization in regulated financial DLT environments.

Cover Image
Downloads
Published
11/30/2026
Section
Articles
License

Copyright (c) 2026 Abbas Ahsun (Author)

Creative Commons License

This work is licensed under a Creative Commons Attribution 4.0 International License.

How to Cite

The Role of Artificial Intelligence and Machine Learning in Optimizing Smart Contract Gas Consumption and Resource Allocation on Banking DLTs. (2026). The Science Post, 2(4). https://www.thesciencepostjournal.com/index.php/tsp/article/view/500