Clean up RPC help messages #1865

issue gavinandresen opened this issue on September 25, 2012
  1. gavinandresen commented at 12:30 AM on September 25, 2012: contributor

    The first line of RPC help messages follow the syntax:

    method <requiredparam> <requiredparam> [optionalparam] [optionalparam]

    That doesn't work nicely now that we have parameters that are JSON objects or arrays.

    I propose that the syntax be changed to:

    method requiredparam requiredparam ( optionalparam optionalparam )

    ... that string-type parameters by reported in double-quotes, number-type parameters left as-is, Arrays be reported as [foo,...] and Objects as {"foo":bar}

    ... and that default values be specified in the description, not using the (confusing) foo=3 syntax.

    Examples of help using old and new schemes:

    verifymessage <bitcoinaddress> <signature> <message>
    verifymessage "bitcoinaddress" "signature" "message"
    
    getreceivedbyaddress <bitcoinaddress> [minconf=1]
    getreceivedbyaddress "bitcoinaddress" ( minconf )
    
    sendfrom <fromaccount> <tobitcoinaddress> <amount> [minconf=1] [comment] [comment-to]
    sendfrom "fromaccount" "tobitcoinaddress" amount ( minconf "comment" "comment-to" )
    
    listunspent [minconf=1] [maxconf=9999999]  ["address",...]
    listunspent ( minconf maxconf  ["address",...] )
    
    signrawtransaction <hex string> [{"txid":txid,"vout":n,"scriptPubKey":hex},...] [<privatekey1>,...] [sighashtype="ALL"]
    signrawtransaction "hex string" ( [{"txid":txid,"vout":n,"scriptPubKey":hex},...] ["privatekey1",...] "sighashtype" )
    
  2. jgarzik commented at 12:43 AM on September 25, 2012: contributor

    Agree, ran into this with lockunspent...

  3. laanwj commented at 6:48 AM on September 25, 2012: member

    Yes, good idea

  4. Diapolo commented at 8:03 AM on September 25, 2012: none

    What benefit has the space after ( and before )? Is it needed for correct parsing?

  5. luke-jr commented at 8:05 AM on September 25, 2012: member

    Looks good.

  6. laanwj commented at 8:18 AM on September 25, 2012: member

    @diapolo no, it's not strictly needed for parsing, but it's human friendly to have some whitespace.

  7. Diapolo commented at 9:01 AM on September 25, 2012: none

    I consider this a form of plenking (https://en.wikipedia.org/wiki/Plenk) and dislike that style.

  8. laanwj commented at 10:00 AM on September 25, 2012: member

    Well, the ( ... ) can span multiple arguments, and they don't make part of the underlying syntax, so they are "special" compared to other grouping characters such as [, ", {. IMO it makes sense to distinguish them from those characters, by adding extra space. Normally you'd maybe use color or a different font-type for this, but in this case that's not possible.

  9. sje1 referenced this in commit 5c2734b7b9 on Oct 29, 2013
  10. laanwj referenced this in commit e507283ae9 on Nov 13, 2013
  11. laanwj referenced this in commit a6099ef319 on Nov 13, 2013
  12. laanwj commented at 4:25 PM on November 13, 2013: member

    This was implemented and has been merged (#3246)

  13. laanwj closed this on Nov 13, 2013

  14. MathyV referenced this in commit babffe3232 on Aug 4, 2014
  15. MathyV referenced this in commit 327b250655 on Aug 5, 2014
  16. DrahtBot locked this on Sep 8, 2021

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-22 06:16 UTC

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