ERC-8466 Agent Credit History
Draft · Vaults & DeFi · created 2026-10-20
A credit history standard that records loan origination, repayment, delinquency, and default outcomes with standard tags on top of the ERC-8004 reputation registry, so anyone can reconstruct and verify that history from the lender's on-chain logs alone.
Why it is needed
The ERC-8004 reputation registry lets anyone leave feedback for an agent, but most feedback is opinion, so faking it costs nothing. Loan repayment, on the other hand, is the result of money actually having moved, and that record already sits on chain. Because every lender currently keeps credit records in its own format, a good repayment history built up with one lender is invisible to another. Lenders also use incomparable values such as different scoring scales, counts, and amounts. Since agents take out small loans frequently, recording every single loan in the registry would also bury other reputation information.
What to implement
event AssociationCreated(bytes32 indexed hash, bytes32 indexed initiator, bytes32 indexed approver, SignedAssociationRecord sar);: An event emitted when a new association record is stored (defined by ERC-8092).event AssociationRevoked(bytes32 indexed hash, bytes32 indexed revokedBy, uint256 revokedAt);: An event emitted when an association record is revoked (defined by ERC-8092).function storeAssociation(SignedAssociationRecord calldata sar) external;: Stores an association record signed by the loan contract and the author on chain.function revokeAssociation(bytes32 hash, uint40 revokedAt) external;: The author, the loan contract, or its owner revokes a stored association.function sourcesOf(address writer) external view returns (bytes32[] memory associationHashes);: Returns the list of hashes for all sources associated with a specific author.function getAssociation(bytes32 hash) external view returns (SignedAssociationRecord memory);: Looks up the full association record stored under a hash.
In depth
Two Feedback Tags
The author calls only ERC-8004's giveFeedback(agentId, value, valueDecimals, tag1, tag2, endpoint, feedbackURI, feedbackHash), with no new contract. tag1 is either credit.statement (for a periodic settlement) or credit.defaulted (on a default), and tag2 indicates the collateral class. feedbackURI must be data:application/json;base64, followed by the base64 of the file's bytes, so the file is carried in the entry itself and persists permanently without a server. feedbackHash must be the keccak256 of those bytes. The author cannot revoke a credit entry, uses a credit-only address, and cannot use it for an agent it owns itself.
Source Contract and Three Events
For each source a leaf came from, the file declares chainId, an ERC-55 checksummed contract, blocks (the first and last block, or null if ongoing), and the exact signatures of the three events open, repaid, and defaulted. All three events must have uint parameters named loanId and agentId and an amount parameter pointed to by fields.amount, and the open event must also have a maturity timestamp pointed to by fields.dueAt. Readers must not narrow the log scan range using the blocks the author wrote; they may only narrow it using the range from a manifest they trust. A loan contract that does not emit these events cannot be verified under this profile.
Leaves and the Merkle root
A leaf is one loan closed by a repaid or defaulted log. It holds loan, amount, dueAt, closedAt, outcome (1 on-time repayment, 2 late repayment, 3 default, 4 reserved in v1), tx, log, and so on. leafHash is the value obtained by abi.encoding chainId, contract, agentId, loanId, amount, dueAt, closedAt, outcome, txHash, logIndex and then applying keccak256 twice. Leaves are ordered by closing block and log order, and the root is computed as a binary Merkle tree that hashes each sorted pair; if there are no leaves, the root is bytes32(0).
Statement file structure
Statements form a chain via seq (starting at 1, incrementing by 1) and prev, which points to the previous statement's feedbackHash; window.fromBlock must equal the previous statement's toBlock+1. closed is split into counts and amounts for on-time, late, default, and recovered (recovered is always 0 in v1), and classes breaks these down further by collateral type. anchors record a subset of the most recent leaves in the window in full (5 recommended) so individual proofs can be run on-chain. The file uses JCS canonical encoding and must not exceed 8,192 bytes, 16 sources, or 16 anchors.
Default files and the 24-hour rule
When a loan defaults, the writer must post a credit.defaulted entry within 24 hours, and the statement for the window containing that default must include it in its totals. Default files use the same ERC-8004 fields as statement files, holding the one relevant source and the full default leaf under credit. Because of this rule, even if a writer stops posting settlements, a reader scanning the logs since the last window can catch an unreported default against the 24-hour standard.
Writer obligations and omission detection
Writers must post each agent's windows so they continue unbroken from the first statement, must post at least one statement every 30 days while a loan is open or closed, and must never reuse the same seq. Readers follow the (writer, agent) chain and treat revoked entries, missing seq values, prev mismatches, broken windows, statements that omit a declared source, and changes in asset or decimals as failures on the writer's part. They must also scan the logs since the last window to check for unreported defaults.
Light checks and full rebuilds
A light check only verifies a sample via a handful of calls per statement, so a statement with a genuine anchor but fabricated totals can still pass. A full rebuild recomputes, from the complete logs of every source the chain declares (and any manifest sources), the leaves, the leaves array, the root, the four totals, opened, outstanding, and whether the anchor is actually the window's latest leaf. Rebuilding without a manifest only shows that the statement matches the logs of the sources the writer declared; it gives no guarantee that those sources actually belong to the real lender. Readers must choose which writers to trust themselves, and should only count reconstructed totals as verified for writers that have a manifest.
ERC-8092 on-chain manifests
Optionally, an ERC-8092 Associated Accounts record signed by both the loan contract (or its ERC-173 owner) and the writer can be stored on chain, letting which contracts count as a given writer's sources be read directly from the chain rather than from the writer's files. It is stored with storeAssociation and can be revoked by the writer, the loan contract, or the contract's owner via revokeAssociation, and is queried with sourcesOf and getAssociation. This ERC-8466 was written in October 2026 and is currently in Draft status, so details such as the exact rules, where on-chain manifests live, or how cross-chain sources are handled may still change or stall.
Things to watch out for
- Self-dealing lenders: Even if a loan contract runs a circular trade, lending money to an agent controlled by the same owner and having it repaid, this passes every check in this profile because the funds actually moved. Readers must judge for themselves which writers to trust.
- Dishonest writers and planted sources: If a writer's key posts a fake root, a full rebuild will catch it, but a source the writer has never declared is invisible without a manifest. A leaked or malicious writer key can declare its own contract as a new source and craft a statement that matches only that contract's logs.
- A light check is only a sample: A statement with a genuine anchor but fabricated totals can still pass a light check, so a light check's result must not be treated as a verified value.
- Reorg: A window that ends on a block that is not yet finalized may point to logs that later disappear, so windows must end on a finalized block.
- Planted entries: Anyone can call giveFeedback to post a plausible-looking credit entry about an agent, so trying to check every untrusted writer runs up request costs. Readers should either read only trusted writers or cap the number of requests for a full read.