Automated Smart Contract Vulnerability Detection using Hybrid Deep Learning and Language Models
Abstract
With the emergence of block chain and smart contracts, security of the smart contract at any stage of its use is very relevant to prevent risks of finance and operations. The automated methods of finding vulnerabilities in smart contracts give a dependable and scalable solution. In this research, we employ the annotated smart contracts with identified flaws that are provided by the Smart Contract flaws Dataset on Kaggle. The dataset provides various contracts which can be used for supervised learning. The preprocessing phase consists of tokenization, data visualization, distribution analysis and building word clouds with the aim to identify key textual patterns. Typical ML algorithms such as LSTM, BERT, DistilBERT are trained and evaluated using accuracy, precision, recall, and F1-score. The study combines embedding techniques based on BERT with DL-based models like BiLSTM, BiGRU, and CNN + LSTM to enhance the ability of vulnerability detection. Moreover, it proposes a user interface based on the Flask which enables to provide live text input for prediction to build a practical and interactive deployment space for the evaluation of secure smart contracts. The comparison results indicate that the CNN + LSTM model performs best of all the models with 98.1% on all the metrics. This shows that the CNN + LSTM model can better capture the sequential and contextual aspects of smart contract code.