1
0
mirror of https://github.com/bitcoin/bips.git synced 2026-10-19 19:29:18 +00:00

bip-138: specify BIP388 wallet policy backup content

This commit is contained in:
pythcoiner
2026-06-18 04:38:58 -04:00
parent 9e2a585a9a
commit 810b4df73e
3 changed files with 161 additions and 1 deletions

View File

@@ -404,6 +404,54 @@ the ranged derivation indexes covered by the descriptor set.
lower bound for when the descriptor set may have received funds. Importing
wallets MAY use this value as a scanning hint.
#### BIP388 Wallet Policy Backup Content
When `CONTENT` is `TYPE = 0x01` with `DATA = 0x0184` (BIP388), `PLAINTEXT` is a
UTF-8 JSON wallet policy backup document. A BIP388 wallet policy is a descriptor
template plus a vector of key information items, as defined in BIP388.
Test vectors are in
[`bip388.json`](./bip-0138/test_vectors/bip388.json).
The document is one of two forms:
- A single policy, a JSON object `{ "keys": [...], "policy": "<template>" }`.
- Multiple policies, a JSON object `{ "version": 1, "policy_sets": [...] }`.
Parsers select the form by structure: an object with a `policy_sets` field is the
multiple form, an object with a `policy` field is the single form.
##### Policy Fields
`keys` is a required array of BIP388 key information items, each a serialized
extended public key with optional key origin (`[fingerprint/path]xpub`). It MUST
contain at least one key. Keys MUST NOT contain private key material.
`policy` is a required non-empty string containing a BIP388 wallet descriptor
template, with `@i` key placeholders referring to `keys`.
##### Policy Set Fields
A policy set has the same `keys` and `policy` fields as the single form, plus the
optional metadata fields:
If optional boolean `archived` is `true`, importing wallets SHOULD NOT use the
policy for new address generation.
`range` is an optional two-element array `[start, end]`, inclusive, describing the
ranged derivation indexes covered by the policy.
`birth_time` is an optional integer Unix timestamp in seconds, indicating a lower
bound for when the policy may have received funds. Importing wallets MAY use this
value as a scanning hint.
##### Multiple Policies Document
The multiple form is a JSON object with the following fields:
- `version`: integer. This specification defines version `1`.
- `policy_sets`: array of policy set objects.
#### Encrypted Payload
`ENCRYPTED_PAYLOAD` follows this format:
@@ -459,10 +507,13 @@ contains test vectors for generation of encryption secret.
[chacha20poly1305_encryption.json](./bip-0138/test_vectors/chacha20poly1305_encryption.json)
contains test vectors for ciphertexts generated using CHACHA20-POLY1305.
[encrypted_backup.json](./bip-0138/test_vectors/encrypted_backup.json)
contains test vectors for generation of complete encrypted backup.
contains test vectors for generation of complete encrypted backups, including
BIP380 and BIP388 content.
[bip380_descriptor_backup.txt](./bip-0138/test_vectors/bip380_descriptor_backup.txt)
and [bip380_descriptor_backup.json](./bip-0138/test_vectors/bip380_descriptor_backup.json)
contain test vectors for BIP380 descriptor backup documents.
[bip388.json](./bip-0138/test_vectors/bip388.json)
contains test vectors for BIP388 wallet policy backup documents.
## Acknowledgements