RPC sendmany first (dummy, empty string) argument is not optional #33182

issue pinheadmz openend this issue on August 13, 2025
  1. pinheadmz commented at 11:20 am on August 13, 2025: member

    I need a sanity check on this since #25093 was merged over three years ago and no one seems to have complained yet.

    0-->  bitcoin-cli -regtest sendmany ''  '{"bcrt1qzsmq9xxmt85uf0nu2qjrptvqdgak38umnj0p4h": 10}'
    19a43e18d3e5fcfb36dd6d4832b6ff374f877ac5dd83056dddf5d60147e082a51
    2
    3-->  bitcoin-cli -regtest sendmany '{"bcrt1qzsmq9xxmt85uf0nu2qjrptvqdgak38umnj0p4h": 10}'
    4error code: -1
    5error message:
    6sendmany ( "" ) {"address":amount,...} ( minconf "comment" ["address",...] replaceable conf_target "estimate_mode" fee_rate verbose )
    

    Certainly looks like the first argument is required:

    https://github.com/bitcoin/bitcoin/blob/2581258ec200efb173ea6449ad09b2e7f1cc02e0/src/wallet/rpc/spend.cpp#L391-L396

    …how do you make a first argument optional, anyway?

  2. fanquake added the label Wallet on Aug 13, 2025
  3. fanquake added the label RPC/REST/ZMQ on Aug 13, 2025
  4. furszy commented at 1:47 pm on August 14, 2025: member
    The dummy first argument dates back to the ‘accounts’ days, which were removed in 2018 (109e05dcd163b8ddb7f4b3550db6b9ab833). After all this time, I’m tempted to suggest removing the argument outright. We’d just need a clear paragraph in the release notes.
  5. maflcko commented at 2:07 pm on August 20, 2025: member

    …how do you make a first argument optional, anyway?

    You can use named args, by using the -named=1 option:

    0$ ./bld-cmake/bin/bitcoin-cli -named=1 sendmany amounts='{"hi":1}'
    

    This shows that the arg is correctly marked as optional.

    What am I missing?

  6. maflcko added the label Questions and Help on Aug 20, 2025
  7. pinheadmz commented at 2:21 pm on August 20, 2025: member
    ah using -named=1 is my answer thanks.
  8. pinheadmz closed this on Aug 20, 2025


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: 2025-09-04 21:13 UTC

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