Skip to main content

Try it Live

Run ENS examples in the interactive playground

ENS (Ethereum Name Service)

ENSIP-15 compliant ENS name normalization with WASM acceleration. Prevents homograph attacks, validates names, and ensures consistent canonical representation.
New to ENS? Start with Fundamentals to learn name structure, normalization, and resolution.

Overview

Tevm provides complete ENS support:
  • Normalization - ENSIP-15 compliant name normalization and beautification
  • Validation - Character set, script mixing, and confusable detection
  • Security - Homograph attack prevention and security best practices
  • Performance - 5-6x faster normalization via WebAssembly
  • Standards - Full ENSIP-1, 10, and 15 compliance

Quick Start

import {
  normalize,
  beautify,
  is,
  from,
  toString
} from 'tevm/Ens';

// Normalize ENS name
const normalized = normalize("Nick.ETH");
// Returns: "nick.eth"

// Beautify (preserve emoji)
const beautified = beautify("💩.eth");

// Type guard
if (is(value)) {
  // value is BrandedEns
}

// Convert to/from string
const branded = from("vitalik.eth");
const plain = toString(branded);

Effect Schema

import { EnsSchema } from '@tevm/voltaire/Ens/effect'

const ens = EnsSchema.from('vitalik.eth')
ens.namehash() // Uint8Array(32)
ens.normalize().toString() // 'vitalik.eth'

Core Functions

normalize(name)

normalize(name: string): string
Normalize ENS name to canonical form (lowercase, ENSIP-15 compliant).

beautify(name)

beautify(name: string): string
Beautify ENS name (preserve emoji and mixed case where appropriate).

from(name)

from(name: string): BrandedEns
Create branded ENS from string (auto-normalizes).

toString(ens)

toString(ens: BrandedEns): string
Convert branded ENS to string.

is(value)

is(value: unknown): value is BrandedEns
Type guard for branded ENS.

Types

import type { brand } from 'tevm/brand';

type BrandedEns = string & { readonly [brand]: "Ens" }

Security

Always normalize ENS names before use to prevent homograph attacks. Names like “аpple.eth” (with Cyrillic ‘а’) can appear identical to “apple.eth” but resolve to different addresses.
Voltaire’s ENS implementation uses z-ens-normalize, a Zig implementation of ENSIP-15 maintained by the evmts organization. It passes 100% of ENSIP-15 validation tests and Unicode normalization tests. For full ENS resolution (name → address), see @ensdomains/ensjs or use Voltaire’s primitives with your provider.

See Also