Towards Effective Detection of Ponzi Schemes on Ethereum with Contract Runtime Behavior Graph

Ruichao Liang, Jing Chen, Cong Wu, Kun He, Yueming Wu, Weisong Sun, Ruiying Du, Qingchuan Zhao, Yang Liu

This paper presents PonziGuard, a novel framework designed to detect Ponzi schemes on the Ethereum blockchain with high precision and interpretability. Unlike previous methods that rely on static code analysis or transaction history, PonziGuard focuses on the runtime behavior of smart contracts, allowing it to identify scams even before they have processed a single real-world transaction.

TL;DR

PonziGuard detects Ethereum Ponzi schemes by executing contracts in a simulated environment and analyzing the resulting "Contract Runtime Behavior Graph" (CRBG) using Graph Neural Networks. It achieves a 97.5% F1-score and successfully identified 805 real-world Ponzi contracts responsible for approximately $500 million in losses.

What Problem Does This Paper Address?

Ponzi schemes on Ethereum have caused massive financial losses, yet they are notoriously difficult to detect. Existing tools generally fall into two categories:

  1. Rule-based/Static Analysis: These look at the contract's source code or opcodes without running them. The authors demonstrate that at the opcode level, Ponzi and non-Ponzi contracts are statistically almost identical, making static detection unreliable.
  2. Transaction-based Machine Learning: These analyze a contract's history of interactions. The fatal flaw here is that they are reactive; they can only catch a scam after it has already claimed victims. They cannot detect "0-day" Ponzi schemes (newly deployed contracts with no history).

PonziGuard addresses this by focusing on the logic of the contract as it executes, capturing the fundamental "invest-and-reward" pattern that defines a Ponzi scheme.

Methods

The PonziGuard pipeline consists of five main stages:

  1. Static Code Analysis: It first scans the contract to identify function properties (like payable) and data dependencies.
  2. Transaction Sequence Generation: To observe behavior, PonziGuard doesn't wait for real users. It uses a heuristic-based "fuzzer" to generate synthetic transaction sequences designed to trigger investment and reward logic.
  3. Runtime Behavior Collection: The contract is executed within an instrumented Ethereum Virtual Machine (EVM). Using dynamic taint analysis, the system tracks how sensitive data (like the amount of Ether sent or the sender's address) flows through the contract's operations.
  4. CRBG Construction: The execution trace is converted into a Contract Runtime Behavior Graph.
  5. Pruning: It removes "noisy" graphs from failed or irrelevant executions.
  6. Joining: It links subgraphs from different transactions to capture persistent state changes.
  7. Semantic Embedding: Instead of simple IDs, it uses Doc2Vec to create embeddings for nodes based on the textual descriptions of opcodes found in the Ethereum Yellow Paper.
  8. Graph Classification: A Graph Attention Network (GAT) processes the CRBG to classify the contract as either a Ponzi scheme or benign.

Datasets

  • XBlock Ground-Truth: A dataset of 6,498 smart contracts (including 314 verified Ponzi schemes) used for training and benchmarking.
  • Ethereum Mainnet: 14 million historical blocks used to evaluate real-world effectiveness.
  • 0-Day Test Set: 10,000 recently deployed contracts (from March 2024) to test the ability to catch new scams.

Key Insights and Ideas

  • Behavior > Code: The authors proved that opcode frequency distributions are a poor signal for detection (KL divergence of only 0.011–0.018). However, the flow of data—specifically how new investments are stored and how rewards are triggered by contract balances—is a unique "behavioral fingerprint."
  • The Power of Natural Language: One of the most clever ideas in the paper is using the official Ethereum Yellow Paper's English descriptions of opcodes to train the node embeddings. This allows the GNN to "understand" the semantic relationship between different operations (e.g., knowing that CALLVALUE and BALANCE both relate to monetary state).
  • Proactive Detection: By generating its own test transactions, PonziGuard can "interrogate" a contract the moment it is deployed, solving the 0-day detection problem.

Key Results

  • State-of-the-Art Performance: PonziGuard achieved 96.9% precision, 98.2% recall, and a 97.5% F1-score, significantly outperforming previous SOTA models like SourceP (92.4% F1) and MulCas (78.9% F1).
  • Real-World Impact: When applied to the Ethereum Mainnet, it identified 805 Ponzi contracts. These contracts were involved in over 615,000 transactions and absorbed roughly 281,700 Ether (approx. $500 million USD).
  • 0-Day Success: In a test of 10,000 brand-new contracts, it flagged 15 Ponzi schemes that had only a single transaction (the creation transaction), proving it can stop scams before they start.
  • Interpretability: Using gradient-based heatmaps, the authors showed that the model correctly focuses on "investment" clusters (centered around CALLVALUE) and "reward" clusters (centered around BALANCE).

Limitations and Future Work

  • Overhead: Running contracts in an instrumented EVM adds a time overhead of roughly 25-30% compared to native execution. While acceptable for security auditing, it might be slow for real-time monitoring of every single transaction on the network.
  • Evasion Obfuscation: Future scammers might attempt to "poison" the CRBG by adding junk logic or complex control flows specifically designed to break the graph pruning and joining algorithms.
  • Cross-Chain Applicability: The current work is specific to the EVM. The authors suggest that extending this behavioral graph approach to other ecosystems (like Solana or Move-based chains) is a promising future direction.

Summary updated

BibTeX
@article{liang2025towards,
  author = {Ruichao Liang and Jing Chen and Cong Wu and Kun He and Yueming Wu and Weisong Sun and Ruiying Du and Qingchuan Zhao and Yang Liu},
  title = {{Towards Effective Detection of Ponzi Schemes on Ethereum with Contract Runtime Behavior Graph}},
  journal = {ACM Trans. Softw. Eng. Methodol.},
  year = {2025},
  doi = {10.1145/3707458},
}
Figure