Skip to main content

Running a Subgraph Query

Not everything that is on the blockchain is indexed by Etherscan. On the other hand, subgraph allows users to query any data that is on the Ethereum blockchain using specific queries.

First, visit the Stakehouse V2 Subgraph Playground.

To get data related to a KNOT, run the following query:

{
stakehouseAccounts(where: { id: "${id}", lifecycleStatus: 3, depositor: "${account}" }) {
id
totalDETHMintedFormatted
totalSLOTFormatted
totalCollateralizedSLOTInVaultFormatted
sETHMintedFormatted
sETHCollateralizedAtMintingFormatted
stakeHouseMetadata {
id
sETH
sETHExchangeRateFormatted
sETHTicker
}
}
}

Here’s a sample output corresponding to a KNOT:

{
"data": {
"stakehouseAccounts": [{
"id": "0xa97f0308ffffd1d253f35ef4d8309059b7d89fd530a9adce7e101d23ed15e519bcb0cd8bf0c6f9cc40eddd7966f7a6bb",
"totalDETHMintedFormatted": "24",
"totalSLOTFormatted": "8",
"totalCollateralizedSLOTInVaultFormatted": "4",
"sETHMintedFormatted": "12",
"sETHCollateralizedAtMintingFormatted": "12",
"stakeHouseMetadata": {
"id": "0x33b37b3b44f49ba4e0cfec3d0365937dceb0c4cb",
"sETH": "0xede4d410a4da6c3b8baa25ee8dfd912c6c59f052",
"sETHExchangeRateFormatted": "3",
"sETHTicker": "sBOOST"
}
}]
}
}

In case the terms in the query sound confusing, try reading the Querying The Graph docs.