Skip to content

Latest commit

 

History

History
59 lines (46 loc) · 1.88 KB

README.md

File metadata and controls

59 lines (46 loc) · 1.88 KB

ENS reverse lookup as a service

ENS (Ethereum Name Service) domains are a way to connect a human-readable domain (such as kian.eth) to an address on the Ethereum blockchain (such as 0x5295b474F3A0bB39418456c96D6FCf13901A4aA1).

This repo contains a Cloudflare Worker script that will perform the reverse-lookup: that is, given an ethereum address, return the ENS domain.

examples

My address, which owns 2 ENS domains and has the reverse record set to 'kian.eth':

request: /ens/0x5295b474F3A0bB39418456c96D6FCf13901A4aA1

{
  "reverseRecord": "kian.eth",
  "domains": [
    "kian.eth",
    "бутерин.eth"
  ]
}

An address which owns 3 ENS but does not have a reverse record set:

request: /ens/0xd035a780deccf7808875c6a555937b7c44299f45

{
  "reverseRecord": null,
  "domains": [
    "whiskey.dcl.eth",
    "coins.dcl.eth",
    "don.dcl.eth"
  ]
}

You can bypass the graphql call by setting ?mode=fast in the request:

request: /ens/0x5295b474F3A0bB39418456c96D6FCf13901A4aA1?mode=fast

{
  "reverseRecord": "kian.eth",
}

developing

Setting your ethereum node

Don't forget to set your ethereum node in src/config.ts! Your node must be served from port 80 or 443- this is a limitation with Cloudflare, they don't seem to support reaching out to nonstandard ports.