Under-Optimized Smart Contracts Devour Your Money
arXiv:1703.03994
Abstract
Smart contracts are full-fledged programs that run on blockchains (e.g., Ethereum, one of the most popular blockchains). In Ethereum, gas (in Ether, a cryptographic currency like Bitcoin) is the execution fee compensating the computing resources of miners for running smart contracts. However, we find that under-optimized smart contracts cost more gas than necessary, and therefore the creators or users will be overcharged. In this work, we conduct the first investigation on Solidity, the recommended compiler, and reveal that it fails to optimize gas-costly programming patterns. In particular, we identify 7 gas-costly patterns and group them to 2 categories. Then, we propose and develop GASPER, a new tool for automatically locating gas-costly patterns by analyzing smart contracts' bytecodes. The preliminary results on discovering 3 representative patterns from 4,240 real smart contracts show that 93.5%, 90.1% and 80% contracts suffer from these 3 patterns, respectively.
In International Conference on Software Analysis, Evolution, and Reengineering (SANER), 2017
Cited by in corpus (8)
- A comprehensive survey on smart contract construction and execution: paradigms, tools, and systems
- Securify: Practical Security Analysis of Smart Contracts
- Vandal: A Scalable Security Analysis Framework for Smart Contracts
- Trustless Machine Learning Contracts; Evaluating and Exchanging Machine Learning Models on the Ethereum Blockchain
- An Adaptive Gas Cost Mechanism for Ethereum to Defend Against Under-Priced DoS Attacks
- Cost-Effective Data Feeds to Blockchains via Workload-Adaptive Data Replication
- Characterizing Erasable Accounts in Ethereum
- An Empirical Study of Protocols in Smart Contracts