In this Notion document, we'll walk through the steps involved in querying, fetching, and displaying information about subgraphs that have significant activity—those with over 1 million queries in a day. This process involves querying The Graph's network subgraphs, retrieving subgraph names, and building a curation dashboard to display the results.
The steps below explain the entire process, including the necessary GraphQL queries and code implementation in page.tsx
.
The first step is to find subgraphs that have a high level of activity—specifically, those with over 1 million queries in the past day. These queries go into the queries.js
file.
<aside> 💡
Data is updated daily starting 8 PM EST. If no results, check back later.
</aside>
graphql
Copy code
const now = BigInt(Math.floor(Date.now() / 1000))
const past24 = now - BigInt(86400)
export const QUERY_SUBGRAPHS = `
query($past24: BigInt!) {
queryDailyDataPoints(
where: {
dayStart_gte: $past24,
query_count_gte: 1000000
},
orderBy: total_query_fees,
orderDirection: desc
) {
total_query_fees
query_count
subgraphDeployment {
id
}
}
}
`
id
of the subgraph deployment (which is an IPFS hash).query_count
and total_query_fees
.Example JSON Response:
json
Copy code
{
"data": {
"queryDailyDataPoints": [
{
"query_count": "96811667",
"subgraphDeployment": {
"id": "Qmc9sKbQk6wKMTDA9Wkw2E8w4C199gaYk6xmZei5ZeGKjH"
},
"total_query_fees": "8982.3888311147"
},
{
"query_count": "97793235",
"subgraphDeployment": {
"id": "Qmc9sKbQk6wKMTDA9Wkw2E8w4C199gaYk6xmZei5ZeGKjH"
},
"total_query_fees": "8890.9755680753"
}
]
}
}
Note: The subgraph IDs returned are IPFS hashes, which we will use in the next step to retrieve the corresponding subgraph names.
After fetching the subgraph IDs, we need to retrieve human-readable names and metadata for these subgraphs.