loading page

Don’t Play with Gas: Relating Metrics with Smart Contract Deployment Costs
  • George Melas,
  • Alexandros Chatzigeorgiou,
  • Apostolos Ampatzoglou
George Melas
University of Macedonia

Corresponding Author:[email protected]

Author Profile
Alexandros Chatzigeorgiou
University of Macedonia
Author Profile
Apostolos Ampatzoglou
University of Macedonia
Author Profile

Abstract

Smart Contracts (SC) are computer programs that run on blockchains and can be executed automatically in a deterministic way, when pre-determined conditions are met. Currently, Ethereum is the biggest blockchain network with more than 200,000 SCs deployed every month[1](#fn-0002). The main mechanism for financially managing and securing such networks is “ Gas Consumption”. In particular, a gas cost is assigned to each operation that alters the blockchain state, based on the SC size and complexity. Thus, the cost that a SC incurs to its owner and users is related to the internal structure of the SC. By considering that the average cost for deploying a Smart Contract can reach up to thousands of euros, it becomes obvious that internal quality of SCs is of great importance. To this end, in this article we present a comprehensive analysis of the correlation of a set of code metrics (e.g., size, complexity) with the actual gas required to deploy Smart Contracts. The empirical evidence that we provide rely on the analysis of over 90,000 SCs. In addition to the produced empirical knowledge, in most of the cases validating the theoretical expectation, we have implemented a web-based application (Smart Contracts Quality Analysis Platform—SCQAP) that visualizes the findings, enabling the on-demand creation of correlation diagrams, and offers access to a public repository of our data (metrics and deployment gas consumption) via a REST API. To the best of our knowledge this is the biggest empirical study on SCs, which: (a) sets up the scene for further large-scale studies on Smart Contracts (through tooling and public dataset); and (b) provides guidance to software practitioners on parameters that can inflate deployment costs.