Queen's School of Computing
Supervisor: Prof. Ahmed Hassan 

Internal Examiner: Prof. Farhana Zulkernine
External Examiner: Prof. Jianbing Ni (ECE)
Chair: Prof. Sameh Sorour


Studying the Gas Usage and Price of Transactions in the Ethereum Blockchain Platform

Abstract

Ethereum is a blockchain platform that hosts and executes general-purpose computer programs known as smart contracts. Users execute smart contracts by sending transactions to one of the functions of the contract. The execution of smart contracts in Ethereum has a cost that is measured in Gas unit. Executing a function
of a smart contract burns a certain amount of gas units (a.k.a., gas usage). The total gas usage depends on how much computing power is necessary to carry out the execution of the function. Ethereum follows a free-market policy for deciding the transaction fee for executing a transaction. More specifically, users choose how much they are willing to pay in cryptocurrency for each unit of gas (a.k.a., gas price). Miners process transactions to gain mining rewards, which come directly from the paid transaction fees by users. However, neither the user nor the miner know, beforehand, the gas usage of a transaction. In this thesis, we analyze the Ethereum transaction data spanning between Oct. 2017 and Feb. 2019 (the Byzantium period) to conduct two studies that examine how gas usage and price impact the transaction processing dynamics of the Ethereum blockchain platform.

In our first study, we examine the strategies that are adopted by miners to prioritize transactions, the stability of the gas usage of contract functions, and whether the gas usage of a contract transaction can be predicted within a reasonable margin. We observe that most miners follow the default strategy for prioritizing transactions (which solely relies on gas price), a significant amount of contract functions have a very stable gas usage history, and it is possible to provide a real-time estimation of the gas usage of a transaction for these contracts with a median Adjusted RSquared of 0.86.

In the second study, we focus on understanding gas prices. We analyze how users commonly set gas prices and whether the contracts that are involved in user-to-contract transactions influence gas prices. Subsequently, we build a regression model to discover the factors that are strongly associated with the gas price of transactions. We observe that the gas prices set by users assume a wide range of values, vary considerably over time, and change based on the user. We also observe that the gas price of user-to-contract transactions differ
significantly across contracts and functions. Lastly, we observe that different factors are more strongly associated with gas prices at different times.

Our findings can help researchers to focus on the vulnerabilities of the current gas mechanism in their future work, provide developers insights on how to improve their decentralized applications (DApps) regarding transactions, motivate users to make an informed decision when issuing a transaction, and help miners to adopt optimized mining strategy.