ERC-8478 x402 payment recipient verification (x402 Payee Verification for ERC-8004 Agents)
Draft · Signatures & auth · created 2026-10-30
The procedure by which, before an agent pays another agent via x402, it checks whether the payTo address in the payment request is a wallet registered to the counterparty's ERC-8004 identity, or an address that wallet has delegated to via signature.
Why it is needed
In x402 payments, the client sends money to the payTo address returned in the server's 402 response. Until now there has been no way to verify that this address truly belongs to that agent. If the server is hacked, the domain is hijacked, or a proxy or malicious middleware in between alters the response, the payment still goes through and the resource is still delivered, but the money goes elsewhere. ERC-8004 defines an 'agent wallet' for each agent to receive payments, but no one has compared payTo against this wallet. In fact, on one chain, as of October 31, 2026, of 20,228 agents, 5,591 returned x402 payment requirements, and only 5 had a payTo matching their agent wallet; 5,584 were run by a single operator whose payTo was the owner address while the agent wallet sat empty. Neither the payer nor the seller alone can close this gap.
In depth
How identity is declared
The seller discloses its ERC-8004 identity by including an erc8004 key inside the extra object of each x402 payment requirement. registry holds the identity registry's chain and address in CAIP-10 format, and agentId holds the token id as a decimal string. If payTo is not the agent wallet, delegation information must be included in the delegation field. If the payer already knows the identity through another channel such as a directory, this field can be omitted.
Conditions for a payment requirement to be bound to an identity
For a payment requirement to be considered bound to identity (registry, agentId) at a specific block B, two conditions must both hold. First, the endpoint condition: the origin (scheme, host, port) of the requested resource must be in the list of service endpoints in the agent's registration file. Second, the recipient condition: payTo must either match the agent wallet at that block (including cases with no contract code on other EVM networks) or there must be a valid delegation pointing to that payTo. The endpoint condition prevents a server that is not the agent from impersonating the identity, and the recipient condition prevents someone other than the agent from setting the payment destination.
Structure of the delegation (PayeeDelegation)
To authorize a payment to an address other than itself (a treasury, a payment processor, etc.), the agent wallet creates a PayeeDelegation via an EIP-712 structured signature. This includes the registry's chain and address, the agentId, the signing agent wallet, the block number at which that wallet was set (walletSetAt), the network and payTo where the payment will occur, the asset (or * meaning any asset), the allowed origin (or * meaning any origin), the valid start and end times, and a distinguishing nonce. This signature is carried as a message and signature value in extra.erc8004.delegation of the payment requirement.
walletSetAt and handling of wallet replacement
When checking whether a delegation is valid, the checker checks several rules in a defined order and stops at the first rule that fails. Among them, the wallet-set-at rule requires finding the most recent MetadataSet event, which ERC-8004 emits whenever the agent wallet changes, before block B, and requires that event's block number to match the walletSetAt recorded in the delegation. This is a safeguard so that a delegation signed while the wallet was pointed elsewhere does not automatically come back to life if the wallet is later switched back to the same address. If the event cannot be read or parsed, the result becomes not-read.
Verification procedure and result values
The checker reads the registry at a single block B through a trusted node and proceeds through steps in a defined order, returning the result of whichever step produces an answer first. The result is one of verified-wallet (the recipient is the agent wallet), verified-delegation (a valid delegation points to that payTo), mismatch, invalid-delegation (a delegation rule was violated), endpoint-unlisted, owner-only (the wallet is empty and payTo is the owner), no-agent-wallet, no-identity, or not-read. The payer should only sign when the result is verified-wallet or verified-delegation, and must not treat not-read or owner-only as verified.
Cross-checking against the signed payment
If the payer has already signed the payment, the checker should compare that payment against the payment requirement. If the signed recipient differs from payTo, or the signed amount exceeds the requirement's amount, the comparison is treated as failed and recorded in notes as payment-differs. For ERC-3009 style authorizations, the recipient is read from the to field and the amount from the value field. This catches cases where the requirement that was verified and the payment that was actually created came from different requirements.
The payees list and delegation revocation
A delegation is valid only if the network and the payTo address appear together in the registration file's payees list. A payee not in the list, an empty list, or a file with no list at all all make the delegation invalid. If the seller removes an entry from payees, only that payee's delegation is revoked and the rest remain valid. However, if the registration file is served over HTTPS, whoever controls the file can re-publish an old version that still contains the removed entry and undo the revocation, which makes validUntil the only limit that can be trusted. Revocation becomes certain only when agentURI is content-addressed (e.g. ipfs://) or a data: URI.
Proposal status
This proposal is still in Draft status. Detailed rules or field composition may change going forward, or discussion may stall without reaching adoption.
Things to watch out for
- The registry chain is the root of trust: The checker must read the identity registry through a node it trusts. An RPC node that lies can return any agent wallet it likes.
- Registration file hosting risk: An attacker who controls the host of a registration file can insert their own origin as the endpoint, but cannot change the agent wallet or forge a delegation. However, they can re-publish an old file that still contains a removed payees entry and undo the revocation.
- Wallet key leakage: If an agent wallet's key leaks, an attacker can sign a delegation to their own address. If the owner sets up a new agent wallet in ERC-8004, all previously signed delegations are invalidated.
- Similar-looking addresses: Address comparison must always be done on the full address, never by comparing only the beginning or end. When showing an address to a person, the full address must be shown as well.
- Untrusted text: The agent name or description in a registration file is written directly by the seller, so it may contain embedded instructions. Checkers and payers must treat this only as data, never as instructions.