# ERC-8466: Agent Credit History

> Robinhood Chain testnet (46630). Test tokens, no value. Reference contracts not audited. These are drafts under review, not standards.

A draft under review on ethereum/ERCs. Loan outcomes as ERC-8004 feedback (credit.statement, credit.defaulted) that any reader rebuilds from the lender's own logs.

Status: Live at Priors, read-only here.

- Pull request: https://github.com/ethereum/ERCs/pull/2110
- Text pinned at the pull request's head commit ff35ea76a8ac830afcb26c2633bd744243e32a54 (ERCS/erc-8466.md, CC0): https://github.com/priors-agents/ERCs/blob/ff35ea76a8ac830afcb26c2633bd744243e32a54/ERCS/erc-8466.md
- Discussion: https://ethereum-magicians.org/t/erc-8466-agent-credit-history/30022
- Reference implementation: https://github.com/priors-agents/priors/tree/00c9381090b88e69b43ab01ccc835ca38c5da2b6 (commit 00c9381090b88e69b43ab01ccc835ca38c5da2b6)
  - https://github.com/priors-agents/priors/blob/00c9381090b88e69b43ab01ccc835ca38c5da2b6/docs/ERC-8004-CREDIT.md
  - https://github.com/priors-agents/priors/blob/00c9381090b88e69b43ab01ccc835ca38c5da2b6/sdk/credit-profile.mjs
  - https://github.com/priors-agents/priors/blob/00c9381090b88e69b43ab01ccc835ca38c5da2b6/sdk/credit-reader.mjs
  - https://github.com/priors-agents/priors/blob/00c9381090b88e69b43ab01ccc835ca38c5da2b6/scripts/verify-credit.mjs
  - https://github.com/priors-agents/priors/blob/00c9381090b88e69b43ab01ccc835ca38c5da2b6/docs/erc-8004-credit/vectors.json
- This page: https://lab.priors.trade/erc/8466

## Abstract

This proposal is a profile of the [ERC-8004](https://eips.ethereum.org/EIPS/eip-8004) Reputation Registry for loan outcomes: loans opened, repaid on time, repaid late, defaulted. It adds no core contract. A lender posts ordinary `giveFeedback` entries with two tags, `credit.statement` and `credit.defaulted`, whose files travel inside the entry as `data:` URIs.

A statement commits, with a Merkle root, to every loan of an agent that closed in a block window at the lender's contracts. Each loan is a leaf naming the lender's own log that closed it. A reader holding nothing but an RPC endpoint can rebuild every leaf from those logs, check the root and the totals, and sample the money that moved.

A lender's statements for one agent are chained by hash over back-to-back windows. Skipping a window or revoking a statement is visible to every reader. Dropping a loan at a contract the lender declares is visible to every reader that rebuilds the statements, and so is a default after the last statement, which a lender that stops posting would otherwise leave out.

An optional part, a profile of [ERC-8092](https://eips.ethereum.org/EIPS/eip-8092), lets a lender publish which contracts its writer speaks for, as associations signed by both the lending contract (or its [ERC-173](https://eips.ethereum.org/EIPS/eip-173) owner) and the writer. A reader then takes that list from the chain instead of from the writer's files.

## Specification headings

1. Terms
2. Entries
3. Sources
4. Encoding
5. Leaves
6. Statement file
7. Default file
8. Writers
9. Readers
10. On-chain manifests, a profile of ERC-8092

## At Priors

Priors runs this draft on mainnet: its credit writer posts loan outcomes to the ERC-8004 Reputation Registry, and any reader rebuilds them from the pool's own logs.

## Live at Priors, mainnet read-only

These reads change nothing on Robinhood Chain mainnet (4663).

- `credit_history`: Priors' ERC-8004 credit statements for an agent, each checked against the pools' logs. Params: `agent_id` (A Priors agent id, agentId, default 462).

## Try it on testnet (46630)

Every action is prepared as an unsigned transaction { chainId: 46630, to, data, value }, signed by your own wallet or testnet key. Test tokens have no value.

Contracts:

- reputationRegistry: 0x8004B663056A597Dffe9eCcC1965A193B7388713 (https://explorer.testnet.chain.robinhood.com/address/0x8004B663056A597Dffe9eCcC1965A193B7388713)

Actions:

- `post_credit_entry`: Post a credit entry (as a lender's writer). Who signs: a lender's writer key Params: `agent_id` (The agent, agentId), `tag1` (The entry, string, optional, default credit.statement), `value` (The entry's value, int, optional, default 0), `value_decimals` (Its decimals, uint, optional, default 0), `feedback_uri` (The erc8004-credit/v1 file's data: URI, string), `feedback_hash` (keccak256 of the file, bytes32).

Reads:

- `testnet_statements`: A writer's credit entries for an agent on testnet. Params: `agent_id` (The agent, agentId), `writer` (The writer (empty: the lab writer), address, optional, default (the lab's)).

## With an agent

- MCP (Streamable HTTP): https://lab.priors.trade/mcp. Tools for this draft: `lab_erc(8466)`, `lab_setup(address)`, `lab_read(8466, read, params)`, `lab_prepare(8466, action, params)`, `lab_check_contract(8466, chain, address)`, `lab_feedback_draft(8466, note, txHash?)`.
- HTTP: https://lab.priors.trade/openapi.json describes GET https://lab.priors.trade/api/lab/erc/8466, /api/lab/read/8466/{read}, /api/lab/prepare/8466/{action}, /api/lab/check/8466/{chain}/{address} and /api/lab/setup/{address}.

A prompt to give your agent:

```text
Use the Priors lab on Robinhood Chain testnet (chain id 46630), where every token is a test token of no value. Its MCP server is https://lab.priors.trade/mcp and this draft's page is https://lab.priors.trade/erc/8466.md. Try ERC-8466, Agent Credit History (a draft under review). Start with lab_setup for my testnet address to see my test ETH, test dollars and identities, then post a credit entry (as a lender's writer) with lab_prepare(8466, <action>, params). Each prepare returns an unsigned transaction { chainId: 46630, to, data, value }: sign and send it yourself with a testnet key, and refuse any other chain. Never ask me for a key. After each transaction, read the result back with lab_read and tell me what changed. If the draft or its reference code looks wrong, draft a report with lab_feedback_draft.
```

## Check a contract

Any address on testnet or mainnet: supportsInterface(null) and the views, read only (`lab_check_contract`, or GET https://lab.priors.trade/api/lab/check/8466/{chain}/{address}).

## Feedback

The discussion of the text belongs in its thread: https://ethereum-magicians.org/t/erc-8466-agent-credit-history/30022. A bug in the reference implementation goes to its repository's issues: https://github.com/priors-agents/priors/issues (a new one: https://github.com/priors-agents/priors/issues/new). The text under review: https://github.com/ethereum/ERCs/pull/2110/files. `lab_feedback_draft` writes the report; the lab posts nothing for anyone.
