The Dimecoin Database

What does the -rescan and -reindex command do?

Intro

Want to know, what does the -rescan and -reindex command do? How and when to rescan / reindex the wallet? Running a core wallet/node can be somewhat finicky at times. There are two commands a user can use to fix a wide range of wallet-related issues if you encounter problems — rescan and reindex.

Commonly, most issues arise with the core wallet if it does not shut down gracefully. For example, if a user force closes the wallet while it is running, or there is a power failure. A user may apply a change to the data directory while the wallet is running or for many other reasons that lead to the local blockchain database becoming corrupt or broken.

Additionally, there are instances where your balance will not reflect properly, or the wallet will not sync any further. Typically, restarting the wallet will not resolve these issues on its own.

If your wallet is not syncing, you are stuck on the wrong chain, or the balance is not reflecting as expected, you will need to rescan or reindex, depending on your issue.

It is common to misunderstand which command to use in a given scenario. This guide will provide a brief overview of what these commands do and when to use them.

What does the -rescan command do, and when to use it?

The rescan command ‘rescans’ the local blockchain files and looks for missing transactions in the wallet. This can often occur if you are importing private keys or restoring a wallet backup file (wallet.dat). When you restore backup or import a key, it will not know to associate your wallet with the transactions related to the address or keys being imported.

This command will only be used if you are missing transactions in your wallet or your balance is incorrect. When the rescan process starts, it will go through each block and search for transactions associated with the private keys in the local wallet. Upon completion of the scan, the transaction history for the wallet will be rebuilt, and your balance should reflect properly.

What does the -reindex command do, and when to use it?

The reindex command rebuilds the blockchain index from the existing data that is already downloaded. These are in the form of blk.dat files. Running this command does not download the blockchain from scratch as many think it does. It will recreate the existing database and recheck the information to ensure it is correct. Running this process can be lengthy as it completely rechecks and rebuilds the blockchain index and chainstate.

Reindex will need to be used if your client fails on startup and receives an assertion error, says no block source found or the blockchain database is corrupt. Commonly this occurs when there is a non-graceful shutdown of the client which leads to a corrupt block database.

How to rescan your wallet?

The first thing you will need to do is backup your wallet! Before performing any sort of maintenance or making changes to your wallets data files, it should always be the first thing you do. Please follow this link to learn how to backup your wallet properly!

Windows:


Step 1: Create Shortcut

Locate the wallet folder and right click on the application labeled dimecoin-qt.exe and click 'create shortcut'. The default location should be this: “C:\Program Files\Dimecoin”

Step 2: Add -rescan Flag to Target Parameter

Right click on the shortcut you just created in step 1 and click ‘properties‘. Under the shortcut tab located the Target field. At the end of the target parameter, after the “, type -rescan. Make sure to put a space after the quotation mark. Once the -rescan flag has been added to the end of the target parameter, click apply and OK.

Rescan Target Parameter

Now start the wallet. Don’t forget to remove -rescan from the shortcut once the wallet loads up. If you don’t, the next time you start the wallet it will go through the rescan process again.

MAC:

Step 1: Run Terminal Application

Goto your wallet folder and drag the wallet file to the terminal.

Step 2: Execute Rescan

Type -rescan and hit enter.

Linux

Step 1: Open Terminal

Using the command line, change directories to your wallet folder. Typically, ./dimecoin.

Step 2: Change Directory

Once in you have changed to the ./dimecoin directory, execute the command ./dimecoin-cli stop to stop the daemon. Now restart the daemon with the command ./dimecoind -rescan

Once the Rescan process is complete, your blockchain database and chainstate will be rebuilt and restored, allowing the wallet to function properly without error.

How to Reindex your wallet?

Windows:


Step 1: Create Shortcut

Locate the wallet folder and right click on the application labeled dimecoin-qt.exe and click 'create shortcut'. The default location should be this: “C:\Program Files\Dimecoin

Step 2: Add -reindex Flag to Target Parameter

Right click on the shortcut you just created in step 1 and click ‘properties‘. Under the shortcut tab located the Target field. At the end of the target parameter, after the “, type -reindex. Make sure to put a space after the quotation mark. Once the -reindex flag has been added to the end of the target parameter, click apply and OK.

Reindex Target Parameter

Now start the wallet. Don’t forget to remove -reindex from the shortcut once the wallet loads up. If you don’t, the next time you start the wallet it will go through the reindex process again.

MAC:

Step 1: Run Terminal Application

Goto your wallet folder and drag the wallet file to the terminal.

Step 2: Execute Reindex

Type -reindex and hit enter.

Linux

Step 1: Open Terminal

Using the command line, change directories to your wallet folder. Typically, ./dimecoin.

Step 2: Change Directory

Once in you have changed to the ./dimecoin directory, execute the command ./dimecoin-cli stop to stop the daemon. Now restart the daemon with the command ./dimecoind -reindex

Once the Reindex process is complete, your blockchain database and chainstate will be rebuilt and restored, allowing the wallet to function properly without error.

Final Thoughts

The Re-indexing and re-scanning commands utilize a fair amount of memory resources and disk space. It will take time to perform these tasks. It is important to let the wallet to fully complete these operations. Your balance will not reflect in your wallet until it re-syncs past the block which contains your transaction! If you are still having issues with your wallet, please do not hesitate to contact us in our Telegram Support Channel, or via email.


Page Contents