wealdtech / go-ens

Apache License 2.0
90 stars 33 forks source link

newly registered domain names does not resolve #5

Closed robdefeo closed 3 years ago

robdefeo commented 4 years ago

A newly registered domain name that was registered on 05-03-2020 on ENS does not reverse resolve.

Example

ens.ReverseResolve with robdefeo.eth resolves to 0x74dbac8dbca500185d4dc44679a451df1d9ef710 however 0x74dbac8dbca500185d4dc44679a451df1d9ef710 does not reverse resolve using v3.3.0

mcdee commented 4 years ago

It doesn't appear that this domain has a reverse resolver configured.

robdefeo commented 4 years ago

Do you know how I can do that? I also tried the code example with wealdtech.eth from the readme modified slightly to use V3 and infura and it did not resolve. Do you know what I should be doing?

package main

import (

    "fmt"
    "github.com/ethereum/go-ethereum/ethclient"
    ens "github.com/wealdtech/go-ens/v3"
)

func main() {
    client, err := ethclient.Dial("https://mainnet.infura.io/v3/")
    if err != nil {
        panic(err)
    }

    // Resolve a name to an address
    domain := "wealdtech.eth"
    address, err := ens.Resolve(client, domain)
    if err != nil {
        panic(err)
    }
    fmt.Printf("Address of %s is %s\n", domain, address.Hex())

    // Reverse resolve an address to a name
    reverse, err := ens.ReverseResolve(client, address)
    if err != nil {
        panic(err)
    }
    if reverse == "" {
      fmt.Printf("%s has no reverse lookup\n", address.Hex())
    } else {
      fmt.Printf("Name of %s is %s\n", address.Hex(), reverse)
    }
}
robdefeo commented 4 years ago

I also looked up https://etherscan.io/address/robdefeo.eth and https://etherscan.io/address/mailchain.eth they both appear to resolve correctly on etherscan

robdefeo commented 4 years ago

In addition if I try tim.mailchain.eth it does work. but mailchain.eth does not. Is there something wrong with NameHash

mcdee commented 4 years ago

NewReverseResolver() used the default reverse resolver. Since the upgrade there are additional reverse resolvers out there so I have added a function NewReverseResolverFor() that takes an address as an additional parameter and uses it to find the appropriate resolver. This appears to have fixed the issue, but please give it a try and let me know if it now behaves.

(You don't need to change your code just update the go-ens module to v3.4.0)

robdefeo commented 4 years ago

Thanks @mcdee that appears to have fixed the issue around mailchain.eth e.g. older address. The newer address robdefeo.eth still does not resolve though. Is this related to the recent changes by ENS?

mcdee commented 4 years ago

That domain does not have a reverse resolver set, as can be seen with Ethereal or https://etherscan.io/enslookup?q=robdefeo.eth