# geyserbench API (Frankfurt) — user reference

Programmatic access to everything the web page at https://bench.cartographer.club can do:
list results, read a full result with per-transaction timings, reserve UDP ports for shred streams,
submit a test against your own Solana feeds, and poll it until it finishes.

This document is written for both people and language models. Everything a client needs is on this page.

```
Base URL      https://bench.cartographer.club
Auth          header  X-API-Key: gb_...        (or  Authorization: Bearer gb_...)
Format        JSON in, JSON out (UTF-8); errors are {"detail": "<reason>"} with an HTTP status
Rate limit    tests per key per hour (default 6, can be raised or removed per key; see GET /v1/me) — other calls are not limited
Admin         there is none in this API: a key can only do what an anonymous visitor of the page can do
Location      measured from Frankfurt (Cherry Servers); test traffic leaves from 88.216.182.12
Docs          GET /v1/docs returns this file (no key needed)
```

## 1. Quick start

```bash
KEY=gb_your_key
B=https://bench.cartographer.club

# who am I, what are my limits
curl -s $B/v1/me -H "X-API-Key: $KEY"

# run the reference feeds only (no endpoints of your own), 3000 transactions, listed on the page
JOB=$(curl -s -X POST $B/v1/tests -H "X-API-Key: $KEY" -H 'Content-Type: application/json' \
      -d '{"toml": "", "transactions": 3000}' | python3 -c 'import sys,json; print(json.load(sys.stdin)["id"])')

# poll until finished (typically 20–90 s; up to several minutes with 200 000 transactions or a queue)
until curl -s $B/v1/tests/$JOB -H "X-API-Key: $KEY" | grep -q '"finished":true'; do sleep 5; done

# the result
curl -s $B/v1/tests/$JOB/result -H "X-API-Key: $KEY"
```

Python (standard library only):

```python
import json, time, urllib.request
B, KEY = "https://bench.cartographer.club", "gb_your_key"

def call(path, body=None):
    req = urllib.request.Request(B + path, data=json.dumps(body).encode() if body is not None else None,
                                 headers={"X-API-Key": KEY, "Content-Type": "application/json"})
    return json.load(urllib.request.urlopen(req, timeout=60))

toml = '''
[[endpoint]]
name = "my yellowstone"
kind = "yellowstone"
url = "https://grpc.example.com:443"
x_token = "..."
'''
job = call("/v1/tests", {"toml": toml, "transactions": 3000, "unlisted": True})
while not call(f"/v1/tests/{job['id']}")["finished"]:
    time.sleep(5)
res = call(f"/v1/tests/{job['id']}/result")      # raises HTTP 409 if the test failed instead of finishing
for s in res["summary"]:
    print(f"{s['name']:60s} first {s['first_share']*100:5.1f}%  p50 {s['p50_ms']:.2f} ms  p99 {s['p99_ms']:.2f} ms")
```

## 2. How a test works

1. You submit 0–3 endpoints of your own (TOML, same format as geyserbench). Empty TOML = measure the built-in
   reference feeds only. The reference feeds for key users are the **public** set (`GET /v1/refs`).
2. The runner first checks that every feed — reference and yours — actually delivers data (a 50-transaction probe,
   UDP sources get a short listen). Feeds that deliver nothing (silent, invalid token, closed port) are dropped from the
   run and reported in `precheck` (`ok: false` with a `reason`). The test then runs on the survivors.
3. geyserbench subscribes to all surviving feeds at once (commitment `processed`, one fixed account filter) and records
   the arrival time of every transaction on every feed until `transactions` signatures were seen by all feeds
   (default 3000, min 1000, max 200000).
4. If a feed falls far behind (fewer than half of the best feed's transactions within the window) it is dropped and the
   run is repeated without it; what happened is in `meta.timeouts`.
5. The result is stored and (unless `unlisted`) listed on the page. The result link always works:
   `https://bench.cartographer.club/r/<test id>`.

Numbers in a result are relative: for every transaction, the feed that delivered it first is "first"; the others get a
lag in milliseconds behind that first delivery. A feed's `first_share` is the share of transactions it delivered first;
`p50_ms`/`p95_ms`/`p99_ms` are percentiles of its lag (0 = it was first).

## 3. Endpoints

All `/v1/*` calls except `/v1/docs` require the key header. Unknown or revoked key → `401`.

### GET /v1/me
Key identity and quota.
```json
{"key_id": "1a2b3c4d", "name": "alice", "created": "2026-10-26 20:40:11.512", "limit_per_hour": 6, "used_last_hour": 1}
```
`limit_per_hour` is `null` for a key without an hourly limit.
```json
{"key_id": "5e6f7a8b", "name": "bob", "created": "…", "limit_per_hour": null, "used_last_hour": 12}
```

### GET /v1/info
Everything a client needs to know before submitting.
```json
{
  "site": "https://bench.cartographer.club", "location": "Frankfurt (Cherry Servers)", "submissions": "open",
  "reference_feeds": ["Reflow UDP Shredstream — …", "Reflow FRA GRPC Endpoint — …", "Divers AMS gRPC (200$/month)"],
  "kinds": {"yellowstone": "gRPC url (+ optional x_token)", "arpc": "url", "arpcv3": "url (aRPC v3 / Corvus Omen …)", "thor": "url + x_token", "triport": "wss://… + x_token (Triport pre-exec WebSocket)",
            "shredstream": "url of your Jito ShredStream proxy (gRPC)", "shreder": "url", "jetstream": "url",
            "udpshredstream": "port = one of the ports shown on the page (url is not needed: we listen on 0.0.0.0:<port>)"},
  "max_endpoints": 3,
  "transactions": {"min": 1000, "max": 200000, "default": 3000},
  "udp": {"ip": "88.216.182.12", "port_pool": "21000-21999", "wait_seconds": 15, "reserve_seconds": 3600},
  "limits": {"tests_per_hour": 6, "queue": 20},
  "docs": "https://bench.cartographer.club/v1/docs"
}
```
`submissions` is `"open"` normally; `"closed"` means maintenance — `POST /v1/tests` returns `503` then.

### GET /v1/refs
`{"names": [...]}` — the reference feeds your test will be measured against (the public set).

### GET /v1/ports
Three UDP ports on `88.216.182.12` reserved for this key for one hour (renewed on each call while unused).
Any sender may deliver to them. Use one of them as `port` in a `udpshredstream` endpoint.
```json
{"ip": "88.216.182.12", "ports": [21417, 21052, 21803], "expires": "2026-10-26 21:41:00", "wait_seconds": 15, "reserve_seconds": 3600}
```

### POST /v1/ports/reserve
Body `{"source_ip": "1.2.3.4"}` (public IPv4 of the host that will send shreds). Reserves and opens one port for that
sender only. Reply: `{"ip", "port", "from", "expires", "wait_seconds", "reserve_seconds"}`. At most 6 open reservations per key.

### POST /v1/tests  → 201
Submit a test. Body:

| field          | type   | default | meaning |
|----------------|--------|---------|---------|
| `toml`         | string | `""`    | 0–3 `[[endpoint]]` blocks (format below); empty = reference feeds only |
| `transactions` | int    | 3000    | signatures to collect, 1000…200000 |
| `unlisted`     | bool   | false   | `true` = do not list on the public page (the link and the API still work) |
| `contact`      | string | —       | optional, ≤120 chars, stored with the job |

Reply: the test document (same as `GET /v1/tests/{id}`), initially `"status": "queued"`.

Errors: `400` bad TOML / endpoint (the `detail` says which field), `409` requested UDP port is in use,
`429` hourly limit for the key, `503` submissions closed or queue full.

### GET /v1/tests
`{"tests": [...]}` — the tests submitted with this key, newest first (`?limit=50`, max 500).

### GET /v1/tests/{id}
```json
{
  "id": "quWCsqrLUx7g", "status": "done", "finished": true,
  "name": "my yellowstone", "kind": "yellowstone", "created": "2026-10-23 16:17:53.422", "updated": "2026-10-23 16:18:03.929",
  "origin": "public", "runner": "bench1", "transactions": 3000,
  "run_id": "glXd5yNfb9vp", "error": null,
  "precheck": [{"name": "Divers AMS gRPC (200$/month)", "role": "reference", "ok": true, "reason": ""},
               {"name": "my yellowstone", "role": "endpoint", "ok": false, "reason": "connected but delivered 0 of 50 tx within 25 s"}],
  "endpoints": [{"name": "my yellowstone", "kind": "yellowstone", "url": "https://grpc.example.com:443/", "shred_target": null}],
  "link": "https://bench.cartographer.club/r/quWCsqrLUx7g",
  "result_url": "https://bench.cartographer.club/v1/tests/quWCsqrLUx7g/result"
}
```
`status` lifecycle: `queued` → (`waiting_traffic` for UDP endpoints: listening `wait_seconds` for the first shreds) →
`checking` (data probe) → `running` → `done` | `failed` | `expired`. `finished` is true for the last three.
`precheck` appears once the probe ran; `run_id` once the result is stored. For a `udpshredstream` endpoint
`shred_target` is `{"ip", "port", "from", "wait_seconds"}` — send your shreds there as soon as the test is queued.

### GET /v1/tests/{id}/result
The full result document (section 4) plus `"test"` (the test document). While not finished: `409` with the status in
`detail` (`"test is not finished: status=running"`, or `status=failed, error=...`). Any test id works — results are
link-public — not only your own.

### GET /v1/runs
`{"runs": [...], "mode": "public"}` — publicly listed results, newest first (`?limit=50`, max 500). One item:
```json
{"run_id": "glXd5yNfb9vp", "job_id": "quWCsqrLUx7g", "runner": "bench1", "started": "2026-10-23 16:17:55.000",
 "signatures": 3000, "endpoints": ["feed A", "feed B"], "fastest": "feed A"}
```

### GET /v1/runs/{run_id}
Full result document (section 4) by run id.

### GET /v1/runs/{run_id}/deltas.csv
The per-transaction timings as CSV: header `sig,<feed 1>,<feed 2>,...`; one row per signature; cell = arrival time in
ms (see section 4, `signatures`), empty if that feed did not deliver it.

### GET /v1/docs
This document, `text/markdown`. No key needed.

## 4. The result document

```json
{
  "run_id": "glXd5yNfb9vp", "job_id": "quWCsqrLUx7g", "runner": "bench1", "started": "2026-10-23 16:17:55.000", "public": 1,
  "meta": {
    "account": "pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA", "commitment": "processed",
    "transactions_target": 3000, "signatures": 3000, "bench_wall_seconds": 4.55, "started_at_unix": 1792772275.19,
    "fastest": "Reflow UDP Shredstream — …",
    "precheck": [{"name": "...", "role": "reference|endpoint", "ok": true, "reason": ""}],
    "excluded": "feed X",                       // only when a feed was dropped as stalled
    "timeouts": [{"attempt": 1, "seconds": 110, "target": 3000, "delivered": {"feed A": 3000, "feed X": 120}, "dropped": ["feed X"]}]
  },
  "endpoints": [{"name": "feed A", "kind": "udpshredstream"}, {"name": "feed B", "kind": "yellowstone"}],
  "summary": [
    {"name": "feed A", "first_share": 0.9603, "firsts": 2881, "p50_ms": 0.0, "p95_ms": 0.0, "p99_ms": 0.823, "valid": 3000, "backfill": 0}
  ],
  "pings": {"count": 20, "interval_s": 0.2, "measured_at_unix": 1792772283.69,
            "targets": [{"endpoint": "feed B", "role": "endpoint", "host": "62.197.45.101", "ip": "62.197.45.101",
                         "sent": 20, "loss_pct": 0.0, "min_ms": 7.686, "avg_ms": 7.699, "max_ms": 7.721, "mdev_ms": 0.008,
                         "geo": {"cc": "NL", "country": "The Netherlands", "city": "Amsterdam", "asn": "AS58061", "org": "...", "rdns": null}}]},
  "shred_sources": {"feed A": {"45.154.33.81": 30345, "88.216.36.69": 30250}},
  "signatures": [{"sig": "125hDy6i…", "t": {"feed A": 1002.71, "feed B": 1003.13}}]
}
```

| field | meaning |
|---|---|
| `summary[].first_share` | fraction (0–1) of the collected transactions this feed delivered first |
| `summary[].firsts` | the same as a count |
| `summary[].p50_ms` `p95_ms` `p99_ms` | percentiles of this feed's lag behind the first delivery, ms (0 = it was first) |
| `summary[].valid` | transactions this feed delivered that were in the compared set |
| `summary[].backfill` | transactions this feed delivered only after every other feed had them (late catch-up) |
| `meta.fastest` | the feed with the highest `first_share` |
| `meta.signatures` | size of the compared set (transactions seen by every surviving feed) |
| `meta.precheck` | the data probe results; `ok: false` feeds did not take part |
| `meta.timeouts` | present when a collection window ran out: delivered counts per feed and which were dropped |
| `pings.targets[]` | 20 ICMP pings from the bench host to each feed's host, plus ASN/geo; `role` = `reference` or `endpoint` |
| `shred_sources` | for UDP feeds: sender IP → packets received during the run |
| `signatures[].t` | arrival time per feed, ms since the run's first observation; a missing feed key = not delivered; lag = `t[feed] − min(t)` |

Hidden addresses: some reference providers asked not to be exposed; their IPs appear as `hidden-N` in `pings` and
`shred_sources`, and the bench host's own addresses as `hidden`. Everything else is as measured.

## 5. Endpoint TOML

Same as a geyserbench config, only the `[[endpoint]]` blocks are read (`[config]`, `[backend]`, `[[histogram]]` are ignored).
At most 3 blocks. Names: letters, digits, space, `.`, `:`, `-`, ≤48 chars; a name that looks like a reference provider gets a `user ` prefix.

```toml
[[endpoint]]
name = "my yellowstone"
kind = "yellowstone"            # yellowstone | arpc | arpcv3 | thor | triport | shredstream | shreder | jetstream | udpshredstream
url = "https://grpc.example.com:443"
x_token = "optional token"     # redacted from the stored job once the run is over

[[endpoint]]
name = "my shreds"
kind = "udpshredstream"
port = 21417                    # one of GET /v1/ports (or the port from POST /v1/ports/reserve); no url
```

Rules: `url` must be `http(s)://host[:port][/path]` and resolve to a public IP (the resolved IP is pinned for the run);
the runner connects from `88.216.182.12` — whitelist that address on your side first. For `udpshredstream`, start
sending shreds to `88.216.182.12:<port>` right after submitting; if nothing arrives within `wait_seconds` (15 s) the
source is dropped as silent and the test continues without it.

## 6. Errors and limits

| status | when |
|---|---|
| 400 | bad TOML / endpoint field, bad `source_ip`, `transactions` out of range (`detail` explains) |
| 401 | missing, unknown or revoked key |
| 404 | no such test / run |
| 409 | result requested before the test finished; requested UDP port in use |
| 429 | hourly test limit for the key, or too many open port reservations |
| 503 | submissions closed for maintenance, or queue full (20 jobs) |

Tests run one at a time in submission order on a shared runner, so a queued test waits for the ones before it.
Poll `GET /v1/tests/{id}` every 5–10 s.

Questions, a key, a higher limit: Telegram https://t.me/inventandchill
