# ERC-8461: Agent Default Registry

> 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. Lenders record defaults of loans to agent identities, and anyone counts them against the reporters it trusts.

Status: Testnet only.

- Pull request: https://github.com/ethereum/ERCs/pull/2105
- Text pinned at the pull request's head commit 7bf377e5fb727a61bedfeea1d9dd640b2c2c8124 (ERCS/erc-8461.md, CC0): https://github.com/priors-agents/ERCs/blob/7bf377e5fb727a61bedfeea1d9dd640b2c2c8124/ERCS/erc-8461.md
- Discussion: https://ethereum-magicians.org/t/erc-8461-agent-default-registry/30026
- Reference implementation: https://github.com/priors-agents/erc-agent-default-registry/tree/eb26be80a4aed99f440f92c5ca59c6c6641d44ff (commit eb26be80a4aed99f440f92c5ca59c6c6641d44ff)
- This page: https://lab.priors.trade/erc/8461

## Abstract

This proposal defines one contract where lenders record the defaults of loans they made to identities of an [ERC-721](https://eips.ethereum.org/EIPS/eip-721) identity registry, such as the Identity Registry of [ERC-8004](https://eips.ethereum.org/EIPS/eip-8004). Each record names the identity, the owner address the loan recorded, the asset, the principal and the lender's reference to the loan, and can later be marked cured with the amount recovered, or voided within a short window if it was made by mistake. A lender that reports from several addresses names one of them its primary, and its records count under that primary. Anyone may record, and a record counts only for a reader that trusts the primary it is stored under: a contract asks how many open, cured and still provisional defaults an identity, or an owner address, has according to the lenders it names, at a cost that grows with that list alone.

## Specification headings

1. Interface
2. Primaries
3. Records
4. Counting
5. Listing

## At Priors

Nothing at Priors runs this draft. Its reference contracts go on the testnet only.

## 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:

- defaultRegistry: 0x8845f144F5dEFef80fc2C1d0be3A48a11DEceDE9 (https://explorer.testnet.chain.robinhood.com/address/0x8845f144F5dEFef80fc2C1d0be3A48a11DEceDE9)
- lineGranter: 0x7932F9FE3182C79B8Fc9eC5aB66540d49B816A13 (https://explorer.testnet.chain.robinhood.com/address/0x7932F9FE3182C79B8Fc9eC5aB66540d49B816A13)
- creditLine: 0x370fAf15c0D3F877eBfFb6A5377C350AEb291B02 (https://explorer.testnet.chain.robinhood.com/address/0x370fAf15c0D3F877eBfFb6A5377C350AEb291B02)
- creditLineFast: 0xE2f95B3f9eD0C680E6e3c4B15a4480F98390b02F (https://explorer.testnet.chain.robinhood.com/address/0xE2f95B3f9eD0C680E6e3c4B15a4480F98390b02F)
- backedLine: 0x575f245a79D24Ca3C486c0F97d8F395398E0c292 (https://explorer.testnet.chain.robinhood.com/address/0x575f245a79D24Ca3C486c0F97d8F395398E0c292)
- backedLineFast: 0xD543D6bacA011C7DAA4Ba6d817Fa494a7976512d (https://explorer.testnet.chain.robinhood.com/address/0xD543D6bacA011C7DAA4Ba6d817Fa494a7976512d)

Actions:

- `report_default`: Report a lab loan past due plus grace (marked defaulted and recorded by the lab's reporter). Who signs: anyone, once the loan is past due plus grace Params: `loan_id` (The loan on a lab line, uint), `line` (Which lab line the loan is on: normal, fast, backed or backed_fast, string, optional, default normal).
- `record_default`: Record a default (as a reporter). Who signs: a lender's reporter Params: `agent_id` (The identity, agentId), `owner` (Its owner when the loan was drawn, address), `asset` (The asset lent (empty: the test dollar), address, optional, default (the lab's)), `principal` (The principal, in test dollars, amount), `loan_ref` (The loan's reference (bytes32, not zero), bytes32), `contract` (Your own default registry's address (empty: the lab's shared one), address, optional).
- `record_cure`: Record a cure. Who signs: the record's reporter Params: `record_id` (The record, uint), `recovered` (What was recovered, in test dollars, amount), `contract` (Your own default registry's address (empty: the lab's shared one), address, optional).
- `void_record`: Void a record within the void window. Who signs: the record's reporter or its primary Params: `record_id` (The record, uint), `contract` (Your own default registry's address (empty: the lab's shared one), address, optional).
- `set_primary`: Propose a primary (as a reporter). Who signs: a reporter Params: `primary` (The primary, address), `contract` (Your own default registry's address (empty: the lab's shared one), address, optional).
- `accept_primary`: Accept a reporter (as its primary). Who signs: the proposed primary Params: `reporter` (The reporter, address), `contract` (Your own default registry's address (empty: the lab's shared one), address, optional).
- `drop_reporter`: Drop a reporter (as its primary). Who signs: the reporter's primary Params: `reporter` (The reporter, address), `contract` (Your own default registry's address (empty: the lab's shared one), address, optional).

Reads:

- `agent_defaults`: An identity's defaults, counted against trusted primaries. Params: `agent_id` (The identity, agentId), `trusted` (Trusted primaries, comma-separated (empty: the lab's reporter), addresses, optional, default (the lab's)), `contract` (Your own default registry's address (empty: the lab's shared one), address, optional).
- `owner_defaults`: An owner's defaults, counted against trusted primaries. Params: `owner` (The owner, address), `trusted` (Trusted primaries (empty: the lab's reporter), addresses, optional, default (the lab's)), `contract` (Your own default registry's address (empty: the lab's shared one), address, optional).
- `reported`: Whether a lab loan's default was recorded, and its record. Params: `loan_id` (The loan, uint), `line` (Which lab line the loan is on: normal, fast, backed or backed_fast, string, optional, default normal).
- `records_of_agent`: An identity's records. Params: `agent_id` (The identity, agentId), `start` (From, uint, optional, default 0), `limit` (At most, uint, optional, default 20), `contract` (Your own default registry's address (empty: the lab's shared one), address, optional).
- `record`: One record. Params: `record_id` (The record, uint), `contract` (Your own default registry's address (empty: the lab's shared one), address, optional).
- `primary_of`: A reporter's primary. Params: `reporter` (The reporter, address), `contract` (Your own default registry's address (empty: the lab's shared one), address, optional).

Deploy your own:

- `registry`: Your own AgentDefaultRegistry. Params: `identity_registry` (The identity registry (empty: the testnet ERC-8004 one), address, optional, default (the lab's)).

## With an agent

- MCP (Streamable HTTP): https://lab.priors.trade/mcp. Tools for this draft: `lab_erc(8461)`, `lab_setup(address)`, `lab_read(8461, read, params)`, `lab_prepare(8461, action, params)`, `lab_deploy_prepare(8461, deploy, params)`, `lab_check_contract(8461, chain, address)`, `lab_feedback_draft(8461, note, txHash?)`.
- HTTP: https://lab.priors.trade/openapi.json describes GET https://lab.priors.trade/api/lab/erc/8461, /api/lab/read/8461/{read}, /api/lab/prepare/8461/{action}, /api/lab/deploy/8461/{deploy}, /api/lab/check/8461/{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/8461.md. Try ERC-8461, Agent Default Registry (a draft under review). Start with lab_setup for my testnet address to see my test ETH, test dollars and identities, then report a lab loan past due plus grace (marked defaulted and recorded by the lab's reporter), then record a default (as a reporter), then record a cure, then void a record within the void window, then propose a primary (as a reporter), then accept a reporter (as its primary) with lab_prepare(8461, <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(0x95030b12) and the views, read only (`lab_check_contract`, or GET https://lab.priors.trade/api/lab/check/8461/{chain}/{address}).

## Feedback

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