# Recta

> Recta is a preflight for AI agents that move stablecoins (and BTC) between blockchains. Before a transfer, the agent asks Recta; Recta reads every route it knows at the same chain state (Across, CCTP, Stargate, USDT0 and others) and returns the cheapest one it can prove, against the route the agent would have used anyway.

## Fee

Recta charges exactly 5 % of the saving it verifies on chain after the agent executes its route. No saving, no charge. No prepayment and no credit: the agent signs, with each decision, a Permit2 authorization capped at `max_fee_authorization`, and Recta's collection pulls only the verified 5 % (never more than the cap) in USDC on Base; the payer's ledger shows whether each fee has been collected yet (`charged`). The evaluation itself is free.

## Access

Every commercial request is signed by the EVM key of the agent's own sender address (EIP-191 personal_sign). No API key, account or secret is issued. The agent signs this text, one field per line:

```
Recta signed request v1
method: POST
path: /v1/golden-corridor/commercial-evaluations
idempotency-key: <the Idempotency-Key header, or empty>
body-keccak256: <0x keccak256 of the exact body bytes, lowercase>
issued-at: <unix seconds>
```

and sends `x-recta-signer` (its address), `x-recta-issued-at` and `x-recta-signature`. The signing instant may be at most 300 s from Recta's clock. For an evaluation, the request's `sender` must be the signer. Smart accounts (EIP-1271) cannot sign this way.

## Flow

1. `POST /v1/golden-corridor/commercial-evaluations` with an `Idempotency-Key` header and the request schema below: a durable decision (winner, saving bound, expected fee and fee cap) or an abstention. Free.
2. `GET /v1/golden-corridor/commercial-evaluations/{result_id}/execution-artifact`: the transactions to sign. While collection is on it first answers SIGNATURE_REQUIRED with the Permit2 fee terms; `POST /v1/golden-corridor/commercial-evaluations/{result_id}/fee-authorization` stores the signed permit and returns the artifact.
3. The agent executes the transactions itself, then `POST /v1/golden-corridor/commercial-evaluations/{result_id}/execution` with `{ "origin_tx_hash": "0x…" }`. Recta verifies the delivery on chain and records the realized saving and its 5 %.
4. `GET /v1/golden-corridor/commercial-accruals/{payer}`: the payer's fees and whether each was collected. An unpaid fee blocks new evaluations with HTTP 402 until the debt permit it offers is signed (`POST /v1/golden-corridor/fee-debts`).

## Documents

- [Service descriptor](https://api.recta.build/v1/golden-corridor/commercial-evaluations/schema): contract RECTA_COMMERCIAL_EVALUATION_CONTRACT_V21, corridors, providers, limits and the JSON Schemas of every body.
- [OpenAPI 3.1](https://api.recta.build/openapi.json)
- [Status](https://api.recta.build/v1/status): whether the service is ready.
- [MCP server](https://api.recta.build/mcp) (Streamable HTTP): the same routes as tools, for agents that speak the Model Context Protocol. It never holds a key: the agent signs with its own wallet.
