Scholay

学术搜索 · AI 审稿 · LaTeX 协作

GethReplayer: a smart contract testing method based on transaction replay

作者:Xiaohong Shi, Ziyan Wang, Runlu Zhong, Liangliang Ma, Xiangping Chen, Peng Yang · 发表于:International Journal of Web Information Systems · 年份:2024 · DOI:10.1108/ijwis-08-2023-0138 · 被引用次数:2 · 研究领域:Blockchain Technology Applications and Security、FinTech, Crowdfunding, Digital Finance、Auction Theory and Applications

Purpose Smart contracts are written in high-level programming languages, compiled into Ethereum Virtual Machine (EVM) bytecode, deployed onto blockchain systems and called with the corresponding address by transactions. The deployed smart contracts are immutable, even if there are bugs or vulnerabilities. Therefore, it is critical to verify smart contracts before deployment. This paper aims to help developers effectively and efficiently locate potential defects in smart contracts. Design/methodology/approach GethReplayer, a smart contract testing method based on transaction replay, is proposed. It constructs a parallel transaction execution environment with two virtual machines to compare the execution results. It uses the real existing transaction data on Ethereum and the source code of the tested smart contacts as inputs, conditionally substitutes the bytecode of the tested smart contract input into the testing EVM, and then monitors the environmental information to check the correctness of the contract. Findings Experiments verified that the proposed method is effective in smart contract testing. Virtual environmental information has a significant effect on the success of transaction replay, which is the basis for the performance of the method. The efficiency of error locating was approximately 14 times faster with the proposed method than without. In addition, the proposed method supports gas consumption analysis. Originality/value This paper addresses the difficulty that...