← docs

ERC-8004 agent registration and x402 payments

ERC-8004 gives AI agents an on-chain identity: a registry contract stores agent metadata and assigns a unique agent ID. Syenite supports registration on Base, Ethereum, Arbitrum, and BNB Chain, and declares x402 payment support in the same registration document so your agent is discoverable and payment-ready.

what you get

After registering, your agent has a public agent ID (NFT-style) on the chain you chose. Syenite exposes that ID via /.well-known/agent-registration.json. Clients and other agents can discover your MCP endpoint, x402 support, and services from that URL. The Syenite landing page shows an "ERC-8004 Agent" link when AGENT_ID (or AGENT_ID_BASE) is set.

demo: run the registration script

Syenite ships a script that builds and sends the registration transaction. You need a wallet with native gas on the target chain and AGENT_PRIVATE_KEY in .env.

Step 1: Install and configure

From the mcp directory, ensure dependencies are installed. Create or edit .env and set:

AGENT_PRIVATE_KEY=0x...

Use a dedicated wallet for the agent. Do not commit this key.

Step 2: Dry run (no tx sent)

Build the registration payload and see what would be sent. Default chain is Base.

$ npm run register-agent -- --dry-run
$ npm run register-agent -- --chain=ethereum --dry-run

The script loads agentRegistrationJson() from the server (name, description, MCP endpoint, x402 support), encodes it as a data URI, and shows the register(agentURI) call.

Step 3: Submit the transaction

Remove --dry-run to send the transaction to the ERC-8004 registry (0x8004A169FB4a3325136EB29fA0ceB6D2e539a432).

$ npm run register-agent -- --chain=base

After the tx confirms, look up your agent ID on the block explorer (e.g. Basescan) under the registry contract or your address's NFT transfers.

Step 4: Set agent ID and redeploy

Put the numeric agent ID in .env as AGENT_ID (or AGENT_ID_BASE for Base). Redeploy Syenite so /.well-known/agent-registration.json includes your registration.

discovery

GET https://syenite.ai/.well-known/agent-registration.json returns the EIP-8004 registration document: type, name, description, image, services (MCP and web endpoints), x402Support: true, and registrations (agentId and agentRegistry per chain). Clients that support ERC-8004 use this to resolve your agent.

gas

Registration is a single contract call. Use gas.estimate with operations: ["contract_register"] to see current cost on each chain. See Wallet balances and gas estimates.

x402 and agent payments

x402 is an open protocol that uses the HTTP 402 "Payment Required" status code for agent-to-agent and agent-to-service micropayments. Services that support x402 return 402 when a request requires payment; the client sends payment on-chain and retries with proof. Settlement is fast and chain-agnostic (Base, Solana, and others).

Syenite's registration document includes "x402Support": true, which tells discovery clients and wallets that this agent can participate in x402 flows. The MCP endpoint itself is currently free and rate-limited; x402 is a declaration for future payment integration and for appearing in agent directories that filter by payment capability.

To verify: fetch the registration document and check the x402Support field. Agents with both ERC-8004 and x402 are discoverable as payment-capable DeFi tools. DeFi operations (quotes, execution, data) can be monetized per call via this standard — no API keys or billing dashboards required.

Related