Skip to content

rpc-extractor: add more RPCs (uptime, getmemoryinfo, ...) #199

Closed

Description

@0xB10C

#191 implemented getpeeinfo support, but we can add some other useful RPCs. Some ideas (partly from https://github.com/jvstein/bitcoin-prometheus-exporter) are:

Ordered by importance:

Activity

  1. added
    enhancement
    help wanted
    good first issue
    on Aug 18, 2025
  2. deadmanoz commented on Aug 28, 2025

    @deadmanoz
    Collaborator

    Hey @0xB10C I'll pick this one up next?

  3. 0xB10C commented on Aug 28, 2025

    @0xB10C
    CollaboratorAuthor

    sure! It's probably easiest to start with a RPC that's already implemented in http://github.com/rust-bitcoin/corepc. Maybe uptime and getmemoryinfo are good starting points.

    Also note that I've started working on #231. Depending on what's ready first one of us might need to rebase.

  4. changed the title [-]rpc-extractor: add more RPC (uptime, getmemoryinfo, ...)[/-] [+]rpc-extractor: add more RPCs (uptime, getmemoryinfo, ...)[/+] on Sep 19, 2025
  5. 0xB10C commented on Sep 23, 2025

    @0xB10C
    CollaboratorAuthor

    doing getmempoolinfo in #269

  6. 0xB10C commented on Dec 10, 2025

    @0xB10C
    CollaboratorAuthor

    uptime and getnettotals done in #302 by @GuiSchet !

  7. GuiSchet commented on Dec 11, 2025

    @GuiSchet
    Contributor

    ey, next week i'll continue with these RPCs. Any info/tips ´re welcome.

  8. 0xB10C commented on Dec 11, 2025

    @0xB10C
    CollaboratorAuthor

    I've ordered the OP by importance. I think getmemoryinfo and getaddrmaninfo would be awesome to have next.

  9. deadmanoz commented on Dec 13, 2025

    @deadmanoz
    Collaborator

    If @GuiSchet is working from the top I will grab some of the lower ones

  10. deadmanoz commented on Dec 13, 2025

    @deadmanoz
    Collaborator

    Just some notes as I look into some of these.

    getorphantxs is a hidden (test-only) RPC call added in v29 (rust-bitcoin/corepc#333). No support for it in either https://github.com/rust-bitcoin/corepc or @0xB10C's fork (https://github.com/0xB10C/corepc).

    I think that the correct approach is to upstream the change to rust-bitcoin/corepc (I'll work on this as a side task), so I'll first consider some of the other RPCs

  11. deadmanoz commented on Dec 13, 2025

    @deadmanoz
    Collaborator

    I think the only other hidden (test-only) RPC call is getrawaddrman

    As per @0xB10C's comment on rust-bitcoin/corepc#333, this is already being used in https://github.com/0xB10C/addrman-observer.

    But this is using the old bitcoincore-rpc (https://github.com/0xB10C/addrman-observer/blob/master/proxy/Cargo.toml).

    I assume we'd also prefer to have getrawaddrman available in rust-bitcoin/corepc directly for use here in peer-observer?

    Edit: yeah, we don't want to introduce bitcoincore-rpc just for this

  12. 0xB10C commented on Dec 13, 2025

    @0xB10C
    CollaboratorAuthor

    Correct, yeah some of these aren't yet implemented in corepc yet, but I think it it's very worthwhile to implement them upstream rust-bitcoin/corepc#333 and then use a master branch commit until they do a release.

    I think getrawaddrman is actually a good one to start with, since it gives us a lot more insights into addrman changes and addrman usage we don't currently have.

    Note that I'm currently testing #305 and will probably merge this early next week. There are going to be conflicts since I'm changing the protobufs a bunch.

  13. deadmanoz commented on Dec 13, 2025

    @deadmanoz
    Collaborator

    Yeah no worries!!

  14. 2 remaining items

  15. GuiSchet commented on Dec 18, 2025

    @GuiSchet
    Contributor

    @0xB10C @deadmanoz, thinking of doing getnetworkinfo or getblockchaininfo, any preference or suggestions?

  16. deadmanoz commented on Dec 18, 2025

    @deadmanoz
    Collaborator

    Your choice mate, I can pickup some other issues!!

  17. 0xB10C commented on Dec 22, 2025

    @0xB10C
    CollaboratorAuthor

    started implementing getorphantxs upstream rust-bitcoin/corepc#435

  18. deadmanoz commented on Dec 30, 2025

    @deadmanoz
    Collaborator

    Also started implementing getrawaddrman upstream: rust-bitcoin/corepc#439.

    getchaintxstats has been merged upstream, when/how do we make use of it (will allow me to update #312 and move from draft)?

  19. 0xB10C commented on Dec 30, 2025

    @0xB10C
    CollaboratorAuthor

    good question. One idea could be to collect a few merged corepc PRs and then rebase my custom branch:

    # Use custom commit to support cpu_load and inv_to_send in getpeerinfo.
    corepc-node = { git = "https://github.com/0xb10c/corepc", rev = "3fb9897bca0e41ba1f96a4532578e64349c97864", features = ["download", "29_0"] }
    corepc-client = { git = "https://github.com/0xb10c/corepc", rev = "3fb9897bca0e41ba1f96a4532578e64349c97864", features = ["client-sync"]}

    Also happy to rebase my custom corepc branch now and then you can use that in #312.

  20. deadmanoz commented on Dec 30, 2025

    @deadmanoz
    Collaborator

    @0xB10C if you can rebase then I can use in #312

  21. 0xB10C commented on Dec 30, 2025

    @0xB10C
    CollaboratorAuthor

    @0xB10C if you can rebase then I can use in #312

    Done!

    With #323, we should be able to use getorphantxs now too.

  22. GuiSchet commented on Jan 22, 2026

    @GuiSchet
    Contributor

    After reviewing the current RPC coverage and Bitcoin Core's available RPCs, I'd like to propose adding these:

    1. getchaintips

    Returns information about all known tips in the block tree, including the main chain and orphaned branches.

    Field Description Overlap?
    height Height of each chain tip None
    hash Block hash of each tip None
    branchlen Length of branch to main chain None
    status active, valid-fork, valid-headers, headers-only, invalid None

    2. listbanned

    Returns list of all manually banned IPs/subnets with ban details.

    Field Description Overlap?
    address Banned IP/subnet None
    ban_created When ban started (timestamp) None
    banned_until Ban expiration (timestamp) None
    ban_reason manually or node-misbehaving None

    3. getmininginfo

    Returns mining-related information consolidated in one call.

    Field Description Overlap?
    networkhashps Estimated network hash rate NEW
    nBits (v29+) Compact difficulty target NEW
    target (v29+) Full difficulty target NEW
    pooledtx Txs in mempool Similar to getmempoolinfo.size
    difficulty Current difficulty Already in getblockchaininfo
    chain Network name Already in getblockchaininfo
    warnings Active warnings Already in getblockchaininfo/getnetworkinfo
  23. 0xB10C commented on Jan 26, 2026

    @0xB10C
    CollaboratorAuthor

    After reviewing the current RPC coverage and Bitcoin Core's available RPCs, I'd like to propose adding these:

    Thanks for proposing these. However, I'm not immediately sure how they relate to P2P monitoring and what new information they present..

    getchaintips

    We use this extensively in fork-observer already. I could make sense to have metrics for stale blocks in peer-observer too, but I'm not exactly sure if they'd give us much new information.

    listbanned

    As you mentioned, this only give us the manually banned IPs and subnets. Not something that's automatically banned based on heuristics. We know which IPs and subnets have been banned for each node. Addtionally, I think ban_reason is something that an LLM hallucinated. There is no such thing for the Bitcoin Core RPC listbanned.

    getmininginfo

    I don't think networkhashps is a relevant P2P monitoring information. And nBits and target are numeric fields that aren't really translatable into useful metrics too, I think.

    The getblocktemplate RPC could be interesting for information about the fees, weight, tx count, sigops, ... of templates. But I don't think it's a priority to add this.

  24. edilmedeiros commented on Mar 10, 2026

    @edilmedeiros
    Contributor

    bitcoin/bitcoin#34683 seems to be related to this work and has gained some movement recently. It would imply a rewrite of the extractor: instead of manually adding rpc cases, use some form of automatic generation. Not suggesting this to be done, just reporting something that might eventually get merged on core that can have a positive impact.

  25. 0xB10C commented on Mar 10, 2026

    @0xB10C
    CollaboratorAuthor

    Agree. The hope would be that something like corepc switches to it, and we can use it from there. For the short-term, I think no action is needed in peer-observer.

  26. satsfy commented on Mar 10, 2026

    @satsfy

    Hi @0xB10C, I'm working on that PR in Bitcoin Core with Will and may soon also begin the corepc side of this.
    I'd love to ask you a few questions about what you want from corepc so I can better direct my efforts and help peer-observer too.

    1. The current client in corepc is intended for integration testing only. Would you like a full codegen production client?
    2. Which versions of Bitcoin Core are you interested in? I've been able to generate down to v24, would you need anything earlier?
    3. Are you also interested in the types provided by corepc? Or just a client? Another way to put it is: would you like to rely more on the into_model() conversion to rust bitcoin types, or are the client raw types sufficient for you?
    4. Which RPC methods do you use (assuming the ones listed in this issue are the ones that interest your the most). Are there any pain points you're currently working around? (Missing fields, wrong types, version gaps, etc.)

    Happy to hear any other thoughts or suggestions you might have.

  27. 0xB10C commented on Mar 12, 2026

    @0xB10C
    CollaboratorAuthor

    The current client in corepc is intended for integration testing only. Would you like a full codegen production client?

    Yeah, your observation is correct, we are (ab)using the integration testing-only client in peer-observer for now. There is e.g. https://github.com/alpenlabs/bitcoind-async-client we could switch too, if we find out we need something more "production" ready. Ideally, the codegen part would only touch the types, and not the clients?

    Which versions of Bitcoin Core are you interested in? I've been able to generate down to v24, would you need anything earlier?

    For peer-observer specifically, only recent-ish versions of Bitcoin Core are interesting. The oldest I'm currently running is v29.2 or so. However, with peer-observer, we frequently run newer release candidates or master, so having a way of running the code gen myself for an not-yet-released version of Bitcoin Core is interesting.

    Are you also interested in the types provided by corepc? Or just a client? Another way to put it is: would you like to rely more on the into_model() conversion to rust bitcoin types, or are the client raw types sufficient for you?

    We recently merged #351 to use the version agnostic types, where possible.

    Which RPC methods do you use (assuming the ones listed in this issue are the ones that interest your the most). Are there any pain points you're currently working around? (Missing fields, wrong types, version gaps, etc.)

    We are currently using a patched version of corepc since they haven't made a release in a while and don't yet support some of the changes that are merged in Bitcoin Core master, but not yet released in a Bitcoin Core release. See

    # Use custom commit to support:
    # - cpu_load and inv_to_send in getpeerinfo
    # - and master has the fix https://github.com/rust-bitcoin/corepc/pull/483
    # (branch 2026-02-v0.11-peer-observer-custom)
    # When updating the Bitcoin Core version used, grep for CORE_VERSION_GREP
    # and update the corepc_client::types::v* to the new version.
    corepc-node = { git = "https://github.com/0xb10c/corepc", rev = "b777fa7160c7b97e1e845e771953a158233660cd", features = ["download", "30_2"] }
    corepc-client = { git = "https://github.com/0xb10c/corepc", rev = "b777fa7160c7b97e1e845e771953a158233660cd", features = ["client-sync"]}

  28. 0xB10C commented on Mar 25, 2026

    @0xB10C
    CollaboratorAuthor

    We've implemented all listed RPCs here. I think we can close this for now and reopen if we find more than we want to have.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementgood first issuehelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions