An Empirical Investigation on the Trade-off between Smart Contract Readability and Gas Consumption

6Citations
Citations of this article
11Readers
Mendeley users who have this article in their library.
Get full text

Abstract

Blockchain technology is becoming increasingly popular, and smart contracts (i.e., programs that run on top of the blockchain) represent a crucial element of this technology. In particular, smart contracts running on Ethereum (i.e., one of the most popular blockchain platforms) are often developed with Solidity, and their deployment and execution consume gas (i.e., a fee compensating the computing resources required). Smart contract development frequently involves code reuse, but poor readable smart contracts could hinder their reuse. However, writing readable smart contracts is challenging, since practices for improving the readability could also be in contrast with optimization strategies for reducing gas consumption. This paper aims at better understanding (i) the readability aspects for which traditional software and smart contracts differ, and (ii) the specific smart contract readability features exhibiting significant relationships with gas consumption. We leverage a set of metrics that previous research has proven correlated with code readability. In particular, we first compare the values of these metrics obtained for both Solidity smart contracts and traditional software systems (written in Java). Then, we investigate the correlations occurring between these metrics and gas consumption and between each pair of metrics. The results of our study highlight that smart contracts usually exhibit lower readability than traditional software for what concerns the number of parentheses, inline comments, and blank lines used. In addition, we found some readability metrics (such as the average length of identifiers and the average number of keywords) that significantly correlate with gas consumption.

Cite

CITATION STYLE

APA

Vacca, A., Fredella, M., Di Sorbo, A., Visaggio, C. A., & Canfora, G. (2022). An Empirical Investigation on the Trade-off between Smart Contract Readability and Gas Consumption. In IEEE International Conference on Program Comprehension (Vol. 2022-March, pp. 214–224). IEEE Computer Society. https://doi.org/10.1145/3524610.3529157

Register to see more suggestions

Mendeley helps you to discover research relevant for your work.

Already have an account?

Save time finding and organizing research with Mendeley

Sign up for free