Scalable Algorithms for Gas Analysis and Optimization in Smart Contracts

The Hong Kong University of Science and Technology
Department of Computer Science and Engineering


PhD Thesis Defence


Title: "Scalable Algorithms for Gas Analysis and Optimization in Smart Contracts"

By

Mr. Soroush FAROKHNIA


Abstract:

Blockchains are a family of distributed consensus protocols that maintain a 
shared, append-only ledger without relying on a trusted central authority. 
Smart contracts are self-enforcing programs executed on blockchains that can 
support arbitrarily complex logic. Their applications span multiple domains, 
including finance, healthcare, and supply chain management, in both the public 
and private sectors. They are currently in charge of billions of dollars' 
worth of digital assets. On modern programmable blockchains, users incur 
execution fees, known as "gas," when interacting with contracts. In the last 
five years, Ethereum users spent more than 19.6 billion USD on gas fees. The 
high cost of gas and the existence of "out-of-gas" vulnerabilities, which have 
led to millions of dollars in user losses, make the analysis and minimization 
of gas usage a critical research problem. Yet, existing approaches often 
produce suboptimal results, lack strong assurances, or do not scale. These 
limitations frequently compel developers to rely on manual audits, which are 
costly, error-prone, and can leave vulnerabilities undiscovered.

The main body of this thesis explores the impact of gas from multiple 
perspectives. It first approaches the topic from the user's point of view, 
focusing on gas estimation and its subsequent reduction through improved 
compiler optimizations. It then shifts to the miner's perspective, analyzing 
strategies for revenue maximization on two major cryptocurrencies, Ethereum 
and Cardano. The primary objective is to develop scalable solutions that 
provide strong formal assurances. To this end, this work leverages techniques 
such as parameterized algorithms and algebro-geometric methods, which are 
particularly effective at exploiting the structural sparsity inherent in smart 
contracts. Furthermore, it illustrates that blockchain research is 
fundamentally interdisciplinary, utilizing methodologies beyond traditional 
computer science to uncover costly vulnerabilities. Finally, each core 
contribution is backed by comprehensive empirical evaluations, demonstrating 
significant improvements over state-of-the-art solutions.


Date:                   Thursday, 26 March 2026

Time:                   4:00pm - 6:00pm

Venue:                  Room 2132C
                        Lift 22

Chairman:               Prof. Hai YANG (CIVL)

Committee Members:      Dr. Jiasi SHEN (Supervisor)
                        Dr. Amir GOHARSHADY (Co-supervisor, Oxford)
                        Prof. Ke YI
                        Prof. Charles ZHANG
                        Dr. Maximilian NITZSCHNER (MATH)
                        Dr. Guillermo PÉREZ (University of Antwerp)