I just restored my Bitcoin wallet from a wallet.dat file using an old Windows Vista PC with Bitcoin Core 16.3. It has some balances, but I need to check if the wallet.dat file is intact without making any transactions. I can open it without syncing and it shows the same balances as the explorer. Can I be totally sure those funds are spendable?
Yeah, I think you can verify it without doing a transaction. Try using bitcoin-cli on your offline wallet to check the balance. Just make sure to point it to the right wallet directory.
If you can open up the wallet and everything looks good with the balances, you’re probably safe to spend. The wallet does some integrity checks when it opens, like checking keys and checksums. That should catch random corruption, but not if someone tampered with it.
I tried that getbalance command you mentioned, but got this weird error, "method not found". Maybe that feature wasn't around in 16.3. Gonna check out your other suggestion though. Just so you know, my wallet shows 0 balance now but it does display the transactions. It was rescanned recently with version 19.01.
Good point, unless transactions change the wallet.dat file. I might do another test later to see what that warning message was about. After I encrypted the wallet, I got this message saying to replace old backups because they become useless.
That message is standard for encryption. You only need to back up after encrypting, not after every transaction. Encrypting creates new keys, but old ones still exist. If you didn’t back up, yeah, old backups become pretty much useless.
I should've been careful mentioning that warning. I actually tested the passphrase on an encrypted wallet.dat by changing it to the same one and didn't see any warning. Does encrypting generate new addresses only the first time, or every time you change the passphrase?
But what if you had unencrypted backups before and then deleted your wallet.dat? If you restored from an old backup, would it still work since there are no UTXOs tied to new keys?
Yes, that would work! Even if you destroy the wallet.dat, old keys are still there. Just remember it depends on the wallet type. With older non-HD wallets, it might get tricky based on key usage.
You sure about that? If you don't let Bitcoin Core sync, the getbalance might show old info. And by the way, verifychain doesn't always check the whole blockchain.