An Empirical Analysis of Source Code Metrics and Smart Contract Resource Consumption


Research output: Contribution to journalArticle (journal)peer-review

13 Citations (Scopus)
273 Downloads (Pure)


A Smart Contract (SC) is a program stored in the Ethereum blockchain by a contract-creation transaction. SC developers deploy an instance of the SC and attempt to execute it in exchange for a fee, paid in Ethereum coins (Ether). If the computation needed for their execution turns out to be larger than the effort proposed by the developer (i.e., the gasLimit), their client instantiation will not be completed successfully.
In this paper we examine smart contracts from 11 Ethereum blockchain-oriented software projects hosted on, and we evaluate the resources needed for their deployment (i.e., the gasUsed). For each of these contracts we also extract a suite of object-oriented metrics, to evaluate their structural characteristics.
Our results show a statistically significant correlation between some of the object-oriented (OO) metrics and the resources consumed on the Ethereum blockchain network when deploying smart contracts. This result has a direct impact on how Ethereum developers engage with a SC: evaluating its structural characteristics, they will be able to produce a better estimate of the resources needed to deploy it. Other results show specific source code metrics to be prioritised based on application domains when the projects are clustered based on common themes.
Original languageEnglish
Article numbere2267
Number of pages33
JournalJournal of software: Evolution and Process
Early online date14 May 2020
Publication statusE-pub ahead of print - 14 May 2020


  • smart contract (SC)
  • blockchain oriented software (BOS)
  • object-oriented (OO)
  • object-oriented programming (OOP)
  • Chidamber and Kemerer (C&K)
  • abstract syntax-tree (AST)


Dive into the research topics of 'An Empirical Analysis of Source Code Metrics and Smart Contract Resource Consumption'. Together they form a unique fingerprint.

Cite this