October 26, 2026
Bitcoin Fraud Detection: Comparative Analysis on Low-Connectivity Graphs
Roberto Cardillo; Jacques Henrique Dias
DOI: 10.22167/2675-6528-202603418
Article derived from a Course Conclusion Work (TCC), with content based on the student’s original work and adapted to the editorial format of the E&S Magazine with the support of the ResumeAI tool, an artificial intelligence solution developed by Instituto Pecege for textual synthesis and organization.
Summary
Frauds and money laundering activities in cryptocurrency networks pose challenges to traditional detection methods due to the relational and dynamic nature of transactions. The study evaluated machine learning models for binary classification of Bitcoin transactions, categorized as legitimate or illicit, using the Elliptic dataset represented as a directed graph. Strict temporal partitioning was adopted, and only local variables were considered, excluding aggregated variables to mitigate temporal information leakage. The Random Forest model was employed as a benchmark, and the GCN, GraphSAGE, and GAT graph neural network architectures were trained with hyperparameter optimization and early stopping. The results indicated superior performance of Random Forest on the test set, with a macro F1 of 85.95%, while GraphSAGE achieved the best performance among graph neural networks, with a macro F1 of 79.14%. The removal of aggregated variables significantly reduced the performance difference between validation and test, improving generalization. A temporal distribution shift was also observed, which impacted the models’ performance. It was concluded that, in sparse and heterophilic graphs, tabular models can outperform graph-based approaches when evaluated under rigorous temporal validation.
Keywords: temporal evaluation; Bitcoin; fraud detection; graph neural networks; information leakage.
1. Introduction
The growing adoption of cryptoassets and the expansion of digital finance have intensified the need for effective methods to identify illicit transactions, such as fraud and money laundering. Although blockchain networks offer transparency and traceability, the pseudo-anonymous nature of movements makes immediate linking to real identities difficult (Weber et al., 2019). This scenario demands advanced analytical solutions, of great interest to data science, financial regulation, and digital forensics.
Literature indicates that combating illicit activities in cryptocurrencies requires analyzing not only individual transaction attributes but also structural interaction patterns, as fraudulent conduct often emerges from relational flows (Dou et al., 2020; Liu et al., 2021). Bitcoin, in particular, stands out as an object of study due to its transactional volume and documented illicit uses. The Elliptic Bitcoin Transaction Dataset, introduced by Weber et al. (2019), models transactions as nodes and payment flows as edges, enabling the investigation of illicit transaction classification in a temporal and relational environment.
In this context, graph neural networks (GNNs) have gained relevance due to their ability to learn representations from the topological structure and node attributes. Architectures such as Kipf and Welling’s (2017) Graph Convolutional Network (GCN), Hamilton, Ying, and Leskovec’s (2017) GraphSAGE, and Veličković et al.’s (2018) Graph Attention Network (GAT) allow for the incorporation of neighborhood information to build more informative contextual representations than those based solely on local variables. However, evaluating models on dynamic graphs requires temporally coherent protocols to avoid overestimating performance in prospective scenarios, as highlighted by Rossi et al. (2020).
Despite the methodological advances of GNNs, their superiority over tabular models in fraud detection is not automatic. Studies such as Weber et al. (2019) have already demonstrated the competitiveness of models like Random Forest on the Elliptic dataset. A recurring challenge in fraud graphs is the inconsistency between neighboring nodes, where fraudsters connect to legitimate profiles for camouflage, weakening the premise of local similarity (Liu et al., 2021). Furthermore, in heterophilic scenarios, where connected nodes do not share similar characteristics, indiscriminate aggregation of neighbor information can impair learned representations, leading to performance loss in low homophily graphs (Zhu et al., 2020; Dou et al., 2020).
The evaluation of models on temporal graphs also imposes the need for experimental protocols that respect the chronological order of observations. The use of future information in training can generate optimistic estimates and reduce the representativeness of performance under real conditions. Rossi et al. (2020) and Weber et al. (2019) highlight the importance of strict temporal splits for prospective evaluation, especially in financial applications where the distribution of patterns can change over time.
Given this scenario, the realization of this study is justified by the practical and academic relevance of evaluating, with methodological rigor, to what extent graph-based models effectively outperform tabular approaches in detecting illicit transactions in Bitcoin. The issue is important not only for the graph learning literature but also for analytical intelligence applications in money laundering prevention, financial monitoring, and digital investigation. By comparing models under strict temporal partitioning and discussing the effects of low connectivity, heterophily, class imbalance, and temporal leakage, the work contributes to a more realistic assessment of the problem and to the choice of methods more compatible with the properties of the analyzed dataset. Thus, the objective of this work was to compare the performance of Random Forest and graph neural network architectures, specifically GCN, GraphSAGE, and GAT, in detecting illicit transactions in the Elliptic Bitcoin Transaction Dataset, under strict temporal validation, evaluating the influence of graph structure, class imbalance, temporal distribution shift, and potential information leakage on the predictive capability and robustness of these models.
2. Material and Methods
This study was characterized as an applied research, with a quantitative approach and experimental design, aiming to compare supervised models for binary classification of Bitcoin transactions. The methodological design adopted an experimental protocol that preserved the chronological order of observations, as recommended by Weber et al. (2019) and Rossi et al. (2020), for a prospective evaluation and to mitigate performance overestimation.
The research utilized the Elliptic Bitcoin Transaction Dataset (Weber et al., 2019), where transactions were represented as nodes and financial flows as directed edges. Only labeled observations were considered, with binary classification: 0 for legitimate and 1 for illicit. The analyzed graph comprised 46,564 nodes and 36,624 edges, with an approximate density of 0.0017% and an average degree of 1.57, characterizing a sparse structure with low connectivity.
Data preprocessing involved reading attribute, class, and edge files. Transactions classified as “unknown” were excluded, and nodes received a continuous numerical index, with edges mapped to this new indexing. Edges associated with excluded nodes were removed, maintaining the directed graph. In variable selection, only local variables (1 to 94) were used, with aggregated variables (95 to 165) removed to mitigate temporal leakage and ensure realistic prospective conditions.
The data partitioning was performed temporally, respecting the chronological sequence of transactions. Time instants 1 to 34 were allocated for training and instants 35 to 49 for testing, following the protocol by Weber et al. (2019). For hyperparameter optimization, the training period was subdivided: instants 1 to 30 for training and 31 to 34 for validation. This division preserved the test set and ensured sufficient examples of the illicit class for hyperparameter selection.
Four classification models were compared: the Random Forest algorithm (Breiman, 2001) as a tabular baseline, and three graph neural network (GNN) architectures. The GNNs evaluated were the Graph Convolutional Network (GCN) (Kipf and Welling, 2017), GraphSAGE (Hamilton, Ying, and Leskovec, 2017), and Graph Attention Network (GAT) (Veličković et al., 2018).
The hyperparameter optimization of GNNs was performed with the Optuna library, employing the Tree-structured Parzen Estimator method (Akiba et al., 2019). For Random Forest, RandomizedSearchCV was used (Bergstra and Bengio, 2012). The decision threshold was adjusted based on the maximization of the macro F1-score on the temporal validation set, considering the imbalance and temporal distribution shift.
The imbalance between classes was treated differently. In Random Forest, class weighting was used. In graph neural networks, the cross-entropy loss function (CrossEntropyLoss) was used without explicit weighting, as exploratory studies indicated performance degradation with class weights in heterophilic graphs (Zhu et al., 2020).
The evaluation metrics adopted were the macro F1-score, balanced accuracy, the Matthews Correlation Coefficient (MCC), and the area under the precision-recall curve (AUC-PR). These measures were selected due to the imbalanced nature, where the illicit class is the minority, and for being more sensitive to the balance between error types, providing adequate evaluation for classifiers on datasets with unequal distribution.
The experiments were conducted in a Google Colab Pro environment, using NVIDIA Tesla T4 GPU (16 GB VRAM), Intel Xeon CPU (2 vCPUs), and 12 GB RAM. The main libraries employed were PyTorch, PyTorch Geometric, scikit-learn, Optuna, and NumPy. To ensure reproducibility, random seeds were fixed in the main libraries (Python, NumPy, PyTorch), for both CPU and GPU processing.
3. Results and Discussion
The research results revealed a detailed panorama on the effectiveness of different machine learning models in detecting illicit transactions in Bitcoin, with emphasis on strict temporal validation and graph structural characteristics. The comparison between the tabular Random Forest model and graph neural network architectures (GCN, GraphSAGE, and GAT) allowed for the identification of the most robust approaches for the Elliptic Bitcoin Transaction Dataset, considering class imbalance, temporal distribution shift, and potential information leakage. The findings indicated that Random Forest outperformed GNNs in several performance metrics, a result that challenges the premise of automatic superiority of graph-based models in all contexts.
Initially, a significant temporal distribution shift was observed between the validation and test sets. The prevalence of illicit transactions in the validation set was approximately 17%, while in the test set, this proportion dropped to 6.5%. This variation is crucial as it demonstrates that the distribution of fraud patterns did not remain constant over time. Such behavior reinforces the importance of temporally coherent evaluation protocols, like those adopted in this study, to avoid overestimating model performance in prospective scenarios, as highlighted by Rossi et al. (2020). The difference in prevalence can affect model calibration and the balance between false positives and false negatives, requiring caution in interpreting the results.
Random Forest Performance
The Random Forest model demonstrated the best overall performance on the test set, achieving a macro F1 of 85.95%. This result is notable and surpasses the performance reported by Weber et al. (2019) for the illicit class, with an F1 of 73.62% compared to their 69.4% obtained using only local variables. This improvement of approximately 4.22 percentage points indicates the model’s ability to effectively capture discriminative patterns, even without explicit incorporation of the graph structure.
In the training set, Random Forest presented almost perfect metrics, with F1 Macro of 0.9972, balanced accuracy of 0.9994, recall of 100.00% for the illicit class, and precision of 98.99%. Although these values suggest an excellent ability to fit the training data, they also warn of the need to evaluate the model’s generalization on unseen data. In supervised classification problems, especially with imbalanced classes, training performance can be misleading, and the model’s true quality lies in its ability to predict correctly in new scenarios.
Upon transitioning to the validation set, the Random Forest metrics showed an expected reduction, but still maintained robust performance. The F1 Macro was 0.9026, balanced accuracy was 0.8688, illicit class recall was 74.61%, and precision was 94.75%. These figures indicate that the model retained a high predictive capacity and, crucially, strong precision in identifying illicit transactions. This implies that when the model classified a transaction as fraudulent, the probability of being correct was high, which is fundamental for reducing false positives in practical applications.
In the test set, the performance of Random Forest continued to decrease, but in a controlled manner, with a Macro F1 of 0.8595, balanced accuracy of 0.8405, recall of 69.44%, and precision of 78.33%. This drop, especially in precision, suggests a proportional increase in false positives and a slight reduction in the correct identification of illicit transactions. Such behavior is consistent with the strict temporal validation methodology, which exposes the model to changes in data distribution over time, simulating more realistic application conditions. The results confirm the robustness of Random Forest in capturing relevant patterns in local variables and maintaining competitive performance even in the face of temporal distribution shift.
Decision Threshold Optimization
The optimization of the decision threshold was an important step before the final evaluation, and its effects varied significantly among the models. For Random Forest, the default threshold of 0.50 was maintained, resulting in a final F1 of 85.95%, unchanged from the initial threshold. This suggests that the model already presented a good balance between precision and recall, demonstrating greater predictive stability in the face of distribution changes observed in the test data.
In contrast, graph neural network architectures benefited from threshold optimization. GraphSAGE, for example, increased its macro F1 from 77.45% to 79.14% with an optimized threshold of 0.55. Similarly, GCN achieved the most significant gain among GNNs, moving from 74.46% to 78.64% with a threshold of 0.66. These adjustments indicate that threshold calibration was relevant for improving the balance between fraud identification and false positive control, especially in a class imbalance scenario.
The GAT, in turn, showed a more discrete gain, with its macro F1 increasing from 73.28% to 73.40% after optimizing the threshold to 0.51. This result suggests that, although recalibration produced a small advance, the main limiting factor for the GAT was not just the cutoff point, but rather its intrinsic ability to discriminate classes in the analyzed context. In general, optimizing the decision threshold proved more critical for GNNs, indicating that these models are more sensitive to probability calibration compared to the greater robustness of the Random Forest.
Model Comparison
The comparative analysis of the models on the test set confirmed the superiority of Random Forest over all graph neural network architectures. Random Forest achieved the highest F1 Macro (0.8595) and the highest balanced accuracy (0.8405), indicating a superior balance in the classification of both classes. Its precision for the illicit class was 78.33%, significantly higher than that of graph-based models, which translates into a lower false positive rate in the detection of fraudulent transactions. The F1 for the illicit class, at 73.62%, reinforces this specific advantage.
Among GNNs, GraphSAGE presented the best relative performance, with a Macro F1 of 0.7914 and a balanced accuracy of 0.8278. Its recall for the illicit class was 69.53%, a value very close to that of Random Forest (69.44%), suggesting a similar ability to identify fraudulent transactions. However, GraphSAGE’s precision was considerably lower, at 54.88%, indicating that this detection occurred at the expense of a higher number of false positives. The F1 for the illicit class for GraphSAGE was 61.34%, lower than that of Random Forest, which suggests that the relational structure aggregated by the model was not sufficient to generate decisions as accurate as those of the tabular method.
The GCN achieved slightly lower performance than GraphSAGE, with a Macro F1 of 0.7864 and a balanced accuracy of 0.7933. Its recall for the illicit class was 61.68%, and its precision was 58.65%, resulting in an illicit class F1 of 60.13%. These results indicate that the GCN performed more modestly in both sensitivity and precision, possibly limited by the network’s structural characteristics, such as low connectivity and heterophily. The GAT, in turn, presented the worst performance among all models, with a Macro F1 of 0.7340, a balanced accuracy of 0.7869, and an illicit class F1 of 51.08%. Its precision of 42.84% was the lowest, evidencing a high incidence of false positives.
The consolidation of additional metrics, such as the Matthews Correlation Coefficient (MCC) and the Area Under the Precision-Recall Curve (AUC-PR), reinforces the superiority of Random Forest. The tabular model achieved an MCC of 0.7205 and an AUC-PR of 0.6311, values significantly higher than those of GNNs. GraphSAGE obtained an MCC of 0.5879 and an AUC-PR of 0.4601; GCN, an MCC of 0.5730 and an AUC-PR of 0.4291; and GAT, an MCC of 0.4803 and an AUC-PR of 0.2801. The AUC-PR is particularly relevant in problems with low prevalence of the positive class, such as fraud detection, and the superior performance of Random Forest on this metric demonstrates its greater suitability for identifying the minority class across different decision thresholds (Davis & Goadrich, 2006).
Analysis of the Superiority of “Random Forest”
The superiority of Random Forest can be attributed mainly to the structural characteristics of the Elliptic Bitcoin Transaction Dataset. The local variables (1 to 94) proved to be highly discriminative, which reduced the added value of message propagation between nodes. Furthermore, the sparsity of the graph, with 46,564 nodes and 36,624 edges, resulting in an approximate density of 0.0017%, and the average degree of 1.57, with many isolated nodes or nodes with few connections, limited the ability of GNNs to propagate information effectively. In parts of the graph, GNNs became functionally similar to tabular models due to the lack of informational neighborhood.
Another crucial factor is the low graph homophily, where connected nodes do not necessarily share the same class. Fraudulent agents frequently connect to legitimate entities as a camouflage strategy, as discussed by Dou et al. (2020). This heterophily generates neighborhoods with conflicting information, diluting discriminative signals and intensifying the over-smoothing phenomenon, which impairs the performance of GNNs (Li, Han & Wu, 2018; Zhu et al., 2020). Message-passing based models, such as GNNs, implicitly assume that neighbors share similar characteristics, a premise that does not hold in heterophilic graphs.
Additionally, the class imbalance mitigation strategy also contributed to the performance difference. The Random Forest used class weighting, while the GNNs were trained with a standard cross-entropy loss function, without explicit weighting. Exploratory results indicated that the combination of class weights with neighbor aggregation in heterophilic graphs degraded the performance of GNNs. The literature points to the need for specific mechanisms for learning on imbalanced graphs (Liu et al., 2021). Finally, the temporal distribution shift, although a secondary factor, also contributed to the robustness differences between the models.
Interpretability and Explainability
Regarding interpretability, the results were consistent with the structural limitations of the graph. The GNNExplainer method, applied to interpret the GNN predictions, returned null weights for all variables, indicating a difficulty in extracting interpretable patterns in sparse and heterophilic graphs. This finding suggests that, in the analyzed context, the relational information was not clear or consistent enough to be interpreted by this technique.
In contrast, the variable importance analysis in Random Forest revealed a high concentration of predictive power in a few variables, with `feature_53` showing a dominant importance of 48.3%. This demonstrates that the tabular model’s decision is strongly anchored in specific attributes, reinforcing the idea that tabular information contains more consistent and discriminative signals than the relational structure in a graph with the characteristics of the Elliptic Dataset.
This work brought relevant methodological contributions. The first was the systematic documentation of the impact of temporal information leakage on aggregated variables, quantifying a degradation of 40.6 percentage points in F1, which provides a replicable protocol to mitigate this problem in future research with the Elliptic Dataset. The second contribution lies in the analysis of the interaction between class weighting and message propagation in heterophilic graphs, where class weighting in GNNs resulted in a degradation of 10 to 13 percentage points in F1, suggesting that balancing techniques for tabular data may require adaptations in low-homophily graphs. The third contribution was the differentiated adjustment of the decision threshold, which showed gains for GNNs, while Random Forest maintained the standard threshold, evidencing different sensitivities to calibration.
In summary, the results obtained in this study demonstrate that, in the context of the Elliptic Bitcoin Transaction Dataset and under a rigorous temporal validation protocol, Random Forest consistently outperformed graph neural network architectures (GCN, GraphSAGE, and GAT) in detecting illicit transactions. The superiority of the tabular model is explained by the high discriminative capacity of local variables, combined with the sparsity and heterophily characteristics of the graph, which limit the effectiveness of message propagation in GNNs. Prospective evaluation and mitigation of temporal leakage were crucial for a realistic analysis, confirming that, in graphs with low connectivity and homophily, well-calibrated tabular models can be more suitable for the fraud detection task than graph-based approaches.
4. Conclusion
The present study aimed to compare the performance of Random Forest and graph neural network architectures, specifically GCN, GraphSAGE, and GAT, in detecting illicit transactions in the Elliptic Bitcoin Transaction Dataset, under strict temporal validation. It was found that Random Forest exhibited superior performance compared to graph-based models, with a macro F1 of 85.95% on the test set, while GraphSAGE achieved the best result among graph neural networks, with a macro F1 of 79.14%. This superiority of the tabular model was attributed to the high discriminative capacity of local variables and the sparsity and heterophily characteristics of the graph, which limited the message-passing effectiveness of GNNs. A significant temporal distribution shift was observed, with the prevalence of illicit transactions dropping from 17% in validation to 6.5% in testing, reinforcing the importance of rigorous temporal validation. The removal of aggregated variables, to mitigate temporal information leakage, contributed to the robustness of the evaluation. The main contribution of this work lies in the empirical demonstration that, in sparse and heterophilic graphs, well-calibrated tabular models can outperform graph-based approaches in detecting illicit transactions, even in a dynamic and class-imbalanced scenario.
Despite the relevant findings, the study has limitations, such as the use of a single dataset, which restricts generalization to other blockchain fraud contexts. The Elliptic Dataset also presents a considerable proportion of unlabelled transactions, and the analysis focused on a limited set of GNN architectures, without exploring more recent models or specialized techniques for heterophilic and imbalanced graphs. For future studies, it is suggested to expand the investigation to other datasets and fraud domains, test architectures developed specifically for heterophilic graphs and hybrid methods, and explore advanced balancing techniques for graph learning. It is also recommended to evaluate the economic and operational feasibility of the models, considering the costs of false positives and negatives, and to deepen the interpretability analysis with semantic description variables, using methods such as permutation importance and SHAP for tabular models, and specific techniques for GNNs.
Bibliographic References
Dou, Y., Liu, Z., Sun, L., Deng, Y., Peng, H., & Yu, P. S. (2020). Enhancing graph neural network-based fraud detectors against camouflaged fraudsters. In Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining (pp. 315-324). ACM. https://dl.acm.org/doi/10.1145/3340531.3411903
Kipf, T. N., & Welling, M. (201
Liu, Z., Dou, Y., Yu, P. S., Deng, Y., & Peng, H. (2021). Pick and choose: A GNN-based imbalanced learning approach for fraud detection. In Proceedings of the Web Conference 2021. https://dl.acm.org/doi/10.1145/3442381.3449989
Weber, M., Domeniconi, G., Chen, J., Weidele, D. K. I., Bellei, C., Robinson, T., & Leiserson, C. E. (2019). Anti-money laundering in Bitcoin: Experimenting with graph convolutional networks for financial forensics. In KDD Workshop on Anomaly Detection in Finance. arXiv. https://arxiv.org/abs/1908.02591
Article originating from the Final Course Project of the Specialization in Data Science and Analytics of the MBA USP/Esalq
To learn more about the course, click here and access the MBX Academy platform