Join the Rootstock Open Slack Community to get the latest updates from the Rootstock Ecosystem!

Reverse suite

Reverse RNS records are stored in the RNS hierarchy in the same fashion as regular records, under a reserved domain, addr.reverse.

Compatible with EIP-181.

addr_suite

Reverse resolving

To generate the RNS name for a given account's reverse records, convert the account to hexadecimal representation in lower-case, and append addr.reverse. For instance, the RNS registry's address at 0x112234455c3a32fd11230c42e7bccd4a84e02010 has any reverse records stored at 112234455c3a32fd11230c42e7bccd4a84e02010.addr.reverse.

function reverseResolve (address) {
  const reverseName = `${address.slice(2).toLowerCase}.addr.reverse`;
  const node = namehash(reverseName);
  const resolver = rns.resolver(node);
  const name = resolver.name(node);
  return name;
}

Ensure a reverse lookup

As the owner of the reverse-node is able to set any name as resolution after claiming, it is important to ensure the resulting `name` is used in the forward-resolution. To do so you might query the name's address resolution.

Register a reverse resolution

The owner of the addr.reverse domain is a registrar that permits the caller to take ownership of the reverse record for their own address.

function registerReverse (address, owner) {
  reverseRegistrar.claim(owner, { from: address });
}

Architecture

Receive updates

Get the latest updates from the Rootstock ecosystem

Loading...