Abdussamad thank you so much for your help. I installed the Electrum daemon on an Ubuntu EC2 instance and restored the wallet using the MPK. The 'electrum' commands are so eay to use. Everything went smooth and everything is going well except one problem.
I generated 40 wallets on my desktop electrum wallet using: wallet.change_gap_limit(50)
Do you mean 40 wallets or 40 addresses? I think you mean addresses. Don't confuse wallets and addresses. A wallet has many addresses.
On my instance when I use 'electrum listaddresses' in the command line it lists the first 20 addresses correctly in order and then ignores addresses 21-40. Instead it then shows a further 5 addresses, none of which are on my desktop wallet. Any idea why this happens? I stopped/restarted the daemon and alsorestored the wallet again but it shows the same thing.
On my desktop even when I reduce the wallet addresses back to the default 20, the instance daemon command line shows 20 identical to desktop wallet addresses and then those extra unknown 5 addresses.
Please advise if I am doing something wrong or if this is the way it is supposed to work.
On the desktop wallet go to view menu > addresses and switch to addresses tab. Up top you will see filter selections. Change the filter to "change" and "all". You will find the extra addresses there. These are change addresses that electrum uses internally to send back money to itself:
https://en.bitcoin.it/ChangeUse addrequest --force to get addresses on the server. That way you'll always get an unused addresses from the receiving chain.