"Catchall" ENSIP-10 Wildcard Resolver

Thought it would be cool to use the ENSIP-10 spec to build a “catchall” resolver for any ENS domain. Basically, every subdomain “inherits” all the resolution records set by a parent domain (so *.royalfork.eth resolves like royalfork.eth). Anyone can set up a “catchall” resolver for their domain by calling catchall-resolver.setResolver(), and ENS.setResolver(catchall-resolver) and this will work for their domain. Not sure if this has any practical use, but I think it’s interesting nonetheless.

Contract is here: 0xca7c4a117baef1b7a122d55ede7216ba6631ac3e
Code is here: GitHub - royalfork/catchall-resolver

How it works:

  • Domain owner calls setResolver(node, resolver) which sets node and resolver in a map
  • The ENSIP10 resolve() function searches through a subdomain’s parent domains for an applicable resolver in the above map (borrowed from @nick’s very clever recursive findResolver() implementation)
  • resolve() replaces the node argument in data with the parent’s nodehash (replacement of bytes 4-36).

Pretty simple. If you want to check it out:

nodehash("royalfork.eth") = f47a153bb881860e9a4390b84b063154e9623c32a1611c73aef2038a134d8eba
dnsencode("sub.royalfork.eth") = 0373756209726f79616c666f726b0365746800
nodehash("sub.royalfork.eth") = dda95c62a7c411a55b980f71d5f6ec8bd86b7fb4e7117bcbbbce72dfc1716310
abiencode(addr("sub.royalfork.eth")) = 3b3b57dedda95c62a7c411a55b980f71d5f6ec8bd86b7fb4e7117bcbbbce72dfc1716310

Also, I can no longer view my record details on https://app.ens.domains/name/royalfork.eth/details (should have addr and a few text records set). Did I accidentally break something?


I believe this is due to the presence of resolve. Makoto is working on a PR that should fix this.