Ethereum Name Service — human-readable names like `vitalik.eth`, avatars, text records, and ENSIP-19 multichain primary names across L1 and major L2s.
- 01displaying readable wallet names
- 02avatar resolution
- 03multichain primary names (ENSIP-19)
- 04text records (twitter, url, description)
- 05subdomain issuance for users
- pnpm add viem
| Variable | Scope | Description |
|---|---|---|
| NEXT_PUBLIC_MAINNET_RPC_URL | Client | Ethereum mainnet RPC URL — ENS resolution always starts from L1, even for L2 primary names. |
Resolve ENS via viem against an Ethereum mainnet client. Forward-resolve names with `getEnsAddress({ name: normalize(name) })` and reverse-resolve addresses with `getEnsName({ address })` from `viem/actions`. Always pass names through `normalize` (UTS-46) from `viem/ens` before lookup. For ENSIP-19 multichain primary names on Base, OP, Arbitrum, Scroll, or Linea, pass `coinType` (e.g. `8453` for Base) so the L2 reverse registrar is queried. Reverse-resolve before showing an address in the UI, and forward-resolve the result back to verify the name actually points to the address (prevents impersonation via dangling primary records). Read avatar/text records via `getEnsAvatar` and `getEnsText`.
- ⚑Reverse resolution is unverified by default — always re-forward-resolve the returned name and check it equals the original address before displaying, or you can be spoofed by anyone setting their primary name to `vitalik.eth`.
- ⚑ENS resolution requires an L1 mainnet client even when the user is on an L2 — keep a mainnet RPC available separately from your app's main chain RPC.
- ⚑ENSIP-19 L2 primary names need explicit `coinType` (e.g. SLIP-44 / EVM chain ID) — without it you'll only see the L1 default record and miss Base/OP/Arb names.
- ⚑The hosted ENS subgraph is being phased out as a public dependency — for production indexing, run your own (Goldsky/The Graph Network) or use the Universal Resolver via RPC instead of querying the subgraph directly.
- ⚑Names must be UTS-46 normalized — passing raw user input with uppercase or homoglyphs will throw or resolve to the wrong address.
- ⚑Basenames (`*.base.eth`) are a separate namespace operated by Coinbase — they're ENS-compatible but registration/economics are independent; treat as a sibling integration.