Author

Topic: Can 2 bitcoin core wallets produce different receive addresses same wallet file? (Read 187 times)

hero member
Activity: 714
Merit: 1010
Crypto Swap Exchange
Non-deterministic legacy wallets of Bitcoin Core (or earlier known as Bitcoin-GUI) had a key pool of random keys and from those derived addresses accordingly. When such a key pool was exhausted by usage, a new batch of random keys were generated and added to the wallet's key pool.

This could cause problems, especially if the wallet had to be recovered from backed up wallet.dat files. You could loose newer key batches if your backup files didn't contain those newer key batches and thus could loose coins as a consequence.
legendary
Activity: 1568
Merit: 6660
bitcoincleanup.com / bitmixlist.org
Actually this is very strange.

I tried that command in both machines .
Listreceivedbyaddress 0 true then it shows
Both machines came up with the same address starting with 1 the legacy address with funding of the same amount.

However machine 2 came up with the address starting with 3 at the start with more coins inside?

But this seems so weird because on both machines the gui front page on the wallet shows received coins to the address starting with 3
Address.


Try opening Bitcoin Core again, loading both of the wallets, and then issue the RPC command rescanblockchain. Then the transaction history will be in both wallets and you should get the correct listreceivedbyaddress outputs for both wallets.
legendary
Activity: 3612
Merit: 5297
https://merel.mobi => buy facemasks with BTC/LTC
It's strange that both wallets show the same p2sh address (the address starting with a "3"), but only one of them lists it as an output from the "listreceivedbyaddress" .

The only things i can imagine is that the problem lies in the wallets not being fully synchronised or the transaction funding your p2sh address being unconfirmed (or maybe it's confirmed but due to syncing issues your wallet is not yet aware of this)?

Listreceivedbyaddress only shows addresses that did get funded. You used the parameter "0", so if there's an unconfirmed transaction funding said address, it'll be shown. Unconfirmed transactions reside in the mempool for a while. If you have one wallet that was online whilst the transaction funding your p2sh wallet was broadcasted, and the other one wasn't, the first one will show the p2sh address (even if the tx is unconfirmed) whilst the second one will not (untill the transaction is confirmed, and the wallet caught up synchronisation up untill the block where the transaction was confirmed). At least, it'll show the address untill the mempool is pruned (or the transaction gets confirmed and the wallet gets fully synchronised)

I guess there might be some discrepancies if your wallets aren't both completely synchronised... So, my next questions (and the only potential cause for the behaviour you're describing i can think off) would be: is the transaction funding your p2sh confirmed, and is your wallet synced up untill the block where the transaction was confirmed?
member
Activity: 103
Merit: 18
I'm happy you got things solved Smiley

Just for your info, there used to be a command "listreceivedbyaddress 0 true" that could be run from the console (either use bitcoin-cli from the commandline, or open a console in the bitcoin core gui implementation). I didn't check for more recent bitcoin core versions, but i'd be supprised if it was removed...

It's a safe command that should show all historically (and currently) funded addresses. The parameter "0" indicates that also addresses funded with unconfirmed transactions should be shown, and the parameter "true" indicates watchonly addresses should also be shown.

Thanks for your help .

Actually this is very strange.

I tried that command in both machines .
Listreceivedbyaddress 0 true then it shows
Both machines came up with the same address starting with 1 the legacy address with funding of the same amount.

However machine 2 came up with the address starting with 3 at the start with more coins inside?

But this seems so weird because on both machines the gui front page on the wallet shows received coins to the address starting with 3
Address.

Can sometimes addresses be missed out of a wallet.dat?

But if it was missed out how can the gui show it on the wallet front page ? I see that address starting with 3 on both wallets. Even though it is not there when I do the listreceivedbyaddress 0 true command.

Can a wallet dat saved at a different time miss out an address?
But if it did why would it show on the gui it received coins to that address on the wallet front page?

Machine 1 the most recently synced one shows coins recieved to an address starting with 3
But that command listreceivedbyaddress 0 true does not bring that up in the console.






legendary
Activity: 3612
Merit: 5297
https://merel.mobi => buy facemasks with BTC/LTC
I'm happy you got things solved Smiley

Just for your info, there used to be a command "listreceivedbyaddress 0 true" that could be run from the console (either use bitcoin-cli from the commandline, or open a console in the bitcoin core gui implementation). I didn't check for more recent bitcoin core versions, but i'd be supprised if it was removed...

It's a safe command that should show all historically (and currently) funded addresses. The parameter "0" indicates that also addresses funded with unconfirmed transactions should be shown, and the parameter "true" indicates watchonly addresses should also be shown.
member
Activity: 103
Merit: 18
Thanks. Yes I didnt explain well.

No, I've not tried multi sig.

I think the problem was that the wallet on machine 1 with a more recent blockchain could see that several addresses had been used to receive coins. So it had hidden them from view as recieve addresses. Machine 2 with a older copy of the blockchain didnt know this so was generating them as new receive addresess. So it looked at first like they were not generating the same sequence of addresses

So it took a few more clicks on both until I reached an address that had never been used to receive coins.

They are now both creating identical addresses in the same order on both machines.

I wasnt aware bitcoin core hides receive addreses once they have been used.
legendary
Activity: 3612
Merit: 5297
https://merel.mobi => buy facemasks with BTC/LTC
I have a hard time following what's happening...

Your wallet shows addresses starting with 1, 3 and bc1?

the addresses starting with a 1 are legacy addresses. Those starting with a 3 are p2sh addresses (for example wrapped segwit or multisig), those starting with bc1 are segwit or taproot addresses.

Have you been playing around with multisig, or have you been using the console to create different types of receiving addresses?

I'm no longer running my own node, but to list all address that were ever generated AND received an input, you should be able to run "listreceivedbyaddress 0 true" on the console (if i'm not mistaking)

you could also use the "getwalletinfo" command to see if there's a derivation path. That way you know if you have a deterministic wallet or not (at least, this should work if my memory services me correctly... like i said, i shut down my node a long time ago).

member
Activity: 103
Merit: 18
Thanks for replying.

Okay a few updates and details. I think I perhaps found out what was happening.

Machine 1. Not internet connected but blockchain updated in the last few weeks. Running bitcoin v21
Machine 2. Not internet connected blockchain now out of date by over a year or more ..(But blockchain was not even on day 1 and said 15 years behind when I wrote the first post).

Both have the same wallet.dat or if not the same wallet.dat exactly then an older copy of that same wallet.dat.
Because both show the same received tx on the gui front page. Slight different balance because a couple new tx have shown up on machine 1 because it has a more updated blockchain.  

Confusing things to me.

1. When I load this wallet.dat into machine 1. I see the same balance (pretty much)as machine 2 even now.
But although machine 1 shows in the transactions it has received to an address starting with a number 3 previously.
When I click on the tab in core that says window and go down to receive addresses.
That address 3 is not there I see different addresses.

When I look at this receiving addresses list on both machines then I see this.

Both machines match with the first address this starts with a 1
But then machine 1 does not have the receiving address starting with 3. Machine 2 shows this address.

Then when I was clicking generate more receiving addresses they were creating different addresses even after I noticed  a matching 1.
This matching address started with a bc1

Now that I've loaded a more updated blockchain to machine 2
And generated a lot more receive addresses I see they are all matching.

What I think happened was this. I'm just guessing.

I suspect that machine1 is removing addresses that starts with a 3 or bc1 as receiving address once it has some bitcoin sent to it.
So I had to keep making more and more until it got past those that machine 1 could see had recieved some tx but machine didnt know had received coins already.

The thing that seemed strange to me at the time was this.

Machine1 eventually produced a recieved address I could see that machine 2 had on there. But because machine 1 knows the next 2 addresses had already recieved coins ...then when I pressed generate more. It skipped those.  Where as machine 2 did not know this and produced them.

When they started producing the same addresses. Then when I went back I could see aha these addresses that machine 2 was generating had actually recieved coins on machine 1 in the past but those addresses machine 1 had taken out of the recieved address preview window.

I think there may be some settings somewhere where you can tell bitcoin core to show you all recieved addresses even if they had been used to recieve previously.

Strange thing is that it leave the address starting with 1 even though that has been used.

Maybe this is reasonable explanation?

Thanks.

legendary
Activity: 3612
Merit: 5297
https://merel.mobi => buy facemasks with BTC/LTC
in the old times, wallets generated by bitcoin core were not deterministic.

If you copied your wallet.dat from node a to node b, the existing private keys were available to both node a and node b. But when you created a new address, a new private key would be generated completely random. So, after copying, both nodes had access to the pre-existing private keys, but starting from when the copy happened, each node would start creating unique private keys => public keys => addresses

If you have such a "legacy" wallet, and you use it with a new bitcoin core installation, irrc the wallet remains in legacy format (not deterministic, random key generation).

Electrum, on the other hand, is a deterministic wallet (eventough you CAN import private keys to create a non deterministic wallet if you want to). This means that if you copy an electrum wallet generated using the default settings in the wallet generation wizard, and you copy said wallet to a different machine, both machines will derive the same private keys.

There used to arise problems due to the fact bitcoin core wallets were not deterministic, so several years ago the core developers introduced deterministic wallets, so if you create a new wallet with bitcoin core in the "default" way, it'll be deterministic and it can be copied to other nodes and still have all nodes using the same wallet create the same addresses.
member
Activity: 351
Merit: 37
hero member
Activity: 1120
Merit: 540
Duelbits - Play for Free | Win for Real
OP we need more details.

Have you loaded the exact same wallet file onto two different PCs?

What version of bitcoin core is used on both PCs?

In one of the wallets where you requested new receiving addresses, what are the address initials? Do they start with the prefix 1 (legacy), 3 (p2sh-segwit) or bc1 (native segwit)?

See that in the receive tab, there is a button to switch the type of address to be generated, next to the Amount label and BTC acronym.

OP mentions that he had an old wallet, when loading these two wallets on different machines, a warning appeared that you were using a legacy wallet? Did you migrate from a legacy wallet to one with a descriptor in each of the wallets on your two PCs?

Op mentions that it generated 5 new addresses on one of the copied PCs, but only one matched. This leads me to believe that the wallets are possibly generating the same addresses, but the OP is generating them in different formats and did not specify this.

To decipher what is happening, we need you to explain in detail what I requested at the beginning of this post.
member
Activity: 103
Merit: 18
I have a strange occurrence I dont understand.
I have an old wallet.dat file I am scanning all my old usb drives.
I loaded it into a bitcoin core wallet on 2 different machines running the same version of bitcoin core.

The weird thing. On machine 1 I see different receive addresses to that on machine 2.
On one machine I can see the wallet has received coins to an address starting with 3
But that is not even showing up when I click receiving addresses?
How can that be possible? How can an address the wallet show received coins into it and those coins are still there are not listed under the windows receive addresses tab? That seems impossible?

Also when I click generate new receiving addresses 5x and got 5 new addresses on each machine.
Only 1 of those addresses  5 matched on both machines the others were all different . ?

This seems weird because I was expecting these wallets to generate addresses that matched in the same order?
Is this not how it should work? Even after they both generated a matching address. The next ones were different?
I was under the impression bitcoin core knows the next address to be generated even if it is offline? So I was expecting them to produce the same matching addresses in tandem.

Is one a rogue wallet generating rogue addresses it should not generate?

Electrum generates the exact same addresses in the exact same order if run on 2 different machines?
Does core not make them in order?

How to see every single address that a core wallet currently controls or has had some action?
Sorry this bit is also confusing.
Listaddressgroupings command does not tell you the addresses your wallet.dat controls?
It tells you what people may think you control?

This is strange

Which command to put in bitcoincore to make it show every address it controls and its balance?
This should total the same amount of bitcoins that the wallet gui shows is inside it ?
Is that correct.

Listaddressgroupings does not show you which addresses your wallet.dat controls this is just on chain analysis and guess which wallets are related somehow?

What about this command - listreceivedbyaddress add a true of false on the end?
What does the true and false bit mean?
I just want to see every address in the wallet I control with my wallet.dat and every address with how much is contained on that address.


Jump to: