Skip to content

royalfork/catchall-resolver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🅴🅽🆂 Catchall Resolver

CatchallResolver is an ENSIP-10 "Wildcard" resolver which proxies all subdomain resolution requests to the parent resolver. For instance, if royalfork.eth has set a "text/email" record to ens@royalfork.org, with the CatchallResolver, sub.royalfork.eth, another.royalfork.eth, and double.sub.royalfork.eth will also have text/email records set to ens@royalfork.org. The CatchallResolver works for all ENSIP defined resolver methods (addr, text, contenthash, etc).

CatchallResolver is deployed on mainnet at: 0xca7c4a117baef1b7a122d55ede7216ba6631ac3e

Use

Like the ENS public resolver, a single deployment of CatchallResolver can be used by many ENS domains. If you'd like to use CatchallResolver for your domain (such that *.yourdomain.eth resolves to yourdomain.eth):

  1. Call the CatchallResolver's setResolver(node, resolver) method with:
    • node = Namehash of your domain (eg: namehash(yourdomain.eth))
    • resolver = Address to the "catchall" resolver to which resolution requests are sent (eg: the PublicResolver contract at 0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41)
  2. Set your domain's ENS resolver to "Catchall Resolver"
    • Call the ENS Registry's setResolver(node, resolver) with resolver address: 0xca7c4a117baef1b7a122d55ede7216ba6631ac3e

Example

The Namehash of royalfork.eth is f47a153bb881860e9a4390b84b063154e9623c32a1611c73aef2038a134d8eba, and resolver is 0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41.

  1. On 0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41, validate that resolver does indeed service your node. Screen Shot 2022-05-01 at 7 47 00 PM

  2. On 0xca7c4a117baef1b7a122d55ede7216ba6631ac3e, set the parent resolver for domain: Screen Shot 2022-05-01 at 8 50 10 PM

  3. On 0xca7c4a117baef1b7a122d55ede7216ba6631ac3e, ensure that resolution is working: Screen Shot 2022-05-01 at 9 02 38 PM

  4. On 0x00000000000c2e074ec69a0dfb2997ba6c7d2e1e, set resolver to CatchallResolver: Screen Shot 2022-05-01 at 8 53 33 PM

  5. Using ethers.js, test that everything works as expected:

    const { ethers } = require("ethers");
    const provider = new ethers.providers.JsonRpcProvider("https://mainnet.infura.io/v3/3761559e11414fd8afa394df10d77d00");
    
    (async () => {
      for (const name of [
        'royalfork.eth',
        'sub.royalfork.eth',
        'a.b.c.royalfork.eth'
      ]){
        console.log(`${name}`);
        let resolver = await provider.getResolver(name);
        let resolveName = await provider.resolveName(name);
        if (resolver) {
          console.log(`resolver address ${resolver.address}`);
          console.log(`eth address ${resolveName}`);
        } else {
          console.log(`resolver not found for ${name}`);
        }
        console.log(`-----`);
      }
    })();
    

    Ouputs:

    royalfork.eth
    resolver address 0xca7C4a117bAef1B7A122D55Ede7216Ba6631AC3E
    eth address 0xb82875007A206D52222887B8Bc21ed309357f878
    -----
    sub.royalfork.eth
    resolver address 0xca7C4a117bAef1B7A122D55Ede7216Ba6631AC3E
    eth address 0xb82875007A206D52222887B8Bc21ed309357f878
    -----
    a.b.c.royalfork.eth
    resolver address 0xca7C4a117bAef1B7A122D55Ede7216Ba6631AC3E
    eth address 0xb82875007A206D52222887B8Bc21ed309357f878
    -----
    

😀

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors