Name & Address Lookup
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 https://go.dev/learn/ 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 https://github.com/TxnLab/nfd-cli-examples for a simple CLI program that provides, name and reverse-address lookup, 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:
V1 LSIG Address used:PE6GCTZGVJRX6FHCUZUVB4DOLPMXD4MJFIYKB37R4YQACMI3ZWFR3FDXR4
This can be verified against the API, by using the nameSig REST API, a GET request to https://api.nf.domains/nfd/nameSig/nfdomains.algo 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 -addrRSV2YCHXA7MWGFTX3WYI7TVGAS5W5XH5M7ZQVXPPRQ7DNTNW36OW2TRR6I
Which will output (for mainnet which is still V1):
V1 LSIG Rev-Address used:GF36NDIOFS33TMC7IPHLOC2XYGI5SCD5YAIRVEGOC2JLSPNZRUZCQ7CHEI Found 1 NFDs linked as V1 address [...]
The reverse address verification API for the same: https://api.nf.domains/nfd/revAddressSig/RSV2YCHXA7MWGFTX3WYI7TVGAS5W5XH5M7ZQVXPPRQ7DNTNW36OW2TRR6I