Blockchain Security: A Reproducible Machine Learning Framework for Smart Contract Vulnerability Detection

Smart contracts on the Ethereum blockchain enable decentralized, trustless applications but remain highly susceptible to security vulnerabilities that have caused substantial financial losses. Traditional static and symbolic analysis tools often suffer from limited generalizability and high false-positive rates, motivating the exploration of machine learning alternatives. In this paper, we present a reproducible machine learning framework for smart contract vulnerability detection using a carefully designed synthetic dataset of 400 contracts. The dataset contains twelve static code-level features (including lines of code, external calls, delegatecalls, cyclomatic complexity, and state variable writes) and a binary vulnerability label with realistic class imbalance (22.5% vulnerable). We evaluate four classifiers Logistic Regression, Random Forest, Extra Trees, and Histogram-based Gradient Boosting under a stratified train-test protocol. Experimental results show that tree-based ensembles achieve strong performance, with HistGradientBoosting reaching an F1-score of 0.971 and ROC-AUC of 1.000, while Logistic Regression provides a competitive and more interpretable baseline (F1-score 0.882, ROC-AUC 0.974). Feature importance analysis highlights external calls, delegatecalls, and cyclomatic complexity as the most discriminative indicators. We openly release the dataset, preprocessing pipeline, and evaluation scripts to support reproducibility. Although the synthetic nature of the data limits direct claims about real-world deployment, the framework offers a transparent, controllable testbed for benchmarking detection methods and studying the impact of class imbalance and feature design in smart contract security research.

Authors

Publication Details

Journal
Preprints.org
Published
2026-10-27
DOI
https://doi.org/10.20944/preprints202610.2628.v1
Primary Topic
Blockchain Technology Applications and Security
Type
preprint
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
preprint

Blockchain Security: A Reproducible Machine Learning Framework for Smart Contract Vulnerability Detection

Alireza Assadzadeh
2 links
Preprints.org
Blockchain Technology Applications and Security
preprint

Blockchain Security: A Reproducible Machine Learning Framework for Smart Contract Vulnerability Detection

Alireza Assadzadeh
preprint en

Abstract

Smart contracts on the Ethereum blockchain enable decentralized, trustless applications but remain highly susceptible to security vulnerabilities that have caused substantial financial losses. Traditional static and symbolic analysis tools often suffer from limited generalizability and high false-positive rates, motivating the exploration of machine learning alternatives. In this paper, we present a reproducible machine learning framework for smart contract vulnerability detection using a carefully designed synthetic dataset of 400 contracts. The dataset contains twelve static code-level features (including lines of code, external calls, delegatecalls, cyclomatic complexity, and state variable writes) and a binary vulnerability label with realistic class imbalance (22.5% vulnerable). We evaluate four classifiers Logistic Regression, Random Forest, Extra Trees, and Histogram-based Gradient Boosting under a stratified train-test protocol. Experimental results show that tree-based ensembles achieve strong performance, with HistGradientBoosting reaching an F1-score of 0.971 and ROC-AUC of 1.000, while Logistic Regression provides a competitive and more interpretable baseline (F1-score 0.882, ROC-AUC 0.974). Feature importance analysis highlights external calls, delegatecalls, and cyclomatic complexity as the most discriminative indicators. We openly release the dataset, preprocessing pipeline, and evaluation scripts to support reproducibility. Although the synthetic nature of the data limits direct claims about real-world deployment, the framework offers a transparent, controllable testbed for benchmarking detection methods and studying the impact of class imbalance and feature design in smart contract security research.

Preprints.org
Blockchain Technology Applications and Security
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Laika access coming soon