Hey everyone,
I’m having trouble launching my Bitcoin Core wallet on Windows. It keeps throwing up an error that says: Error reading from database.
I’ve tried uninstalling and reinstalling various versions of BC, but I’m still stuck with the same issue and the wallet refuses to open. It was fully synced before all this happened.
In the debug log, there's a message about LevelDB error: Corruption block checksum mismatch: F:\Bitcoin\chainstate/3348075.ldb.
I’ve come across a few other threads with similar issues, and it seems like the general advice is to back up wallet.dat, then delete everything and start fresh.
So I’m wondering, can I just delete the 3348075.ldb file from the chainstate folder and then restart? Would that save me from having to completely resync the whole blockchain again?
Thanks!
Starting with -reindex-chainstate should be good enough, you won't need to resync all of the blocks as the corruption is in the chainstate database and not the blockchain.
No. LevelDB lays out its database in a particular way and deleting any of its files is a surefire way to have even more corruption. The data there is not necessarily stored sequentially.
Inorder to perform reindex
Navigate to your bitcoin.conf file , by default located in
C:\Users\<you>\AppData\Local\Bitcoin
Else, check the part selected while installing ,if you don't have it create one.
Insert
First, close Bitcoin Core.
Find Bitcoin Core's installation folder, look for "Bitcoin-qt" if you're using the GUI, else in daemon folder. (if you've used the installer, it defaults to "C:\Program Files\Bitcoin")
While inside that folder, click Windows Explorer's "File" menu and select "Open Windows PowerShell" that will select the current folder as your working directory.
The working directory should be displayed in PowerShell, e.g.: PS C:\Program Files\Bitcoin>
In PowerShell, enter this to start Bitcoin-qt with the mentioned command line arg:
That'll start Bitcoin Core and tell it to rebuild the chainstate.
Take note that it will take quite some time but it will not re-download blocks that you already have, unless your blockchain is "pruned".
If you decided to follow the instructions above, you MUST remove that entry in your bitcoin.conf after your node is done with it.
Or else, it will reindex-chainstate every time you restart the client.
Also, the default data directory is in the "Roaming" appdata directory instead of "local".
So it should be in: C:\Users\<YOUR_USERNAME>\AppData\Roaming\Bitcoin ; Shortcut: %appdata%/bitcoin
But if you've set the datadir in F:/ with the GUI's "Welcome Screen", you should use/create the bitcoin.conf file there.
Probably to start from the scratch is the best advice you have found so far as reindex-chainstate takes the painful time and doesn't guarantee that it will cope with the problem.
A few months ago I found myself in the similar situation and reindex-chainste didn't help thus I wasted the time trying to use it to avoid IBD.
When starting from scratch don't forget to put down into bitcoin.conf the following entries: dbcache=1/4 RAM (for 8 GB dbcache=2048, while for 16 GB dbcache=4096) and blocksonly=1 to sync a bit faster.
BTW, v. 27.0 completes its halt operations much faster then my previous 26.0
But the debug.log entry shows otherwise.
It specifically written that a file in his chainstate folder is corrupted that should be fixed by rebuilding the chainstate as mentioned by achow101.
Your previous case may not be related to chainstate corruption that's why the command didn't worked.
And the time it takes to --reindex-chainstate may not be fast but not as slow as --reindex or IBD.
Agreed, but IBD secures full guarantee of pure untouched copy of blockchain at your possession.
After my case I'm sold on the keeping of backup copy of the blockchain. I have acquired 2TB SSD and attach it to my node from time to time to keep this backup active.
So I did the reindex-chainstate=1 and removed the pound sign. Now Bitcoin Core wallet is running again, but now it's starting back from 2009, which was the reason I was afraid I'd have to do.
I made a note about reindex-chainstate in my reply just below his.
To rephrase that, if your blockchain is pruned, it'll have to redownload the blockchain to rebuild the chainstate.
If it is pruned, I'm afraid that you don't have any choice but to restart IBD due to having a corrupted chainstate and pruned blockchain.
Also, read the other important notes since you've used the config file method.
Or is your blockchain not pruned?
Because it will seemingly do IBD but it's just processing the existing blocks on your disk.
Are you using Bitcoin-qt (with GUI)? Does it show "Processing Blocks on disk", if so, that's just "reindexing"... not downloading.
Are you using a prune mode ?? Or you don't know how to check ??
If yes (you don't know if it's pruned )
For bitcoin-qtwith GUI go to your
settings>options
You should see your prune settings like this
if it's checked ✔️ then you are pruned and running re-index will probably start the whole sync process from the beginning just as @nc50lc posted in his comment
If not then read this again