ERC-8458 Agent income statement (Agent Income Statements)
Draft · Other · created 2026-10-20
A standard for an income statement that publishes an AI agent's record of ERC-20 token deposits, binding each individual transaction into a Merkle root so anyone can re-verify it directly from on-chain logs alone.
Why it is needed
The income an agent earns from HTTP payment protocols such as x402 is already disclosed on the original chain as token transfer records. But for a lender, marketplace, or explorer to verify an agent's income, they must either simply trust a number someone else computed, or manually scan through every log of the token from scratch. ERC-8004 lets an agent roll up cumulative revenue into a single number (revenues), but that number does not reveal which transactions make it up, what period it covers, or give anyone else a way to re-verify it. Lenders want to use an agent's steady income as grounds for extending a credit line, but without trusting the agent or the aggregator, and without a cheap way to verify, they cannot extend credit.
What to implement
giveFeedback(agentId, value, valueDecimals, tag1, tag2, endpoint, feedbackURI, feedbackHash): The call by which a writer posts an income statement to an agent's ERC-8004 Reputation Registry.Transfer(address indexed from, address indexed to, uint256 value): The signature of an ERC-20 transfer event that can be recognized as a payment.event PaymentProven(uint256 indexed agentId, bytes32 indexed root, bytes32 txHash, uint32 logIndex);: The event emitted when a verifier proves that a specific transaction is included in a Merkle root.function leafHash(Payment calldata payment) external pure returns (bytes32);: Takes payment information and returns the computed Merkle leaf hash for that transaction.function verifyPayment(bytes32 root, bytes32[] calldata proof, Payment calldata payment) external returns (bool);: Verifies whether a specific payment is included under a given root, using a Merkle proof.
In depth
How a statement is published
A writer posts an income statement via giveFeedback(agentId, value, valueDecimals, tag1, tag2, endpoint, feedbackURI, feedbackHash). tag1 is fixed to revenues, the example ERC-8004 gives for cumulative revenue, and tag2 is fixed to x402.statement to distinguish it from other revenues entries. value is the cumulative income through the end of the window, in the asset's base units (bounded by int128, at most 2^127-1), and valueDecimals must equal the asset's decimals (at most 18). feedbackURI must be data:application/json;base64, followed by the standard base64 encoding of the file bytes, and feedbackHash must be the keccak256 of those bytes. The evidence is embedded in the entry itself, so it persists permanently without a server or pinning, and a writer cannot withdraw a statement once posted.
Window boundary rules
The period a statement covers is a window, a span of log positions from (fromBlock, fromLog) to (toBlock, toLog). A window must break at any log where the agent's owner or agentWallet changes (Transfer, MetadataSet), so that every transaction is aggregated against the owner and wallet that were valid at the time it occurred. If a single block contains multiple change logs, transactions between them fall into no window at all. owner and payTo record the registry's ownerOf and getAgentWallet values as is.
Transactions recognized as payments
Only Transfer logs of the asset where to equals payTo and value is nonzero, and from is not the zero address, not payTo itself, and not owner, are counted as payments. Only four cases are excluded, minting, zero-value transfers, payTo's self-transfers, and transfers sent by the owner; everything else is included regardless of sender. For this reason the total is called income, not x402 revenue, and distinguishing a sale from a loan drawdown is left to the reader.
Leaves and the Merkle root
A single leaf is a single payment, with fields payer, amount, paidAt, tx, and log. The leaf hash is the double keccak256 of the abi.encode of ten fields, chainId, asset, agentId, owner, payer, payTo, amount, paidAt, txHash, and logIndex, matching the format expected by OpenZeppelin's MerkleProof. Leaves are ordered by log position, and the root is a binary Merkle tree built by sorting and hashing each pair going up. If there are no leaves, the root is bytes32(0).
Chaining (seq/prev) and the named writer
The statements a single writer posts for a single agent are linked by seq (incrementing by 1 from 1) and prev (the previous statement's feedbackHash), so windows connect without gaps. value is the previous statement's value plus this window's income. An agent's owner can use ERC-8004's setMetadata to designate an address under the incomeWriter key, telling readers which writer to read first. This designation adds no trust; that writer's statements must be verified exactly like any other writer's, and two writers' chains may count the same transaction, so they must not be summed together.
Reader verification: light check and full reconstruction
A reader can verify in two stages. A light check confirms an entry's URI, hash, encoding, and field consistency, a chain's seq/prev and window continuity, window boundaries against change logs, and samples some anchors for factual accuracy, but a statement with genuine anchors and a tampered total can still pass. A full reconstruction directly re-reads the asset's Transfer logs and recomputes every leaf along with received, payers, root, and anchors to compare against the statement, so it verifies without trusting the writer at all.
On-chain verifier
An optional verifier contract implements IIncomeStatementVerifier and ERC-165. leafHash(payment) returns the defined leaf hash, and verifyPayment(root, proof, payment) returns true, and emits a PaymentProven event, only when the payment's amount is nonzero, payer is not the zero address, payTo, or owner, and the Merkle proof is valid. On failure it returns false rather than reverting. The verifier proves membership only; which root to trust is decided by the calling contract.
A proposal that has not yet been finalized
ERC-8458 is currently in Draft status, a proposal still under discussion and subject to change. Detailed rules or figures may still change or be discontinued.
Things to watch out for
- Self-payment: If an agent's owner sends money from a different address to pay its own agent, it passes every verification rule. Readers must separately weight factors such as the number of payers, the maximum payer share, and whether money flows back.
- Settlement contract recorded as the payer: When a payment arrives through an escrow, batching contract, bridge, or solver, the leaf's payer becomes that contract's or solver's address, which can obscure the actual payer or a self-payment hidden within it.
- The owner's other addresses: The payment rule excludes only transfers from the owner's own address, so money the owner sends via another address or a bridge on a different chain cannot be distinguished from a genuine payer's money using the logs alone.
- Transfers that are not sales: Loan drawdowns, swap proceeds, refunds, and the like all pass the payment rule as well, so leaves alone cannot reveal what is actually sales income. A party assessing credit must separately filter out known addresses such as lenders.
- Light checks and planted entries: A light check is only the writer's claim, and a statement with genuine anchors and a tampered total can still pass. Because anyone can call giveFeedback, anyone can plant a statement that looks valid, so readers should read only from trusted writers or limit the number of read requests.