View Categories

Lookup crypto address

2 min read

web3yak/web3domain is a package that allows you to use the Web3 protocol to perform domain name lookups for cryptocurrency wallet addresses. The Web3 protocol is a set of specifications for building decentralized applications (dApps) on the Ethereum blockchain.

The package provides a set of functions that you can use to interact with the Ethereum blockchain and perform domain name lookups. It allows you to query the Ethereum blockchain for the wallet address associated with a specific domain name. This can be useful for checking the authenticity of a website or for finding the correct wallet address for a cryptocurrency transaction.

getAddress function

Here is an example of how you could use the package to lookup a wallet address for a domain name:

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.getAddress("jack.demo","ETH").then(x => {
  console.log("Wallet address of jack.demo is : " + x);
}).catch(console.error);

//Retrieves from the ENS domain
resolve.getAddress("brad.eth","ETH").then(x => {
  console.log("Wallet address of brad.eth is : " + x);
}).catch(console.error);

//Retrieves from the UnstoppableDomain
resolve.getAddress("brad.crypto","ETH").then(x => {
  console.log("Wallet address of brad.crypto is : " + x);
}).catch(console.error);

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

Wallet address of brad.crypto is : 0x8aaD44321A86b170879d7A244c1e8d360c99DdA8
Wallet address of jack.demo is : 0x8D714B10B719c65B878F2Ed1436A964E11fA3271
Wallet address of brad.eth is : 0x0C82A14EDCF37266889e531e58cA516c10C78f18