# dHouse Lookup Service (`ls_dhouse`)

Query indexed dHouse covenant state. Spent outputs are **retained** with
their spender recorded, so table chains and hand/receipt history stay
queryable.

## Queries

POST `/lookup` with `{"service": "ls_dhouse", "query": <one of below>}`:

| Query | Returns |
|-------|---------|
| `{"type":"tip","tableId":"<32-hex>"}` | Unspent table output(s) for a TABLE_ID — normally exactly one. |
| `{"type":"outpoint","txid":"...","vout":0}` | That single record (spent or unspent). |
| `{"type":"txid","txid":"..."}` | All dHouse records of a transaction. |
| `{"type":"chain","tableId":"...","limit":100}` | Table-class chain, oldest → newest. `limit` optional. |
| `{"type":"session","playerPkh":"<40-hex>"}` | Hand records (`player_pkh`) + purse records (`owner_pkh`) for a player. |
| `{"type":"spender","txid":"...","vout":0}` | The record; its context's `spentBy` is the spending txid or `null`. |

## Context

Each returned output carries a JSON context:

```json
{
  "outpoint": "txid.vout",
  "class": "table",
  "satoshis": 195001,
  "state": { "...all parsed lock fields, numbers as u64, bytes as hex..." },
  "spentBy": null,
  "createdAt": 1750000000
}
```

`state` is the full parsed field set of the lock (see the topic manager
documentation for the per-class layouts).
