Introduction

Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.

I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.

I also build and publish a variety of tools, libraries, and open-source projects.

This article examines ENSIP-12, which allows profile pictures to be stored and retrieved through ENS and shared across DApps.

This explanation translates, summarizes, and expands on the following specification.

For other EIPs, BIPs, SLIPs, CAIPs, and ENSIPs, see https://cardene.dev/proposals.

Overview

ENSIP-12 standardizes how ENS handles avatars: how to retrieve the URI stored in the avatar text field, supported URI schemes, and how clients should interpret and display those URIs. Users can thereby use a consistent image across applications.

Motivation

ENS primary names, formerly referred to as reverse records, are widely used as Web3 usernames. Applications increasingly let users set avatars, particularly NFTs used as profile pictures (PFPs). Independent avatar management requires repeated setup and loses consistency. An ENS avatar record lets multiple applications reference one image.

ENSIP-12 uses the Text Records defined in ENSIP-5 to standardize avatar storage and retrieval, enabling cross-application profile sharing.

For ENSIP-5, see the following article.

ENSIP-5 Explained: Registering Profile Information in ENS

Specification

Retrieval differs depending on whether the starting point is an ENS name or Ethereum address, but both use a URI stored in the avatar text field.

Retrieval from an ENS Name

Locate the resolver and call:

javascript
.text(namehash(name), 'avatar')

The returned URI identifies the avatar. If no resolver exists, the call reverts, or an empty string is returned, no valid avatar exists.

Retrieval from an Ethereum Address

Perform reverse resolution. Convert the address to lowercase hexadecimal without the 0x prefix and find the resolver for:

text
<address>.addr.reverse

Call the resolver:

javascript
.text(namehash('<address>.addr.reverse'), 'avatar')

If no avatar is retrieved:

  1. Call .name(namehash('<address>.addr.reverse')) to obtain the ENS name.
  2. Verify the reverse record by checking that the name resolves to the original address.
  3. If valid, follow the ENS-name retrieval procedure.

If the fallback fails, consider the avatar absent.

General Format

Avatar information must be stored as a URI. An unrecognized URI scheme is treated as an unset avatar.

Required Image Formats

Clients must support at least:

  • JPEG (image/jpeg)
  • PNG (image/png)
  • SVG (image/svg+xml)

Additional formats are permitted but not required.

URI Types

https

An https URI must point directly to the image. Indirect responses such as HTML or metadata are not permitted.

ipfs

An ipfs URI must likewise reference the image directly. Clients without native IPFS support may rewrite the URI to an https gateway URL.

data

A data URI embeds image data directly and must resolve directly to an image.

NFT References

NFT avatars use URIs conforming to CAIP-22 and CAIP-29. Clients must support at least ERC-721 and ERC-1155.

  1. Obtain the NFT metadata URI from the URI in the avatar field.
  2. Resolve the metadata URI and retrieve the metadata JSON.
  3. Read its image field to obtain the image URL.
  4. Resolve the URL and use the image as the avatar.

Clients must support at least https and ipfs for image retrieval.

They must also verify NFT ownership. When resolving an ENS name, use the address to which it resolves; when starting from an address, use that address. If ownership verification fails, the URI is invalid.

Examples

The following three URIs refer to the image for BAYC token 0.

text
eip155:1/erc721:0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d/0
ipfs://QmRRPWG96cmgTn2qSzjwr2qvfNEuhunv6FNeMFGa9bx6mQ
https://ipfs.io/ipfs/QmRRPWG96cmgTn2qSzjwr2qvfNEuhunv6FNeMFGa9bx6mQ

Different URI formats can therefore resolve to the same image.

Conclusion

ENSIP-12 standardizes ENS profile image storage and retrieval, enabling DApps to share avatars.

Further reading and author links:

https://chaldene.net/