Smart Contract Configuration Guide
This guide covers how to set Reverse Resolution records for 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).
Network | Contract address |
---|---|
Ethereum mainnet | 0x049aba7510f45BA5b64ea9E658E342F904DB358D |
Ethereum testnet (Goerli) | 0x070e83FCed225184E67c86302493ffFCDB953f71 |
Polygon mainnet | 0xa9a6A3626993D487d2Dbda3173cf58cA1a9D9e9f |
Polygon testnet (Mumbai) | 0x2a93C52E7B6E7054870758e15A1446E769EdfB93 |
Step 2: Open the “Write 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 Write as Proxy
tab.
Step 3: Connect Your Web3 Wallet
Click on the Connect to Web3
button in the Write as Proxy
tab and connect the wallet associated with the domain:
Step 4: Generate the Namehash of Your Domain
You can generate the namehash of your domain using any of the resolution libraries or CLI. You can also use online tools to calculate the namehash of the domain.
const {default: Resolution} = require('@unstoppabledomains/resolution');
const resolution = new Resolution();
let namehash = resolution.namehash("brad.crypto")
import com.unstoppabledomains.resolution.Resolution;
DomainResolution resolution = new Resolution();
String namehash = resolution.getNamehash("brad.crypto");
import UnstoppableDomainsResolution
guard let resolution = try? Resolution() else {
print ("Init of Resolution instance with default parameters failed...")
return
}
let namehash = try resolution.namehash(domain: "brad.crypto")
package main
import (
"fmt"
"github.com/unstoppabledomains/resolution-go"
)
func main() {
uns, _ := resolution.NewUnsBuilder().Build()
namehash, _ := uns.Namehash("brad.crypto")
fmt.Println("The namehash for brad.crypto is", namehash)
}
$ resolution namehash -d brad.crypto
"0x756e4e998dbffd803c21d23b06cd855cdc7a4b57706c95964a37e24b47c10fc9"
Step 5: Set the Reverse Record
The UNS contract has a setReverse()
ABI method that takes in the namehash of a domain and sets its reverse record to your wallet address.
Add the generated namehash of the domain you want to configure Reverse Resolution for in the tokenId
field of the setReverse()
method and click the Write
button.
Step 6: Execute the Contract
Click the Write
button to sign the transaction and execute the contract.
After signing the transaction, you can view its details on the blockchain explorer, like so:
Now, applications that have integrated Reverse Resolution will be able to show the reverse record for your domains instead of your wallet address.
Congratulations
You have successfully configured Reverse Resolution for your domain 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.