<p>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:</p>

<p><code>electrum restore xpub...</code></p>

<p>Then you can use the addrequest command with the --force switch to generate addresses:</p>

<p><code>electrum addrequest --force 0.1</code></p>

<p>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 <code>wallet.change_gap_limit(200)</code> on the console tab (view > show console).</p>

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

CC BY-SA 4.0
2018-10-10T20:15:11.240Z
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
}```
Yur Gasparyan
CC BY-SA 4.0
2018-10-10T20:16:29.660Z
I want to know where did amount come from? and what is the amount ?
Yur Gasparyan
CC BY-SA 4.0
2018-10-11T05:42:25.117Z
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
CC BY-SA 4.0
2019-07-31T02:39:53.590Z
Is there a fullnode for BitcoinCash that supports `xpub`?
Sudip Bhattarai
CC BY-SA 4.0
2018-10-10T10:47:34.457Z
2018-10-10T10:47:34.457Z
Abdussamad
<p>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 ? </p>

<p>Thanks! </p>

<bip32-hd-wallets><xpub>
Xpub for HD wallets
Yur Gasparyan
# Xpub for HD wallets

(Asked by: username_0 on 2018-10-10)

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 ?

Thanks!

**Tags:** bip32-hd-wallets, xpub


---

## 1 answers

### Answer by username_1 on 2018-10-10. Score: 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.

> **Comments:**
> **username_0**: 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 }```  
> **username_0**: I want to know where did amount come from? and what is the amount ?  
> **username_1**: 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.  
> **username_2**: Is there a fullnode for BitcoinCash that supports `xpub`?  

---

