Deciding whether an ENS profile may display an NFT avatar

An avatar record still points to an ERC-721 token that changed hands yesterday. Its image server works and the token exists, but that no longer proves the profile may display it as an owned NFT.

Identify the address that must own the token

For forward resolution, obtain the address record for the same ENS name. For resolution starting from an address, follow the reverse-resolution checks and use that address. Query the specified ERC-721 contract on the chain named in the avatar URI and compare ownerOf(tokenId) with the expected address. The two addresses in the fixture differ, so the image lookup stops.

const resolved = "0x" + "11".repeat(20);
const nftOwner = "0x" + "22".repeat(20);
console.log(resolved === nftOwner ? "load token metadata" : "omit NFT avatar");

Invalidate ownership separately from image caching

A cached tokenURI or downloaded image can outlive a transfer. Recheck ownership before displaying the NFT as an ENS avatar and apply the appropriate balance test for ERC-1155. A transfer can invalidate one profile’s avatar without changing any ENS record or image bytes. Keep the token chain, contract and ID in the cache key so similarly numbered tokens cannot share an ownership result.

docs.ens.domains ENSIP-12 avatar records