Skip to content

namehash

namehash(name): string

Defined in: utils/namehash.ts:24

Computes the ENS namehash of a domain name as defined in EIP-137.

The namehash algorithm recursively hashes each label of the domain name, producing a unique 32-byte identifier used by ENS contracts.

Parameters

name

string

the ENS domain name to hash (e.g. ‘vitalik.eth’)

Returns

string

the namehash as a 66-character hex string (0x-prefixed, 32 bytes)

Example

namehash('');
// '0x0000000000000000000000000000000000000000000000000000000000000000'
namehash('eth');
// '0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae'
namehash('vitalik.eth');
// '0xee6c4522aab0003e8d14cd40a6af439055fd2577951148c14b6cea9a53475835'