Overview
AutonomiX is a production-style stack for agent discovery and access control: agents are represented as ERC-8004 NFTs with on-chain identity (endpoint + metadata URI) and a simple reputation score. Off-chain agent endpoints can be paywalled with x402 micropayments (USDC), enabling “pay-per-request” access while keeping discovery public.
The repo is organized as a monorepo with smart contracts, an Express backend (metadata/images + x402-protected routes), and a React + Vite frontend that renders the agent gallery and pulls on-chain/off-chain data together.
What it demonstrates
- ERC-8004 agent NFTs: endpoint + metadata URI + on-chain reputation
- Practical bridge between on-chain discovery and off-chain execution (HTTP agent endpoints)
- x402 paywall design: 402 challenge → USDC payment receipt → retry with receipt
- Clean separation of concerns across contract / backend / frontend
- “Production hygiene” patterns: env-driven config, CORS policy, clear route structure
Key features
-
ERC-8004 contract (Base Sepolia)
- agent identity reads:
agentEndpoint,agentMetadataURI,reputationOf,getAgent - admin flows: register agent, update metadata, update reputation (clamped at 0)
- agent identity reads:
-
Backend (Express + x402)
- Serves ERC-721 metadata:
/metadata/agent<ID>.json - Serves images:
/images/agent<ID>.* - Exposes agent endpoints:
/api/agent<N>(optionally protected by x402 USDC) - Can read/write to the contract for operational tasks (e.g., reputation updates)
- Serves ERC-721 metadata:
-
Frontend (React + Vite)
- Agent gallery and detail views
- Reads identity + reputation from contract
- Fetches metadata/images from backend
- Designed to work cleanly against Base Sepolia
AutonomiX targets Base Sepolia for development. Treat it as a production-style reference stack, not a mainnet deployment.
Live demo
Architecture notes
-
On-chain
- The NFT is the discovery anchor: it stores
endpoint+metadataURIand exposesreputationOf. - Reputation is a minimal primitive meant to be updated by controlled operations (admin tools / backend flows).
- The NFT is the discovery anchor: it stores
-
Off-chain
- Metadata/images are public and cacheable.
- Sensitive agent routes can be paywalled using x402 so users pay per request in USDC.
-
x402 flow (conceptual)
- First request returns 402 Payment Required + a payment challenge
- Client pays via facilitator and retries with
X-402-Receipt - Backend validates receipt and serves the response
Quickstart
git clone https://github.com/casaisdev/AutonomiX.gitSee the repo READMEs for full setup (env vars, deployment, and wiring):
- Smart contracts (Hardhat 3, deploy/register/verify on Base Sepolia):
- https://github.com/casaisdev/AutonomiX/tree/main/smart-contract
- Backend (Express, metadata/images, x402 paywall config):
- https://github.com/casaisdev/AutonomiX/tree/main/backend
- Frontend (React/Vite, Base Sepolia config, backend integration):
- https://github.com/casaisdev/AutonomiX/tree/main/frontend
Notes
- Keep discovery public (contract + metadata), and gate execution endpoints with x402 only where needed.
- Do not expose admin/private keys client-side; reputation updates should stay server-side or via admin scripts.
- If you add more agents, keep metadata URIs stable and versioned to avoid breaking discovery for existing tokenIds.
Next steps
If I were to evolve AutonomiX further:
- Add per-agent pricing (different x402 price per endpoint)
- Emit “reputation evidence” events (reason + source) for auditability
- Add session/capability layers on top of x402 (bounded permissions)
- Add analytics dashboards (requests, paid volume, agent usage) without leaking user privacy