Deleting the wallet

2 minute read

Updated:

The deletion of a wallet can be done manually ou using Decrediton. dcrwallet doesn’t have any option for wallet deletion or replacement.

Figure 1 - The deletion button on Decrediton
Figure 1 - The deletion button on Decrediton

Decrediton can delete Testnet and Mainnet wallets, as shown previously. To delete a Testnet wallet, just click on the button with the trash can icon, or delete the folder that contains the file wallet.db, just like you would delete any other file.

For a Mainnet wallet, it is recommended for security reasons to perform a secure deletion, which overwrites the disk area where the wallet is stored, to prevent any information from being retrieved by specialized tools. To do it the faster way, do not delete the wallet using Decrediton first, otherwise it will be necessary to wipe all the available space in the hard drive.

1. Motivation

Some reasons why the user might want to delete a wallet:

  • The user wants to create another wallet to separate funds;
  • The user lost the seed (of an empty wallet);
  • The user wants to remove the wallet from the device;
  • The user knows the seed, but has forgotten the password of the private key;
  • The user knows the seed and password of the private key, but would like to create, delete, or change the password that protects the public information

2. Execution

To wipe the wallet you don’t have to delete the wallet using Decrediton. Just close Decrediton and use the secure deletion tool.

The following steps were tested on macOS 10.13 and on Debian Linux 9 64-bit.

In the following sections there is an indication of the default directory for the wallet on each operating system. This is the directory where the wallet file resides, except if the configuration was changed in the file or by command line option. To delete the wallet you need to enter the directory of the network to which belongs the wallet and delete the wallet.db file:

wallets/mainnet/$WALLET_NAME/mainnet/wallet.db
wallets/testnet/$WALLET_NAME/testnet2/wallet.db

After the execution of the secure deletion tool as shown next, delete the directory named after the wallet: wallets/mainnet/$WALLET_NAME

2.1. On Linux, default directory:

Decrediton: ~/.config/decrediton/
dcrwallet: ~/.dcrwallet/

Shred is the native tool for secure deletion. By default, it will overwrite 3 times the file that is being deleted. This parameter can be changed through the -n option.

$ shred --random-source=/dev/urandom --remove wallet.db

The command produces no output. For other options, read the manual with the command man shred.

2.2. On macOS, default directory:

Decrediton: ~/Library/Application Support/Decrediton/
dcrwallet: ~/Library/Application Support/Dcrwallet/

On macOS 10.13 the command srm is no longer available. The rm command uses the -P option for secure deletion in macOS 10.13, which does not exist in the Debian Linux version of ‘rm’. This flag causes ‘rm’ to overwrite each byte of the file with bytes 0xff, 0x00 and 0xff, before deletion.

$ rm -P wallet.db

The command produces no output. For other options, read the manual with the command man rm.

2.3. On Windows, default directory:

Decrediton: C:\Users\$USERNAME\AppData\Local\Decrediton\
dcrwallet: C:\Users\$USERNAME\AppData\Local\Dcrwallet\

Windows does not have any native tool for secure deletion, but Microsoft provides the user the tool SDelete v2.01, created by Sysinternals, a company that Microsoft bought a few years ago.

In its default configuration, SDelete will overwrite the information only once. To change the number of overwrites, use the -p option.

> sdelete wallet.db