Referring to the documentation: https://bitcoincore.org/en/doc/0.20.0/rpc/wallet/getnewaddress/

Using the example:

curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getnewaddress", "params": []}' -H 'content-type: text/plain;'

How do I generate multiple new addresses with a single command to the server without looping the curl command, which will create a new connection each and every time. As in, if I know I need 10 new addresses, instead of looping that curl command 10 times, can I not structure the json in such a way which will send me back 10 address in 1 connection call?

  • 1
    The simple answer is that "using this example", you can't do what you want to do. It is only designed for the generation of a single address. Have a look at the util/deriveaddresses call (bitcoincore.org/en/doc/0.20.0/rpc/util/deriveaddresses) which may do what you want. (Not sure if that's available as an RPC endpoint or just CLI though) – theruss Jul 27 '20 at 2:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.