relay-diagnostic

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Relay Diagnostic Skill

中继诊断Skill

Diagnoses and recovers stuck sponsored transactions by inspecting the sponsor relay's nonce state and optionally triggering automated recovery.
  • 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.
通过检查赞助中继的Nonce状态,诊断并恢复停滞的赞助交易,还可触发自动化恢复操作。
  • check-health — 只读操作,无需钱包。返回中继版本、赞助方Nonce状态、检测到的缺口以及停滞的交易。
  • recover — 需要解锁的钱包(用于获取赞助方API密钥)。尝试RBF、缺口填补,或同时执行两者。

Usage

使用方法

bun run relay-diagnostic/relay-diagnostic.ts <subcommand> [options]
bun run relay-diagnostic/relay-diagnostic.ts <subcommand> [options]

Subcommands

子命令

check-health

check-health

Check the sponsor relay availability and nonce status. No wallet needed.
bun run relay-diagnostic/relay-diagnostic.ts check-health
Output:
json
{
  "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..."
}
检查赞助中继的可用性和Nonce状态,无需钱包。
bun run relay-diagnostic/relay-diagnostic.ts check-health
输出:
json
{
  "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

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:
json
{
  "action": "both",
  "rbf": {
    "supported": true,
    "result": { "bumped": 2 }
  },
  "fillGaps": {
    "supported": true,
    "result": { "filled": 0 }
  },
  "summary": "Recovery request submitted to relay. Run check-health to verify nonce state improved."
}
尝试自动化恢复停滞的交易,需要解锁的钱包。
bun run relay-diagnostic/relay-diagnostic.ts recover [options]
选项:
  • --action <rbf|fill-gaps|both>
    — 恢复模式(默认值:
    both
  • --txids <txid,...>
    — 用于RBF的特定停滞交易ID列表,以逗号分隔(省略则恢复所有)
  • --nonces <n,...>
    — 用于缺口填补的特定缺失Nonce列表,以逗号分隔(省略则填补所有)
输出:
json
{
  "action": "both",
  "rbf": {
    "supported": true,
    "result": { "bumped": 2 }
  },
  "fillGaps": {
    "supported": true,
    "result": { "filled": 0 }
  },
  "summary": "Recovery request submitted to relay. Run check-health to verify nonce state improved."
}

Notes

注意事项

  • Always run
    check-health
    before
    recover
    — recovery without a prior health check may bump transactions unnecessarily.
  • If the relay returns 404 or 501 for recovery endpoints, the tool reports
    supported: false
    with 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 unlock
    first).
  • 请始终在执行
    recover
    前先运行
    check-health
    ——不预先进行健康检查的恢复操作可能会不必要地替换交易。
  • 如果中继对恢复端点返回404或501状态码,工具会返回
    supported: false
    ,并提示联系AIBTC团队。
  • 主网的赞助方地址为
    SP1PMPPVCMVW96FSWFV30KJQ4MNBMZ8MRWR3JWQ7
  • 钱包操作需要解锁的钱包(请先执行
    bun run wallet/wallet.ts unlock
    )。