Saving deployment costs of smart contracts by eliminating gas-wasteful patterns

Jaeyong Park, Daegeon Lee, Hoh In

Research output: Contribution to journalArticle

Abstract

Smart contracts are blockchain-based programs that have developed with the emergence of Ethereum, one of the most well-known blockchains. Gas, paid in Ethers (i.e., the cryptocurrency in Ethereum), is required for the costs to upload and run smart contracts on Ethereum. As cost-inefficiently designed smart contracts result in unnecessary costs, it is vital to eliminate any gas-wasteful code fragments to optimize the deployment costs. In this study, we define five gas-wasteful patterns: ‘Over-public variables’, ‘Redundant initial values’, ‘Loose packing’, ‘Non-base unit types’, and ‘Non-constant variables’, based on the state variables in Solidity, the most commonly used implementation language for smart contracts in Ethereum. We also propose improvement methods related to these patterns and a solution to identify and eliminate the patterns. Furthermore, we analyze 143 real-world contracts deployed on Ethereum and find that 56% of them include the above-mentioned patterns. We also upgrade 43 of the pattern-matched contracts and demonstrate that their deployment costs are decreased on an average by 13.47%, and the most-reduced rate is 64%.

Original languageEnglish
Pages (from-to)53-64
Number of pages12
JournalInternational Journal of Grid and Distributed Computing
Volume10
Issue number12
DOIs
Publication statusPublished - 2017 Jan 1

Fingerprint

Gases
Costs
Ethers

Keywords

  • Cost
  • Ethereum
  • Gas
  • Pattern
  • Smart contract
  • Solidity

ASJC Scopus subject areas

  • Computer Science(all)

Cite this

Saving deployment costs of smart contracts by eliminating gas-wasteful patterns. / Park, Jaeyong; Lee, Daegeon; In, Hoh.

In: International Journal of Grid and Distributed Computing, Vol. 10, No. 12, 01.01.2017, p. 53-64.

Research output: Contribution to journalArticle

@article{b8cc8e4ddafa4573b9bf957503d93fe3,
title = "Saving deployment costs of smart contracts by eliminating gas-wasteful patterns",
abstract = "Smart contracts are blockchain-based programs that have developed with the emergence of Ethereum, one of the most well-known blockchains. Gas, paid in Ethers (i.e., the cryptocurrency in Ethereum), is required for the costs to upload and run smart contracts on Ethereum. As cost-inefficiently designed smart contracts result in unnecessary costs, it is vital to eliminate any gas-wasteful code fragments to optimize the deployment costs. In this study, we define five gas-wasteful patterns: ‘Over-public variables’, ‘Redundant initial values’, ‘Loose packing’, ‘Non-base unit types’, and ‘Non-constant variables’, based on the state variables in Solidity, the most commonly used implementation language for smart contracts in Ethereum. We also propose improvement methods related to these patterns and a solution to identify and eliminate the patterns. Furthermore, we analyze 143 real-world contracts deployed on Ethereum and find that 56{\%} of them include the above-mentioned patterns. We also upgrade 43 of the pattern-matched contracts and demonstrate that their deployment costs are decreased on an average by 13.47{\%}, and the most-reduced rate is 64{\%}.",
keywords = "Cost, Ethereum, Gas, Pattern, Smart contract, Solidity",
author = "Jaeyong Park and Daegeon Lee and Hoh In",
year = "2017",
month = "1",
day = "1",
doi = "10.14257/ijgdc.2017.10.12.06",
language = "English",
volume = "10",
pages = "53--64",
journal = "International Journal of Grid and Distributed Computing",
issn = "2005-4262",
publisher = "Science and Engineering Research Support Society",
number = "12",

}

TY - JOUR

T1 - Saving deployment costs of smart contracts by eliminating gas-wasteful patterns

AU - Park, Jaeyong

AU - Lee, Daegeon

AU - In, Hoh

PY - 2017/1/1

Y1 - 2017/1/1

N2 - Smart contracts are blockchain-based programs that have developed with the emergence of Ethereum, one of the most well-known blockchains. Gas, paid in Ethers (i.e., the cryptocurrency in Ethereum), is required for the costs to upload and run smart contracts on Ethereum. As cost-inefficiently designed smart contracts result in unnecessary costs, it is vital to eliminate any gas-wasteful code fragments to optimize the deployment costs. In this study, we define five gas-wasteful patterns: ‘Over-public variables’, ‘Redundant initial values’, ‘Loose packing’, ‘Non-base unit types’, and ‘Non-constant variables’, based on the state variables in Solidity, the most commonly used implementation language for smart contracts in Ethereum. We also propose improvement methods related to these patterns and a solution to identify and eliminate the patterns. Furthermore, we analyze 143 real-world contracts deployed on Ethereum and find that 56% of them include the above-mentioned patterns. We also upgrade 43 of the pattern-matched contracts and demonstrate that their deployment costs are decreased on an average by 13.47%, and the most-reduced rate is 64%.

AB - Smart contracts are blockchain-based programs that have developed with the emergence of Ethereum, one of the most well-known blockchains. Gas, paid in Ethers (i.e., the cryptocurrency in Ethereum), is required for the costs to upload and run smart contracts on Ethereum. As cost-inefficiently designed smart contracts result in unnecessary costs, it is vital to eliminate any gas-wasteful code fragments to optimize the deployment costs. In this study, we define five gas-wasteful patterns: ‘Over-public variables’, ‘Redundant initial values’, ‘Loose packing’, ‘Non-base unit types’, and ‘Non-constant variables’, based on the state variables in Solidity, the most commonly used implementation language for smart contracts in Ethereum. We also propose improvement methods related to these patterns and a solution to identify and eliminate the patterns. Furthermore, we analyze 143 real-world contracts deployed on Ethereum and find that 56% of them include the above-mentioned patterns. We also upgrade 43 of the pattern-matched contracts and demonstrate that their deployment costs are decreased on an average by 13.47%, and the most-reduced rate is 64%.

KW - Cost

KW - Ethereum

KW - Gas

KW - Pattern

KW - Smart contract

KW - Solidity

UR - http://www.scopus.com/inward/record.url?scp=85050586481&partnerID=8YFLogxK

UR - http://www.scopus.com/inward/citedby.url?scp=85050586481&partnerID=8YFLogxK

U2 - 10.14257/ijgdc.2017.10.12.06

DO - 10.14257/ijgdc.2017.10.12.06

M3 - Article

VL - 10

SP - 53

EP - 64

JO - International Journal of Grid and Distributed Computing

JF - International Journal of Grid and Distributed Computing

SN - 2005-4262

IS - 12

ER -