Skip to content

RWA-ID/x402-Identity

Repository files navigation

x402 Identity Hub

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


Overview

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.

Available Namespaces

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

Smart Contract

X402SubnameRegistrar — deployed on Ethereum mainnet.

0xeb9e9ea385fe28b51a3f9a7d93fb893e0a1f9633

The registrar interacts directly with the ENS NameWrapper contract to issue permanent subnames. Key functions:

Function Description
register(node, label, owner) Mint a single subname
batchRegister(node, labels[], owner) Mint multiple subnames in one tx
isAvailable(node, label) Check if a subname is available
withdrawFees(token) Owner: withdraw accumulated ETH

Mint fee: 0.005 ETH per name
Batch: Up to 10 names per transaction


Tech Stack

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
Hosting IPFS (Pinata) · ENS contenthash

Hosting

The frontend is a static export (next buildout/) pinned to IPFS and served via the x402id.eth ENS contenthash. No centralized server required.

IPFS CID: bafybeic5qzvqbkpc6f2xsz7qukx2gxyyvbj2whlhciwqq7a42h3djztkp4

https://ipfs.io/ipfs/bafybeic5qzvqbkpc6f2xsz7qukx2gxyyvbj2whlhciwqq7a42h3djztkp4/

Local Development

Prerequisites

  • Node.js 18+
  • An Alchemy API key
  • A WalletConnect project ID (from cloud.reown.com)

Setup

git clone https://github.com/RWA-ID/x402-Identity.git
cd x402-Identity
npm install

Create .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=1
npm run dev

Open http://localhost:3000.

Build for Production

npm run build
# Output: ./out/ (static export ready for IPFS)

Contract Development

# 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.mjs

Project Structure

x402-identity-hub/
├── contracts/
│   └── X402SubnameRegistrar.sol   # Core registrar contract
├── 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

ENS Infrastructure

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.ethnamehash("402bot.eth")
  • 402api.ethnamehash("402api.eth")
  • 402mcp.ethnamehash("402mcp.eth")

Parent Name Longevity Commitment

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.


Contact

📧 x402id@onchain-id.id


License

MIT

About

Mint permanent ENS sub domains for AI agents under 402bot.eth | 402api.eth | 402mcp.eth No renewal, Parent Cannot Control giving minters true ownership.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors