DeFi User Behavior Analysis through Clustering

Behavioral segmentation of 6.9 million Ethereum addresses from 22.7 million on-chain transactions across 11 DeFi protocols (Uniswap, Aave, Curve, Maker...). Four user profiles identified with tuned K-means clustering, published open source with dataset, models, a live demo and a full 56-page study.

  • Blockchain
  • DeFi
  • Data Engineering
  • Machine Learning
  • Clustering
  • Docker
  • LLM
  • CI/CD
  • Data Visualization
  • Generative AI

By Marius Ayrault · 22/03/2025 · 3 min read

mriusero/defi-user-behavior-clusteringDiscover how users interact with DeFi platforms through open-source data analytics. By aggregating user behavior and transaction patterns, we reveal insightful trends and provide actionable recommendations.Python20

End-to-end open source project: dataset, models and live demo published on Hugging Face, with a full 56-page study available for download.

The subject

Understanding how users actually interact with decentralized finance: what the typical profiles are, how usage splits across exchanges, lending and stablecoins, and which dynamics emerge over two years of Ethereum network activity. The study tests four hypotheses (economic incentives, substitution of traditional finance, perceived complexity, network effects) against on-chain data.

The data

  • 11 protocols covering the main DeFi families: DEX (Uniswap, Curve, Balancer), lending (Aave, Maker), stablecoins (Tether, USDC, Dai), yield farming (Yearn, Harvest) and NFT (NFTfi).
  • 22,682,739 unique transactions and 6,876,845 addresses collected from the Ethereum blockchain between January 2023 and December 2024, enriched with 177,955 hours of market data.
  • Stored in Parquet and Arrow, with the dataset published and documented on Hugging Face.

The method

  • Feature engineering: 62 variables per address (volumes, frequencies, protocol diversity, exposure, timing behavior), aggregated from transactions and market data, then standardized.
  • Dimensionality reduction: PCA bringing 62 variables down to 28 components while retaining nearly all the variance.
  • Clustering: K-means selected after benchmarking against HDBSCAN, with the number of clusters chosen through the elbow method and hyperparameters tuned with Optuna on a multi-metric objective function.
  • Validation: 0.76 silhouette score and 0.36 Davies-Bouldin index on the final model, with sensitivity analyses on standardization and extreme values.

The results

The segmentation reveals four distinct behavioral profiles among the 6.9 million addresses:

  • Small investors (29%): low transaction volume and frequency, limited platform activity, minimal market exposure.
  • Active investors (41%): the core of the ecosystem, sustained activity with diverse interactions across trading and lending, moderate exposure.
  • Whales (2.3%): high volume and frequency, 88.7% of interactions on lending protocols, the largest transferred values and the strictest risk management.
  • Explorers (28%): moderate activity but high diversity of interactions and assets, limited market influence.

Synthesis of the four DeFi user clusters, small investors, active investors, whales and explorers, with their share of addresses and behavioral signature

Beyond the profiles, the study quantifies structural dynamics: stablecoins are the entry point of DeFi (91% of usage, far ahead of DEX at 7%), adoption decreases as protocol abstraction increases, and network effects cut both ways (5% more users drive roughly 1.85% higher transaction fees).

Generative reporting

For any Ethereum address in scope, the application generates an individualized performance report: 19 behavioral metrics (ROI, fee efficiency, timing, risk exposure…) normalized and ranked both globally and within the address’s cluster, visualized as comparative radar charts. An LLM (Llama 3.3 70B served by Groq) turns those ranks into a written analysis of strengths, weaknesses and recommendations, through a structured prompt that constrains the format and grounds the generation in the computed metrics.

The live demo

The whole analysis can be explored in the application published on Hugging Face, from data collection to the per-address performance report.

The full study

The approach is documented in a 56-page research study: literature review, hypotheses, validation protocol, methodological limits and practical implications for DeFi players.

Download the study (PDF, 56 pages, in French)