RPC introspection #4157

issue insunaa opened this issue on May 9, 2014
  1. insunaa commented at 8:20 AM on May 9, 2014: none

    Enable the bitcoin rpc server to return structured information about the rpc commands it accepts, such as parameters, datatypes, requiredness and maybe a description or parameter bounds

    A static example of this can be found here: https://github.com/d3rrial/bitcoin/blob/getrpcinfo_rpc_command/src/rpcserver.cpp

    Ideal would be something more dynamic, so that developers, should rpc methods be added or removed don't have to crawl through that list of rpc commands.

  2. laanwj commented at 9:30 AM on May 9, 2014: member

    The only drawback that I see is that bitcoin-cli (and other RPC command-line clients) would effectively have to do two roundtrips to the server. Once to get instructions on how to convert the command-line parameters to JSON, and once to do the actual command.

    (edit: duh, caching could be used, HTTP solved this)

  3. laanwj added the label RPC on May 9, 2014
  4. insunaa commented at 9:34 AM on May 9, 2014: none

    That's the tradeoff, save round-trip time by storing it yourself in the RPC client or save memory by requesting a list containing the instructions.

    The one advantage this method would have over RPC clients keeping their own lists, if changes were made to the RPC Server clients would automatically be compatible, as long as the rpcinfo was also updated accordingly.

    This wouldn't break existing RPC applications, but it could expand them. Consider this case: An RPC client stores it's own list of RPC commands, but due to some changes to the rpc server a client rpc command that was formerly valid in this way is now invalid and consistently produces an error, even though the user uses correct input. The client could send a getrpcinfo request to the rpc server and (either temporarily or permanently) adapt it's own rpc command list

  5. laanwj commented at 7:08 AM on June 26, 2014: member

    XBMC's JSONRPC.Introspect API sounds interesting here. It offers introspection and self-documentation (so it's like our 'help' system but machine-parseable).

    http://wiki.xbmc.org/index.php?title=JSON-RPC_API/v3#JSONRPC.Introspect

    This has even been used to auto-generate client-side libs for static programming languages such as C#: https://jsonrpcgen.codeplex.com/ . I'd say this is exactly what we need. There is not a standard for JSON-RPC introspection as such, but this is the second-best thing: an existing implementation with tools already available.

  6. laanwj added the label Brainstorming on Jun 26, 2014
  7. promag commented at 12:04 AM on December 7, 2017: member
  8. jnewbery commented at 9:12 PM on March 28, 2018: member

    Is anyone working on this? I suggest we close as an up-for-grabs issue if it's not actively being worked on.

  9. MarcoFalke commented at 12:02 AM on April 27, 2020: member

    This can be easily implemented with RPCMan (or RPCHelpMan)

  10. MarcoFalke closed this on Apr 27, 2020

  11. 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:15 UTC

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