relay-diagnostic
Relay Diagnostic Skill
Diagnoses and recovers stuck sponsored transactions by inspecting the sponsor relay's nonce state and optionally triggering automated recovery.
Use this for operator diagnostics only. Caller-facing x402 payment state should come from canonical payment-status polling by paymentId, not from relay health heuristics.
- check-health — Read-only, no wallet required. Returns relay version, sponsor nonce status, detected gaps, and stuck transactions.
- recover — Requires an unlocked wallet (to source the sponsor API key). Attempts RBF, gap-fill, or both.
Usage
bun run relay-diagnostic/relay-diagnostic.ts <subcommand> [options]
Subcommands
check-health
Check the sponsor relay availability and nonce status. No wallet needed.
bun run relay-diagnostic/relay-diagnostic.ts check-health
Output:
{
"healthy": true,
"network": "mainnet",
"version": "1.2.0",
"sponsorAddress": "SP1PMPPVCMVW96FSWFV30KJQ4MNBMZ8MRWR3JWQ7",
"nonceStatus": {
"lastExecuted": 4210,
"lastMempool": 4215,
"possibleNext": 4216,
"missingNonces": [],
"mempoolNonces": [4211, 4212, 4213, 4214, 4215],
"hasGaps": false,
"gapCount": 0,
"mempoolDesync": false,
"desyncGap": 5
},
"stuckTransactions": [],
"issues": [],
"formatted": "Relay Health Check (mainnet)\nStatus: HEALTHY\n..."
}
recover
Attempt automated recovery of stuck transactions. Requires an unlocked wallet.
bun run relay-diagnostic/relay-diagnostic.ts recover [options]
Options:
--action <rbf|fill-gaps|both>— Recovery mode (default:both)--txids <txid,...>— Comma-separated list of specific stuck txids for RBF (omit to bump all)--nonces <n,...>— Comma-separated list of specific missing nonces for gap-fill (omit to fill all)
Output:
{
"action": "both",
"rbf": {
"supported": true,
"result": { "bumped": 2 }
},
"fillGaps": {
"supported": true,
"result": { "filled": 0 }
},
"summary": "Recovery request sent to relay. Run check-health to verify nonce state improved."
}
Notes
- Always run
check-healthbeforerecover— recovery without a prior health check may bump transactions unnecessarily. - If the relay returns 404 or 501 for recovery endpoints, the tool reports
supported: falsewith instructions to contact the AIBTC team. - The sponsor address for mainnet is
SP1PMPPVCMVW96FSWFV30KJQ4MNBMZ8MRWR3JWQ7. - Wallet operations require an unlocked wallet (use
bun run wallet/wallet.ts unlockfirst).
More from aibtcdev/skills
arxiv-research
Fetch and compile arXiv papers on LLMs, autonomous agents, and AI infrastructure into scored, grouped research digests. Stores digests at ~/.aibtc/arxiv-research/digests/. No API key required.
178aibtc-news
aibtc.news decentralized intelligence platform — list and claim editorial beats, file authenticated signals (news items) with BIP-322 signatures, browse signals, check weighted leaderboard, review signals as publisher, and trigger daily brief compilation.
166aibtc-news-correspondent
Correspondent for aibtc.news: claim a beat, research daily using live on-chain and market data, file quality signals, earn $25 sBTC per signal included in the daily brief
157btc
Bitcoin L1 operations — check balances, estimate fees, list UTXOs, transfer BTC, and classify UTXOs as cardinal (safe to spend), ordinal (inscriptions), or rune (rune tokens). Data sourced from mempool.space and the Unisat API.
150aibtc-news-fact-checker
Side role: find and correct bad signals, earn leaderboard points per Publisher-approved correction (max 3/day)
149defi
DeFi operations on Stacks — ALEX DEX token swaps and liquidity pool queries, plus Zest Protocol lending (supply, withdraw, borrow, repay, claim rewards). All operations are mainnet-only. Write operations require an unlocked wallet.
148