How to Check a QT Wallet's Integrity Without Transactions?

12 replies 265 views
Posts: 4 · Reputation: 1
#1Nov 15, 2017, 11:33 AM
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?
6 Reply Quote Share
ColdGangMember
Posts: 152 · Reputation: 183
#2Nov 15, 2017, 01:46 PM
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.
6 Reply Quote Share
matrix2021Full Member
Posts: 92 · Reputation: 612
#3Nov 16, 2017, 01:15 AM
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.
1 Reply Quote Share
Posts: 4 · Reputation: 1
#4Nov 16, 2017, 02:12 AM
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.
5 Reply Quote Share
gang2015Member
Posts: 682 · Reputation: 62
#5Nov 17, 2017, 02:55 PM
Which version of pywallet are you using? I checked the GitHub repo but didn’t see anything about a check-integrity command.
1 Reply Quote Share
Posts: 4 · Reputation: 1
#6Nov 17, 2017, 05:15 PM
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.
0 Reply Quote Share
matrix2021Full Member
Posts: 92 · Reputation: 612
#7Nov 17, 2017, 05:46 PM
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.
0 Reply Quote Share
Posts: 4 · Reputation: 1
#8Nov 17, 2017, 09:52 PM
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?
4 Reply Quote Share
matrix2021Full Member
Posts: 92 · Reputation: 612
#9Nov 18, 2017, 03:42 PM
It only generates new addresses the first time you encrypt it. Changing the passphrase won’t affect addresses.
3 Reply Quote Share
0xNodeMember
Posts: 671 · Reputation: 80
#10Nov 18, 2017, 08:54 PM
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?
2 Reply Quote Share
0xChadNewbie
Posts: 513 · Reputation: 3
#11Nov 18, 2017, 09:37 PM
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.
2 Reply Quote Share
gang2015Member
Posts: 682 · Reputation: 62
#12Nov 19, 2017, 03:43 AM
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.
2 Reply Quote Share
Posts: 3523 · Reputation: 35
#13Nov 19, 2017, 09:46 AM
+1 to that. Always good to let it sync for accurate balance.
2 Reply Quote Share

Related topics