Skip to content
On this page

namehash โ€‹

Hashes ENS name.

Import โ€‹

ts
import { namehash, normalize } from 'viem/ens'

Usage โ€‹

ts
import { namehash, normalize } from 'viem/ens'

namehash('wagmi-dev.eth') 
// '0xf246651c1b9a6b141d19c2604e9a58f567973833990f830d882534a747801359'

WARNING

Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to normalize ENS names with UTS-46 normalization before passing them to namehash. You can use the built-in normalize function for this.

Returns โ€‹

string

The hashed ENS name.

Parameters โ€‹

name โ€‹

  • Type: string

A ENS name.

Released under the MIT License.