I have a need to generate a new extended public key (xpub).




How can I do this?

I would like to do it inside json rpc, because that would help automate testing, but I ultimately don't care how I get them. They are for testing.

2 Answers 2


You can do that, but each HD seed needs to be inside its own wallet file which is loaded by the server. Running bitcoind with multiple -wallet arguments will achieve what you are aiming for. Currently it is not supported to dynamically load and unload wallets at runtime, but support for that is being added and will be available in a future release.

  • Exporting xpub from bitcoin node doesn't server purpose as it uses hardened key derviation... you need to export the xprv bitcoin.stackexchange.com/questions/50244/… Apr 23, 2018 at 8:48
  • @toddmo you can generate a valid xpub any way you like if you just want one for testing, it doesn't have to be the same one as the one in your wallet Apr 24, 2018 at 2:11
  • ok I put a lot of effort into editing my question and doing research, which provided an answer, which may not be the best. Sorry but I needed to learn what I needed to ask and cut out all the extraneous babbling in my original question. Now you can see what I really want by looking at my edited question and my new answer. Again, sorry. Feel free to give a better answer than mine.
    – toddmo
    Apr 24, 2018 at 3:04
  • It's worth noting that Bitcoin Core can load and unload wallets at runtime since 0.16. Jul 3, 2023 at 3:23

You can generate new extended public keys on


You can generate them for testnet or mainnet. Just set the network combo box in the upper right to the network you want.

ADVISO: Please don't ever use websites to generate key material. Suitable only for throw-away addresses for testing only.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.