Work with Elastic Subgraphs
Overview
Elastic Subgraphs is the Chainstack suite of tools that provides access to real-time and historical data from DeFi protocols. This data is crucial for monitoring and analyzing DeFi activities and making informed decisions within the DeFi space.
DeFi protocols enable various financial services such as lending, borrowing, trading, and yield farming. Via Chainstack Elastic Subgraphs, you can access such protocols as Uniswap, SushiSwap, Lido, Aave, OpenSea, and more.
Access to DeFi protocols is facilitated through a GraphQL API based on The Graph standard. Additionally, you can use the GraphQL visual interface to compose and execute GraphQL queries.
Basic Elastic Subgraphs workflow
When accessing Elastic Subgraphs for an exact protocol, you use a preset subgraph created specifically for that purpose. To use one of the protocols, you do the following:
- Using the left navigation menu, go to Elastic Subgraphs.
- From the list, open the protocol you are interested in querying.
- Copy either the protocol's Query URL or GraphQL UI URL. They are means that you will use to query the protocol.
To interact with the protocol, you can choose from either of the following Access options:
- Query URL — use this URL to query in the CLI or incorporate it into your code.
- GraphQL UI URL — use this URL to query in the GraphQL UI in your browser.
For examples of using both of these endpoints, see Query a subgraph.
Creating queries with GraphQL UI
Each of the protocols available in Elastic Subgraphs has a preset subgraph schema which you can use to create effective queries and use them within your DApps. To learn the schema of the protocol, do the following:
- Copy the GraphQL UI URL from the protocol details page and paste it into your browser.
- In the page opened, select Explorer.
- In the left pane that opened, explore the interactive schema and use it to create a custom query.
Updated 3 months ago