A Geth-based detection system for ERC20 honeypot contract in Ethereum
摘要
As decentralized finance (DeFi) grows and decentralized exchanges (DEXs) expand, the security of Ethereum smart contracts and blockchain transactions is receiving increasing scholarly attention. The ERC20 token standard has facilitated the emergence of numerous honeypot contracts, which deceive traders by allowing token purchases but blocking withdrawals. This study proposes a lightweight honeypot contract detection system integrated into the go-Ethereum client (Geth). Unlike previous work, our detector does not rely on contract interaction records or source code provided by contract creators. Instead, our approach performs static data flow analysis on contract bytecode to identify honeypot mechanisms. By focusing exclusively on the control flow of the ERC20 Transfer method, our system achieves faster detection than full-contract analysis methods, with an average processing time of 9.74 milliseconds per contract. Experiments on both known honeypot contracts and real-world token contracts demonstrate the effectiveness of our approach in detecting malicious ERC20 contracts.