# Detecting DeFi Securities Violations from Token Smart Contract Code

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

## Key facts

- No citing papers in the map yet (data through 14 Oct 2026).
- Builds on 11 of its 114 references that are in the map.
- First posted on arXiv 6 Dec 2021.

## Builds on (most cited first, 11 of 11)

- [SoK: Decentralized Exchanges (DEX) with Automated Market Maker (AMM) Protocols](https://mlsanity.com/paper/2103.12732/) (2021)
- [Dissecting Ponzi schemes on Ethereum: identification, analysis, and impact](https://mlsanity.com/paper/1703.03779/) (2017)
- [T-EDGE: Temporal WEighted MultiDiGraph Embedding for Ethereum Transaction Network Analysis](https://mlsanity.com/paper/1905.08038/) (2019)
- [Decentralized Applications: The Blockchain-Empowered Software System](https://mlsanity.com/paper/1810.05365/) (2018)
- [Characterizing Code Clones in the Ethereum Smart Contract Ecosystem](https://mlsanity.com/paper/1905.00272/) (2019)
- [Tracing Cryptocurrency Scams: Clustering Replicated Advance-Fee and Phishing Websites](https://mlsanity.com/paper/2005.14440/) (2020)
- [SoK: Lending Pools in Decentralized Finance](https://mlsanity.com/paper/2012.13230/) (2020)
- [Acute Lymphoblastic Leukemia Classification from Microscopic Images using Convolutional Neural Networks](https://mlsanity.com/paper/1906.09020/) (2019)
- [SCSGuard: Deep Scam Detection for Ethereum Smart Contracts](https://mlsanity.com/paper/2105.10426/) (2021)
- [Elysium: Context-Aware Bytecode-Level Patching to Automatically Heal Vulnerable Smart Contracts](https://mlsanity.com/paper/2108.10071/) (2021)
- [EVMPatch: Timely and Automated Patching of Ethereum Smart Contracts](https://mlsanity.com/paper/2010.00341/) (2020)

## Abstract (arXiv)

Decentralized Finance (DeFi) is a system of financial products and services built and delivered through smart contracts on various blockchains. In the past year, DeFi has gained popularity and market capitalization. However, it has also been connected to crime, in particular, various types of securities violations. The lack of Know Your Customer requirements in DeFi poses challenges to governments trying to mitigate potential offending in this space. This study aims to uncover whether this problem is suited to a machine learning approach, namely, whether we can identify DeFi projects potentially engaging in securities violations based on their tokens' smart contract code. We adapt prior work on detecting specific types of securities violations across Ethereum, building classifiers based on features extracted from DeFi projects' tokens' smart contract code (specifically, opcode-based features). Our final model is a random forest model that achieves an 80% F-1 score against a baseline of 50%. Notably, we further explore the code-based features that are most important to our model's performance in more detail, analyzing tokens' Solidity code and conducting cosine similarity analyses. We find that one element of the code our opcode-based features may be capturing is the implementation of the SafeMath library, though this does not account for the entirety of our features. Another contribution of our study is a new data set, comprised of (a) a verified ground truth data set for tokens involved in securities violations and (b) a set of legitimate tokens from a reputable DeFi aggregator. This paper further discusses the potential use of a model like ours by prosecutors in enforcement efforts and connects it to the wider legal context.
