Skip to content

admin_capabilities - Method for Reporting Node Historical Data #754

@0xjvn

Description

@0xjvn

Summary

An RPC endpoint usually does not tell you what historical data it actually has. So we don’t reliably know whether a node can answer things like state at an old block, old receipts/txs, or logs over a wide range. Today we try to guess with heuristics and probing, but that is expensive and still often wrong. It causes misrouting, retries, and a worse experience for users.

I think it also would be useful for a lot of different RPC providers, who want to do automatic routing based on nodes' actual settings.

Method

admin_capabilities

A small RPC method in the admin namespace that returns two things:

config: the retention/pruning-related settings
effective: what data is actually available (oldest block) and how it is removed over time (deletion strategy) for state, tx, logs, and blocks (bodies/receipts)

Example output

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "config": {
      "state": { "scheme": "path", "gcMode": null, "historyState": 90000 },
      "history": { "transactions": 2350000, "logs": 2350000, "logsDisabled": false, "chain": "all" },
      "pruning": { "historyPruned": false, "historyPrunedUpToBlock": null }
    },
    "effective": {
      "state": { "disabled": false, "oldestBlock": "0x12ab34", "deleteStrategy": { "type": "window", "retentionBlocks": 90000 } },
      "tx": { "disabled": false, "oldestBlock": "0x0f00aa", "deleteStrategy": { "type": "window", "retentionBlocks": 2350000 } },
      "logs": { "disabled": false, "oldestBlock": "0x0f00aa", "deleteStrategy": { "type": "window", "retentionBlocks": 2350000 } },
      "blocks": { "disabled": false, "oldestBlock": "0x0", "deleteStrategy": { "type": "none" } }
    }
  }
}

Initially reported here

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions