Backup & Restore¶
Backup¶
After your wallet is encrypted, it should immediately be backed up. The file
called wallet.dat
contains all the critical information for
accessing your wallet, and that is the file which should be backed up
(copied) to multiple physically different locations. For example, it
is recommended to keep copies of this file on multiple USB drives and
store them in different locations. Also, unless your wallet is an
HD Wallet
and you are certain no non-HD PrivateKey/Address
pairs have been imported into your wallet, the latest version of
wallet.dat
should be backed up whenever
funds are added to a new address in your wallet. Your wallet.dat
file is typically stored in the wallets
subdirectory of your data directory:
Data Directory¶
- Windows
Or paste
C:\Users\[YourUsername]\AppData\Roaming\Blocknet\
%appdata%\Blocknet\
into the File Explorer path field. - MacOS
Open Finder and in the Go menu select Go to Folder... and enter the above path.
~/Library/Application Support/Blocknet/
- Linux
~/.blocknet/
CLI Wallet Backup Options (also works for GUI/Qt wallet)¶
-
Option 1 - Close/Quit Blocknet wallet, then backup
wallet.dat
- To ensure
wallet.dat
is not being modified as you are copying it, Close/Quit Blocknet wallet. If you are running a CLI wallet on a Linux OS, quit your wallet by issuing the CLI command,./blocknet-cli stop
in the directory whereblocknet-cli
is located. Note, if your CLI wallet was set up on a Linux system according to the VPS Staking guide, you can stop your CLI wallet from any directory with:blocknet-cli stop
-
Wait till your Wallet stops completely. If running the GUI/Qt wallet, this means waiting till the "Blocknet is shutting down..." message disappears. If running a CLI wallet on Linux, you can monitor the Linux process called
blocknetd
by repeatedly pasting/issuing the following command:Before theps x -o args | grep -v "grep" | grep "blocknetd"
blocknetd
Linux process has stopped completely, that command will return something like this:Continue issuing that/home/[user]/blocknet-4.3.3/bin/blocknetd -daemon
ps x -o args
command until it returns nothing. Then you know theblocknetd
process has stopped completely and it's safe to backup/copy yourwallet.dat
file. -
Within the data directory there is usually a subdirectory called
wallets
which is the default place forwallet.dat
. If you find awallet.dat
file in thewallets
subdirectory, that is the file which should be backed up. - If the
wallets
subdirectory does not exist, then thewallet.dat
in the data directory itself is the file which should be backed up. - Back up your
wallet.dat
simply by copying it to different computer(s) and/or USB drives. - Restart your Blocknet wallet. If you are running a CLI
wallet on a Linux OS, restart your wallet by issuing the CLI command,
./blocknetd -daemon
in the directory whereblocknetd
is located. Note, if your CLI wallet was set up on a Linux system according to the VPS Staking guide, you can restart your CLI wallet from any directory with:blocknet-daemon
- To ensure
-
Option 2 - Issue
backupwallet <backupfile.dat>
command from Debug Console or Command Line Interface- This option does not require that you Close/Quit the Blocknet wallet.
- Be sure to specify the full path of your
backupfile.dat
and make sure it's in a directory where you have write permission.- Example: (Mac):
backupwallet /Users/(username)/Desktop/mywallet.dat
- Example (Windows):
backupwallet c:\Users\(username)\Desktop\mywallet.dat
- Example: (Mac):
GUI/Qt Backup Option¶
If you are using the GUI/Qt wallet, one way to be certain to back up the
correct wallet.dat
file is to select the File->Backup Wallet...
option in the GUI interface:
This gives you the option to write a
backup of your current wallet.dat
to any location and give it any name.
Dumpfile Backup Option¶
If you want to be extra sure you'll be able to restore your wallet,
in addition to backing up your wallet.dat
, you can also back up your
wallet in a dumpfile
format. This format can be especially useful for those who are using an
HD Wallet
because it backs up the wallet's HD seed(s) in a human-readable
format.
Tip: Is my wallet an HD Wallet? How do I find HD seed(s) in the dumpfile
? How do I migrate to HD?
In the lower right corner of the Qt/GUI wallet are some symbols that look something like this:
If you see HD there (not crossed out or greyed out), then your wallet is an
HD Wallet. Note:
All wallets created with Blocknet v4.0 or greater are HD
wallets. To find your wallet's HD seed(s), search the dumpfile
for hdseed=1
. See the answer posted here for full details on the format of dumpfile
.
If your wallet is not an HD wallet and you want to be using a new
HD wallet, the way to acheive that is to create an HD wallet (by
creating a new wallet with the latest version of the Blocknet wallet), then
transfer all your BLOCK to your new HD wallet. Note: You can, for
example, create your new HD wallet on a different computer or in
a different data directory on your existing computer. That way you
can continue to have access to your old non-HD
wallet until funds have been transferred to the new HD
wallet. Another option is to create a new HD wallet simply by
renaming the non-HD wallet.dat
to something else, then restarting Blocknet
wallet (v4.0+). The full instructions for doing it this way are as follows:
- Locate
your current, non-HD
wallet.dat
. - Rename that
wallet.dat
towallet.dat.non-hd
. - Restart Blocknet wallet (must be Blocknet wallet v4.0+).
- Back up the new HD
wallet.dat
which was created by restarting your wallet. - Created a receive address within your new HD wallet (Address Book->Create New Address->My Address) and copy it into a temporary file.
- Close Blocknet wallet
- Rename the new HD
wallet.dat
towallet.dat.hd
. - Rename
wallet.dat.non-hd
back towallet.dat
. - Restart Blocknet wallet.
- Send all your BLOCK from your old non-HD wallet to the newly created receive address in your new HD wallet. Note, if you want to start out by sending a small test amount from your old non-HD wallet to your new HD wallet, you can certainly do so. It just means you'll have to repeat the procedures for switching back and forth between your old non-HD wallet and your new HD wallet.
- Close Blocknet wallet.
- Rename the
wallet.dat
towallet.dat.non-hd
. - Rename
wallet.dat.hd
back towallet.dat
. - Restart Blocknet.
To back up your wallet in a dumpfile
format, issue the following command:
dumpwallet <dumpfile>
The dumpwallet <dumpfile>
command will dump all your wallet's Private
Key/Address pairs in a
human-readable format to
the file you specify as your dumpfile
. Note: Be sure to specify
the full path of dumpfile
and make sure it's in a
directory where you have write permission.
- Example: (Mac):
dumpwallet /Users/(username)/Desktop/dumpfile.txt
- Example (Windows):
dumpwallet c:\Users\(username)\Desktop\dumpfile.txt
Caution: It is strongly recommended NOT to keep this dumpfile
stored on a computer while the computer is connected to the Internet.
You can print the dumpfile
, then delete it, then empty your
Trash. You can also store it within a 256-bit encrypted folder
on your computer and/or on USB drives. (Google for how to encrypt a folder on Windows/Mac.)
However, due to the extremely sensitive information in this file, it
should NOT be kept stored on a computer that can be connected to the
Internet (unless it is within a 256-bit encrypted folder).
Restore¶
Restore from wallet.dat
¶
To restore a previously backed up wallet.dat
file, follow these steps:
- If you haven't already done so, Install Blocknet Wallet and sync it
- Close your Blocknet wallet application.
- Rename or move the
wallet.dat
file in your data directory, if there is one. - If there is a
wallets
subdirectory/folder in the data directory and it contains a file calledwallet.dat
, rename thatwallet.dat
file to something likewallet.dat.empty
. - If a
wallets
subdirectory/folder doesn't already exist in the data directory, make a newwallets
subdirectory/folder in the data directory. -
Copy your backup copy of
wallet.dat
into thewallets
subdirectory of your data directory. Note, it's fine to name yourwallet.dat
to something else while it's being stored safely in other locations. However, it must be named,wallet.dat
when placed in thewallets
subdirectory if the Blocknet wallet app is going to find it.Note, instead of copying your backup
wallet.dat
into thewallets
subdirectory, you could optionally copy it into the data directory itself. However, if you choose this option, be sure to remove thewallets
subdirectory because the Blocknet application will not use awallet.dat
file in the data directory itself if awallets
subdirectory exists. -
Restart Blocknet wallet.
Restore from dumpfile
¶
Firstly, if you haven't already done so, Install Blocknet Wallet and sync it
Next, there are three options:
- If you backed up your wallet using the
dumpwallet <dumpfile>
command, you can restore it simply by issuing theimportwallet <dumpfile>
command from either Tools->Debug Console or from the CLI if using the Command Line Interface. This is the recommended method of restoring from adumpfile
. - Another option you have if you are restoring an
HD Wallet
and you are certain no non-HD PrivateKey/Address
pairs were imported into the wallet you want to restore, is to
extract the HD seed from the dumpfile,
then use the
sethdseed ( newkeypool "seed" )
command to effectively import all the PrivateKey/Address pairs of the HD wallet. Type,help sethdseed
in the Debug Console or CLI for more details on thesethdseed
command. - It's also possible to use the
importprivkey
command to import individual PrivateKey/Address pairs, where the Private Key could come from thedumpfile
, or from the output of adumpprivkey
command issued in some wallet. The use of these commands is not generally recommended, especially if you are using an HD wallet. However, in certain circumstances, these commands might be the only way to salvage funds.