How DeFi Applications can benefit using Subgraphs for data indexing?
Tags: subgraphs
Published: 2023-11-29 10:48:51

<p>On-chain data is what allows DeFi applications to operate their functionalities, maintain visibility, and remain competitive over time. But, obtaining specific data in a preferred format from the blockchain’s decentralized database is extremely complex. <a href="https://www.zeeve.io/subgraphs/">Subgraphs</a>– powered by the Graph protocol, makes data indexing and querying easy with features such as high-speed data indexing, high volume queries handling, and fastest queries through GraphQL. Hence, if you are building a DeFi application that requires all these benefits and seamless access to varied data from blockchain’s huge and complex datasets, then <a href="https://www.zeeve.io/subgraphs/">deploying your own Subgraph</a>/using a shared indexer could be an excellent choice.</p>
<p>This article delves deeper into the importance of <a href="https://www.zeeve.io/subgraphs/">Subgraph for data indexing</a> in DeFi applications in addition to analyzing a concise list of DeFi Subgraphs that are deployed and running on the Graph ecosystem.&nbsp;</p>
<figure class="wp-block-image aligncenter size-large"><a href="https://www.zeeve.io/subgraphs/"><img src="https://www.zeeve.io/wp-content/uploads/2023/11/DeFi-applications-can-use-subgraphs_banner-1024x131.png" alt="" class="wp-image-49112"/></a></figure>
<h2 id="h-briefing-the-subgraph-services">Briefing the Subgraph Services&nbsp;</h2>
<p><a href="https://www.zeeve.io/subgraphs/">Subgraphs</a>– the data indexing tool, works as a bridge between DeFi (or every other) applications and the <a href="https://www.zeeve.io/blockchain-protocols/">blockchain ecosystem</a>. All kinds of DeFi applications— be it a decentralized exchange, crypto investment platform, liquidity platform, lending and borrowing platform, yield farming apps, or Automated Market Makers (AMMs); these projects can build their own Subgraph to extract real-time and historical data via GraphQL calls. The extracted data serves the backed of dApps, driving their dApp-specific functionalities while offering the intended value to the end users.&nbsp;</p>

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qxowz3j926ud2es7hgmp.png)
<p>DeFi applications can use <a href="https://www.zeeve.io/subgraphs/">Subgraph’s hosted service</a> or the Graph’s decentralized network. The decentralized Graph network offers unique benefits such as 60-98% lower monthly cost, Superior uptime, access to hundreds of independent Indexers, and 24/7 technical support by the global community. However, to reap all these benefits, it requires deployment of nodes, and specific infrastructure requirements.</p>
<p>Regarding Hosted Service, you do not need to stake $GRT tokens, run nodes, or manage <a href="https://www.zeeve.io/subgraphs/">Subgraph infrastructure</a> on your own. Instead, you just need to deploy your Subgraph on a low-code interface and make it available for data querying, but on a Graph-managed centralized infrastructure. Hosted Service also supports <a href="https://www.zeeve.io/subgraphs/">deployment of custom subgraphs</a> for query of very specific on-chain data. Want to learn about the end-to-end process of Subgraph deployment and management. Refer to our guide below:</p>
<p><a href="https://www.zeeve.io/blog/how-to-deploy-custom-subgraph-with-the-graph-protocol/"><strong>How to deploy custom Subgraph with The Graph Protocol?</strong></a></p>
<h2>Challenges of data indexing in DeFi applications&nbsp;</h2>
<p><strong>1. Infrastructure setup:</strong> DeFi applications looking to index and query <a href="https://www.zeeve.io/blog/blockchain-data-indexing-navigating-its-working-and-challenges/">blockchain data</a>, will need to invest significant time, effort, and resources in setting up complex infrastructure such as data servers, RPC nodes, clients, and delegate hardware infrastructure for handling SQL queries. This process is cost and resource-intensive, and meanwhile, it requires specialized skills to continuously maintain optimal performance of each component.</p>
<p><strong>2. Slow response to queries:</strong> Most of the Layer-1 blockchains and even prominent DeFi applications distribute their historical data across the events that are stored separately outside of the <a href="https://www.zeeve.io/blockchain-protocols/">blockchain</a> and its decentralized ledger. Retrieving these data via the traditional method of RPC will slow down the query process and the response time considerably. This problem will even increase when data needs to be queried frequently.</p>
<p><strong>3. Problem in customizing queries:</strong> <a href="https://www.zeeve.io/subgraphs/">Data indexing</a> and querying via current RPCs and APIs are ideal for serving generic queries (for example, top-k queries). Therefore, <a href="https://www.zeeve.io/blog/banking-the-unbanked-defi-promoting-financial-inclusion/">DeFi</a> applications may face a lot of challenges while customizing their queries for highly specific data retrieval.&nbsp;</p>
<p><strong>4. Inefficient data retrival:</strong> One of the big headache for DeFi applications is parsing data from massive resources. Talking about <a href="https://www.zeeve.io/blockchain-protocols/deploy-ethereum-blockchain/">Ethereum</a> alone, it records more than <a href="https://www.statista.com/statistics/730838/number-of-daily-cryptocurrency-transactions-by-type/">1 million daily transaction</a> as of August 2023. This amount is twice that of Bitcoin, which processes 55,000 daily transactions. Retrieving data from such huge resources is usually unsuitable and difficult.&nbsp;</p>
<h2>How Subgraphs can tackle the above data indexing challenges in DeFi apps</h2>
<p>Subgraphs on the Graph protocol can be based on Graph’s <a href="https://www.zeeve.io/platform/">decentralized network</a> or hosted service. Both these <a href="https://www.zeeve.io/subgraphs/">Subgraph</a> services can tackles the above data indexing challenges in DeFi applications:</p>
<p><strong>1. </strong><strong>Providing deployment-ready infrastructure:</strong> To <a href="https://www.zeeve.io/subgraphs/">deploy your Subgraph</a> to Graph’s decentralized network, you need specific infrastructure to run nodes, or manage the graph-CLIs, and other components. By choosing the Graph’s hosted service, it will provide you with a simple UI for seamless creation and <a href="https://www.zeeve.io/subgraphs/">deployment of Subgraph</a>. For this, you just need a Github account, with no need for infrastructure setup, RPC or Graph nodes, CLI, wallets, and more. However, the decentralized Graph network offers unique benefits that we will discuss later.<br></p>
<p><strong>2.</strong><strong> Blazingly fast response to queries: </strong>The Graph decentralized network is optimized to offer fastest queries through GraphQL API, allowing all types of DeFi applications to access on-chain data easily and instantly. Also, The Graph is optimized for best in-class performance and fast syncing speed, which further boosts the response time.<br></p>
<p><strong>3.</strong><strong> Customized queries with Custom Subgraphs:</strong><strong> </strong>Knowing that DeFi applications need very specific <a href="https://www.zeeve.io/blog/blockchain-data-indexing-navigating-its-working-and-challenges/">blockchain data</a>, such as the transaction history of a specific user, identity of investors, and precise smart contract events– The Graph facilitates the creation of <a href="https://www.zeeve.io/subgraphs/">custom subgraphs</a> that run highly customized queries back and forth.</p>
<p><strong>4.</strong><strong> 24/7 data flow with uptime</strong><strong>:</strong> With Subgraph deployed on the Graph protocol– whether hosted or <a href="https://www.zeeve.io/platform/">decentralized network</a>– , your DeFi applications will keep data flowing on its ecosystem 24/7. Regardless of the massive database or number of blockchains, Subgraphs will ensure efficient data retrieval for each query.&nbsp;</p>
<h2 id="h-list-of-10-defi-subgraphs-and-the-data-they-query-using-subgraph">List of 10 DeFi Subgraphs and the data they query using Subgraph?</h2>
<p>On the Graph protocol, numerous projects have deployed their <a href="https://www.zeeve.io/subgraphs/">Subgraph for data indexing</a> in DeFi applications. Let’s talk about ten prominent DeFi Subgraphs and the type of data they extract using their DeFi Sugraphs:</p>
<h3>1.Kunji Finance Subgraph</h3>
<p>Kunji– the innovative, non-custodial investment and asset management has recently deployed its Subgraph on Zeeve’s hosted service to extract specific data Kunji’s smart contracts and a range of DeFi platforms. With the <a href="https://www.zeeve.io/subgraphs/">Subgraph</a>, Kunji utilizes on-chain data related to investment and trading, such as portfolio value, invested amount, returns, deposits, withdrawals, strategy returns etc. The Subgraphs serves equally to the asset managers, allowing them to make investment decision making and report on money circulation across various DeFis.</p>
<h3>2. SushiSwap Subgraph</h3>
<p>Sushiswap has deployed a series of Subgraph on the Graph protocol, which includes SushiSwap Ethereum, Sushiswap Gnosis, SushiSwap, and simplefi-sushiswap. All these <a href="https://www.zeeve.io/subgraphs/">subgraphs</a> extract different set of data from Sushiswap’s <a href="https://www.zeeve.io/blog/how-to-deploy-a-smart-contract-with-brownie/">smart contracts</a> deployed on different chains. Web3 enterprises and projects building their dApp on Sushiswap can access all kinds of on-chain data easily due to the Subgraphs. These data can range from account balances, token transfers, information related to pool, transaction details/history, and much more. Subgraph simply indexes the raw data, cache it, and provides data based on the GraphQL queries.&nbsp;</p>
<h3>3. Curve Subgraph</h3>
<p>Curve is the next to deploy various subgraphs, such as CurveFi, Curve Finance, and Curve Factory pools. All these <a href="https://www.zeeve.io/subgraphs/">Subgraphs</a> offer a GraphQL endpoint for DeFi Dapps to query on-chain data like transaction history, liquidity pool balance, and TradeFi data. These extracted data are utilized to build high-quality <a href="https://www.zeeve.io/blog/banking-the-unbanked-defi-promoting-financial-inclusion/">DeFi </a>applications with advanced user behavior analytics and interactive Curve protocol-based features.&nbsp;</p>
<h3>4. Loopring Subgraph</h3>
<p>Loopring currently has two open-source DeFi Subgraphs– Loopring <a href="https://www.zeeve.io/appchains/polygon-zkrollups/">zkRollup</a> and Lexplorer. The first one is designed to index and on-chain data from all the Loopring’s zkRollups, providing real-time and historical data like accounts, balances, transactions, and more via GraphQL queries. Talking about the Lexplorer, it’s a block explorer that powers the Loopring protocol.</p>
<h3>5. Hop Protocol Subgraph</h3>
<p>&nbsp;Hop again, has deployed a range of DeFi Subgraphs on the Graph protocol, which includes HOPR on Gnosis, HOPR Channels, and HOPR Nodes Rotsee that enable DeFi projects and dApps to easily access and query data about smart contracts, nodes, and assets bridged across various Ethereum-based chains such as <a href="https://www.zeeve.io/blockchain-protocols/deploy-ethereum-blockchain/">Ethereum</a>, <a href="https://www.zeeve.io/blockchain-protocols/deploy-arbitrum-node/">Arbitrum</a>, <a href="https://www.zeeve.io/blockchain-protocols/deploy-optimism-node/">Optimism</a>, <a href="https://www.zeeve.io/blockchain-protocols/deploy-polygon-blockchain/">Polygon</a>, and xDAI.&nbsp;</p>
<h3>6. Uniswap Subgraph</h3>
<p>Uniswap manages a suite of DeFi subgraphs for indexing and querying on-chain data from different Uniswap <a href="https://www.zeeve.io/blog/smart-contract-standardization-a-necessity-for-the-large-scale-adoption-of-blockchain/">smart contracts</a>. Some of its Subgraphs include Uniswap V3 Celo, Uniswap V3 Ethereum, and Uniswap V3 Arbitrum. Through <a href="https://www.zeeve.io/subgraphs/">Subgraphs</a>, dApps can query data like TVL- Total value locked, current liquidity of the pool, swap data, aggregated fee collections, etc. <a href="https://www.zeeve.io/blog/why-should-you-get-your-defi-smart-contract-audited/">DeFi</a> projects building on the top of Uniswap can leverage all of these Subgraphs published in the Graph Explorer.&nbsp;</p>
<h3>7. Aave Subgraph</h3>
<p>Aave maintains 10+ <a href="https://www.zeeve.io/subgraphs/">Subgraphs</a> on the Graph protocol that query the indexed data from various Aave <a href="https://www.zeeve.io/blog/the-powerful-role-of-composability-of-smart-contracts-in-defi/">smart contracts</a> via the GraphQL endpoint. Leveraging the Aave Subgraphs, DeFi projects can track data related to deposits, borrows, collateral ratios, and a lot more. All these insights support the development of data-rich DeFi apps that analyze and use both individual and market-level activities.&nbsp;</p>
<h3>8. Airswap Subgraph</h3>
<p>Airswap Subgraphs allow DeFi projects to query and access valuable on-chain data out of AirSwap smart contracts, such as swap amount, tokens, transaction volume, user balances, and more. With access to these details, <a href="https://www.zeeve.io/blog/banking-the-unbanked-defi-promoting-financial-inclusion/">DeFi</a> applications can include custom analytics and trading tools that enhance their overall experience with the AirSwap DEX ecosystem.&nbsp;</p>
<h3>9. Synthetix Subgraph</h3>
<p>Synthethix Subgraph includes a GraphQL API endpoint to query the indexed on-chain data from Synthetix smart contracts. The data can vary from exchange rates, price feeds, and volumes per Synths to TVL. DeFi applications can utilize all these data to build innovative applications on top of the Synthethix protocol.</p>
<h3>10. Convex Subgraph</h3>
<p>&nbsp;Convex hosts a suite of <a href="https://www.zeeve.io/subgraphs/">Subgraphs</a> on the Graph protocol, allowing decentralized finance projects to index and access a complete range of historical and other relevant on-chain data, such as tracking total revenue and yield on the Convex Finance platform.&nbsp;</p>
<h2>Deploy and manage your DeFi Subgraph easily with Zeeve’s Hosted Service</h2>
<p>As discussed, there are tremendous benefits to using <a href="https://www.zeeve.io/subgraphs/">Subgraph for data indexing</a> in Defi applications. However, you are using Hosted Service; note that it is gradually sunsetting, and projects are being encouraged to move to Graph’s decentralized network. For all the projects that still want to leverage hosted service– <a href="https://www.zeeve.io/">Zeeve</a> can help.</p>

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/grpk8660cmxsuc9vzuh9.png)
<p>Zeeve’s hosted service enables deployment for the protocols that are not yet available on the Graph. Basically, you have three options- to opt for shared indexers where a single Graph node will manage multiple <a href="https://www.zeeve.io/subgraphs/">Subgraphs</a> for different projects. Secondly, you can have a dedicated indexer where a single node will be dedicated to a single Subgraph (this is suitable for projects with huge data indexing needs). Lastly, you build fully <a href="https://www.zeeve.io/subgraphs/">custom Subgraphs</a> with Zeeve’s advanced stack and expert assistance. The indexers, nodes, and every other component will be deployed and maintained by <a href="https://www.zeeve.io/">Zeeve</a>.&nbsp;</p>
<p>With Zeeve, you do not need to manage Graph nodes or stake GRT tokens. Everything will be managed on Zeeve’s end, and you can simply make pay the indexers in any fiat currency. This approach will decrease the cost of maintaining Subgraph significantly while you can get benefits like 99.9% API SLA, upto 5x speeder data indexing and 2x lower data lag. Plus, <a href="https://www.zeeve.io/">Zeeve</a> will monitor all your <a href="https://www.zeeve.io/subgraphs/">Subgraphs</a> constantly on critical parameters, eliminating further chance of downtime or performance-related issues.&nbsp;</p>
<p>For more information on how <a href="https://www.zeeve.io/subgraphs/">Zeeve’s hosted Subgraph</a> brings value to your project, connect with our experts. We are happy to assist you. You can drop your queries via email on this page or you can also <a href="https://www.zeeve.io/talk-to-an-expert/">schedule one-to-one call with our web3 consultants</a>.&nbsp;</p>