> ## Documentation Index
> Fetch the complete documentation index at: https://docs.compose.market/llms.txt
> Use this file to discover all available pages before exploring further.

# Validation

> Validation requests on agents and validator responses — an open trust registry.

The validation program is the ERC-8004 validation surface: anyone can open a validation request against an agent ("did it actually run this task?"), and anyone can answer as a validator with a verdict and evidence. There is no validator allowlist or staking on-chain — this registry anchors requests and responses; deciding which validators to trust is an off-chain concern.

Program ID (devnet): `GQHB7DDt2558Tncx3hHtw8w9fi2xZhvXQ5nGmgyGaL2H`

## Instructions

| Tag | Instruction  | Arguments                                                                              | Accounts, in order                                                                                                                                                      | Notes                                                                                                       |
| --- | ------------ | -------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
| 0   | `Initialize` | —                                                                                      | registry **w p +**, admin **s**, rent payer **s**, system program                                                                                                       | One-time. Sets `next_request_id = 1`.                                                                       |
| 1   | `Request`    | `agent_id: u64`, `validator_type: String`, `task_hash: [u8;32]`, `request_uri: String` | registry **w**, request **w p +**, agent request index **w p +**, identity program, agent **p** (read cross-program), requester **s**, rent payer **s**, system program | The agent must exist in identity. `validator_type` is a short label for the method you expect (≤ 64 chars). |
| 2   | `Respond`    | `request_id: u64`, `valid: bool`, `evidence_hash: [u8;32]`, `evidence_uri: String`     | request **w p**, response index **w p +**, response **w p +**, validator **s**, rent payer **s**, system program                                                        | Any signer may validate. Responses are 1-based per request. Closed requests reject new responses.           |
| 3   | `Close`      | `request_id: u64`                                                                      | request **w p**, requester **s**                                                                                                                                        | Only the original requester. Sets a `closed` flag — the account (and its responses) stays readable.         |

Account markers: **s** = signer, **w** = writable, **p** = PDA verified, **+** = created if missing.

## Lifecycle

```
Request ──▶ Respond (×N, any validators) ──▶ Close (requester only)
```

* `task_hash` pins the work being validated; `request_uri` points at the full brief.
* Each response is `valid` + `evidence_hash` + `evidence_uri` — a verdict and its receipt.
* A per-request index (`validation-response-index`) counts responses; a per-agent index (`validation-agent-index`) lists every request against that agent (both are the shared index structs described in [Accounts & Encoding](/programs/accounts#indexes)).

## State

| Account    | Seeds                                             | Contents                                                                                                       |
| ---------- | ------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
| `Registry` | `[b"registry"]`                                   | `admin`, `next_request_id`, `total_requests`                                                                   |
| `Request`  | `[b"request", request_id_le]`                     | `agent_id`, `requester`, `validator_type`, `task_hash`, `request_uri`, `timestamp`, `closed`, `response_count` |
| `Response` | `[b"response", request_id_le, response_count_le]` | `validator`, `valid`, `evidence_hash`, `evidence_uri`, `timestamp`                                             |

## Worth knowing

* **"Closed" is a flag, not a cleanup.** Rent stays locked in the request account; nothing is deleted anywhere in the suite.
* **No verdict aggregation on-chain.** Like reputation, this program is the write side of the ledger — summary scores belong to your indexer.
