Confirming a reverse ENS label before showing it in account history

A block explorer receives a name for an Ethereum address through reverse resolution. The address holder can set that text without controlling the forward record of the named domain.

Perform the round trip

Given the address, retrieve its candidate reverse name. Resolve that name’s forward Ethereum address record and compare the decoded 20 bytes with the address you started from. The fixture uses valid synthetic addresses and deliberately mismatches them. The resulting history row displays the original address.

const queried = "0x" + "11".repeat(20);
const candidate = "merchant.eth";
const forward = "0x" + "22".repeat(20);
console.log(forward.toLowerCase() === queried.toLowerCase() ? candidate : queried);

Separate display from transaction identity

Keep the address as the transaction key even when the round trip succeeds. For a historical label, query both directions at the same block context if archival resolution is available; otherwise label it as the present-day name. A timeout or missing forward record is enough to withhold the friendly label, without implying that the account itself is invalid.

eips.ethereum.org ERC-181 reverse resolution