Multichain
L2 & Crosschain Resolution
But isn't ENS on mainnet?
Yes, technically. The resolution process always starts on mainnet. There needs to be, one source of truth after all. However, the name resolution process can branch off to other chains, offchain gateways and much more.
To read a more in-depth explanation of how resolution works, checkout the section dedicated to the Resolution Process.
My dapp is on X but I want ENS
The ENS Protocol can be used on/for any chain!
If you are building a non-mainnet dApp and want to use ENS names simply add a Mainnet RPC to your Wagmi config and specify chainId: 1 in your config like so:
import { useAccount, useEnsAvatar, useEnsName } from 'wagmi'
const Name = () => {
const { data: ensName } = useEnsAddress({
name: 'nick.eth',
chainId: 1, // (1 = Ethereum, 11155111 = Sepolia)
})
return <div>{ensName || address}</div>
}And voila! You can now resolve ENS names anywhere! 🎉