NFD API
  • NFDomains API
  • Quick Start
  • Reference
    • On-Chain Reference
      • On-Chain Diagram V3+
        • On-Chain Diagram V2+
        • V1 On-Chain Diagram
      • Registry Application IDs
      • Contract methods
      • Name & Address Lookup
        • V1 Resolution example (go)
          • Example PyTeal name/ID validity check
      • NFDs owned by Address
      • Reading of NFD metadata
      • Properties
      • Contract Changelog
    • NFDomains REST API Reference
    • Integrators Guide
      • Using an NFD for sending assets to Algorand accounts
      • Using an NFD to sending to non-Algorand chains.
      • Resolving an Algorand address to an NFD name / avatar
      • Interactive NFD lookup
      • Discord / Telegram bots
      • Linking an Application to an NFD
      • Using Vaults (2.x+)
      • Expirations / MBR liquidation
    • API Changelog
    • Status Page
  • Community
Powered by GitBook
On this page
  1. Reference
  2. On-Chain Reference

Name & Address Lookup

PreviousContract methodsNextV1 Resolution example (go)

Last updated 8 months ago

The following Go code and example command-line application demonstrates how to efficiently resolve the smart-signature account address for a name, or an address on-chain.

See if you want a quick start with go. Other implementations will be provided, but this code should be fairly understandable and easily translated to other languages.

See for a simple CLI program that provides, name, reverse-address lookup (verified, linked addresses), 'owned by' lookup (3.4+), as well as decoding/displaying of all the metadata within an NFD.

This program supports looking up / reading V2+ NFDs as well as V1.

To lookup the smart-signature account address for nfdomains.algo, you could use the following example command-line application and run:

go run ./main.go -name nfdomains.algo

Which (for mainnet) will output:

Found as V2 name, ASA ID:763844429, APP ID:763844423 ...

This can be verified against the API, by using the nameSig REST API, a GET request to which should return the exact same address.

To be able to look up the NFD app ids for a particular address, run:

go run ./main.go -addr RSV2YCHXA7MWGFTX3WYI7TVGAS5W5XH5M7ZQVXPPRQ7DNTNW36OW2TRR6I

Which will output:

Found 1 NFDs linked as V2 address [...]

The reverse address verification API for the same:

To be able to look up the NFD app ids owned by a particular address, run:

go run ./main.go -addr RSV2YCHXA7MWGFTX3WYI7TVGAS5W5XH5M7ZQVXPPRQ7DNTNW36OW2TRR6I -owns

This will display all 3.x NFDs owned by a particular address. V1/V2 NFDs are not fetchable using this solution. The NFD API will need called instead (or you will need to index NFDs yourself).

https://go.dev/learn/
https://github.com/TxnLab/nfd-cli-examples
https://api.nf.domains/nfd/nameSig/nfdomains.algo
https://api.nf.domains/nfd/revAddressSig/RSV2YCHXA7MWGFTX3WYI7TVGAS5W5XH5M7ZQVXPPRQ7DNTNW36OW2TRR6I