BTB
/

ENS (Ethereum Name Service)

Domainswebsite
Naming system on Ethereum: resolve names (alice.eth, DNS names) to addresses and records and addresses back to primary names through the Universal Resolver, register and renew .eth names with the ENSv2 ETHRegistrar (commit-reveal, paid in USDC/DAI), and set address/text records and primary names.

What you can do

resolve-nameName -> address / text recordNormalize (ENSIP-15), DNS-encode, then UniversalResolver.resolve(name, abi.encode(addr(namehash)) or text(namehash,key)); follow CCIP-Read. Simplest: viem getEnsAddress / getEnsText (viem >= 2.35) which use this contract. Pass coinType for L2 addresses.
reverse-lookupAddress -> primary nameUniversalResolver.reverse(address bytes, 60) (or the L2 coinType); viem getEnsName.
register-eth-nameRegister a new .eth name (ENSv2)1) ETHRegistrar.isAvailable(label). 2) getRegisterPrice(label, duration, USDC) -> (base, premium). 3) USDC.approve(ETHRegistrar, base+premium, plus a small margin). 4) Optionally deploy your own resolver via VerifiableFactory.deployProxy(PermissionedResolverImpl, salt, initialize(...)), or pass 0x0 and set it later. 5) commitment = makeCommitment(label, owner, secret, subregistry=0x0, resolver, duration, referrer=0x0); commit(commitment). 6) Wait >= 60 s (and < 24 h). 7) register(label, owner, secret, 0x0, resolver, duration, USDC, 0x0).
renew-eth-nameRenew a .eth nameCheck ETHRegistry.getStatus(uint256(labelhash)): 2 REGISTERED -> ETHRegistrar.renew((label,duration,0x0), USDC); 1 RESERVED (unmigrated v1 name) -> ETHRenewerV1.renew((label,duration,0x0), USDC). Approve the token for getRenewPrice first. Anyone can renew any name.
set-recordsSet address / text recordsFind the name's resolver with UniversalResolver.findResolver(dnsName). If it supports interface 0xc7279f88 (ENSv2 Permissioned Resolver): setText(dnsName,key,value) / setAddress(dnsName,coinType,addrBytes). Otherwise (ENSv1 PublicResolver): setText(namehash,key,value) / setAddr(namehash,addr). ENSjs >= 5.2.5 picks the right path.
set-primary-nameSet the reverse recordReverseRegistrar.setName('alice.eth') from the address (mainnet), or DefaultReverseRegistrar.setName for a default across chains; make sure the name's addr record points to that address.
ENSv2 is live: v1 registration and renewal on ETHRegistrarController are disabled (it is no longer a BaseRegistrar controller and renew() reverts). Old code that sends ETH to the v1 controller fails; use ETHRegistrar (ENSv2) or ETHRenewerV1.
Fees are paid in ERC-20 (USDC/DAI) via transferFrom, not ETH: approve first. Prices are USD per year: $8 (5+ chars), $160 (4), $640 (3), minimum duration 28 days.
Commit-reveal: register only between 60 s and 24 h after commit, with exactly the same parameters and secret, or it reverts; keep the secret private until register.
Expiry: ENSv2 names have a 28-day grace period after expiry (renewable only by renewal, they stop resolving), then a 21-day temporary premium auction starting near $100M that halves daily, then anyone can register. Unmigrated v1 names keep the v1 90-day grace view but must be renewed via ETHRenewerV1; if not migrated and not renewed they eventually become available in v2.

Contracts

Read any function, or build a write and sign it. Amounts are in base units (1 USDC = 1000000).
Universal Resolver (UpgradableUniversalResolverProxy)other on ethereum0xeEeEEEeE14D718C2B47D9923Deab1335E144EeEe
read resolve(bytes,bytes)
Canonical entry point for forward resolution (ENSv1 and ENSv2 names). Args: (name, data). name = DNS-encoded, ENSIP-15-normalized name (e.g. 'nick.eth' -> 0x046e69636b0365746800); data = one ABI-encoded resolver call such as addr(bytes32 node), addr(bytes32,uint256 coinType) or text(bytes32,string key) (node = namehash), or multicall(bytes[]) of several. Returns (bytes result, address resolver); decode result with the inner call's ABI. May revert with OffchainLookup (EIP-3668 CCIP-Read): use a client that follows CCIP-Read (viem getEnsAddress/getEnsText do this).
read reverse(bytes,uint256)
Primary-name lookup. Args: (lookupAddress as bytes, e.g. the 20-byte address; coinType: 60 for Ethereum, or the ENSIP-11 coin type for an L2). Returns (string primary, address resolver, address reverseResolver). It already checks that the primary name forward-resolves back to the address.
read resolveWithGateways(bytes,bytes,string[])
Same as resolve but with your own list of CCIP-Read gateway URLs.
read reverseWithGateways(bytes,uint256,string[])
Same as reverse but with your own CCIP-Read gateway URLs.
read findResolver(bytes)
Find the resolver contract for a DNS-encoded name (walks the ENSv2 registry tree, falling back to ENSv1 for unmigrated names). Use this to discover where to write records; never hardcode a resolver.
ETHRegistrar (ENSv2, current .eth registrar)other on ethereum0xD6D8369e55c94Ae8AFA714E6cF7AB5bE54D5CC81
read isAvailable(string)
True if the label (e.g. 'alice' for alice.eth, no '.eth') can be registered now. Pre-migrated ENSv1 names are RESERVED and return false.
read getRegisterPrice(string,uint64,address)
Args (label, duration in seconds, paymentToken). Returns (base, premium) in the payment token's raw units (USDC: 6 decimals, DAI: 18). 5+ characters = $8/yr, 4 = $160/yr, 3 = $640/yr, with multi-year discounts (12.5% at 2 yrs, ~31% at 3-5 yrs, ~44% at 6 yrs). Premium is a 21-day decaying premium on recently expired names. Reverts if the name is unavailable or duration < MIN_REGISTER_DURATION (28 days).
read getRenewPrice(string,uint64,address)
Renewal price (base only, no premium) in paymentToken raw units for (label, duration seconds, token). Reverts NameNotRenewable if the name is not renewable here (unmigrated names renew through ETHRenewerV1).
read makeCommitment(string,address,bytes32,address,address,uint64,bytes32)
Compute the commitment hash. Args (label, owner, secret, subregistry, resolver, duration, referrer). secret = random 32 bytes you keep; subregistry = 0x0 for none; resolver = the resolver to set (e.g. your own Permissioned Resolver proxy); duration = seconds (uint64); referrer = bytes32(0) if none.
write commit(bytes32)
Step 1 of commit-reveal: store the commitment. Then wait at least MIN_COMMITMENT_AGE (60 s) and at most MAX_COMMITMENT_AGE (86400 s = 24 h) before register.
write register(string,address,bytes32,address,address,uint64,address,bytes32)
Step 2: register. Args (label, owner, secret, subregistry, resolver, duration, paymentToken, referrer); all but paymentToken must equal the makeCommitment inputs. NOT payable: the fee is pulled in an ERC-20 (USDC 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 or DAI 0x6B175474E89094C44Da98b954EedeAC495271d0F at launch) via transferFrom, so approve this contract for base + premium first. Returns tokenId. This replaces the ENSv1 ETHRegistrarController register (which took ETH and a Registration struct) and is a breaking change.
write renew((string,uint64,bytes32),address)
Renew a REGISTERED (new or migrated) ENSv2 name. Args: RenewData struct (label, duration seconds, referrer) and paymentToken (approve it for getRenewPrice first). Anyone can renew any name.
write renewBatch((string,uint64,bytes32)[],address)
Renew several names in one tx, all paid with the same ERC-20.
read commitmentAt(bytes32)
Timestamp when a commitment was recorded (0 if none).
read isRenewable(string)
Whether this contract can renew the label now.
read getRemainingGracePeriod(string)
Seconds of grace period left for an expired name (ENSv2 grace = 28 days, GRACE_PERIOD() = 2419200).
ETHRegistry (ENSv2 .eth PermissionedRegistry, ERC-1155 name tokens)other on ethereum0xf60aba43E1f7F3DAB1186Ff03B561401C9Df85E2
read getStatus(uint256)
Arg: uint256(labelhash(label)). Returns 0 AVAILABLE, 1 RESERVED (pre-migrated ENSv1 name not yet migrated: use the v1 contracts to manage it), 2 REGISTERED (ENSv2 name).
read getExpiry(uint256)
Expiry unix timestamp (uint64) of a name; arg uint256(labelhash).
read getTokenId(uint256)
Current token id of a name. Token ids are MUTABLE in ENSv2 (they change on some events), so resolve it at transaction time instead of caching.
read ownerOf(uint256)
Owner of a name token (ERC1155Singleton: exactly one owner per token).
read getResolver(string)
Resolver set for a label (e.g. 'nick').
write setResolver(uint256,address)
Change a name's resolver. Caller needs ROLE_SET_RESOLVER on the name (the registrant gets it at registration). Changing resolver does not copy records.
write setSubregistry(uint256,address)
Set the child registry used for subnames. Caller needs ROLE_SET_SUBREGISTRY.
write safeTransferFrom(address,address,uint256,uint256,bytes)
ERC-1155 transfer of a name (amount = 1). Transfers change the token id and clear delegated roles.
ETHRenewerV1 (renews unmigrated ENSv1 .eth names)other on ethereum0x56c447F308F463A01121C41E72b0E7e7557fCb68
write renew((string,uint64,bytes32),address)
Renew a RESERVED (not yet migrated) ENSv1 .eth name; also syncs the expiry back to the v1 BaseRegistrar. Args: RenewData (label, duration seconds, referrer) and paymentToken (USDC/DAI, approve first). The old ETHRegistrarController.renew() now reverts.
read getRenewPrice(string,uint64,address)
Renewal price in the payment token's raw units.
read isRenewable(string)
Whether this contract can renew the label.
read getRemainingGracePeriod(string)
Grace seconds left for an expired name.
StandardRentPriceOracle (ENSv2 pricing)other on ethereum0x76F29609A363a8A1a2a6abe2e859C0F8916Af469
read isPaymentToken(address)
Whether an ERC-20 is accepted for registration/renewal (USDC and DAI at launch; USDT is not).
read getRegisterPrice(string,uint64,uint64,address)
Hypothetical price: (label, available-for seconds, duration, paymentToken) -> (base, premium). For a real quote use ETHRegistrar.getRegisterPrice instead.
VerifiableFactory (deploys per-account resolvers / per-name registries)factory on ethereum0x77510ba162dfeA3d8989E3f0928a691B345730D2
write deployProxy(address,uint256,bytes)
Deploy your own Permissioned Resolver: deployProxy(PermissionedResolverImpl 0x565b0F456a04Ac9b48758190e90030623Cff57C5, salt = uint256(keccak256(abi.encode(keccak256('OwnedResolver'), owner, 0))), initialize((address account,uint256 roleBitmap)[] grants, bytes[] calls)). Emits ProxyDeployed(sender, proxyAddress, salt, implementation); the address is CREATE2-deterministic.
read verifyContract(address)
Prove a proxy was deployed by this factory and get its current implementation.
PermissionedResolverImpl (ENSv2 resolver implementation; call your own proxy, not this)other on ethereum0x565b0F456a04Ac9b48758190e90030623Cff57C5
write setAddress(bytes,uint256,bytes)
On YOUR Permissioned Resolver proxy (find it with UniversalResolver.findResolver): set an address record. Args (DNS-encoded name, coinType: 60 = ETH, address bytes). Note: v2 setters take a DNS-encoded name, not a namehash. Caller needs the resolver role (e.g. ROLE_SET_ADDR); owning the name token does not grant it automatically.
write setText(bytes,string,string)
Set a text record (DNS-encoded name, key, value), e.g. 'avatar', 'url', 'com.twitter'. Interface id 0xc7279f88 (the v1 setText(bytes32,...) selector does not work here).
write setContenthash(bytes,bytes)
Set the contenthash (DNS-encoded name, EIP-1577 bytes).
write multicall(bytes[])
Batch several setters in one tx.
read resolve(bytes,bytes)
ENSIP-10 read (normally done through the Universal Resolver).
ENS Registry (ENSv1)other on ethereum0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e
read owner(bytes32)
ENSv1 manager (controller) of a node (namehash). For unmigrated names only; migrated names are owned in the ENSv2 ETHRegistry.
read resolver(bytes32)
ENSv1 resolver of a node.
write setResolver(bytes32,address)
Set the resolver of an unmigrated, unwrapped ENSv1 name (caller must be the node owner/approved).
write setSubnodeRecord(bytes32,bytes32,address,address,uint64)
Create/update an ENSv1 subname: (parent node, labelhash, owner, resolver, ttl).
BaseRegistrar (ENSv1 .eth ERC-721)token on ethereum0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85
read nameExpires(uint256)
ENSv1 expiry timestamp of uint256(labelhash(label)). ENSv1 grace period is 90 days (GRACE_PERIOD()).
read ownerOf(uint256)
ERC-721 registrant of an unwrapped, unmigrated .eth name.
read available(uint256)
ENSv1 availability. Not meaningful for new registrations any more: v1 registration is disabled, use ETHRegistrar.isAvailable.
write reclaim(uint256,address)
Set ENSv1 registry ownership of the name to the given manager (registrant only).
write safeTransferFrom(address,address,uint256,bytes)
Transfer the name; transferring to UnlockedMigrationController with encoded data is how an unwrapped v1 name migrates to ENSv2 (see migration docs).
NameWrapper (ENSv1, ERC-1155)other on ethereum0xD4416b13d2b3a9aBae7AcD5D6C2BbDBE25686401
read ownerOf(uint256)
Owner of a wrapped ENSv1 name (id = uint256(namehash)).
read getData(uint256)
(owner, fuses, expiry) of a wrapped name.
write setResolver(bytes32,address)
Set resolver of a wrapped, unmigrated name (fuses may forbid it).
write setSubnodeRecord(bytes32,string,address,address,uint64,uint32,uint64)
Create a wrapped subname: (parentNode, label, owner, resolver, ttl, fuses, expiry).
write unwrapETH2LD(bytes32,address,address)
Unwrap a .eth 2LD: (labelhash, registrant, controller). New projects should not build on the wrapper (ENSv2 replaces fuses with roles).
PublicResolver (ENSv1)other on ethereum0xF29100983E058B709F3D539b0c765937B804AC15
write setAddr(bytes32,address)
Set ETH address of an unmigrated ENSv1 name that uses this resolver (node = namehash). Only for names whose resolver is this contract; check first, never hardcode.
write setAddr(bytes32,uint256,bytes)
Set a multichain address (node, ENSIP-11 coinType, address bytes).
write setText(bytes32,string,string)
Set a text record (node, key, value).
write setContenthash(bytes32,bytes)
Set contenthash.
write multicall(bytes[])
Batch several setters.
read addr(bytes32)
Direct read (prefer the Universal Resolver).
read text(bytes32,string)
Direct read of a text record.
ReverseRegistrar (L1, ENSv1)other on ethereum0xa58E81fe9b61B5c3fE2AFD33CF304c454AbFc7Cb
write setName(string)
Set msg.sender's Ethereum-mainnet primary name (e.g. 'alice.eth'). Still the write path after ENSv2 launch. Set the forward address record too, or reverse lookups fail verification.
write setNameForAddr(address,address,address,string)
Set the primary name for an address you control/are approved for: (addr, owner, resolver, name).
read node(address)
Reverse node for an address.
DefaultReverseRegistrar (ENSv1)other on ethereum0x283F227c4Bd38ecE252C4Ae7ECE650B0e913f1f9
write setName(string)
Set msg.sender's default primary name (used on chains with no chain-specific primary name).
read nameForAddr(address)
Default primary name stored for an address.
ENS tokengovernance on ethereum0xC18360217D8F7Ab5e7c516566761Ea12Ce7F9D72
read balanceOf(address)
ENS balance (18 decimals).
write transfer(address,uint256)
ERC-20 transfer.
write delegate(address)
Delegate ENS DAO voting power (to yourself to vote).
read getVotes(address)
Current voting power.
read delegates(address)
Current delegate of an account.