Subgraph
This is a page covering the graph's ENS subgraph. The ENS subgraph indexes on-chain events of second-level .eth names, and DNS imported names. It allows us to build a reasonable approximation of the ENS names an address owns. To read more about why not all names (such as Offchain & Gasless Names) show up in the subgraph read the listing names page.
The Graph is a protocol for indexing and querying data from blockchains. There are multiple subgraphs that you can use to query information about ENS names. These subgraphs are available for mainnet, sepolia and holesky.
Developers are welcome to use our rate limited API endpoints above for testing, but it is highly encouraged to sign up for a free account with TheGraph to get your own API key.
The schema for the ENS subgraph is defined in /schema.graphql.
There are certain use cases where the graph is better for querying ENS specific information than through the resolution process. One of such use-cases is querying which NFT names are owned by a specific address.
One can explore the following examples interactively via the Graph Explorer Playground
Ensure the address is lowercase
query getDomainsForAccount {
domains(where: { owner: "0xa508c16666c5b8981fa46eb32784fccc01942a71" }) {
name
}
}
query getDomainForAccount {
account(id: "0xa508c16666c5b8981fa46eb32784fccc01942a71") {
registrations(first: 1, orderBy: expiryDate, orderDirection: desc) {
domain {
name
}
}
id
}
}
returns
{
"data": {
"account": {
"registrations": [
{
"domain": {
"name": "datanexus.eth"
}
}
],
"id": "0xa508c16666c5b8981fa46eb32784fccc01942a71"
}
}
}
query getSubDomains($Account: String = "messari.eth") {
domains(where: { name: "messari.eth" }) {
name
id
subdomains(first: 10) {
name
}
subdomainCount
}
}
returns
{
"data": {
"domains": [
{
"name": "messari.eth",
"id": "0x498ada62251a1227664ace8d97b0de2dcc6652ddf61e6fb5d3150f43ccf599e6",
"subdomains": [
{
"name": "subgraphs.messari.eth"
},
{
"name": "bd.messari.eth"
}
],
"subdomainCount": 2
}
]
}
}
query getDomainExp($Account: String = "paulieb.eth") {
registrations(
where: { domain_: { name: $Account } }
first: 1
orderBy: expiryDate
orderDirection: desc
) {
expiryDate
}
}
returns
{
"data": {
"registrations": [
{
"expiryDate": "1714752524"
}
]
}
}