EVMNS DOCS
  • Introduction
  • FAQ
    • Common FAQ
    • Registration FAQ
    • Points FAQ
  • Users Guide
    • How to add EOS EVM network into wallet?
    • How to transfer EOS tokens across EOS and EOS-EVM networks?
    • How to withdraw EOS Token from Binance to EOSEVM network
    • Access EVMNS Mobile with MetaMask Wallet
    • Guide for whitelist holders to register a domain?
  • Multi-Chain
  • Key Features
  • DAPP DEVELOPER GUIDE
    • EVMNS Enabling your DApp
    • Working with EVMNS
    • Resloving Names
    • Managing Names
  • Additional Information
    • What is DID
    • Why DID is Needed
    • Development
    • Contact & Community
Powered by GitBook
On this page
  • Reverse Resolution
  • Transferring a Name
  • Updating Records
  • Updating the Address Record
  • Updating Other Records
  • Updating multiple records in one transaction
  • Configuring Reverse Resolution
  1. DAPP DEVELOPER GUIDE

Managing Names

Reverse Resolution

While 'regular' resolution involves mapping from a name to an address, reverse resolution maps from an address back to a name. EVMNS supports reverse resolution to allow applications to display EVMNS names in place of hexadecimal addresses.

Reverse resolution is accomplished via the special purpose domain addr.reverse and the resolver function name(). addr.reverse is owned by a special purpose registrar contract that allocates subdomains to the owner of the matching address - for instance, the address 0x314159265dd8dbb310642f98f50c066173c1259b may claim the name 314159265dd8dbb310642f98f50c066173c1259b.addr.reverse, and configure a resolver and records on it. The resolver in turn supports the name() function, which returns the name associated with that address.

EVMNS does not enforce the accuracy of reverse records - for instance, anyone may claim that the name for their address is '123.evm'. To be certain that the claim is accurate, you must always perform a forward resolution for the returned name and check it matches the original address.

Most libraries provide functionality for doing reverse resolution:

```javascript
import { getName, getLabelhash, getNameHash } from 'evmns.js'

const address = '0x...'
const name = await getName({address})
console.log('name: ' + name)

const labelhash = getLabelhash('123');
console.log('labelhash: ' + labelhash)

const namehash = getNameHash('123.evm');
console.log('namehash: ' + namehash)
....

Transferring a Name

In EVMNS, each name has a designated owner. This owner, whether it is an account or a contract, is granted the exclusive authority to modify the name within the EVMNS registry. The owner of a name has the capability to transfer ownership to any other account, enabling a smooth transition of control.

// safeTransferFrom
NameWrapper->safeTransferFrom(address from,address to,uint256 namehash,uint amount,bytes data)

Updating Records

To modify the resources associated with an address and the way it resolves, it is essential to update the records of that name in its respective resolver.

Each resolver may have its own mechanism for updating records, but a widely used standard method is implemented by the public resolver, along with many other resolvers. Several libraries offer built-in functionality to facilitate updating a resolver's records using this standardized interface.

Updating the Address Record

// setName
PublicSolver->setName(bytes32 hashname,string name)

Updating Other Records

Some libraries - presently only web3.js - support updating other record types, such as content hashes and text records, using the same pattern. For example, to set or update a text record:


// setAddr
PublicSolver->setAddr(bytes32 namehash,uint256 coinType,bytes address)

// setContenthash
PublicSolver->setContenthash(bytes32 namehash,bytes hash)

// setText
PublicSolver->setText(bytes32 namehash,string key,string value)

Updating multiple records in one transaction

Public Resolver has multicall that permits users to set multiple records in a single operation.

Configuring Reverse Resolution

While 'regular' resolution involves mapping from a name to an address, reverse resolution maps from an address back to a name - or other metadata. EVMNS supports reverse resolution to allow applications to display EVMNS names in place of hexadecimal addresses.

Before this can be done, the owner of the address has to configure reverse resolution for their address. This is done by calling the claim() method on the reverse resolver, found at the special name 'addr.reverse'.

PreviousResloving NamesNextWhat is DID

Last updated 1 year ago

Most commonly this is accomplished via a user-interface such as the .

EVMNS DApp