This document specifies a format for exporting wallet backup data, including accounts, descriptors, associated keys, labels, transactions, and partially signed Bitcoin transactions (PSBTs). The format aims to standardize wallet backup and restore operations across different Bitcoin wallet implementations.
Bitcoin wallets store various forms of metadata beyond just private keys, including account structures, descriptors, labels, and transaction history. While BIP39 and BIP32 provide standardized mechanisms for key recovery, they do not preserve additional wallet-specific metadata necessary for seamless migration between wallets.
A standardized wallet backup format ensures that users can migrate wallets without losing critical metadata, reducing vendor lock-in and enabling more robust recovery options.
Several wallet implementations store backup data in proprietary formats, making migration difficult. This proposal aims to introduce a structured, human-readable format, leveraging JSON to store all essential wallet metadata in a portable way. The JSON Lines format is chosen for compatibility with existing tools and for incremental parsing capabilities.
A wallet backup is a UTF-8 encoded text file containing a single valid JSON object representing the backup structure. This object includes wallet-level metadata, multiple accounts, and associated key data.
version: Optionnal version of the backup formatname: Optional wallet namedescription: Optional wallet descriptionaccounts: Array of account objectsnetwork: The network Bitcoin/Testnet/Signet/Regtestproprietary: Optional JSON object storing application-specific metadata
-
name: Optional account name -
description: Optional account description -
active: Optional field to notify if the account is active -
descriptor: Output descriptor defining the account structureTBD: It may not strictly contain a descriptor but should allow room for:
- output descriptor (BIP-0380)
- wallet policy (BIP-0388)
- silent payments
- lightning?
- ark?
- any arbitrary representation of metadata needed to find & spend coins for an
account
-
receive_index: Optional maximum receive index for generated receive addresses -
change_index: Optional maximum change index for generated change addresses -
timestamp: Optional timestamp indicating account creation time -
keys: Optional dictionary of descriptor keys mapped to metadata -
labels: Optional labels for transactions, addresses, and keys following BIP-0329 -
transactions: Optional list of fully confirmed transactionsTBD: Which transactions should be backed up?
- Only the transactions spending coins controlled by the account?
- Also, transactions funding controlled coins? Or only the corresponding outpoints?
-
psbts: Optional list of unspent but (partially) signed transactions -
bip39_mnemonic: Optional mnemonic words following bip39Note: the purpose of such backup is to potentially to be stored online, so storing mainnet mnemonics is strongly discouraged.
-
proprietary: Optional JSON object storing account-specific metadata
key: Public key/fingerprintalias: (optional) User-defined aliasrole: (optional) Defines the role of the key in wallet operationskey_type: (optional) Defines the ownership type of the keykey_status: (optional) Status of the key (active/inactive/revoked)bip85_derivation_path: (optionnal) the bip85 path used to derived this key from the master key
main: Key used for normal spending conditionsrecovery: Key designated for recovery scenariosinheritance: Key to inherit funds if the primary user disappearscosigning: Key designated for policy-enforcing cosigning
internal: Main user-owned keyexternal: Heirs or trusted individualsthird_party: Keys held by a service provider
active: The key is actively usedinactive: The key is not (yet) actively usedrevoked: The key have been revoked and MUST not be used anymore
- Importing wallets should preserve all metadata they support and discard unsupported fields.
- Wallets should warn users if essential data cannot be restored.
- Wallets should ensure that key roles and types are properly mapped to their internal structures.
- The backup format should not include private keys to avoid unintended key exposure.
- Backup should be encrypted to prevent unauthorized access.
- Care should be taken to ensure that proprietary metadata does not contain sensitive information.
This format is extensible and allows future additions without breaking compatibility. Wallets may choose to ignore fields they do not recognize while maintaining the structural integrity of the backup.