Investigating Similarities Across Decentralized Finance (DeFi) Services
DOI:
https://doi.org/10.5195/ledger.2025.402Keywords:
Decentralized Finance, Ethereum, Smart Contract, Clustering, Graph Representation LearningAbstract
We explore the adoption of graph representation learning (GRL) algorithms to investigate similarities across services offered by Decentralized Finance (DeFi) protocols. Following existing literature, we use Ethereum transaction data to identify the DeFi building blocks. These are sets of protocol-specific smart contracts that, similarly to “financial LEGO bricks”, are utilized in combination within single transactions and encapsulate the logic to conduct specific financial services such as swapping or lending cryptoassets. We propose a method to categorize these blocks into clusters based on their smart contract attributes and the graph structure of their smart contract calls. We employ GRL to create embedding vectors from building blocks and agglomerative models for clustering them. To evaluate whether they are effectively grouped in clusters of similar functionalities, we associate them with eight financial functionality categories and use this information as the target label. We find that in the best-case scenario purity reaches .888. We use additional information to associate the building blocks with protocol-specific target labels, obtaining comparable purity (.864) but higher V-Measure (.571) and discuss plausible explanations for this difference. In summary, this method helps categorize existing financial products offered by DeFi protocols, and can effectively automatize the detection of similar DeFi services, especially within protocols.
References
Auer, R., Haslhofer, B., Kitzler, S., Saggese, P., Victor, F. “The Technology of Decentralized Finance (DeFi).” Digital Finance 6.1 55–95 (2024) https://doi.org/10.1007/s42521-023-00088-8.
Becker, H. “Identification and Characterization of Events in Social Media.” (2011) PhD Thesis. New York: Columbia University (Accessed 24 January 2025) http://www.cs.columbia.edu/~hila/ hila-thesis-distributed.pdf.
Di Angelo, M., Salzer, G. “Tokens, Types, and Standards: Identification and Utilization in Ethereum.” In J. Xu, S. Schulte, P. Ruppel, A. Küpper, D. Jadav (Eds.), 2020 IEEE International Conference on Decentralized Applications and Infrastructures (DAPPS) 1–10 (2020) https://doi.org/10.1109/DAPPS49028.2020. 00001.
Fan, S., Min, T., Wu, X., Wei, C. “Towards Understanding Governance Tokens in Liquidity Mining: A Case Study of Decentralized Exchanges.” World Wide Web 26.3 1181–1200 (2023) https://doi.org/10.1007/ s11280-022-01077-4.
Fritsch, R., Käser, S., Wattenhofer, R. “The Economics of Automated Market Makers.” In Proceedings of the 4th ACM Conference on Advances in Financial Technologies 102–110 (2022) https://doi.org/10.1145/ 3558535.3559790.
Han, B., Wei, Y., Wang, Q., Collibus, F. M. D., Tessone, C. J. “MT2AD: Multi-Layer Temporal Transaction Anomaly Detection in Ethereum Networks with GNN.” Complex & Intelligent Systems 10 613–626 (2024) https://doi.org/10.1007/s40747-023-01126-z.
Harvey, C. R., Ramachandran, A., Santoro, J. DeFi and the Future of Finance. Newark: John Wiley & Sons (2021).
Heimbach, L., Schertenleib, E., Wattenhofer, R. “Risks and Returns of Uniswap V3 Liquidity Providers.” In 4th ACM Conference on Advances in Financial Technologies (AFT), Cambridge, Massachusetts, USA 89–101 (2022) https://doi.org/10.1145/3558535.3559772.
Heimbach, L., Schertenleib, E., Wattenhofer, R. “Short Squeeze in DeFi Lending Market: Decentralization in Jeopardy?” In A. Essex et al., Financial Cryptography and Data Security. FC 2023 International Workshops: Voting, CoDecFin, DeFi, WTSC, Bol, Brač, Croatia, May 5, 2023, Revised Selected Papers 337–351 (2023) https://doi.org/10.1007/978-3-031-48806-1_22.
Jensen, J. R., Ross, O. “Managing Risk in DeFi.” SSRN (2020) (Accessed 24 January 2025) https: //dx.doi.org/10.2139/ssrn.3745568.
Khan, A., Akcora, C. G. “Graph-Based Management and Mining of Blockchain Data.” In CIKM ’22: Proceedings of the 31st ACM International Conference on Information & Knowledge Management 5140–5143 (2022) https://doi.org/10.1145/3511808.3557502.
Kitzler, S., Saggese, P., Diem, C., Bernhard, H., Thurner, S. “Systemic Risk in Decentralized Finance (DeFi) - An Investigation of Smart Contract Interdependencies.” In Proceedings of the 11th International Conference on Complex Networks and their Applications 233–235 (2022) https://dx.doi.org/10.5281/ zenodo.7593062.
Kitzler, S., Victor, F., Saggese, P., Haslhofer, B. “A Systematic Investigation of DeFi Compositions in Ethereum.” In S. Matsuo et al. (Ed.), Financial Cryptography and Data Security. FC 2022 International Workshops. FC 2022. Lecture Notes in Computer Science. 13412 272–279 (2022) https://doi.org/10. 1007/978-3-031-32415-4_18.
Kitzler, S., Victor, F., Saggese, P., Haslhofer, B. “Disentangling Decentralized Finance (DeFi) Compositions.” ACM Transactions on the Web 17.2 1–26 (2023) https://doi.org/10.1145/3532857.
Lehar, A., Parlour, C. A. “Decentralized Exchange: The Uniswap Automated Market Maker.” SSRN (2021) (Accessed 24 Jan 2025) https://dx.doi.org/10.2139/ssrn.3905316.
Leman, A., Weisfeiler, B. “A Reduction of a Graph to a Canonical Form and an Algebra Arising During This Reduction.” Nauchno-Technicheskaya Informatsiya 2.9 12–16 (1968).
Li, S., Gou, G., Liu, C., Hou, C., Li, Z., Xiong, G. “TTAGN: Temporal Transaction Aggregation Graph Network for Ethereum Phishing Scams Detection.” In WWW’22: Proceedings of the ACM Web Conference 2022 661–669 (2022) https://doi.org/10.1145/3485447.3512226.
Moin, A., Sekniqi, K., Sirer, E. G. “SoK: A Classification Framework for Stablecoin Designs.” In Financial Cryptography and Data Security: 24th International Conference, FC 2020, Kota Kinabalu, Malaysia, February 10–14, 2020 Revised Selected Papers Springer 174–197 (2020) https://doi.org/10.1007/ 978-3-030-51280-4_11.
Murtagh, F., Legendre, P. “Ward’s Hierarchical Agglomerative Clustering Method: Which Algorithms Implement Ward’s Criterion?” Journal of Classification 31 274–295 (2014) https://doi.org/10.1007/ s00357-014-9161-z.
Narayanan, A., Chandramohan, M., Venkatesan, R., Chen, L., Liu, Y., Jaiswal, S. “graph2vec: Learning Distributed Representations of Graphs.” arXiv (2017) (Accessed 24 January 2025) https://doi.org/10. 48550/arXiv.1707.05005.
Pocher, N., Zichichi, M., Merizzi, F., Shafiq, M. Z., Ferretti, S. “Detecting Anomalous Cryptocurrency Transactions: An AML/CFT Application of Machine Learning-Based Forensics.” Electronic Markets 33 37 (2023) https://doi.org/10.1007/s12525-023-00654-3.
Popescu, A.-D. “Decentralized Finance (DeFi)–The Lego of Finance.” Social Sciences and Education Research Review 7.1 321–349 (2020) https://ideas.repec.org/a/edt/jsserr/v7y2020i1p321-348. html.
Protocols are Badger, Convex, Fei, Harvestfinance, RenVM, Vesper, Yearn, Barnbridge, dYdX, Futureswap, Hegic, Nexus, Synthetix, 0x, 1inch, Balancer, Curvefinance, SushiSwap, Uniswap, Aave, Compound, Instadapp, and Maker. The choice of the protocols, their associated contracts, and the timeframe are conditional to the availability of sources utilized in Kitzler et al. (2022)5
Schär, F. “Decentralized Finance: On Blockchain- and Smart Contract-Based Financial Markets.” Federal Reserve Bank of St. Louis Review 2 153–74 (2021) https://doi.org/10.20955/r.103.153-74.
Shervashidze, N., Schweitzer, P., Van Leeuwen, E. J., Mehlhorn, K., Borgwardt, K. M. “Weisfeiler-Lehman Graph Kernels.” Journal of Machine Learning Research 12.77 2539–2561 (2011) http://jmlr.org/papers/ v12/shervashidze11a.html.
Sun, X. “Liquidity Risks in Lending Protocols: Evidence from Aave Protocol.” arXiv (2022) (Accessed 24 January 2025) https://doi.org/10.48550/arXiv.2206.11973.
Tolmach, P., Li, Y., Lin, S.-W., Liu, Y. “Formal Analysis of Composable DeFi Protocols.” In Financial Cryptography and Data Security. FC 2021 International Workshops: CoDecFin, DeFi, VOTING, and WTSC, Virtual Event, March 5, 2021, Revised Selected Papers 25 149–161 (2021) https://doi.org/10.1007/ 978-3-662-63958-0_1.
Van der Maaten, L., Hinton, G. “Visualizing Data Using t-SNE.” Journal of Machine Learning Research 9.86 2579–2605 (2008) http://jmlr.org/papers/v9/vandermaaten08a.html.
von Wachter, V., Jensen, J. R., Ross, O. “Measuring Asset Composability as a Proxy for DeFi Integration.” In Financial Cryptography and Data Security. FC 2021 International Workshops: CoDecFin, DeFi, VOTING, and WTSC, Virtual Event, March 5, 2021, Revised Selected Papers 25 109–114 (2021) https://doi.org/ 10.1007/978-3-662-63958-0_9.
Weber, M., et al. “Anti-Money Laundering in Bitcoin: Experimenting with Graph Convolutional Networks for Financial Forensics.” arXiv (2019) (Accessed 24 Janaury 2025) https://doi.org/10.48550/arXiv. 1908.02591.
Werner, S., Perez, D., Gudgeon, L., Klages-Mundt, A., Harz, D., Knottenbelt, W. “SoK: Decentralized Finance (DeFi).” In AFT ’22: Proceedings of the 4th ACM Conference on Advances in Financial Technologies 30–46 (2022) https://doi.org/10.1145/3558535.3559780.
Xiong, X., Wang, Z., Chen, X., Knottenbelt, W., Huth, M. “Leverage Staking with Liquid Staking Derivatives (LSDs): Opportunities and Risks.” Cryptology ePrint Archive Paper 2023/1842 (Accessed 25 January 2025) https://eprint.iacr.org/2023/1842.
Xu, J., Paruch, K., Cousaert, S., Feng, Y. “SoK: Decentralized Exchanges (DEX) with Automated Mar- ket Maker (AMM) Protocols.” ACM Computing Surveys 55.11 1–50 (2023) https://doi.org/10.1145/ 3570639.
Xu, J., Vadgama, N. “From Banks to DeFi: the Evolution of the Lending Market.” In N. Vadgama, J. Xu, P. Tasca (Eds.), Enabling the Internet of Value: How Blockchain Connects Global Businesses Cham: Springer 53–66 (2022) https://doi.org/10.1007/978-3-030-78184-2_6.
Additional Files
Published
How to Cite
Issue
Section
License
Copyright (c) 2025 Junliang Luo, Stefan Kitzler, Pietro Saggese

This work is licensed under a Creative Commons Attribution 4.0 International License.
Authors who publish with this journal agree to the following terms:
- The Author retains copyright in the Work, where the term “Work” shall include all digital objects that may result in subsequent electronic publication or distribution.
- Upon acceptance of the Work, the author shall grant to the Publisher the right of first publication of the Work.
- The Author shall grant to the Publisher and its agents the nonexclusive perpetual right and license to publish, archive, and make accessible the Work in whole or in part in all forms of media now or hereafter known under a Creative Commons Attribution 4.0 International License or its equivalent, which, for the avoidance of doubt, allows others to copy, distribute, and transmit the Work under the following conditions:
- Attribution—other users must attribute the Work in the manner specified by the author as indicated on the journal Web site;
- The Author is able to enter into separate, additional contractual arrangements for the nonexclusive distribution of the journal's published version of the Work (e.g., post it to an institutional repository or publish it in a book), as long as there is provided in the document an acknowledgement of its initial publication in this journal.
- Authors are permitted and encouraged to post online a prepublication manuscript (but not the Publisher’s final formatted PDF version of the Work) in institutional repositories or on their Websites prior to and during the submission process, as it can lead to productive exchanges, as well as earlier and greater citation of published work. Any such posting made before acceptance and publication of the Work shall be updated upon publication to include a reference to the Publisher-assigned DOI (Digital Object Identifier) and a link to the online abstract for the final published Work in the Journal.
- Upon Publisher’s request, the Author agrees to furnish promptly to Publisher, at the Author’s own expense, written evidence of the permissions, licenses, and consents for use of third-party material included within the Work, except as determined by Publisher to be covered by the principles of Fair Use.
- The Author represents and warrants that:
- the Work is the Author’s original work;
- the Author has not transferred, and will not transfer, exclusive rights in the Work to any third party;
- the Work is not pending review or under consideration by another publisher;
- the Work has not previously been published;
- the Work contains no misrepresentation or infringement of the Work or property of other authors or third parties; and
- the Work contains no libel, invasion of privacy, or other unlawful matter.
- The Author agrees to indemnify and hold Publisher harmless from Author’s breach of the representations and warranties contained in Paragraph 6 above, as well as any claim or proceeding relating to Publisher’s use and publication of any content contained in the Work, including third-party content.
- The Author agrees to digitally sign the Publisher’s final formatted PDF version of the Work.
Revised 7/16/2018. Revision Description: Removed outdated link.