Subgraphs provide an easy and intuitive way for Web3 developers to filter and query data from archive nodes. When you deploy a subgraph and set up the query criteria, successful hits are indexed and stored in a PostgreSQL database. A GraphQL endpoint is created, allowing you to access the most recent subgraph data, synchronized to the latest block.
This document provides an introduction to subgraphs and walks you through the process of adding, creating, and deploying a subgraph, as well as querying subgraph data.
Set up a subgraph:
To set up a subgraph, follow these steps:
- Add a subgraph
- Create and configure a subgraph
- Deploy a subgraph
Add a subgraph:
In the subgraphs section, you can view a list of all existing subgraphs and filter the view using the Protocol drop-down list. You can create a new subgraph by clicking the "Add Subgraph" button, and view the details of an existing subgraph by clicking on its name.
Subgraphs must be associated with a project. If you do not have a project to add the subgraph to, see "Create a Project".
To add a subgraph, follow these steps:
- Click the "Add Subgraph" button. The "Add Subgraph" page is displayed.
- In the "Choose Network" section, choose the Blockchain protocol, Network (currently Mainnet is supported), and type.
- Click "Next". The "Create Subgraph" section is displayed.
- In the "Create Subgraph" section, enter a name for the subgraph, select the project you want to assign the subgraph to, and click "Add Subgraph".
- The details page of the new subgraph is displayed. It includes information such as the owner, creation date, region, and protocol. You can view metrics about the requests made in the subgraph, the subgraph query URLs, and the subgraph deployment command required to deploy the subgraph.
That's it! You have now added a subgraph and can move on to creating and configuring the subgraph to suit your needs, for more information visit: https://docs.chainstack.com/subgraphs#set-up-a-subgraph