Enhancing Blockchain Security Through Smart Contract Vulnerability Classification Using BiLSTM and Attention Mechanism - Abdulnaser Almasloum (Journal of Current Research in Blockchain, 2026)
The rapid adoption of blockchain technology has intensified the need for robust smart contract security mechanisms. However, traditional rule-based or static analysis tools often fail to detect context-dependent vulnerabilities embedded in complex contract logic. This study proposes a deep learning framework for automated smart contract vulnerability classification using a Bidirectional Long Short-Term Memory (BiLSTM) network integrated with an Attention Mechanism. The model was trained and evaluated on the SC_Vuln_8label.csv dataset, comprising 12,520 labelled Solidity smart contracts categorized into eight distinct vulnerability types, including Re-entrancy, Integer Overflow, and Short Address Attack. Through bidirectional contextual learning and attention-based feature weighting, the proposed model achieved 93.7% test accuracy, 0.93 precision, and a macro F1-score of 0.92, outperforming baseline models such as CNN, GRU, and standard LSTM by up to 5.3 percentage points. Attention heatmap analysis further revealed the model’s interpretability by highlighting vulnerability-prone code segments (e.g., call.value, send(), and withdraw() functions) consistent with expert-identified risk indicators. These results demonstrate that the BiLSTM + Attention framework not only enhances vulnerability detection accuracy but also provides transparent and explainable reasoning, offering a reliable foundation for AI-assisted smart contract auditing systems in blockchain security.