---
name: hayes-flop-tribe
description: Safe, fair, multi-operator FLOP Testnet inference routing via https://hayesfloptribe.com. Checks live chain gas before spending, avoids full or paused miners, selects idle signed-offer miners with cross-operator fallbacks, caps retries to prevent gas drain, and recovers stuck channel escrow via permissionless timeout.
version: 1.1.0
homepage: https://hayesfloptribe.com
compatibility: OpenClaw, Hermes, Claude Code, Codex
---

# Hayes FLOP Tribe — Safe FLOP Testnet Inference Skill

Use **https://hayesfloptribe.com** as your read-only, multi-operator offer indexer on FLOP Testnet.
Live snapshot: **45/116** ready miners (**1311** free slots) across **12** independent operator(s) · Gas: **RED (741.377x)** · Models: `qwen/qwen3-4b` (23/52 ready, min 4.5 FLOP), `qwen/qwen3-14b` (12/38 ready, min 4.5 FLOP), `qwen/qwen3-8b` (9/20 ready, min 4.5 FLOP), `qwen/qwen3-32b-fp8` (1/2 ready, min 5.95 FLOP), `qwen/qwen2.5-coder-7b-instruct` (0/1 ready, min - FLOP), `qwen/qwen2.5-7b-instruct` (0/1 ready, min - FLOP), `qwen/qwen2.5-14b-instruct` (0/1 ready, min - FLOP), `qwen/qwen3-1.7b` (0/1 ready, min - FLOP).

## Hard Safety Rules (Do Not Skip)
1. **Never send an inference session when `safeToOpen === false`** (red gas or all miners paused). Wait `recommendedWaitSec` and re-check.
2. **Always leave gas reserve outside escrow** (at least `recommendedGasReserveFlop`, currently ~`9.833 FLOP` for open fee + surge buffer; note `openChannelWithProfiledOffer` scales linearly at ~`0.011069 × feeMultiplier`, e.g. ~`4.0–4.5 FLOP` at `360x–410x`!).
3. **Never blindly hit full or paused miners** — always query `/api/pick` right before opening (results expire in ~30s).
4. **Retry at most 1 time** on failure/429/503 using `fallbacks[0]` to avoid draining wallet balance.
5. **Never hardcode mnemonics or private keys into shell history, logs, or web forms.** Read credentials from environment variables only.

---

## Step 1: Check Wallet Balance & Live Gas Traffic Light

```bash
curl -sS "https://hayesfloptribe.com/api/gas" | jq '{status, safeToOpen, advice, feeMultiplier, recommendedWaitSec, estOpenFeeFlop, recommendedGasReserveFlop, readyMiners}'
```

- `status: "green"` → Safe to open immediately.
- `status: "yellow"` → Elevated fees; ensure wallet has enough buffer above `minEscrowFlop + recommendedGasReserveFlop`.
- `status: "red"` or `safeToOpen: false` → **STOP and wait** `recommendedWaitSec` seconds, then re-query.

Also verify your wallet balance covers `minEscrowFlop + recommendedGasReserveFlop` (e.g., for a `10 FLOP` faucet wallet, leave ~`9.833 FLOP` for gas and set `budget=10`).

---

## Step 2: Smart Pick (1 Primary + 2 Cross-Operator Fallbacks)

Replace `model` and `budget` (total FLOP available for this session including gas reserve):

```bash
PICK=$(curl -sS "https://hayesfloptribe.com/api/pick?model=qwen/qwen3-14b&budget=10&maxTurns=1")
echo "$PICK" | jq '{ok, safeToOpen, advice, escrowFlop, primary: {name: .primary.name, operator: .primary.operator, endpoint: .primary.endpoint, latencyMs: .primary.latencyMs, freeSlots: .primary.capacity_free_slots}, fallbacks: [.fallbacks[] | {name, operator, endpoint, latencyMs}]}'
```

Check the JSON before sending any on-chain transaction:
- If `.safeToOpen == false` → wait `.recommendedWaitSec` seconds and stop.
- If `.ok == false` and `.advice == "insufficient_budget"` → top up wallet or switch to a model with lower `minEscrowFlop`.
- Otherwise proceed with `.primary` and keep `.fallbacks[0]` ready.

---

## Step 3: Run Inference via Signed Offer Path (Normal Settlement)

**Option A — Official offer indexer flag (simplest 1-liner; verify `escrowFlop` with `/api/pick?budget=10` first):**
```bash
export FLOP_INDEXER_URL="https://hayesfloptribe.com"
flop agent infer \
  --via offer \
  --offer-indexer-url "https://hayesfloptribe.com" \
  --model qwen/qwen3-14b \
  --max-flop 4.5 \
  --max-tokens 256 \
  --prompt 'Summarize the key properties of verifiable inference.'
```

**Option B — Use the exact `cliCommand` returned by `/api/pick`:**
```bash
echo "$PICK" | jq -r '.cliCommand'
```

Tips:
- Cooperative settlement charges the full channel escrow (`--max-flop`). Short prompts with `--max-tokens 256` settle fastest.
- If your public RPC drops during metadata download, pass `--rpc-timeout 120000`.
- If the CLI prints `"cooperative settlement outcome unknown"`, verify the channel on-chain before assuming failure — it may have already settled cleanly (`Closed`).

---

## Step 4: One-Shot Fallback Retry (Max 1 Retry)

If the primary miner returns `HTTP 429` (pool full), `HTTP 503` (temporary gas pause), or fails **before** opening a channel:

```bash
FAILED_MINER=$(echo "$PICK" | jq -r '.primary.miner')
# Either run fallbacks[0].cliCommand directly:
echo "$PICK" | jq -r '.fallbacks[0].cliCommand'

# Or re-pick once excluding the failed miner:
curl -sS "https://hayesfloptribe.com/api/pick?model=qwen/qwen3-14b&budget=10&exclude=${FAILED_MINER}" | jq '{ok, advice, primary: .primary.name, cliCommand}'
```

**Stop after 1 retry.** If both attempts fail, re-check `/api/gas` and wait at least 60–120 seconds before trying again.

---

## Step 5: Stuck Channel Self-Rescue (Permissionless Timeout Refund)

If a channel stays open without settling (for example, miner rejected an under-funded escrow with `HTTP 402` or a session stalled), your escrow is **never lost**:
1. Wait until the channel expires on-chain: `finalizedBlock > openedAt + maxDuration` (~20–24 minutes for default `1200s` channels).
2. Confirm status is still open, then submit permissionless `computeChannel.timeout(channelId)` (on-chain fee ≈ `0.015017 × feeMultiplier`, e.g. ~`4.7 FLOP` at `310x` — wait for lower gas if needed; any wallet can trigger it, full unused escrow returns to the buyer with zero slash).

**Check channel state (read-only):**
```bash
CHANNEL_ID=12345 FLOP_RPC="${FLOP_RPC:-wss://testnet.flop.network}" node -e '
import("@polkadot/api").then(async ({ ApiPromise, WsProvider }) => {
  const api = await ApiPromise.create({ provider: new WsProvider(process.env.FLOP_RPC) });
  const head = (await api.rpc.chain.getHeader(await api.rpc.chain.getFinalizedHead())).number.toNumber();
  const ch = await api.query.computeChannel.channels(process.env.CHANNEL_ID);
  console.log({ finalizedHead: head, channel: ch.toHuman() });
  await api.disconnect();
});
'
```

**Trigger refund after expiry (reads signer from `FLOP_URI` env var, never hardcode seed):**
```bash
CHANNEL_ID=12345 FLOP_RPC="${FLOP_RPC:-wss://testnet.flop.network}" node -e '
import("@polkadot/api").then(async ({ ApiPromise, WsProvider, Keyring }) => {
  if (!process.env.FLOP_URI) throw new Error("Set FLOP_URI env var first");
  const api = await ApiPromise.create({ provider: new WsProvider(process.env.FLOP_RPC) });
  const signer = new Keyring({ type: "sr25519" }).addFromUri(process.env.FLOP_URI);
  await new Promise((resolve, reject) => {
    api.tx.computeChannel.timeout(process.env.CHANNEL_ID)
      .signAndSend(signer, ({ status, dispatchError }) => {
        if (dispatchError) return reject(new Error(dispatchError.toString()));
        if (status.isFinalized) { console.log("Finalized:", status.asFinalized.toHex()); resolve(); }
      }).catch(reject);
  });
  await api.disconnect();
});
'
```

Browser alternative (Polkadot.js Apps): open `https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Ftestnet.flop.network#/extrinsics` → `computeChannel` → `timeout(channelId)`.

---

## Step 0 (Optional): Free Agent Survival Toolkit (Auto-Wait, Faucet & Wallet Check)

- **Sleep-mode local runner (`/safe-run.sh`)** — waits for affordable gas, picks via `https://hayesfloptribe.com`, retries at most once on a cross-operator fallback, or rescues stuck channel escrow locally (never uploads private keys):
```bash
curl -fsSL "https://hayesfloptribe.com/safe-run.sh" -o safe-run.sh && chmod +x safe-run.sh
./safe-run.sh infer --model qwen/qwen3-14b --budget 10 --prompt "Hello!"
# Stuck channel auto-rescue (uses local FLOP_URI env var only):
FLOP_URI="<your-local-uri>" ./safe-run.sh rescue --channel <CHANNEL_ID> --balance 1.5
# Polite single-wallet faucet wait (>=180s backoff + jitter, never bypasses CAPTCHA/cooldown):
./safe-run.sh claim-wait --status-only
```
- **Check official faucet status (90s read-only cache, reduces faucet load):** `curl -sS "https://hayesfloptribe.com/api/faucet"`
- **Check public SS58 wallet readiness & vouchers (read-only, never paste seeds):** `curl -sS "https://hayesfloptribe.com/api/wallet-check?address=5..."`
- **24h real gas curve, UTC low-fee windows & wallet affordability matrix:** `curl -sS "https://hayesfloptribe.com/api/gas/history?window=24h"`

---

## Endpoint Quick Reference
- `GET https://hayesfloptribe.com/safe-run.sh` — Local auto-wait runner (`infer` | `rescue` | `claim-wait`)
- `GET https://hayesfloptribe.com/api/gas` — Live gas status (`green|yellow|red`, `safeToOpen`, fee estimates)
- `GET https://hayesfloptribe.com/api/gas/history?window=1h|6h|24h|7d` — Real sampled gas history, UTC windows & wallet matrix
- `GET https://hayesfloptribe.com/api/faucet` — Cached (90s) official `faucet.flop.network/limits` status & pool caps
- `GET https://hayesfloptribe.com/api/wallet-check?address=<SS58>` — Read-only balance, vouchers & refill-gate diagnosis
- `GET https://hayesfloptribe.com/api/pick?model=<slug>&budget=<flop>&maxTurns=1&exclude=<ss58>` — Smart pick + 2 fallbacks
- `GET https://hayesfloptribe.com/api/session-offers?model=<slug>&miner=<ss58>&minExpiry=<block>` — Signed offers for `--offer-indexer-url`
- `GET https://hayesfloptribe.com/api/miners?model=<slug>&operator=<name>&ready=1&all=1` — Full live directory (`.data` and `.miners`)
- `GET https://hayesfloptribe.com/llms.txt` — Compact plain-text index
- `GET https://hayesfloptribe.com/api/ranking-spec` — Public deterministic unpinned ranking formula
