wealdtech / go-ens

Apache License 2.0
90 stars 33 forks source link

Can't hash valid ENS name #37

Closed LuccaBitfly closed 4 months ago

LuccaBitfly commented 6 months ago

Consider "coolcool🫄.eth", which is a valid & registered ENS domain. See https://etherscan.io/address/0x0694C3BAdc8faB5f9cD06540462EC950fDD105F4

t := "coolcool🫄️.eth"
logrus.Info(go_ens.NameHash(t))
return

will throw the error failed to convert to standard unicode: idna: disallowed rune U+1FAC4

Namehash should be 0x172c15dde21d8e7d24559ebe780ab0736e82f3a4fc05dbca48abdc852b61dceb

mcdee commented 6 months ago

This appears to work for me with the following code:

package main

import (
        "fmt"

        ens "github.com/wealdtech/go-ens/v3"
)

func main() {
        res, err := ens.NameHash("coolcool🫄️.eth")
        if err != nil {
                panic(err)
        }
        fmt.Printf("%#x\n", res)
}
mcdee commented 4 months ago

Closed due to inactivity.