Skip to content

ENS Unigraph SQL

The ENS Unigraph combines every ENSv1 “Nametree” (the mainnet ENS Registry, Basenames on Base, Lineanames on Linea, 3DNS on Optimism, and more) and the ENSv2 “Namegraph” into a single unified data model — indexed into ENSDb, a standard PostgreSQL database.

ENS Unigraph SQL is direct, read-only SQL access to that data. The ENS Omnigraph API is built on top of the Unigraph; Unigraph SQL is the layer beneath it, for use cases that go past what the Omnigraph exposes — custom analytics, data pipelines, dashboards, or building your own service. Because it’s just Postgres, you can query it from any language with a Postgres driver — TypeScript, Python, Rust, Go, and more.

The Unigraph models both protocol versions with the same polymorphic entities, so the shape of your query rarely changes between an ENSv1 and an ENSv2 name:

  • Domain — any name, on either protocol version. A type discriminator (ENSv1Domain / ENSv2Domain) tells you which, but the columns you read are shared.
  • Registry — the contracts that hold subnames. ENSv1 and ENSv2 both follow the same Registry → Domain → (sub)Registry → Domain → … namegraph shape.
  • Account — an address; owners, registrants, and permission holders all point here.
  • Registration & Renewal — the lifecycle of a name, polymorphic across registration types (.eth BaseRegistrar, NameWrapper, 3DNS, and ENSv2 Registry registrations).
  • Resolver records — indexed resolver state (addresses, text records, content hashes).
  • Label — the labelHash → label mapping that heals hashed labels into human-readable names.
  • Permissions — the ENSv2 roles model for who can do what in a specific contract.

The Canonical Nametree is the set of all Domains that have an inferrable Canonical Name — materialized from the namegraph. For every Domain in it, the canonical fields are populated — canonical_name, canonical_path, canonical_node, and canonical_depth — across both ENSv1 and ENSv2. That means you can look a name up by canonical_name = 'vitalik.eth', order by canonical_depth, or walk a name’s path without branching on protocol version and without traversing the namegraph yourself.

Multichain coverage is part of the same model: Basenames (.base.eth), Lineanames (.linea.eth), and 3DNS names (.box) are materialized into the same Unigraph as mainnet .eth, so a single query spans every indexable name.