# Pick a chain and know what writing to it costs

> Which chain is actually answering, is its head fresh, and what will a transaction cost right now?

Each call is paid per use in USDC over x402. No API key and no account: call it, get a 402 with the challenge in the `PAYMENT-REQUIRED` header, pay it and repeat the call.

**Every answer in this chain carries a `next` array with the following calls already built** — route, method, the parameters filled in from what was just found, the price and a full url you can fetch as it is. You do not have to work out the next step; follow `next`.

## The calls, starting at `GET /v1/evm/chains`

The numbering is the usual path, not a fixed order: what you actually get offered depends on what each answer finds. A call is only suggested when the data to make it is there, so a suggestion never sends you into a dead end.

1. **`GET /v1/evm/chains`** — $0.005 per call. Live health of every supported chain in one call: chain id, block height and how stale each head is. Start here when you do not yet know which chain to use.
2. **`GET /v1/evm/block`** — $0.005 per call. The head of the chain you picked: height, hash, timestamp, transaction count and how many seconds old it is. A node that is behind returns stale answers without saying so.
3. **`GET /v1/evm/gas`** — $0.005 per call. What it costs to write to it right now: gas price in wei and gwei, the current base fee, and the cost of a plain transfer.
4. **`GET /v1/evm/fees`** — $0.005 per call. And the numbers that actually get a transaction mined: maxFeePerGas and maxPriorityFeePerGas at the slow, normal and fast percentiles of the last 20 blocks of real fee history.

## Worked example

```
GET https://flat-rate-llm.kikoribera03.workers.dev/v1/evm/chains
```

The answer ends with something like:

```json
{
  "next": [
    {
      "rel": "head",
      "why": "...",
      "method": "GET",
      "route": "/v1/evm/block",
      "tool": "evm_block",
      "params": {
        "chain": "eip155:8453"
      },
      "url": "https://flat-rate-llm.kikoribera03.workers.dev/v1/evm/block?chain=eip155%3A8453",
      "price": "$0.005"
    }
  ]
}
```

Fetch that `url`, pay its 402, and the answer will carry its own `next`. Follow it until `next` comes back empty.

## Where this chain leads out

- /v1/evm/estimate-gas — you know what a unit costs; this says how many units your call needs, and hands you back to /v1/evm/fees with the amount in hand.

## The same thing over MCP

Every route here is also an MCP tool at `POST https://flat-rate-llm.kikoribera03.workers.dev/mcp` — the `tool` field of each `next` entry is its name, and `params` goes straight into `arguments`. `tools/list` and the `catalog` tool are free.
