Latest ENS Registrations
Performing SQL queries on the ENS Unigraph requires that you have the unigraph plugin activated in your ENSNode instance. Learn more
Fetch the latest registrations and their associated Domains. See Connect for setup.
It is the name of an ENSDb Writer Schema, which is a database schema within an ENSDb instance, used to store indexed ENS data from a given ENSDb Writer instance. We use ensindexer_0 as the ENSDb Writer Schema Name in examples on this page, but your ENSDb Writer instance may be configured to use a different schema name. Make sure to replace
ensindexer_0 with the actual schema name used by your ENSDb Writer instance
when querying the ENSDb instance directly. For example, ENSIndexer allows configuring its own ENSDb Writer Schema Name with the ENSINDEXER_SCHEMA_NAME environment variable.
SELECT d.canonical_name, r.start, r.expiry, r.grace_period, r.base, r.premium, r.type as registration_type, d.owner_id, d.id as domain_idFROM "ensindexer_0".registrations rJOIN "ensindexer_0".latest_registration_index lri ON r.domain_id = lri.domain_id AND r.registration_index = lri.registration_indexJOIN "ensindexer_0".domains d ON r.domain_id = d.idWHERE r.start <= EXTRACT(EPOCH FROM NOW()) AND d.canonical = true AND r.type <> 'NameWrapper'ORDER BY r.start DESCLIMIT 5;| # | canonical_name | start | expiry | grace_period | base | premium | registration_type | owner_id | domain_id |
|---|---|---|---|---|---|---|---|---|---|
| 1 | [67f53c740a0051f85075dc2383fb83a7b48d2984fc9ed9db56b334ca96d1d309].eth | 1779816216 | 1811352216 | 7776000 | 3125000000003490 | 0 | BaseRegistrar | 0x205d2686da3bf33f64c17f21462c51b5ead462cf | |
| 2 | coolorg.eth | 1779794160 | 1811330160 | 7776000 | 3125000000003490 | 0 | BaseRegistrar | 0x5f71c6074141d41d0e769689dc9830388a5c7e3e | |
| 3 | [1d79e56219bd305bbd3fa8ab125997beceebe63b8f6e12d0b6cb956e955549ca].eth | 1779785856 | 1906016256 | 7776000 | 12508561643849586 | 0 | BaseRegistrar | 0x07a811c0bd3f46733822df66d7e2d723e6f73fd6 | |
| 4 | kevin-af.eth | 1779768924 | 1874463324 | 7776000 | 9383561643846096 | 0 | BaseRegistrar | 0x6a89280251f72918b6b143817201008b3d99d96e | |
| 5 | executor1.eth | 1779743592 | 1937509992 | 7776000 | 15633561643853076 | 0 | BaseRegistrar | 0xbb0274908a353d7c37a97ea1ea099352ee39734e | |
Output matches a result snapshot; live output depends on your ENSNode instance.
ensDb query builder and ensIndexerSchema
schema definition in the Connect example if you haven't already.
import { and, desc, eq, ne, lte, sql } from "drizzle-orm";
const limit = 5;
const recentRegistrations = await ensDb .select({ canonicalName: ensIndexerSchema.domain.canonicalName, expiry: ensIndexerSchema.registration.expiry, start: ensIndexerSchema.registration.start, registrationType: ensIndexerSchema.registration.type, ownerId: ensIndexerSchema.domain.ownerId, domainId: ensIndexerSchema.domain.id, }) .from(ensIndexerSchema.registration) .innerJoin( ensIndexerSchema.latestRegistrationIndex, and( eq( ensIndexerSchema.registration.domainId, ensIndexerSchema.latestRegistrationIndex.domainId, ), eq( ensIndexerSchema.registration.registrationIndex, ensIndexerSchema.latestRegistrationIndex.registrationIndex, ), ), ) .innerJoin( ensIndexerSchema.domain, eq(ensIndexerSchema.registration.domainId, ensIndexerSchema.domain.id), ) .where( and( lte(ensIndexerSchema.registration.start, sql`EXTRACT(EPOCH FROM NOW())`), eq(ensIndexerSchema.domain.canonical, true), ne(ensIndexerSchema.registration.type, "NameWrapper"), ), ) .orderBy(desc(ensIndexerSchema.registration.start)) .limit(limit);
console.log(recentRegistrations);| # | canonicalName | expiry | start | registrationType | ownerId | domainId |
|---|---|---|---|---|---|---|
| 1 | [67f53c740a0051f85075dc2383fb83a7b48d2984fc9ed9db56b334ca96d1d309].eth | 1811352216 | 1779816216 | BaseRegistrar | 0x205d2686da3bf33f64c17f21462c51b5ead462cf | |
| 2 | coolorg.eth | 1811330160 | 1779794160 | BaseRegistrar | 0x5f71c6074141d41d0e769689dc9830388a5c7e3e | |
| 3 | [1d79e56219bd305bbd3fa8ab125997beceebe63b8f6e12d0b6cb956e955549ca].eth | 1906016256 | 1779785856 | BaseRegistrar | 0x07a811c0bd3f46733822df66d7e2d723e6f73fd6 | |
| 4 | kevin-af.eth | 1874463324 | 1779768924 | BaseRegistrar | 0x6a89280251f72918b6b143817201008b3d99d96e | |
| 5 | executor1.eth | 1937509992 | 1779743592 | BaseRegistrar | 0xbb0274908a353d7c37a97ea1ea099352ee39734e | |
Output matches a result snapshot; live output depends on your ENSNode instance.