Litcius/Paper detail

Smart Contracts Refinement for Gas Optimization

Keerthi Nelaturu, Sidi Mohamed Beillahi, Fan Long, Andreas Veneris

202133 citationsDOI

Abstract

Smart contracts facilitate the execution of programmable code on a blockchain. The cost for executing smart contract code is metered using gas - the exact amount of which is based on the computational complexity of the underlying smart contract. Hence, it is imperative to optimize smart contract code to reduce gas consumption and, in some instances, to even avoid malicious attacks. In this paper, we propose an approach to optimize the gas consumption of smart contracts, specifically loop control structures. We present a prototype implementation of our approach using off-the-shelf tools for Solidity smart contracts. We experimentally evaluate our technique using 72 Solidity smart contracts. Our evaluation demonstrates the average gas cost savings per transaction to be around 23,943 gas units, or an equivalent 21% decrease in gas costs. Although the approach causes a slight increase in deployment costs due to the additional internal functions, this is only 16,710 gas units on the average, or a 5% of the total deployment cost. As this overhead remains quite reasonable when compared to the gas cost savings for each transaction, it also confirms the efficacy, practicality and effectiveness of the proposed methodology.

Topics & Concepts

SolidityComputer scienceSoftware deploymentSmart contractOverhead (engineering)Database transactionCode (set theory)Embedded systemDatabaseOperating systemProgramming languageSet (abstract data type)Blockchain Technology Applications and SecuritySecurity and Verification in ComputingAdvanced Malware Detection Techniques