Tags:blockchain, deep learning, smart contract and vulnerability detection
Abstract:
The paper is devoted to methods of detecting vulnerabilities of smart contracts using machine learning. The purpose of the study is to improve the accuracy of detecting the reentrancy vulnerability of smart contracts by implementing new machine learning models. A thorough analysis of the current literature was performed and the shortcomings of the existing tools for detecting vulnerabilities of smart contracts were identified. In particular, insufficient accuracy and low adaptability of existing models to new vulnerabilities were noted. To solve these problems, a new model based on a kind of recurrent neural networks with a gating mechanism, namely a bidirectional GRU with an attention mechanism, was proposed to detect the reentrancy vulnerability at the Solidity code level. Using the Word2vec model, the source code of smart contracts was transformed into an array of vectors and used as input to the neural network. Precision, recall and F-beta score were used to evaluate the developed model. 500 smart contract source codes from the Ethereum blockchain were used to train the model, 250 of which had the reentrancy vulnerability. The constructed model was compared with Simple RNN, LSTM, BLSTM, BGRU and BLSTM-ATT models. The obtained results showed that the developed model is ahead of the listed models. The closest values of the metrics were obtained by the BLSTM-ATT model, while the developed BGRU-ATT model uses significantly fewer parameters that need to be optimized, which reduces the training time of the model to detect new vulnerabilities.
Vulnerability Detection of Smart Contracts Based on Bidirectional GRU and Attention Mechanism