Guides

What does -rescan, -reindex command do & How to rescan / reindex wallet?

Core wallet is quite sensitive and two commands which is used to fix a large number of wallet related issues are - rescan and -reindex.

Are you getting any error when starting your core wallet? Or is your local blockchain database broken / corrupt? This can occur when copying blockchain from one computer to another, when you update wallet incorrectly, or when you shutdown your wallet non-gracefully. Keep restarting application doesn’t help here as it simply gets stuck at wallet loading page or overview screen and it won’t show any further progress. There are also other scenarios in which your cryptocurrency wallet does not display your balance correctly. All these common errors can be fixed safely by manually repairing your wallet.

Whenever your wallet is not syncing or if your balance is not properly shown or whether your wallet is stuck at wrong chain; you’ll be advised to reindex or rescan blockchain files. Beginners often tend to confuse these commands as they both sound similar. Also there are few who reindex and rescan every single time they open their wallet which is not necessary.

Here in this beginners guide we’ll show you how to reindex or rescan your core wallet. But before that lets first see what does rescan and reindex command do. So that you know when to use these commands?

What and when to use Re-scan and Re-index command?

Rescan (-rescan) –

This command re-scans your blockchain files for missing wallet transactions. So when does your wallet fails to store the transaction data? 1. When you restore wallet backup and 2. When you import a new private key to your wallet. The wallet client stores all transaction data of the addresses that it manages. However when you restore a new private key the wallet client doesn’t know the transaction associated with that address.

Use -rescan command only when the transaction is missing in your wallet or if your balance is not reflecting properly. Re-scanning is like recounting the money in your drawer. When you start the wallet with -rescan command your wallet starts up and scans every single blocks which your wallet has downloaded. While scanning all the blocks, it searches for all missing transactions. Once all the transactions are rebuild the correct balance will also reflect accordingly.

Reindex (-reindex) –

First of all re-indexing does not download blockchain from scratch. Instead it rebuilds the blockchain index from the data that you already have downloaded (blk.dat files). It recreates the existing blockchain database and rechecks the information in it. However you must note that re-indexing throws away chainstate and blockchain index. So basically it rebuilds from scratch and it still consumes your ISP bandwidth.

You need to use reindex if your wallet client fails to read blocks or says no block source found. When your wallet is on the wrong chain or if your current blockchain database is corrupt .

reindexing blocks on disk

Note: Re-scanning, reindexing and downloading additional blocks; all these three operations takes time and consumes disk space and memory resources. Also note that until your wallet has synced past the blocks that contains all your transactions you won’t see your balance.

How to reindex or rescan your wallet?

Rescanning or reindexing your wallet is quite simple. Before we show you how it is done it is essential that you first make a backup of your wallet file which is wallet.dat. To know more about wallet backup we suggest you to refer this guide which explains how to backup your wallet and how to export private keys.

wallet reindex backup

Alright! Now let’s see how to start your wallet with -rescan and -reindex command.

To make things easier in most wallet this option is build in. Open your wallet, navigate to tools >> repair wallet and you’ll find all the wallet repair options. Click rescan to rescan your blockchain files and click rebuild index to reindex the blockchain files.

rescan and rebuild block index

Both the operation restarts the wallet application and fixes the issue. In case if you do not find this option within your wallet then follow the steps below.

Windows:

Open your wallet folder, right click wallet-qt.exe file and click on create shortcut. Now right click the shortcut file, click on properties and edit the field labeled as target.

By default it should be something like this: "C:\Program Files (x86)\Bitcoin\bitcoin-qt.exe"

To reindex the target field should look like this: "C:\Program Files (x86)\Bitcoin\bitcoin-qt.exe" -reindex and to rescan the target field should look like:  "C:\Program Files (x86)\Bitcoin\bitcoin-qt.exe" -rescan

bitcoin wallet shortcut

Once -reindex / -rescan flag has been added to the end of the “Target” parameter, click apply and then OK. Now open this shortcut file to reindex or rescan your wallet. Once your wallet is fixed close your wallet and delete the shortcut file or you can keep it and use it whenever necessary. But do note that do not use these commands to open wallet every time. It is only to repair your wallet and once your wallet is fixed it is no longer needed.

Mac: Run terminal application, go to your wallet folder and drag the wallet file to the terminal. Then type -rescan or -reindex and hit enter.

Linux: Use command line and navigate to your wallet folder. If your wallet is open then first stop it (./wallet-cli stop ). Then restart the daemon using the necessary command.

Hope it helps. If your wallet still returns any specific error then do let us know in the comments section.

Show More

coinguides

We are crypto enthusiasts and our main intention with Coin Guides is to educate people about Cryptocurrency and Blockchain technology. We regularly publish content about Bitcoin, Ethereum, Altcoins, wallet guides, mining tutorials and trading tips.

Related Articles

One Comment

  1. Hi, I have been mining with bees in the months of November and December in another computer up to a 82000, but with an outdated wallet. Now it wont sync and I reinstalled my wallet in another PC but only synced an amount I had in October and cant transfer the rest of my coins. Hope you can help me.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button