Restoring application data

From Bisq Wiki
Revision as of 16:15, 28 January 2021 by Huey735 (talk | contribs) (Add Restore trade history section)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Restoring application data can be useful to bring back payment accounts, onion addresses, and other items from a backup—or to move your Bisq instance to an entirely new machine.

You can restore an entire data directory at once, or just the parts you want.

Restore an entire data directory

First make sure Bisq is closed. Then copy the entire Bisq directory from your backup and paste it in your machine's default data directory location. If there already is a directory called Bisq there, remove it (or rename it) and replace it with your backup.

Data directories work across operating systems, so you can copy a data directory created on a Mac to the appropriate location on Linux or Windows, and it will work.

Please do not run the same data directory on 2 machines at the same time, even if you don't run both instances at the same time, as data may get corrupted in strange ways.

Restore payment accounts

A payment account export only contains metadata (name, bank information, etc). For fiat accounts, this means that restoring payment accounts is a 2-step process.

Restore payment account metadata

If you have a payment accounts export file, import it in Account > National Currency Accounts.

If you don't have an export file, but you do have a full backup, you can salvage your payment account metadata from btc_mainnet/db/UserPayload by running the strings utility on the UserPayload file (e.g., run strings /path/to/backup/btc_mainnet/db/UserPayload in a terminal window). The command will output a simplified version of the UserPayload file to your terminal. Scroll up a bit and you should see your payment account information.

Use the output to copy and paste the details into new payment accounts in Bisq, paying special attention to make sure each field is copied over with 100% accuracy (including the salt): even a 1 character difference in any field will cause the hash of the payment account to be different, which means aging and signing status will not be restored in the following step.

There are quirks. Here's an example of output from a strings command:

SEPA
Alice Liddell
DE89370400440532013000
DEUTDE5X*
SKzH
salt
@56655c3738ea9dea3b20f482fff048985a2757e57dff206fbd9e8c4f267f7781

From the output above:

  • Be wary of extra characters at the beginning or end of a line. In the example above, the * character is not part of the BIC "DEUTDE5X".
  • Salts are alphanumeric, so the @ is not part of the salt "56655c3738ea9dea3b20f482fff048985a2757e57dff206fbd9e8c4f267f7781".

If you're on Windows, or cannot use the strings utility for some other reason, you can just open UserPayload directly in a text editor, but there will be more cruft to sift through since the file isn't meant to be human-readable.

It may be tempting to just replace the entire UserPayload file from a backup, but this is not recommended, as it may contain other data that could result in data corruption in your new instance.

Restore payment account aging and signing status

Once you've restored your payment account metadata, you'll see the accounts in Bisq, but they'll have no aging or signing status.

You can get aging and signing status back by replacing btc_mainnet/keys/sig.key from your backup.

  1. Make sure you have no active offers, trades or disputes; once you change sig.key, you will become unreachable.
  2. Close Bisq. Also make sure you've made a backup of your data directory (just in case).
  3. Replace /path/to/data/directory/btc_mainnet/keys/sig.key with the sig.key from your backup.

Upon opening Bisq, you should see account aging and signing status restored for your fiat payment accounts.

If you don't, double-check:

  • You copied account metadata and salt correctly in the previous step.
  • The sig.key you copied is the correct one (i.e., the one you were using when your accounts accrued aging and/or got signed)

Restore onion address

Your onion address determines your local reputation, so depending on your preferences, you may want to reset it or restore it over time.

If you want to restore it:

  • Close Bisq. Also make sure you've made a backup of your data directory (just in case).
  • Replace the /path/to/data/directory/btc_mainnet/tor/hiddenservices/ folder with the btc_mainnet/tor/hiddenservices/ folder from your backup.

When you open Bisq, your onion address will be restored.

This means that the peers that have traded with you will see bubbles with trade counts in their offer books for your offers.

Restore trade history

You may want to keep your trade history despite changing wallets. You can do so by:

  • Closing Bisq.
  • Replacing the /path/to/data/directory/btc_mainnet/db/ClosedTrades file on your new directory with the file from backup with the same name.

You will see bubbles with trade counts in the offer books for any any peers you traded with.

Restore wallet

If starting a new data directory, it's generally best to just send funds from one Bisq instance to another with an on-chain transaction. Bisq wallets use the bitcoinj library, which causes wallet files to get increasingly larger with every transaction—to the point that wallet file corruption becomes increasingly likely and performance suffers (e.g., long startup times)—so it's good to start with a clean wallet every so often.