tomi Domains
tomi Domains
tomi Domains
  • Introduction
    • Domains
      • Terminology
      • Frequently Asked Questions
      • Domains Deployments
      • Registrar Frequently Asked Questions
      • DNS Registrar guide
      • Domains Improvement Proposals
      • DomainsIP-2: Initial Hash Registrar
      • DomainsIP-3: Reverse Resolution
      • DomainsIP-4: Support for contract ABIs
      • DomainsIP-5: Text Records
      • DomainsIP-6: DNS-in-Domains
      • DomainsIP-7: Interface Discovery
      • DomainsIP-8: Multichain Address Resolution
      • DomainsIP-9: Wildcard Resolution
      • DomainsIP-10: EVM compatible Chain Address Resolution
      • DomainsIP-11: Avatar Text Records
      • DomainsIP-12: SAFE Authentication for Domains
      • DomainsIP-13: On-chain Source Parameter
      • Dapp Developer Guide
      • Managing Names
      • Registering & Renewing Names
      • Domains Front-End Design Guidelines
      • Domains AS NFT
      • Domains Layer2 and offchain data support
      • Domains Data guide
      • Name Processing
      • Registry
      • ReverseRegistrar
      • TestRegistrar
      • PublicResolver
      • .tomi Permanent Registrar
        • Registrar
        • Controller
      • DNS Registrar
      • Subgraph
        • Query Examples
      • Resolving Names On-chain
      • Writing a Resolver
      • Writing a Registrar
      • Guide for DApp Developers
      • Technical Description
Powered by GitBook
On this page
  1. Introduction
  2. Domains

Writing a Resolver

A resolver must implement the following method:

function supportsInterface(bytes4 interfaceID) constant returns (bool);

supportsInterface allows callers to determine if a resolver supports a particular record type. Record types are specified as a set of one or more methods that a resolver must implement together. Currently defined record types include:

Record type
Function(s)
Interface ID
Defined in

Ethereum address

addr

0x3b3b57de

Domains Name

name

0x691f3431

ABI specification

ABI

0x2203ab56

Public key

pubkey

0xc8690233

Text records

text

0x59d1d43c

Content hash

contenthash

0xbc1c58d1

supportsInterface must also return true for the interfaceID value 0x01ffc9a7, which is the interface ID of supportsInterface itself.

Additionally, the content interface was used as a de facto standard for Swarm hashes, and has an interface ID of 0xd8389dc5. New implementations should use contenthash instead.

Example Resolver

A simple resolver that supports only the addr type might look something like this:

contract SimpleResolver {
   function supportsInterface(bytes4 interfaceID) constant returns (bool) {
       return interfaceID == 0x3b3b57de;
   }
   function addr(bytes32 nodeID) constant returns (address) {
       return address(this);
   }
}

This trivial resolver always returns its own address as answer to all queries. Practical resolvers may use any mechanism they wish to determine what results to return, though they should be constant, and should minimise gas usage wherever possible.

PreviousResolving Names On-chainNextWriting a Registrar

Last updated 9 months ago

EIP137
EIP181
EIP205
EIP619
EIP634