Record Types

This guide covers the various record types supported by ENS, with a focus on contenthash records, TXT records, and the multiformats specification that enables interoperability across different content addressing systems.

Overview of ENS Record Types

ENS supports multiple record types that can be stored and resolved for each domain:

  • Address Records: Ethereum and other cryptocurrency addresses

  • Contenthash Records: Content addressing (IPFS, IPNS, Arweave, etc.)

  • Text Records: Key-value pairs for metadata

  • Custom Records: Application-specific data

Contenthash Records

Contenthash records are the primary mechanism for linking ENS domains to decentralized content, enabling dWebsites and other decentralized applications.

Contenthash Format

Contenthash records use a standardized format that includes:

  1. Multicodec: Identifies the content addressing system

  2. Content: The actual content identifier

<multicodec><content>

Supported Content Addressing Systems

System
Multicodec
Example

IPFS

0xe3

ipfs://Qm...

IPNS

0xe5

ipns://k51...

Arweave

0x6b

ar://...

Swarm

0x7b

bzz://...

Setting Contenthash Records

Using the ENS App

  1. Connect your wallet

  2. Navigate to your domain

  3. Click "Add/Edit Record"

  4. Set the content hash to your IPFS/Arweave hash

Using Ethers.js

Using IPFS

Decoding Contenthash Records

Multiformats and Multicodecs

Multiformats is a self-describing data format that enables interoperability between different content addressing systems.

Multicodec Table

Multiformat Encoding

TXT Records

TXT records allow you to store arbitrary key-value pairs as metadata for your domain.

Common TXT Record Keys

Key
Purpose
Example

url

Website URL

https://example.com

email

Contact email

contact@example.com

description

Domain description

My personal website

avatar

Profile picture

ipfs://QmAvatar...

notice

Legal notice

Terms of service apply

Setting TXT Records

Reading TXT Records

Address Records

Address records map domain names to cryptocurrency addresses.

Supported Address Types

Setting Address Records

Reading Address Records

Advanced Record Patterns

1. Dynamic Content Routing

2. Multi-Protocol Support

3. Versioned Content

Best Practices

1. Content Hash Management

  • Use IPNS for mutable content: Update content without changing ENS records

  • Set appropriate TTL: Balance between freshness and gas costs

  • Implement fallbacks: Use multiple content addressing systems

2. TXT Record Organization

  • Use consistent naming: Follow established conventions

  • Keep records minimal: Only store essential metadata

  • Document your schema: Maintain a record of all TXT keys used

3. Address Record Security

  • Verify addresses: Double-check all cryptocurrency addresses

  • Use hardware wallets: Store private keys securely

  • Monitor for changes: Track address record modifications

Tools and Libraries

JavaScript Libraries

Example Usage

Troubleshooting

Common Issues

Contenthash not resolving:

  • Verify the multicodec is correct

  • Check that the content exists on the network

  • Ensure the resolver supports contenthash records

TXT records not updating:

  • Check gas limits

  • Verify resolver permissions

  • Wait for transaction confirmation

Address records showing wrong values:

  • Verify the coin type is correct

  • Check for address format issues

  • Ensure the resolver supports the coin type

Resources

Next Steps

With a solid understanding of record types, explore:

Last updated