Affiliation:
1. School of Computer Science and Engineering Sun Yat‐sen University Guangzhou China
2. The School of Journalism and Communication Sun Yat‐sen University Guangzhou China
3. School of Software Engineering Sun Yat‐sen University Zhuhai China
Abstract
AbstractEthereum, as a leading blockchain platform, has attracted a significant number of practitioners. These practitioners require a platform for communication and collaborative problem‐solving, which led to Ethereum Stack Exchange (ESE), a Q&A site dedicated to Ethereum‐related issues. While the Q&A site facilitates communication among practitioners, it also introduces new challenges. Practitioners adopt code snippets from Q&A sites to address problems encountered. However, the quality of code snippets on ESE remains largely unexplored. Vulnerabilities and gas‐inefficient patterns in ESE may spread to the code in Ethereum and threaten its regular operation. In this article, we conduct an empirical study investigating the distribution of vulnerabilities and gas‐inefficient patterns in ESE. Further, we analyze the potential impact of vulnerabilities and gas‐inefficient patterns from ESE on Ethereum. However, we encounter a problem during the vulnerability and gas‐inefficient pattern detection. Established smart contract analysis tools in the mainstream realm necessitate complete source code files for thorough analysis, while codes on ESE are often incomplete code snippets. To address this, we introduce the AST‐based code clone detection technique to construct detectable files corresponding to code snippets. This enables us to detect vulnerabilities and gas‐inefficient patterns in code snippets. In the end, our findings demonstrate that 11.18% of the contract‐level code snippets and 4.06% of function‐level code snippets in ESE have vulnerabilities. And 27.21% of contract‐level code snippets and 17.89% of function‐level code snippets contain gas‐inefficient patterns. The additional consumption caused by the gas‐inefficient pattern in ESE is approximately $1,695,002. Based on these findings, we provide recommendations for both ESE and its users, aiming to foster collaborative efforts and create a more reliable Q&A site for practitioners.
Funder
National Natural Science Foundation of China
Natural Science Foundation of Guangdong Province
Reference50 articles.
1. NakamotoS.Bitcoin: a peer‐to‐peer electronic cash system. Cryptography mailing list.2009.
2. Untangling Blockchain: A Data Processing View of Blockchain Systems
3. A detailed and real-time performance monitoring framework for blockchain systems
4. An overview on smart contracts: Challenges, advances and platforms
5. NakamotoW ButerinV.A Next Generation Smart Contract & Decentralized Application Platform; 2015: 1‐36. Ethereum White Paper.