Link Search Menu Expand Document

Developer Integration

Do you have some ideas for integrating Namesdao .xch Names into a project or application you’re building?

Your application can look up the details of a Namesdao .xch Name from our secondary resolver using a standard HTTP GET request:

sample file https://namesdaolookup.xchstorage.com/namesdao.json

sample sig https://namesdaolookup.xchstorage.com/namesdao.json.sig

You can confirm the authenticity of the .json file by checking the .sig file for our signature. Our PGP key is located in the Namesdao-cli project.

Our secondary name resolver now returns an extensive list of info on a .xch name, per the CHIP-9 recommended standard.

Here is an example of file content (re-formatted to look pretty):

{
  "address": "xch1jhye8dmkhree0zr8t09rlzm9cc82mhuqtp5tlmsj4kuqvs69s2wsl90su4",
  "uris": [
    "https://storage1.xchstorage.cyou/namesdao/namesdao-4295111.jpg",
    "https://storage2.xchstorage.cyou/namesdao/namesdao-4295111.jpg",
    "ipfs://bafybeicwruritcgxdgbfu4d66pi3kotsb3z3cn4dork5z2l5kpvzzzvrcu/namesdao-4295111.jpg"
  ],
  "meta_uris": [
    "https://storage1.xchstorage.cyou/namesdao/namesdao-4295111.json",
    "https://storage2.xchstorage.cyou/namesdao/namesdao-4295111.json",
    "ipfs://bafyreiffjaedvr7x2xb7toew7zeuuu7ewkvqs43f4fmeyq4pjltutav4yi/metadata.json"
  ],
  "nft_coin_id": "78a0dd81c626fa7a530ca2e6eca02805097c8aeb369d85d177ac92fdf5827985"
}

After receiving the URL, you can parse it into a JSON object, and directly pull the address value from there.

If you have a full node, you can also verify the information with your local node using the nft_coin_id.

Python sample code

Here is some sample Python code for the simplest form of resolving an address from our secondary resolver. Note that it requires that the requests package be installed (“pip install requests”).

import json
import requests

name = "Gratitude"
namesdao_name = name.lower()
r = requests.get("https://namesdaolookup.xchstorage.com/" + namesdao_name + ".json")
json_name_info = json.loads(r.content)

address = json_name_info['address']

You can also refer to CHIP-0009 and NDIP-0002 for additional details

Downloading the Namesdao .xch Name NFT collection

You can potentially download the Namesdao .xch Name NFT collection from an explorer such as Spacescan or MintGarden. Just create an account and request an API key, as applicable, on those sites.

This approach can be used to generate statistics, indexes or secondary name resolvers.

Here is an example URL from the Spacescan API to download one page of names

https://api2.spacescan.io/api/nft/collection/col1u9pemm2avjcz8t9emhga4vys5knugsfnctpkk2jyx05jc8d6ch2swe4qvm?coin=xch&version=1&page=20