Abstract:The Ethereum virtual machine (EVM) is a key component of the Ethereum blockchain, and its defects will cause deviations in the execution results of transactions, which will bring serious problems to the Ethereum ecosystem. The existing work on EVM defect detection only treats the virtual machine as an independent smart contract execution tool and does not fully test its workflow, resulting in blind spots in defect detection. To solve the above problems, a defect detection method for the whole process of EVM operation (ETHCOV) is proposed. ETHCOV first combines the weight strategy to guide smart contracts, contract interface parameter inputs, and transaction sequences to vary at different granularities. It then packages them with block state and world state as test cases and finally inputs the test cases into the EVM to trigger the run and compare the test run results, so as to detect the vulnerabilities in the EVM. Based on the above method, a prototype system is implemented and more than 20 000 real smart contracts are tested as input to the EVM for defect detection. Experimental results show that compared with the existing tool EVMFuzzer, ETHCOV improves the test efficiency by 339% and the code coverage by 125%, and the inconsistent output of three sets of test cases is detected. These results show that ETHCOV can effectively detect defects in the EVM.