Permanent ENS subname registration for AI agents β fully onchain on Ethereum.
Mint subnames under 402bot.eth, 402api.eth, or 402mcp.eth for 0.005 ETH each. No renewals, no expiry, no middlemen. The name is yours forever.
π Live: x402id.eth.link π¦ Twitter/X: @x402identity
x402 Identity Hub gives AI agents a verifiable onchain identity through the ENS (Ethereum Name Service) infrastructure. Each minted subname is a permanent ENS record stored in the NameWrapper contract β transferable, resolvable, and composable with the broader ENS ecosystem.
| Name | Purpose |
|---|---|
[name].402bot.eth |
Autonomous AI bots and agents |
[name].402api.eth |
API-facing agents and services |
[name].402mcp.eth |
MCP (Model Context Protocol) servers |
Two contracts on Ethereum mainnet, both Etherscan-verified.
| Contract | Address | Purpose |
|---|---|---|
X402SubnameRegistrar |
0xeb9e9ea385fe28b51a3f9a7d93fb893e0a1f9633 |
Mints permanent ENS subnames under the supported parents |
X402RegistrarForwarder |
0x05af104ce913e7ef39799bfada871817d3761778 |
Splits payment between protocol and a third-party platform's treasury in a single tx |
The registrar interacts directly with the ENS NameWrapper contract to issue permanent subnames. Key functions:
| Function | Description |
|---|---|
register(node, label) |
Mint a single subname |
batchRegister(nodes[], labels[]) |
Mint multiple subnames in one tx |
isAvailable(node, label) |
Check if a subname is available |
withdrawFees() |
Owner: withdraw accumulated ETH |
Mint fee: 0.005 ETH per name (protocol fee)
Batch: Up to 10 names per transaction
Platform fee: 0β0.05 ETH on top of the protocol fee, paid to a platform's treasury via the forwarder (see below)
External platforms can earn from registrations by mounting the x402id widget and setting their own platform fee β paid atomically to a treasury address they specify. The forwarder enforces a 0.05 ETH cap on platform fees and the breakdown is shown to users line-by-line before they sign.
Full integration guide: x402id.eth.link/integrate
<div data-x402id
data-treasury="0xYourPlatformTreasury"
data-platform-fee-wei="1000000000000000"
data-parents="402bot.eth,402api.eth,402mcp.eth"
data-theme="light"></div>
<script src="https://x402id.eth.link/embed.js" async></script>npm install @x402identity/widget-react viemimport { X402Widget } from "@x402identity/widget-react";
import { mainnet } from "viem/chains";
import { namehash, parseEther } from "viem";
<X402Widget
registrar="0xeb9e9ea385fe28b51a3f9a7d93fb893e0a1f9633"
forwarder="0x05af104ce913e7ef39799bfada871817d3761778"
parents={[
{ label: "402bot.eth", node: namehash("402bot.eth") },
{ label: "402api.eth", node: namehash("402api.eth") },
{ label: "402mcp.eth", node: namehash("402mcp.eth") },
]}
platformTreasury="0xYourPlatformTreasury"
platformFeeWei={parseEther("0.001")}
chain={mainnet}
/>| Path | What it is |
|---|---|
contracts/X402RegistrarForwarder.sol |
Payment-splitting forwarder, ERC1155-receiver, owner-tunable fee cap |
packages/widget-core/ |
Framework-agnostic viem helpers (ABIs, validation, tx builders) |
packages/widget-react/ |
<X402Widget> component with fallback connect UI, zero-dep styling |
packages/mcp-server/ |
@x402identity/mcp β MCP server for agents (see below) |
packages/embed/embed.js |
Vanilla script-tag loader for non-React sites β edit this one |
public/embed.js |
Generated copy of the above (npm run sync:embed, runs on every build) |
src/app/widget/ |
Standalone widget page (iframe target for embed.js) |
src/app/integrate/ |
Public integrator-facing docs page |
@x402identity/mcp lets an AI agent claim and manage its own ENS identity directly β no browser, no widget. It speaks the Model Context Protocol, so it drops into Claude Desktop, Claude Code, Cursor, or any MCP client.
npm: @x402identity/mcp Β· source: packages/mcp-server/
{
"mcpServers": {
"x402id": {
"command": "npx",
"args": ["-y", "@x402identity/mcp"]
}
}
}| Tool | What it does |
|---|---|
check_availability |
Validate a label and check if label.parent is free |
get_price |
Total ETH cost for 1β10 mints (protocol fee + optional platform fee) |
register_subname |
Mint one permanent subname |
batch_register |
Mint up to 10 names in one transaction |
resolve_identity |
ENS name β address, owner, text records |
list_names |
All x402 names minted by an address (onchain events) |
Prepare-only (default) β zero configuration, zero custody. Read tools query mainnet directly; mint tools return a fully-encoded transaction (to, data, value) for the caller to sign with any wallet.
Wallet mode β set X402_PRIVATE_KEY and the server signs and broadcasts itself, returning the receipt. X402_MAX_SPEND_WEI (default 0.1 ETH) bounds worst-case loss per call.
| Env var | Default | Purpose |
|---|---|---|
X402_RPC_URL |
keyless public RPCs | Custom mainnet RPC (list_names needs full-range eth_getLogs) |
X402_PRIVATE_KEY |
β | Enables wallet mode |
X402_MAX_SPEND_WEI |
0.1 ETH | Per-call spend cap in wallet mode |
X402_PLATFORM_TREASURY |
β | Route mints through the forwarder and earn a platform fee |
X402_PLATFORM_FEE_WEI |
0 |
Platform fee per mint (forwarder caps at 0.05 ETH) |
Like the widget, anyone can run this server with a treasury configured and earn on every mint routed through it β paid atomically by X402RegistrarForwarder in the same transaction.
Full docs: packages/mcp-server/README.md
| Layer | Technology |
|---|---|
| Smart Contract | Solidity 0.8.20 Β· OpenZeppelin v5 Β· Hardhat |
| Frontend | Next.js 14 Β· React 18 Β· TypeScript |
| Web3 | wagmi v2 Β· viem v2 Β· WalletConnect |
| Styling | Tailwind CSS Β· Framer Motion |
| Agent interface | Model Context Protocol SDK Β· zod |
| Hosting | IPFS (Pinata) Β· ENS contenthash |
The frontend is a static export (next build β out/) pinned to IPFS and served via the x402id.eth ENS contenthash. No centralized server required.
IPFS CID: bafybeiecbjcfatgudqfru2iitmc3tugjq3umnmazqsg4cit2k7ib5fnkhm
https://ipfs.io/ipfs/bafybeiecbjcfatgudqfru2iitmc3tugjq3umnmazqsg4cit2k7ib5fnkhm/
- Node.js 18+
- An Alchemy API key
- A WalletConnect project ID (from cloud.reown.com)
git clone https://github.com/RWA-ID/x402-Identity.git
cd x402-Identity
npm installCreate .env.local:
NEXT_PUBLIC_REOWN_PROJECT_ID=your_walletconnect_project_id
NEXT_PUBLIC_ALCHEMY_MAINNET=https://eth-mainnet.g.alchemy.com/v2/YOUR_KEY
NEXT_PUBLIC_ALCHEMY_SEPOLIA=https://eth-sepolia.g.alchemy.com/v2/YOUR_KEY
NEXT_PUBLIC_REGISTRAR_ADDRESS=0xeb9e9ea385fe28b51a3f9a7d93fb893e0a1f9633
NEXT_PUBLIC_CHAIN_ID=1npm run devOpen http://localhost:3000.
npm run build
# Output: ./out/ (static export ready for IPFS)# Compile contracts
npx hardhat compile --config hardhat.config.js
# Run tests
npx hardhat test --config hardhat.config.js
# Deploy (requires PRIVATE_KEY in .env.local)
node scripts/deploy-viem.mjs
# Setup parent nodes (after deployment)
node scripts/setup-viem.mjsx402-identity-hub/
βββ contracts/
β βββ X402SubnameRegistrar.sol # Core registrar contract
β βββ X402RegistrarForwarder.sol # Platform-fee payment splitter
βββ packages/
β βββ widget-core/ # Framework-agnostic viem helpers
β βββ widget-react/ # <X402Widget> React component
β βββ embed/ # Script-tag loader β source of truth for public/embed.js
β βββ mcp-server/ # @x402identity/mcp (MCP server)
βββ scripts/
β βββ deploy-viem.mjs # Mainnet deploy script (viem)
β βββ setup-viem.mjs # NameWrapper approval + parent setup
β βββ upload-ipfs.mjs # IPFS folder upload (Pinata)
βββ src/
β βββ app/
β β βββ layout.tsx # Root layout + providers
β β βββ page.tsx # Home page
β β βββ globals.css # Global styles
β βββ components/
β β βββ MintForm.tsx # Main mint UI (single + batch)
β β βββ ConnectButton.tsx # Wallet connect button
β β βββ RecentMints.tsx # Live mint feed
β β βββ SuccessModal.tsx # Post-mint confirmation + share
β β βββ WalletConnectErrorBoundary.tsx
β βββ lib/
β βββ wagmi.ts # wagmi config + connectors
β βββ contracts.ts # Contract addresses + ABI
β βββ parents.ts # Parent node configs (namehashes)
βββ hardhat.config.js
βββ next.config.mjs
βββ tailwind.config.ts
Each minted subname is registered through the ENS NameWrapper at 0xD4416b13d2b3a9aBae7AcD5D6C2BbDBE25686401.
The registrar must be approved as an operator on each parent name before registrations can occur. This is handled once during deployment via setApprovalForAll on the NameWrapper.
Parent node hashes used internally:
402bot.ethβnamehash("402bot.eth")402api.ethβnamehash("402api.eth")402mcp.ethβnamehash("402mcp.eth")
Starting June 1, 2026, the expiry of each parent name (402bot.eth, 402api.eth, 402mcp.eth) will be extended by 10 years every month for the next 10 years β adding 120 years of coverage per year, for a cumulative total of 1,200 years at the end of the 10-year program.
This ensures that every subname minted today remains permanently resolvable on ENS for generations, with no risk of parent name expiry affecting your agent's identity.
π§ x402id@onchain-id.id
MIT