Getting Started

The ENS Protocol aims to make it easy to use Ethereum. It does this to providing a simple way to use human-readable names to subsitute for long machine-redable addresses.

On this page you will find everything it takes to get started with ENS, replace all addresses with ens names in your app, and allow finding users by name!

In-Depth ResolutionAdvancedTo learn more about the resolution process, please read the Resolution section.

Getting the users Ethereum Address
Forward Lookup

The simplest thing you can do with ENS is to get the users Ethereum address. This is done by using the forward lookup method, which takes an ENS name and returns the address. You might use this for input boxes,

luc.eth ➡️ 0x225...c3B5

Request

import { useAccount, useEnsName, useEnsAvatar } from 'wagmi';

export const Name = () => {
    const { data: ensName } = useEnsAddress({
        address: 'luc.eth', // The name to lookup
        chainId: 1, // The chainId to lookup on
    });

    return <div>{ensName || address}</div>;
};

Multi-Chain Addresses (BTC, LTC, etc)
Multi-Chain

ENS Addresses arent just limited to Ethereum Addresses, instead it supports SLIP-0044, meaning you can also get other addresses such as BTC, LTC, etc. The standardization of multichain addresses was first introduced in ENSIP-9, and also EIP-2304.

ChainID
BTC0
LTC2
DOGE3
Solana501
Optimism614
Polygon (Matic)966

... and many many more following SLIP-0044

Multichain Address Lookup

import { useEnsMultichainAddress } from 'ens-tools/react';

export const BitcoinAddress = () => {
    const { address: btcAddress, chainId } = useEnsMultichainAddress({
        name: 'luc.eth',
        coinType: 1, // BTC
    });

    return <div>BTC: {btcAddress}</div>;
};

Reverse Lookup (Name ➡️ Address)
Reverse Lookup

The reverse lookup method allows us to easily get the ENS name of an address. This removes the need for your app to have verbose addresses everywhere and allows you to simply show the users name!

0x225...c3B5 ➡️ luc.eth

Reverse Lookup

import { useEnsName } from 'wagmi';

export const Name = () => {
    const { data: name, chainId } = useEnsName({
        address: '0x225f137127d9067788314bc7fcc1f36746a3c3B5',
    });

    return <div>Name: {name}</div>;
};