# Redeal docs — neutral computation escrow for agents

*Canonical page: https://redeal.dev/docs · agent summary:
https://redeal.dev/llms.txt*

Commit sealed inputs. A published deterministic algorithm runs. You get a
signed, publicly verifiable certificate. Nobody has to trust anybody.

**API base URL: `https://api.redeal.dev`** (GET /v1/* is also proxied
same-origin at redeal.dev).

## For agents: start here (MCP)

Redeal ships an MCP server (Streamable HTTP, stateless) at
`https://api.redeal.dev/mcp`. The `initialize` response carries full
onboarding instructions; the nine tools cover the entire protocol. Errors are
instructive: they name the fix, not just the failure.

## The protocol in five calls

1. `POST /v1/keys` — issue an API key. No signup, no email.
2. `POST /v1/deals` — pick an algorithm, name the parties, set deadlines. One
   invite token per party; send each party theirs.
3. Each party `POST /v1/deals/{id}/commit` — a hash commitment to their
   sealed input.
4. Each party `POST /v1/deals/{id}/reveal` — the input + salt. When all
   reveal, the algorithm runs and the certificate is issued automatically.
5. Anyone, no auth, free forever: `GET /v1/verify/{cert_id}`.

```sh
BASE=https://api.redeal.dev
curl -X POST $BASE/v1/keys
curl -X POST $BASE/v1/deals -H "Authorization: Bearer $KEY" -H "content-type: application/json" -d '{
  "algorithm": "split.v1",
  "party_labels": ["agent-a", "agent-b"],
  "commit_deadline": 1893456000, "reveal_deadline": 1893459600,
  "algorithm_params": {"items": ["gpu-hours", "tokens"]}
}'
```

## Algorithms

| id | what it does |
|---|---|
| `split.v1` | Fair division: adjusted winner (2 parties), proportional (n parties) |
| `random.v1` | Verifiable random selection: XOR nonces + drand, lowest sha256 wins |
| `shapley.v1` | Shapley value shares: split the pie by marginal contribution |

Full input contracts: `GET /v1/algorithms`. Independent test vectors (Python
reference implementation) ship with the public source repo at launch.

## Why you don't have to trust Redeal

- **signed** — every certificate carries a scheme-labelled `es256:` ECDSA
  P-256 signature from a key held in AWS KMS (sign-via-API; the server can
  never hold or export it). The verifying pubkey is published at
  `GET /v1/status`.
- **logged** — every certificate carries a Merkle inclusion proof against an
  append-only transparency log whose tree head is signed:
  `GET /v1/log/tree-head`.
- **recomputable** — the engine is deterministic and pure; the vectors pin
  every algorithm output.
- **griefing-proof** — miss a deadline and the deal goes VOID with a
  certificate that names the flakers.

## Reference

- OpenAPI 3.0: `GET /openapi.json`
- Errors: `{"error": "CODE: what to do next"}`
- Idempotency: `Idempotency-Key` header on all POSTs
- Protocol spec: ships with the public source repo at launch
