I have a cold storage in my one of the computers.Also in my project server I have run bitcoin-cli. So I want to remove priv key from here and set the public key from cold storage. I read that it will more secure and I can spend my coins only from cold storage. How can I implement this mechanism ?


1 Answer 1


You can't do this with bitcoin core since it uses hardened derivation so you can't derive addresses using the extended public key. You should use electrum for this instead. An electrum watch-only wallet can mirror the addresses of a an electrum seeded wallet. So just create an electrum wallet on your desktop as normal and then grab the master public key aka extended public key via wallet menu > information. You can then derive addresses using that. The easiest way would be to install electrum on the server, restore the wallet using the xpub:

electrum restore xpub...

Then you can use the addrequest command with the --force switch to generate addresses:

electrum addrequest --force 0.1

The JSON code that is output will contain a unique address everytime. Note you may have to increase the gap limit on the seeded wallet on your desktop via wallet.change_gap_limit(200) on the console tab (view > show console).

Electrum also has a JSON RPC interface as well but you will have to research how to use that yourself.

  • thanks for reply. So I have run the following commands, and at first I have created an account called default_wallet. than when I have run electrum addrequest --force 0.1 it maybe creates an address and I got the follwing response { "URI": "bitcoin:12RDcyE2YRFy6d9NcMhPE2ABszaqMqqqrG?amount=0.1", "address": "12RDcyE2YRFy6d9NcMhPE2ABszaqMqqqrG", "amount": 10000000, "amount (BTC)": "0.1", "exp": null, "id": "e2471abf54", "memo": "", "status": "Unknown", "time": 1539202269 } Oct 10, 2018 at 20:15
  • I want to know where did amount come from? and what is the amount ? Oct 10, 2018 at 20:16
  • The addrequest command requires that you provide it an amount. However that amount is meaningless so just enter anything you like. The amount is the 0.1 part of the command i gave above.
    – Abdussamad
    Oct 11, 2018 at 5:42
  • Is there a fullnode for BitcoinCash that supports xpub? Jul 31, 2019 at 2:39

Your Answer

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

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