Edit this page

Smart Contract Integration Guide

This guide covers how to retrieve the reverse record of UD domains using smart contracts. This process requires using the ABIs built into the Unstoppable Domains UNS smart contract.

Step 1: Select a UNS Registry Smart Contract

The UNS Registry contract is where domain owners store their data and is a map of domain namehashes to key-value dictionaries of records. Choose one of the Unstoppable Registry smart contracts to interact with (either mainnet or testnet).

Polygon testnet registry contract

polygon testnet registry contract

Step 2: Open the “Read as Proxy” Tab for the Registry Contract

Navigate to the Contract tab in either the Etherscan or Polygonscan page of the Registry contract and click on the Read as Proxy tab:

Polygonscan write as proxy tab

polygonscan write as proxy tab

Step 3: Retrieve the Reverse Record

The UNS contract has a reverseOf() method that takes in a wallet address and returns the namehash of the domain that has configured Reverse Resolution to that address.

Polygonscan reverseOf method

polygonscan reverseOf method

Add the wallet address you want to resolve in the addr field of the reverseOf() method and click the Query button.

Polygonscan reverseOf response

polygonscan reverseOf response

The reverseOf() method will return a value of 0 if there is no reverse record configured for the wallet address provided.

Step 4: Get the Domain Metadata

Send a GET request to the Unstoppable Domains metadata endpoint to retrieve the metadata of the domain associated with the namehash returned from the reverseOf() method call:


Step 5: Get the Domain Name From the Metadata

The metadata endpoint returns a JSON response in the following format:

  "name": string,
  "external_link": string,
  "image_url": string,
  "image_data": string,
  "properties": object,
  "attributes": [
  "background_color": string,
  "animation_url": string,
  "youtube_url": string,
  "description": string,
  "image": string,
  "external_url": string

The human-readable form of the domain associated with the token is stored in the name field of the API response.

Smart Contract Considerations

Integrating Reverse Resolution with smart contracts involves using the reverseOf() method to retrieve the namehash of the reverse record, then using the metadata API endpoint to get the human-readable version of the domain.

You can also integrate Reverse Resolution into your application using libraries that allow you to call smart contracts ABIs like ethers.js and web3.js. Here’s an application that integrates Reverse Resolution using ethers.js: https://github.com/Noxturnix/web3udmintfeed.nft.

An example in JavaScript of integrating Reverse Resolution (using the ethers.js library):

const proxyReaderAddress = "0xc3C2BAB5e3e52DBF311b2aAcEf2e40344f19494E";

// partial ABI, just for the reverseOf function.
const proxyReaderAbi = [
  "function reverseOf(address addr) external view returns (uint256)",

const proxyReaderContract = new ethers.Contract(

const address = "0x88bc9b6c56743a38223335fac05825d9355e9f83";

const reverseResolutionTokenId = await proxyReaderContract.reverseOf(address);
  .then(response => response.json())
  .then(data => console.log(data.name));

// jim-unstoppable.x

You have successfully integrated Reverse Resolution using smart contracts. Happy Hacking!

Asking For Help

Having troubles using our services? We’re here to help. Join our Discord Community for real-time support from UD and the community if you need assistance integrating your app.