Chain Future

Solidity, smart-contract development, developer tools and explained protocol engineering

BIP-138 proposes password-free recovery for encrypted Bitcoin wallet metadata

How can a wallet developer back up a Bitcoin wallet’s spending rules so that any one cosigner can recover them without a separate password? BIP-138 proposes a compact encrypted format for data other than the seed, including output script descriptors (BIP-380), which describe a wallet’s output scripts, and wallet policies (BIP-388), which express its spending rules. A Chinese translation of the proposal was published on November 26, 2026.

How one cosigner can recover the backup

The wallet sorts the descriptor’s public keys lexicographically and applies a BIP-340 tagged hash to derive a shared secret, s. It also derives a separate secret, s_i, for each eligible public key. Rather than recording s directly, the backup stores s ⊕ s_i for each such key. The ⊕ symbol means bitwise exclusive OR: applying the same s_i a second time recovers s.

A cosigner can therefore use their own eligible public key to derive s_i, recover s from the corresponding entry and decrypt the payload. The proposal uses ChaCha20-Poly1305 for encryption. Its eligibility rules exclude literal public keys, bare extended public keys (xpubs) and publicly known NUMS points. The design aims to avoid exposing enough information on-chain for a third party to reproduce the secret.

What the backup reveals

The format specifies an identifying MAGIC field, a VERSION field, a derivation path, per-key recovery entries and the ciphertext. Decoy entries make the entry count an unreliable guide to the number of cosigners. Padding rounds the payload length up to a size bucket, concealing its exact length rather than its size altogether.

The specification defines content types for descriptors, policies and strings, with 0x80 as a boundary between type ranges. It also provides a decryption procedure, test vectors and backward-compatibility notes for implementers.