ERC-8478: x402 Payee Verification for ERC-8004 Agents
Lets a paying agent prove that an x402 payTo belongs to the ERC-8004 agent it means to pay, before it signs the payment
Abstract
An agent that pays another agent over the x402 Hypertext Transfer Protocol (HTTP) payment flow receives a payTo
address in the server's 402 Payment Required answer and signs a payment to it. Nothing today ties that address to
the paid agent's ERC-8004 identity: whoever controls the HTTP answer chooses where the money goes.
This proposal defines (1) how an x402 payment requirement names the ERC-8004 identity it is paid to, (2) a payee
binding: the payTo is the identity's registered agent wallet, or the agent wallet signed an
EIP-712 payee delegation naming that payTo, and (3) a verification procedure a payer, wallet,
facilitator or third-party checker runs before the payment is signed, with a fixed set of outcomes checked in a fixed
order. The outcome is a fact about the binding, read at a stated block; it is never a score, and not read is never
the same as verified or mismatch.
Motivation
x402 lets a client pay for an HTTP resource with a signed stablecoin transfer. The server's 402 answer lists what it
accepts: a network, an asset, an amount and a payTo. The client signs a transfer to that payTo. For a person
clicking "pay" in a browser that is the same trust as any checkout page. For an agent that pays other agents without a
person reading each payment, it is a gap:
- The HTTP answer is the only source of
payTo. A compromised server, a hijacked domain, a reverse proxy, a malicious middleware, or an injected instruction in a tool result can change it. The payment still settles, the resource may even be delivered, and the money is gone. - ERC-8004 already has the right anchor and nobody checks it. An ERC-8004 identity has an agent wallet, the
address where the agent receives payments. It is the owner's address when the identity is registered, it can be
changed only with a signature of the new wallet, and it is cleared to the zero address when the identity is
transferred or the owner calls
unsetAgentWallet. No rule says a payer should compare it withpayTo. - Measured on one chain, the binding almost never holds today. On one chain (chain id 4663) the ERC-8004
identity registry held 20,228 agents on 2026-10-31. 5,591 of them answered with an x402 payment requirement. In 5 of
those,
payTowas the agent wallet. In 5,584, all run by one operator,payTowas the identity's owner whilegetAgentWalletreturned the zero address. Such a seller is not shown to be wrong, but nothing on chain says the agent stands behind that address today, and a payer cannot tell it from a substituted one. The same operator could instead receive into one treasury for all its agents; that is the case a delegation covers, so that a payer can tell a treasury the agent authorised from an address nobody did.
A payer cannot fix this alone, because it cannot tell a legitimate payee from a substituted address. The seller cannot fix it alone, because a payer has no rule to check against. This proposal gives both sides the same rule.
ERC-8004 defines the identity and the agent wallet but not how payments bind to them.
Specification
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 and RFC 8174.
Terms
- Seller: the ERC-8004 agent that serves an x402 resource and is paid for it.
- Payer: the party that signs the payment (an agent, its wallet, or a person).
- Checker: whoever runs the verification in this proposal: the payer itself, its wallet, the facilitator, or a third-party service the payer asks.
- Identity registry: an ERC-8004 identity registry, named by chain id and address.
- Agent wallet: the address
getAgentWallet(agentId)returns in the identity registry. No agent wallet registered means that it returns the zero address. Under ERC-8004 this is the state after the identity is transferred, or after the owner callsunsetAgentWallet, untilsetAgentWalletis called again. - Registration file: the document the identity's
agentURI(ERC-8004's name fortokenURI(agentId)) resolves to. - EVM network: a network whose CAIP-2
namespace is
eip155, that is, a chain that runs the Ethereum Virtual Machine (EVM). - Contract code: the code
eth_getCodereturns for an address atBon the registry's chain, unless it is empty or exactly the 23-byte EIP-7702 delegation indicator (0xef0100followed by a 20-byte address). Any other code, including code of another length that starts with0xef0100, is contract code. An address whose code is empty or exactly the indicator has no contract code. - x402 answer: the payment-required object a server returns with HTTP status 402 under the x402 payment protocol,
version 2 (
"x402Version": 2). This proposal relies only on these members, and ignores the others:resource.url, at the top level of the answer: the URL of the paid resource;accepts: the list of payment requirements.
- Payment requirement: one entry of
accepts. This proposal relies only on these members:scheme: the payment scheme, for example"exact";network: the CAIP-2 identifier of the network the payment is made on, for example"eip155:8453";asset: the asset paid; on an EVM network, the token contract address in 0x hex;amount: the amount asked, a decimal string in the asset's smallest unit;payTo: the payee; on an EVM network an address in 0x hex, otherwise the network's own address form;extra: an object for scheme-specific data, to which section 1 adds the keyerc8004.
Addresses in 0x hex are compared case-insensitively. Other values are compared as exact strings unless a rule says otherwise.
1. Naming the seller's identity
A seller that supports this proposal MUST name its ERC-8004 identity in every payment requirement, inside the entry's
extra object, under the key erc8004:
{
"x402Version": 2,
"resource": { "url": "https://example.com/api/thing" },
"accepts": [
{
"scheme": "exact",
"network": "eip155:4663",
"asset": "0x…",
"amount": "50000",
"payTo": "0x…",
"extra": {
"erc8004": {
"registry": "eip155:4663:0x8004A169FB4a3325136EB29fA0ceB6D2e539a432",
"agentId": "20030",
"delegation": null
}
}
}
]
}
registryis a CAIP-10 account id: the chain and address of the identity registry, in the same form as ERC-8004'sagentRegistry. It MAY be on a different chain thannetwork.agentIdis the token id as a decimal string.delegationis eithernullor a payee delegation (section 3), REQUIRED whenpayTois not the agent wallet.
A payer MAY also learn the identity some other way (it chose the seller from a directory by agentId, or the
seller's registration file lists the resource).
2. The payee binding
A payment requirement is bound to the identity (registry, agentId) at block B of the registry's chain when all
of the following hold:
- Endpoint: the resource's origin (scheme, host and port of
resource.url, or of the URL the payer requested when the answer has noresource.url) is listed among the endpoints of the registration file: theendpointvalues of itsservicesentries. An origin matches when an endpoint URL in the file has the same scheme, host and port. Host comparison is case-insensitive and on the ASCII (punycode) form. The checker readsagentURIatBand fetches the document it resolves to when the check runs (adata:URI is decoded in place), because an off-chain document cannot be read at a past block. ERC-8004's optional Endpoint Domain Verification neither satisfies nor replaces this condition. - Payee: one of
- (a) the agent wallet at
Bis not the zero address,payToequals it, and eithernetworkis the registry's chain, ornetworkis an EVM network and the agent wallet has no contract code (one key controls an externally owned account's address on every EVM network); or - (b) the requirement carries a payee delegation (section 3) that is valid at
Bfor thispayTo,network,assetand origin.
- (a) the agent wallet at
The endpoint condition stops a server that is not the agent from claiming the agent's identity. The payee condition stops anyone who is not the agent from choosing where the agent's payments go.
3. Payee delegation
A seller whose payments go to an address other than its agent wallet (a treasury, a splitter, a payment processor, a wallet on another network) authorises it with an EIP-712 signature by the agent wallet:
struct PayeeDelegation {
uint256 chainId; // chain of the identity registry
address registry; // the identity registry
uint256 agentId;
address agentWallet; // the agent wallet that signs
uint64 walletSetAt; // block number of the MetadataSet event that set agentWallet as the agent wallet
string network; // CAIP-2 network of the payment, e.g. "eip155:8453"
string payTo; // the payee as the payment requirement writes it (0x hex or another network's form)
string asset; // the asset as the payment requirement writes it; "*" = any asset on that network
string origin; // "https://host[:port]"; "*" = every endpoint origin in the registration file
uint64 validAfter; // unix seconds
uint64 validUntil; // unix seconds
bytes32 nonce; // makes otherwise identical delegations distinct; checkers do not track it
}
EIP-712 domain: name = "x402 Payee Delegation", version = "2", chainId and verifyingContract = the
identity registry's chain id and address.
In the payment requirement, extra.erc8004.delegation is { "message": <PayeeDelegation as JSON, integers as decimal strings>, "signature": "0x…" }.
The wallet setting event. This proposal assumes an identity registry that emits ERC-8004's
MetadataSet(agentId, "agentWallet", "agentWallet", metadataValue) every time the agent wallet changes: in
register, in setAgentWallet, in unsetAgentWallet, and when a transfer clears it. A checker decodes
metadataValue as an address when it is 20 bytes (the address itself) or 32 bytes (the address left-padded with
zeros, as ABI-encoded); empty bytes and the zero address mean no agent wallet. walletSetAt is the block number of
the event that set the signing wallet as the agent wallet. It binds the delegation to that one setting, so that
rotating the agent wallet away and back does not revive delegations signed before the rotation.
A delegation is valid at block B when every rule below holds. A checker evaluates the rules in this order and
stops at the first that fails; its name is reported as delegationRule (section 4):
identity: the message'schainId,registryandagentIdname the identity the requirement names.agent-wallet:agentWalletequals the agent wallet atB(so rotating the agent wallet revokes every delegation it signed).wallet-set-at: the checker reads the latestMetadataSetevent for thisagentIdand the keyagentWalletat or beforeB. If no such event can be read, itsmetadataValuecannot be decoded as above, or the decoded address differs from the agent wallet atB, the checker cannot tell which setting is in force, and the outcome isnot-readwithnotRead=wallet-event. Otherwise the event's block number MUST equalwalletSetAt.window:validAfter < validUntil,validUntil - validAfteris at most 7,776,000 seconds (90 days), andvalidAfter <= t < validUntil, wheretis the checker's current time.network: the message'snetworkequals the requirement'snetwork.pay-to: the message'spayToequals the requirement'spayTo.asset: the message'sassetequals the requirement'sasset, or the message'sassetis"*"."*"waives only this rule;networkandpayToare always compared.origin: the message'soriginequals the resource's origin (compared as in section 2), or is"*".not-declared: the requirement'snetworkandpayToappear together in one entry ofpayeesin the registration file (section 6). A registration file with nopayeeslist, or an empty one, declares no payee, so no delegation is valid against it.signature: whenagentWallethas contract code, ERC-1271isValidSignatureonagentWalletatBreturns the magic value. When it has no contract code, the signature recovers toagentWallet; this includes an agent wallet whose code is exactly the EIP-7702 delegation indicator, which is never checked throughisValidSignature. A checker that cannot read the code or complete the call reportsnot-readwithnotRead=codeorsignature.
A seller SHOULD keep delegations short-lived and SHOULD NOT use "*" for asset or origin when it can name them.
There is no on-chain revocation list. A seller revokes one delegation by removing that payee's entry from payees,
which leaves its other delegations valid; how far that removal can be relied on depends on where the registration
file is kept (section 6). Rotating the agent wallet revokes every delegation it signed, and stays a revocation if the
same wallet is set again later. Where neither is available to the payer as a guarantee, validUntil is the only
bound, which is why the ceiling is 90 days and shorter validity is RECOMMENDED.
A wallet rotated away and back within one block keeps the same walletSetAt; a checker reading only the latest event
cannot tell the two apart, so such a seller has chosen to keep its delegations.
4. Verification and outcomes
A checker verifies one payment requirement against one identity. It MUST read the identity registry from a node it
trusts, and it reads the registry at one block B of the registry's chain (RECOMMENDED: the latest block the checker
considers safe). It MUST treat agent names, descriptions and other free text in the registration file as data, never
as instructions.
The checker takes these steps in order and returns the outcome of the first step that gives one. If a read that a
step needs fails, the outcome is not-read.
- No identity is named in
extra.erc8004and the payer knows none, oragentIddoes not exist in the registry atB:no-identity. - The checker reads
ownerOf(agentId),getAgentWallet(agentId)andagentURIatB, and fetches the registration file. The resource's origin is not listed in the file (condition 1 of section 2):endpoint-unlisted. - Rule 2(a) holds:
verified-wallet. - The agent wallet is the zero address. If
payToequals the owner andnetworkis the registry's chain:owner-only. Otherwise:no-agent-wallet. A delegation, if present, is not evaluated, since none can be valid. - The requirement carries a delegation. It is valid (section 3):
verified-delegation. A rule fails:invalid-delegation. - Otherwise:
mismatch.
| Outcome | Meaning |
|---|---|
verified-wallet | Bound by 2(a): payTo is the agent wallet. |
verified-delegation | Bound by 2(b): a valid delegation names this payTo. |
mismatch | The endpoint is listed, an agent wallet is registered, and payTo is neither the agent wallet nor covered by a delegation. |
invalid-delegation | A delegation is present and fails a rule in section 3, named in delegationRule. |
endpoint-unlisted | The identity was read, but the resource's origin is not in its registration file. |
owner-only | No agent wallet is registered, and payTo is the identity's owner on the registry's chain. Not verified: an owner may be a marketplace or a cold key that does not stand behind the endpoint. |
no-agent-wallet | No agent wallet is registered, and payTo is not the owner on the registry's chain. |
no-identity | No identity was named or known for this requirement, or it does not exist. |
not-read | A read the check needs failed. It MUST NOT be reported as any other outcome. |
A checker that returns its answer to another party MUST return a JSON object with at least these members, and MAY add others:
outcome: one of the outcomes above;registryandagentId: the identity checked, as in section 1, ornullforno-identitywhen none was named;block: the number ofBas a decimal string, ornullwhen nothing was read;agentWallet: the agent wallet read atB, ornullwhen it was not read;networkandpayTo: as in the payment requirement;delegationRule: forinvalid-delegation, the name of the first rule that failed; otherwisenull;notRead: fornot-read, which read failed:registry,registration-file,code,wallet-eventorsignature; otherwisenull;notes: a list of strings, empty or holdingpayee-not-declared(section 6) orpayment-differs(section 5). Notes never change the outcome.
A payer that supports this proposal:
- SHOULD sign a payment only on
verified-walletorverified-delegation; - MUST NOT treat
not-readas verified; - SHOULD NOT treat
owner-onlyas verified; a seller in that state reachesverified-walletby calling ERC-8004'ssetAgentWalletwith a signature of the wallet, which may be the owner's own address; - MUST, if its own policy pays on another outcome, record which outcome it paid on.
A facilitator MAY run the check and MAY refuse to settle a payment whose requirement is mismatch, but a payer MUST
NOT rely on a facilitator's check alone when the facilitator was named by the same 402 answer it is checking.
5. Signed payment
When the payer has already signed the payment, the checker SHOULD compare it with the requirement. The comparison
fails when the signed recipient differs from payTo, or the signed value is greater than the requirement's amount.
For an ERC-3009 authorization, the recipient is its to and the value its value. A failed
comparison is reported in notes as payment-differs. This catches a requirement that was checked and a payment
that was built from a different one.
6. Discovery
A seller lists, in its registration file, under its x402 service, the payees it may use and the delegations that
authorise them, so that a directory or checker can verify the seller before any payment is asked. A seller that uses
a delegation MUST list the delegated payee (its network and payTo); a seller paid only at its agent wallet SHOULD
list it:
{
"services": [
{
"name": "x402",
"endpoint": "https://example.com/api/thing",
"payees": [
{ "network": "eip155:4663", "payTo": "0x…" },
{ "network": "eip155:8453", "payTo": "0x…", "delegation": { "message": { }, "signature": "0x…" } }
]
}
]
}
The list binds delegations. A delegation is valid only for a network and payTo that appear together in one
entry of payees (rule not-declared of section 3); the entry need not carry the delegation itself, which may
arrive in the 402 answer. network is compared as a CAIP-2 identifier. A payee that is absent, an empty list, or a
file with no list gives invalid-delegation. Removing one entry therefore revokes the delegation for that payee and
leaves the seller's other delegations valid.
How far a removal can be relied on. Whoever controls where the registration file is served cannot forge a
delegation, but can serve an earlier copy of the file in which a removed entry is still present, for as long as that
delegation is unexpired. A removal is tamper-proof only when the identity's agentURI is content-addressed (for
example ipfs:// with the content identifier) or a data: URI, because then only a registry transaction by the
identity's owner or an approved operator can change what the file says. For a file served over HTTPS, validUntil
remains the only bound a payer can rely on. The same host can also remove entries and so stop valid payments; that
fails closed.
Rule 2(a) does not depend on the list. For any outcome, a checker that reads a payees list, including an empty
one, and finds the requirement's network and payTo absent from it SHOULD add payee-not-declared to notes. The
402 answer remains what a payment is made against.
Rationale
- Why the agent wallet and not the identity owner. ERC-8004 makes the agent wallet the address where the agent
receives payments. It starts as the owner's address, so a seller paid at its owner is
verified-walletwith no extra step. It changes only with a signature of the new wallet, and it is cleared when the identity is transferred, so a new owner does not inherit a payee binding. When it has been cleared, the owner is still on chain, but the owner may be a cold key, a multisig or a marketplace contract that never receives payments, soowner-onlyis reported apart and is not verified. - Why a signed delegation and not an on-chain list. Many sellers receive into a shared treasury or on several networks. An off-chain EIP-712 delegation costs nothing to issue, works for payees on networks the registry is not on, and is checked with one signature recovery. Rotating the agent wallet revokes all of them at once.
- Why
walletSetAtand not wallet equality alone. Equality with the current agent wallet revokes on rotation, but revives every unexpired delegation if the old wallet is set again. Binding the block of the setting event is a revocation epoch that needs no new contract storage. A checker that finds the latest event disagreeing with the stored agent wallet reportsnot-readrather than guess which setting is in force. - Why the
payeeslist binds a delegation. A delegation travels in every 402 answer, so anyone can keep a copy, and it verifies untilvalidUntil. If the key to a receiving address leaks, or a payment processor is let go, whoever holds that address and can change the 402 answer presents the old delegation and is verified. Without a binding list the only remedy short of waiting is a new agent wallet setting, which voids every delegation on every network at once. With it, removing one entry revokes one delegation. The cost is that a new payee needs a file update as well as a signature. - Why 90 days. For a registration file served over HTTPS,
validUntilis the only bound a payer can rely on (section 6), so the ceiling is the longest a lost payee can keep verifying. - Why the EIP-7702 indicator is not contract code. Rule 2(a) accepts an agent wallet on other EVM networks because one key controls an externally owned account's address on all of them. An account that has set an EIP-7702 delegation on the registry's chain is still controlled by that key everywhere; testing only for empty code would make such a seller sign a delegation to its own address for every other network. For the same reason its delegations are checked by signature recovery only: the key is what controls the account on every network, and one path keeps two checkers from disagreeing.
- Why the endpoint condition. Without it, any server can name a well-known agent's identity, set
payToto that agent's wallet and pass the payee check while serving nothing; worse, a payer would credit that agent with the delivery. Binding the resource's origin to the registration file closes this. ERC-8004's Endpoint Domain Verification proves the other direction, that a domain names the agent; a server that is not the agent can publish that file too, so it does not count here. - Why the registration file is fetched at check time. Only the
agentURIitself is on chain. For an HTTPS file a checker cannot fetch the copy that was served atB; for a content-addressed ordata:URI the URI read atBfixes the content, and the two readings agree. - Why a fixed check order. Several conditions can fail at once. Fixing the order makes two checkers return the same outcome for the same input. The endpoint comes first because a server the agent does not list says nothing about the agent's payments. A missing agent wallet comes before the delegation because no delegation can be valid then, and the missing wallet is what the seller has to fix.
- Why fixed outcomes and no score. A payer applies its own policy; a checker's job is to say what holds. Keeping
not-readseparate stops a failed read from turning into a pass or a fail. - Why
extra. x402 payment requirements already carry anextraobject for scheme-specific data; using it keeps existing clients working unchanged.
Backwards Compatibility
Sellers that do not add extra.erc8004 keep working, and payers that do not check are unaffected. A payer that
checks gets no-identity for such sellers unless it knows the identity another way, and decides by its own policy.
Registration files without payees stay valid for sellers paid at their agent wallet (rule 2(a)); a seller that uses
delegations needs a payees list. This proposal adds no contract and changes no ERC-8004 registry.
Test Cases
These cases follow from the Specification:
registeralone: the agent wallet is the owner, set by theMetadataSetevent right afterRegistered; apayToequal to it isverified-wallet.registerandsetAgentWalletin one transaction, andregister, transfer,setAgentWallet: the latest event carries the stored agent wallet, sowalletSetAtis that event's block.- An
onERC721Receivedcallback that sets, unsets or transfers insideregister: the latest event disagrees with the stored agent wallet, so a delegation isnot-read(wallet-event). - A delegation by
AwithwalletSetAt= the blockAwas set; the agent wallet rotates to another wallet and back toA: the latest setting is a later block, so the delegation isinvalid-delegation(wallet-set-at). The same delegation with no rotation isverified-delegation. - The window: a delegation of exactly 90 days is valid; one of 90 days and one second, or of 365 days, is
invalid-delegation(window) at any time. - The
payeeslist: a listed payee is valid; a list that does not name the payee, names itspayTofor another network, is empty, or is absent givesinvalid-delegation(not-declared). asset"*": it covers another asset for the samenetworkandpayTo, and never anotherpayTo.- The check order: an unlisted endpoint with an invalid delegation is
endpoint-unlisted; a zero agent wallet with apayToequal to the owner isowner-only, and with a delegation present isno-agent-wallet. - EIP-7702: an agent wallet whose code on the registry's chain is exactly the 23-byte indicator, or empty, is
verified-walleton another EVM network; 24 bytes starting with0xef0100are contract code (mismatchwithout a delegation).
Every case except the first two is given in one or more of eighteen complete vectors (registration file, agent wallet, owner,
agent wallet code, latest setting event, requirement, signed delegation, checker time and expected answer) in
vectors.json. The delegations are signed with a public development key.
Reference Implementation
A checker needs no contract: it reads the identity registry and the registration file and follows section 4. The
vectors in vectors.json give its inputs and expected answers.
Security Considerations
- The registry chain is the trust root. A checker must read the identity registry from a node it trusts; a lying remote procedure call (RPC) endpoint can return any agent wallet.
- Registration file hosting. The registration file is fetched over HTTP or the InterPlanetary File System (IPFS).
An attacker who controls the file's host can list its own origin as an endpoint, but cannot change the agent wallet
or forge a delegation, so it can at most redirect where a resource is served, not where payment goes. It can,
however, undo a revocation: by serving a copy of the file in which a removed
payeesentry is present again, it keeps that payee's unexpired delegation verifying. Only a content-addressed ordata:agentURImakes a removal final (section 6); otherwise the 90-day ceiling bounds it. A payer that needs more should prefer sellers whoseagentURIis content-addressed. - A lost payee. If a receiving address is lost or a processor is let go while its delegation is unexpired, the
seller removes that entry from
payees. Where the file's host is not trusted to keep it removed, the seller sets a new agent wallet, which voids every delegation. - Externally owned accounts across chains. Rule 2(a) accepts the agent wallet on another EVM network only when it
has no contract code on the registry's chain. A contract wallet at the same address on another chain may be
controlled by someone else, so such payees need a delegation. The EIP-7702 indicator is matched exactly (23 bytes):
code that merely begins with
0xef0100is treated as contract code. - Registries that do not emit every setting. On an identity registry that does not emit
MetadataSetfor every change of the agent wallet, a rotation away and back with no event cannot be seen, and delegations signed before it revive. Rule 2(a) does not use the event. - Key compromise. If the agent wallet key is compromised, the attacker can sign delegations to its own address.
The remedy is the ERC-8004 owner setting a new agent wallet, which voids every earlier delegation, including when
the old wallet is set again later (
walletSetAt). - Lookalike addresses. Comparison is on the full address, never on a prefix or suffix. Checkers that echo addresses to a person should show them in full.
- Untrusted text. Agent names and descriptions in registration files are written by the seller and can carry instructions aimed at an agent reading them; section 4 requires checkers to treat them as data, and payers should do the same.
Copyright
Copyright and related rights waived via CC0.