Wallet backup and restore

Backup

This documentation describes how to safely back up your wallet file for safe storage in case your computer or laptop is damaged or lost. smartcash Core stores all data necessary to control your smartcash addresses in a single file called wallet.dat. This wallet is in the Berkeley DB format and stores the pairs of private/public cryptographic keys used to manage your balances on the smartcash blockchain. SmartCash NodeClient makes most of these operations transparent and even generates automatic backups of your wallet file in case it is corrupted, but the user is responsible for ensuring that these backups are stored in a safe place. If you lose access to your wallet file, you will permanently lose access to your smartcash.

It is important to consider that if you have not encrypted your wallet using the Settings > Encrypt Wallet menu item, anyone with access to the backed up wallet.dat file will immediately have full access to your smartcash. If you do choose to encrypt your wallet, do not store the password in the same place as the wallet.dat file, particularly if you are saving the backup to the cloud.

Backup from SmartCash NodeClient

Firstly, never copy your wallet.dat file while SmartCash NodeClient is open. Always use the File > Backup Wallet menu if the wallet is open. When you select this menu item, a dialog box will appear to specify where the file should be saved. Enter a name for the file, select a location and click Save. The example below shows saving the file to a USB stick. Keep this file in a physically separate location to your computer.

../../_images/backup-wallet.png
../../_images/backup-save.png

Backing up the SmartCash NodeClient wallet from the File menu

Backup by copying wallet.dat

If SmartCash NodeClient is not running, you can also backup your wallet by simply copying the wallet.dat file to another location. This file is located in the smartcash data folder. You were given the option to specify the location of this folder during installation, but by default the folder is in the following locations on different operating systems:

  • Windows

    C:\Users\YourUserName\Appdata\Roaming\smartcash
    

    You can access this folder directly by Windows Key + R and typing %APPDATA%\smartcash

  • Linux

    /home/YourUserName/.smartcash
    

    You can access this folder directly by typing cd ~/.smartcash at the terminal or ~/.smartcash in the path bar using the Go > Enter Location… menu item in Files

  • macOS

    /Users/YourUserName/Library/Application Support/smartcash
    

    You can access this folder by typing cd ~/Library/Application Support/smartcash at the terminal or ~/Library/Application Support/smartcash in dialog at the Go > Go To Folder menu item in Finder

Ensure SmartCash NodeClient is not running, then simply copy the wallet.dat file from this folder to another folder in the normal way for your operating system. The example below shows copying the file to a USB stick using simple drag and drop while holding down Ctrl on a Windows system. On most operating systems, you can also right click on the file and select Copy, then select Paste in the target folder. Keep this file in a physically separate location to your computer. Be careful to copy (not move) the file!

../../_images/backup-copy.png

Backing up wallet.dat by copying to another folder

Automatic backups

Every time you open SmartCash NodeClient, it will automatically create a backup copy of wallet.dat in the smartcash/backups folder. Up to 10 backups can be kept here by default, and the oldest backup will be deleted as each additional new backup is created. You can modify the number of backups kept here using the -createwalletbackups=n parameter at the command line or in smartcash.conf. Setting this value to 0 completely disables backups.

You can view the automatic backups folder by browsing to smartcash folder at the location specified above for wallet.dat and opening the backups folder. Since these files are not active when SmartCash NodeClient is running, you can safely copy them at any time. They are also a handy backup if the original files in the smartcash folder become corrupted due to improper shutdown of the SmartCash NodeClient app.

Restore

To restore a backup, install SmartCash NodeClient on the target system (or stop it, if already installed) and rename the existing wallet.dat file in the smartcash folder.

../../_images/restore-rename.png

Renaming the old wallet.dat file to wallet.old in the smartcash folder

Then copy the backup wallet file to the smartcash folder and ensure it is named wallet.dat. Now, when you start SmartCash NodeClient again, it will load the new wallet. Do not replace wallet.dat while SmartCash NodeClient is running, since this will result in data corruption!

../../_images/restore-copy.png
../../_images/restore-rename-dat.png

Copying the backup file into the nodeclient folder and renaming it to wallet.dat

Backup storage considerations

Any backup depends to some extent on the existence of software capable of reading the data at some future point in time. As such, it is good practice to store a copy of the software used to create the backup together with the backup file itself. In this case, this would be a copy of the version of SmartCash NodeClient you used to create the backup.

The wallet.dat file itself should be encrypted using a password set from the Settings > Encrypt Wallet menu item. However, this only prevents someone with access to the file from creating transactions, not from opening the file. You could additionally store the file in another encrypted container, such as a USB stick using BitLocker in Windows, LUKS in Linux or FileVault on macOS. It is also possible to create disk images or zip files with password encryption - the choice is yours. For further reading on encrypted containers, see here.

Where you store this file is then up to you. It could be in your home, in a safe deposit box at a bank, a waterproof or fireproof container, or on cloud storage such as Google Drive, Dropbox or iCloud. Consider where you will store any passwords needed to restore access to the wallet (in your head, on paper, in a password manager, etc.) and who may need access to the password in the future.

Finally it is important to understand that wallet.dat itself is a relatively dangerous way to store large amounts of funds - it is simply a database file storing private keys. While the convenience of storing a wallet file directly is fine for smaller holdings, it is more secure to to store large amounts of smartcash on a single predefined address in a way that you are guaranteed access through any software supporting the protocol, rather than a specific implementation of that protocol. If you are interested in this, read more about paper wallets, where the private key can be printed directly or also encrypted using BIP38 for safe storage.

Verifying backups

There is no fixed procedure to verify your backup, but you should test restoring it at least once to make sure it works. If you have a simple copy of the file, try to restore it to your current nodeclient folder and start SmartCash NodeClient to make sure it opens without any errors. If you decided to store the file in an encrypted zip file, make sure you can unzip it and that it opens correctly in SmartCash NodeClient. In short, make sure that you (or the person you are trusting to eventually go through this process for you) can actually reverse your backup process to get access to your smartcash, instead of relying on the fact that this process should theoretically be reversible.