1

Using the https://ens.domains/ is there a way to query the ENS name service using an API endpoint and get a JSON response? I want to be able to integrate these eth addresses into my application.

1

Cindercloud has a rest-endpoint which is specifically designed for this.

Documentation on this endpoint can be found here.

6
  • that requires signing up for that service. etherscan.io/enslookup -- etherscan has a free lookup tool, but i'm not sure how to output the json api Jun 10 '19 at 16:19
  • Instead of using the rapidapi endpoint, you can also use api.cinder.cloud. It's rate limited, but free.
    – Qkyrie
    Jun 11 '19 at 8:19
  • Looks like you own that api restpoint, hence the bias. thanks anyways. I want to just do a simple call to retrieve what a .eth domain resolves to. why is it so difficult to do? Jun 11 '19 at 14:45
  • I do indeed. It's not that difficult, it's just calling the ENSResolver contract on chain with the correct data, but you asked for an API endpoint which returns a json result and I happen to have something like that, which is why I proposed it as a solution :)
    – Qkyrie
    Jun 12 '19 at 14:13
  • Do I need to install any other js libraries or sign up for some token key id? Jun 12 '19 at 15:24
0

Old question, but this was the first result on Google. Since 2019, Cloudflare now hosts a free Ethereum web resolver. You can read more here: https://blog.cloudflare.com/cloudflare-distributed-web-resolver/

The ethers.js project is a fantastic, easy to use, web-ready Ethereum client that supports many providers, one of which being a CloudflareProvider (https://docs.ethers.io/v5/api/providers/api-providers/#CloudflareProvider)

So resolving an ENS address to a wallet address is now as easy as:

  1. Install ethers.js, with yarn for example:
yarn add ethers

  1. Import the module:
import { ethers } from 'ethers'
  1. Resolve:
const provider = new ethers.providers.CloudflareProvider()
const address = await provider.resolveName('mydomain.eth')

Happy coding :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.