Uniquely identify two wallet.dat files

1

I have two encrypted wallet.dat files and I'm looking for a way to uniquely identify them from each other. I started using a md5 hash but then I quickly realized that this hash changed each time the bitcoind client was started and recognized the wallet. Is there a way to uniquely identify two unencrypted wallets?

ThomasReggi

Posted 2016-12-29T23:32:37.093

Reputation: 111

2Is there some reason that you can't give the wallets different names and use -wallet to specify to Bitcoin which wallet you want?Nick ODell 2016-12-29T23:36:12.017

I'll look into that. Is there any way to check of two wallets are the same?ThomasReggi 2016-12-29T23:37:37.793

Answers

1

Unless you're using HD wallets (only if you created the wallets using Bitcoin Core 0.13 or later), two wallets are never the same as soon as they've done a transaction.

Every time an address is generated or a transaction is sent, a new address is added to the key pool of the wallet (a queue of unused future addresses). If you have two copies of a wallet file, and use generate a new address in one, it is instantly different from the older copy, and it will diverge over time (generate different addresses in the future). So the answer is probably: there is no way to compare two wallets because you shouldn't be relying on the ability to compare them. If you do, you may end up with balance surprises or even monetary loss.

If you're using an HD wallet, you can compare whether the key chains are identical by looking at the hdmasterkeyid in the output of the getwalletinfo RPC call (using bitcoin-cli or the debug console in Bitcoin-Qt).

Pieter Wuille

Posted 2016-12-29T23:32:37.093

Reputation: 54 032