GasChecker: Scalable Analysis for Discovering Gas-Inefficient Smart Contracts

被引:66
作者
Chen, Ting [1 ]
Feng, Youzheng [2 ]
Li, Zihao [2 ]
Zhou, Hao [3 ]
Luo, Xiaopu
Li, Xiaoqi [3 ]
Xiao, Xiuzhuo [1 ]
Chen, Jiachi [3 ]
Zhang, Xiaosong [1 ]
机构
[1] Univ Elect Sci & Technol China, Sch Comp Sci Engn, Chengdu 611731, Sichuan, Peoples R China
[2] Univ Elect Sci & Technol China, Inst Big Data Secur, Big Data Res Ctr, Chengdu 611731, Sichuan, Peoples R China
[3] Hong Kong Polytech Univ, Dept Comp, Kowloon, Hong Kong, Peoples R China
基金
国家重点研发计划; 中国国家自然科学基金;
关键词
Contracts; Task analysis; Programming; Load management; Tools; Load modeling; Smart contract; scalable analysis; gas-inefficient pattern; symbolic execution; parallelization; MapReduce;
D O I
10.1109/TETC.2020.2979019
中图分类号
TP [自动化技术、计算机技术];
学科分类号
0812 ;
摘要
Ethereum, the largest blockchain for running smart contracts, charges the people who send transactions to deploy or invoke smart contracts for thwarting resource abuse. The amount of transaction fee depends on the size of that contract and the operations executed by that contract. Consequently, smart contracts with inefficient code will waste money. In this article, we propose and develop the first tool, named GasChecker, for automatically identifying gas-inefficient code in smart contracts, and conduct the first empirical study on the prevalence of gas-inefficient code in the deployed smart contracts. More precisely, we first summarize ten gas-inefficient programming patterns and propose a new approach based on symbolic execution (SE) to detect them in the bytecode of smart contracts. To make our approach scalable to analyze millions of smart contracts, we parallelize SE by tailoring it to the MapReduce programming model, and propose a new feedback-based load balancing strategy to effectively utilize cloud resources. Extensive experiments show that GasChecker scales well with the increase of workers. The empirical study demonstrates that lots of real smart contracts contain various inefficient code. Manual investigation demonstrates that only 2.5 percent of discovered gas-inefficient instances are false positives.
引用
收藏
页码:1433 / 1448
页数:16
相关论文
共 34 条
[11]  
Chen T, 2017, 2017 IEEE 24TH INTERNATIONAL CONFERENCE ON SOFTWARE ANALYSIS, EVOLUTION, AND REENGINEERING (SANER), P437, DOI 10.1109/SANER.2017.7884649
[12]  
Chen T, 2017, 2017 IEEE 24TH INTERNATIONAL CONFERENCE ON SOFTWARE ANALYSIS, EVOLUTION, AND REENGINEERING (SANER), P442, DOI 10.1109/SANER.2017.7884650
[13]  
Ciortea Liviu, 2009, Operating Systems Review, V43, P5, DOI 10.1145/1713254.1713257
[14]  
Dean J, 2004, USENIX ASSOCIATION PROCEEDINGS OF THE SIXTH SYMPOSIUM ON OPERATING SYSTEMS DESIGN AND IMPLEMENTATION (OSDE '04), P137
[15]   In Code We Trust? Measuring the Control Flow Immutability of All Smart Contracts Deployed on Ethereum [J].
Froewis, Michael ;
Boehme, Rainer .
DATA PRIVACY MANAGEMENT, CRYPTOCURRENCIES AND BLOCKCHAIN TECHNOLOGY, 2017, 10436 :357-372
[16]  
Grech N., 2018, P ACM PROGRAM LANG, DOI DOI 10.1145/3276486
[17]  
Ibing Andreas, 2013, Testing Software and Systems. 25th IFIP WG 6.1 International Conference, ICTSS 2013. Proceedings: LNCS 8254, P196, DOI 10.1007/978-3-642-41707-8_13
[18]  
Kalla S., 2017, MOON BLOCKCHAINS HIR
[19]  
Kehrli J, 2016, BLOCKCHAIN 2 0 FROM
[20]  
Khknen K., 2011, WORKSHOP BYTECODE SE, P75