# Malicious Code Detection in Smart Contracts via Opcode Vectorization

arXiv: https://arxiv.org/abs/2504.12720 · HTML: https://mlsanity.com/paper/2504.12720/

## Key facts

- Cited by 6 papers in the map (data through 14 Oct 2026).
- First posted on arXiv 17 Apr 2025.

## Built on by (most cited first, 6 of 6)

- [A Comprehensive Study of Exploitable Patterns in Smart Contracts: From Vulnerability to Defense](https://mlsanity.com/paper/2504.21480/) (2025)
- [Information Security Based on LLM Approaches: A Review](https://mlsanity.com/paper/2507.18215/) (2025)
- [UEChecker: Detecting Unchecked External Call Vulnerabilities in DApps via Graph Analysis](https://mlsanity.com/paper/2508.01343/) (2025)
- [A Novel GPT-Based Framework for Anomaly Detection in System Logs](https://mlsanity.com/paper/2510.16044/) (2025)
- [Towards Understanding Deep Learning Model in Image Recognition via Coverage Test](https://mlsanity.com/paper/2505.08814/) (2025)
- [Facial Recognition Leveraging Generative Adversarial Networks](https://mlsanity.com/paper/2505.11884/) (2025)

## Abstract (arXiv)

With the booming development of blockchain technology, smart contracts have been widely used in finance, supply chain, Internet of things and other fields in recent years. However, the security problems of smart contracts become increasingly prominent. Security events caused by smart contracts occur frequently, and the existence of malicious codes may lead to the loss of user assets and system crash. In this paper, a simple study is carried out on malicious code detection of intelligent contracts based on machine learning. The main research work and achievements are as follows: Feature extraction and vectorization of smart contract are the first step to detect malicious code of smart contract by using machine learning method, and feature processing has an important impact on detection results. In this paper, an opcode vectorization method based on smart contract text is adopted. Based on considering the structural characteristics of contract opcodes, the opcodes are classified and simplified. Then, N-Gram (N=2) algorithm and TF-IDF algorithm are used to convert the simplified opcodes into vectors, and then put into the machine learning model for training. In contrast, N-Gram algorithm and TF-IDF algorithm are directly used to quantify opcodes and put into the machine learning model training. Judging which feature extraction method is better according to the training results. Finally, the classifier chain is applied to the intelligent contract malicious code detection.
