View Categories

Lookup domain name

1 min read

The @web3yak/web3domain package can be used to look up the domain name associated with a specific crypto wallet address. The package allows you to perform reverse lookups, where you can input a wallet address and it will return the domain name associated with that address if it exists.

You can use the getDomain function to perform a reverse lookup and get the domain name associated with a specific wallet address.

var w3d = require("@web3yak/web3domain");

    const settings = {
      matic_rpc_url: "https://polygon-mainnet.g.alchemy.com/v2/..........",  //Get your own RPC free URL
      eth_rpc_url: "https://eth-mainnet.g.alchemy.com/v2/................" //Get your own RPC free URL
    };
    let resolve = new w3d.Web3Domain(settings);

    //Retrieves from the Web3Domain
resolve.getDomain("0x8D714B10B719c65B878F2Ed1436A964E11fA3271","W3D").then(x => {
    console.log("EVM address to Web3Domain Name : " + x);
  }).catch(console.error);
  
  //Retrieves from the ENS domain
  resolve.getDomain("0x0C82A14EDCF37266889e531e58cA516c10C78f18","ENS").then(x => {
    console.log("EVM Address to ENS Domain : " + x);
  }).catch(console.error);

This will return the domain name associated with the wallet address “0x1234567890abcdef” if it exists on the Ethereum blockchain.

The package allows to perform both forward and reverse lookups, forward being domain name to address and reverse being address to domain name.