Author

Topic: Electrum 4.0.9 wallet sync problem (Read 54 times)

legendary
Activity: 3038
Merit: 4418
Crypto Swap Exchange
April 08, 2021, 04:16:17 AM
#11
Actually I understand that Electrum may not be a good choice to handle a huge number of addresses. But in this situation if someone having rights is going to make transaction from Wallet A, the gap limit of wallet A is required to be changed as the same as Wallet B first in order to take the correct balance? 
Balance in Wallet A will never be updated. The sole purpose of Wallet A is to sign the transaction and nothing else. Wallet B has to have the correct information and you will be able to have it since that is the wallet that is able to craft the transaction to be signed in Wallet A.

It really wouldn't matter if the addresses doesn't appear in both wallets, if the corresponding master private key is in Wallet A, the addresses generated will never deviate. The wallet will also be able to tell which private keys to generate and sign as the PSBT generated by Electrum shows the full derivation path so the gap limit is not an issue at all.


Code:
{
-snip-
            "value": -snip-,
            "n": 1,
            "scriptPubKey": {
              "asm": "-snip-",
              "hex": "-snip-",
              "reqSigs": 1,
              "type": "witness_v0_keyhash",
              "addresses": [
                "-snip-"
              ]
            }
          }
        ]
      },
      "bip32_derivs": [
        {
          "pubkey": "-snip-",
          "master_fingerprint": "-snip-",
          "path": "m/0'/1/0"
        }
-snip-
legendary
Activity: 2702
Merit: 4002
April 08, 2021, 03:52:33 AM
#10
Actually I understand that Electrum may not be a good choice to handle a huge number of addresses. But in this situation if someone having rights is going to make transaction from Wallet A, the gap limit of wallet A is required to be changed as the same as Wallet B first in order to take the correct balance? 
B wallet is nothing but a representation of A wallet without the risk of having a private key if both wallets are synchronized (connected to the Internet) then there is no point in creating B wallet.

You can use btcpayserver[1] if you want to receive notifications and you can also increase the gap limit (assuming you intend to do something related to creating a website or payment interface.

[1] https://docs.btcpayserver.org/ElectrumWallet/
legendary
Activity: 3668
Merit: 6382
Looking for campaign manager? Contact icopress!
April 08, 2021, 03:29:55 AM
#9
Yes I do think that the wallets will sync between each other.

They don't sync with each other. They are independent entities. Any of them, and only if it's online, syncs with the Electrum servers (which are sync-ed with the blockchain).
Since the watch only wallet has the master public key, it can hold the same addresses as the offline wallet, but only the online wallet will know what happens on the blockchain.
And the offline wallet needs help (gap limit) to enlarge the number of addresses it sees, but that's actually not necessary, since it'll remain offline anyway, and, as @nc50lc said, the offline wallet can sign the transactions anyway. And that's the only use (besides security) for the offline wallet.

In my case, I need to generate some addresses for a number of users (which is greater than default number 20). My program also subscribe to those addresses for notifying when bitcoins are transferred to those addresses. Therefore get an unused address from Electrum may not be a good solution to me in current approach as some addresses may remain unused at last.

Actually I understand that Electrum may not be a good choice to handle a huge number of addresses. But in this situation if someone having rights is going to make transaction from Wallet A, the gap limit of wallet A is required to be changed as the same as Wallet B first in order to take the correct balance?  

The offline wallet will not know the updates in balances / incoming-outgoing transactions. Since it's offline, it doesn't receive that information from the Electrum server.
The offline wallet is only good for signing transactions (i.e. spend), and those transactions have to be made with the online wallet (which is the only one that knows the correct transactions/balances/inputs)


If you only want to notify users, the online watch-only wallet should do most of the job: see the incoming transactions, notify the users. The offline wallet is still useful for security and signing.
But if you plan big number of addresses, you'll have to go with Bitcoin Core.
newbie
Activity: 6
Merit: 3
April 08, 2021, 03:09:19 AM
#8
Quote
Are both wallets online? If both wallets are online, then you don't need to increase both wallets' gap limits.
Wallet A is offline in my program. In actual case, I will not have the right to make any transaction from Wallet A in my role. Therefore I get a watch-only Wallet B.

Quote
From the topic title, I think that OP may be (wrongly) thinking that the wallets will sync between each other.
Yes I do think that the wallets will sync between each other.

In my case, I need to generate some addresses for a number of users (which is greater than default number 20). My program also subscribe to those addresses for notifying when bitcoins are transferred to those addresses. Therefore get an unused address from Electrum may not be a good solution to me in current approach as some addresses may remain unused at last.

Actually I understand that Electrum may not be a good choice to handle a huge number of addresses. But in this situation if someone having rights is going to make transaction from Wallet A, the gap limit of wallet A is required to be changed as the same as Wallet B first in order to take the correct balance? 
legendary
Activity: 3668
Merit: 6382
Looking for campaign manager? Contact icopress!
April 08, 2021, 02:40:31 AM
#7
From the topic title, I think that OP may be (wrongly) thinking that the wallets will sync between each other.

OP: maybe you would be nice and tell the actual setup (what is offline and what is online) and what you want to actually achieve.
(For example, if you want to make a merchant solution and you expect to generate huge number of addresses, Electrum may not be your best option.)
legendary
Activity: 2618
Merit: 6452
Self-proclaimed Genius
April 08, 2021, 02:33:09 AM
#6
I have changed the gap limit of Wallet B only. But this change does not reflect on Wallet A too. Do I need to also manually change the gap limit of Wallet A?
Are both wallets online? If both wallets are online, then you don't need to increase both wallets' gap limits.
They'll both produce more addresses if needed as long as you're not skipping some addresses unused, use the command in my first reply to get an unused address.

If A is offline, you'll need to manually produce the addresses but since it's offline, I can't see any reason to synchronize its addresses list since it'll be able to sign transactions for walletB anyways.

What's your use-case BTW?
legendary
Activity: 3038
Merit: 4418
Crypto Swap Exchange
April 08, 2021, 02:27:00 AM
#5
I have changed the gap limit of Wallet B only. But this change does not reflect on Wallet A too. Do I need to also manually change the gap limit of Wallet A?
Yes. If you don't change the gap limit, it won't be shown in wallet A.

Rule of the thumb is that as long as the addresses in Wallet B are also in Wallet A, any subsequent addresses generated will not deviate as well. I'm not sure how the gap limit of the offline wallet would work since it technically won't know which addresses aren't used?
newbie
Activity: 6
Merit: 3
April 08, 2021, 02:24:22 AM
#4
I have changed the gap limit of Wallet B only. But this change does not reflect on Wallet A too. Do I need to also manually change the gap limit of Wallet A?
legendary
Activity: 2618
Merit: 6452
Self-proclaimed Genius
April 08, 2021, 02:22:13 AM
#3
It didn't synchronize because Electrum will only generate addresses beyond the "gap limit" if the last address was already used.
In your case, the new address created in wallet B using createnewaddress is the 21st in the address index.
That command will produce a new receiving addresses that's not in the already-generated 20.

If you need to receive bitcoins, use add_request "amount" instead and that will return with an unused address within the gap limit.
legendary
Activity: 3668
Merit: 6382
Looking for campaign manager? Contact icopress!
April 08, 2021, 02:18:18 AM
#2
Did you by chance created multiple addresses like this and they're all unfunded?
Because you may have passed the default gap limit and all you may have to do is to increase that.
newbie
Activity: 6
Merit: 3
April 08, 2021, 01:51:41 AM
#1
Hi, I have a wallet file (lets say Wallet A) and I use the master public key of Wallet A to create a watch-only wallet file (lets say wallet B).

I try to load wallet B in daemon and create some new addresses of wallet B by electrum command 'createnewaddress', and addresses created can be found in 'listaddresses' in Wallet B.
However, those addresses newly created cannot be found in Wallet A. Is there any way to synchronize Wallet A with the newly created addresses? Thanks.
Jump to: