With the rapid development of the Ethereum ecosystem and the increasing applications of decentralized finance (DeFi), the security research of smart contracts and blockchain transactions has attracted more and more attention. In particular, front-running attacks on the Ethereum platform have become a major security concern. These attack strategies exploit the transparency and certainty of the blockchain, enabling attackers to gain unfair economic benefits by manipulating the transaction order. This study proposes a sandwich attack detection system integrated into the go-Ethereum client (Geth). This system, by analyzing transaction data streams, effectively detects and defends against front-running and sandwich attacks. It achieves real-time analysis of transactions within blocks, quickly and effectively identifying abnormal patterns and potential attack behaviors. The system has been optimized for performance, with an average processing time of 0.442 s per block and an accuracy rate of 83%. Response time for real-time detection new blocks is within 5 s, with the majority occurring between 1 and 2 s, which is considered acceptable. Research findings indicate that as a part of the go-Ethereum client, this detection system helps enhance the security of the Ethereum blockchain, contributing to the protection of DeFi users’ private funds and the safety of smart contracts. The primary contribution of this study lies in offering an efficient blockchain transaction monitoring system, capable of accurately detecting sandwich attack transactions within blocks while maintaining normal operation speeds as a full node.
Read full abstract