LogSentry: An LSTM-Based Framework for Real-Time Vulnerability Detection in Smart Contracts
摘要
Smart contracts, as a core component of blockchain systems, play a critical role in ensuring the stability and trustworthiness of decentralized applications. The logs generated during contract execution provide essential evidence for vulnerability detection and behavior auditing. This paper proposes LogSentry, a deep neural network-based framework for real-time vulnerability detection in smart contracts. The framework leverages Long Short-Term Memory (LSTM) networks to model contract execution logs as natural language sequences, learning normal contract behavior patterns and promptly detecting log sequences that deviate from typical execution trajectories when potential anomalies occur. Furthermore, we introduce an incremental update mechanism that enables the model to dynamically adapt as contract log patterns evolve over time. Experimental results on multiple real-world smart contract datasets demonstrate that LogSentry achieves up to 97% accuracy in detecting abnormal executions and potential vulnerabilities, indicating its effectiveness and practical applicability.