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.
Is there a fullnode for BitcoinCash that supports
xpub? – Sudip Bhattarai – 2019-07-31T02:39:53.590thanks 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.1it maybe creates an address and I got the follwing responseI want to know where did amount come from? and what is the amount ? – Yur Gasparyan – 2018-10-10T20:16:29.660
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 – 2018-10-11T05:42:25.117