> ## Documentation Index
> Fetch the complete documentation index at: https://voltaire.tevm.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# Ens

> Ethereum Name Service (ENS) normalization, encoding, and validation

<Card title="Try it Live" icon="play" href="https://playground.tevm.sh?example=primitives/ens.ts">
  Run ENS examples in the interactive playground
</Card>

# ENS (Ethereum Name Service)

ENSIP-15 compliant ENS name normalization with WASM acceleration. Prevents homograph attacks, validates names, and ensures consistent canonical representation.

<Tip>
  New to ENS? Start with [Fundamentals](/primitives/ens/fundamentals) to learn name structure, normalization, and resolution.
</Tip>

## 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

<Tabs>
  <Tab title="Functional API">
    ```typescript theme={null}
    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);
    ```
  </Tab>
</Tabs>

### Effect Schema

```ts theme={null}
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)

```typescript theme={null}
normalize(name: string): string
```

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

### beautify(name)

```typescript theme={null}
beautify(name: string): string
```

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

### from(name)

```typescript theme={null}
from(name: string): BrandedEns
```

Create branded ENS from string (auto-normalizes).

### toString(ens)

```typescript theme={null}
toString(ens: BrandedEns): string
```

Convert branded ENS to string.

### is(value)

```typescript theme={null}
is(value: unknown): value is BrandedEns
```

Type guard for branded ENS.

## Types

```typescript theme={null}
import type { brand } from 'tevm/brand';

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

## Security

<Warning>
  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.
</Warning>

## Related Projects

Voltaire's ENS implementation uses [z-ens-normalize](https://github.com/evmts/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](https://github.com/ensdomains/ensjs) or use Voltaire's primitives with your provider.

## See Also

* [Ens (Effect)](https://voltaire-effect.tevm.sh/primitives/ens) - Effect.ts integration with Schema validation
* [Normalization](/primitives/ens/normalization) - ENSIP-15 details
* [Validation](/primitives/ens/validation) - Name validation rules
* [Security](/primitives/ens/security) - Homograph attack prevention
* [ENSIP Standards](/primitives/ens/ensip-standards) - ENS improvement proposals
* [z-ens-normalize](https://github.com/evmts/z-ens-normalize) - Zig ENSIP-15 implementation
