Skip to content

ENSDb (PostgreSQL)

For use cases that go beyond what the ENS Omnigraph exposes — you can query the live onchain state of ENSv2 directly via SQL.

ENSDb is an open standard that stores the full ENSv2 state in a PostgreSQL database. Because it’s plain Postgres, you can use any language with a Postgres driver — TypeScript, Python, Rust, Go, and more.

  • You need full SQL power — joins, aggregations, window functions, CTEs.
  • You’re building custom services on top of ENS data.
  • You’re hitting the API limits of the public hosted instances and need unrestricted local access.

Example: fetch ENSv2 domains with the ENSDb SDK

Section titled “Example: fetch ENSv2 domains with the ENSDb SDK”
import { EnsDbReader } from "@ensnode/ensdb-sdk";
import { eq } from "drizzle-orm";
const ensDbReader = new EnsDbReader(ensDbConnectionString, ensIndexerSchemaName);
const { ensDb, ensIndexerSchema } = ensDbReader;
const v2Domains = await ensDb
.select()
.from(ensIndexerSchema.domain)
.where(eq(ensIndexerSchema.domain.type, "ENSv2Domain"));
SELECT * FROM ensindexer_mainnet.domains
WHERE type = 'ENSv2Domain'
LIMIT 10;