Surface "general information" through RPC #17952

issue msafi opened this issue on January 17, 2020
  1. msafi commented at 5:40 PM on January 17, 2020: none

    Is your feature request related to a problem? Please describe.

    3rd party Bitcoin clients using bitcoind don't have an easy and reliable way to know the general info that's displayed in the Bitcoin Core GUI.

    image

    I would like to be able to display this information on the Bitcoin client that I'm working on.

    Describe the solution you'd like

    How can we surface this information through RPC? Should we add a new RPC endpoint for it? Something like getgeneralinfo which would return the clientversion, datadir, blocksdir, and startup time?

  2. msafi added the label Feature on Jan 17, 2020
  3. brakmic commented at 5:57 PM on January 18, 2020: contributor

    Hi,

    I've implemented a possible solution to this feature request. This is how it looks like when executed in the console:

    bitcoin-cli -regtest getgeneralinfo

    {
      "clientversion": "v0.19.99.0-a654626f0-dirty",
      "useragent": "/Satoshi:0.19.99/",
      "datadir": "/Users/brakmic/Library/Application Support/Bitcoin/regtest",
      "blocksdir": "/Users/brakmic/Library/Application Support/Bitcoin/regtest/blocks",
      "startuptime": "2020-01-18T17:49:50Z"
    }
    

    bitcoin-cli -regtest help getgeneralinfo

    getgeneralnfo
    
    Returns data about the bitcoin daemon.
    
    Result:
      {
        "clientversion": "version string",     (string) Client version
        "useragent":"client name",             (string) Client name
        "datadir":"datadir path",              (string) Data directory path
        "blocksdir":"blocksdir path",          (string) Blocks directory path
        "startuptime":"string",                (string) Startup time
      }
    
    Examples:
    > bitcoin-cli getgeneralinfo 
    > curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getgeneralinfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/
    

    However, I am not sure about the format of the startup time as it is shown right now. Maybe there's a better convert function that I should be using.

    We'll see after I have opened the PR. ;)

    Regards,

  4. jonatack commented at 7:19 PM on January 18, 2020: member

    I'm not sure what the use case is here. Perhaps related to #17314, and more applicable to it than the RPC API, though the trend seems to be toward removing info like this, not adding it.

  5. msafi commented at 7:57 PM on January 18, 2020: none

    @jonatack the use case is basically enabling a separate GUI that's powered by bitcoind and that is as capable as Bitcoin Core GUI. Of course this getgeneralinfo end-point alone doesn't enable that, but it moves us a little bit closer.

    I think there's a general desire to rearchitect the Bitcoin Core GUI so that it is not tightly coupled with the code outside of the qt/ folder. In that case one obvious solution is to have a GUI that works asynchronously by using RPC with bitcoind, as described in this comment.

  6. jonatack commented at 8:12 PM on January 18, 2020: member

    Thanks @msafi for the explanation.

  7. msafi commented at 8:15 PM on January 18, 2020: none

    @jonatack Sorry, I should've been more specific. I was referring to this line from the comment:

    If I would have some wishes open, one of them would be that the GUI works perfectly asynchronous over the RPC interface

    Perhaps because you use RPC as the primary interface, you don't see the value in adding this call? I felt the need for this change when I tried to rebuild the Bitcoin Core GUI by only relying on bitcoind and RPC.

    Based on my limited understanding of the code, it seems to me that the getinfo call is specific to bitcoin-cli. If you don't use bitcoin-cli and talk directly to RPC by using curl you don't have access to getinfo.

  8. jonatack commented at 8:18 PM on January 18, 2020: member

    Yes, agreed, I didn't understand what the motivation was. This makes more sense now. I'll defer to others' opinions here.

  9. MarcoFalke commented at 4:43 PM on January 19, 2020: member

    This information is already available:

    • uptime
    • getnetworkinfo
  10. msafi commented at 5:10 PM on January 19, 2020: none

    @MarcoFalke Please see this #17958 (comment)

  11. MarcoFalke commented at 11:30 PM on May 7, 2020: member

    The feature request didn't seem to attract much attention in the past. Also, the issue seems not important enough right now to keep it sitting around idle in the list of open issues.

    Closing due to lack of interest. Pull requests with improvements are always welcome.

  12. MarcoFalke closed this on May 7, 2020

  13. DrahtBot locked this on Feb 15, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-13 15:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me