Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
199c7be
bip encrypted_backup
pythcoiner Aug 22, 2025
e9858e8
Assign BIP138
murchandamus May 11, 2026
7707cf2
bip-0138: make PLAINTEXT LENGTH mandatory and add optional payload pa…
pythcoiner Jun 18, 2026
72d8a95
bip-0138: use assigned BIP number 138 for magic and domain separation…
pythcoiner Jun 18, 2026
b7ba284
bip-138: clarify CONTENT is a single TLV and forbid all-zero nonce
pythcoiner Jun 18, 2026
9e2a585
bip-138: specify BIP380 descriptor backup content
pythcoiner Jun 18, 2026
810b4df
bip-138: specify BIP388 wallet policy backup content
pythcoiner Jun 18, 2026
d115620
bip-138: make BIP380 backup content JSON-only
pythcoiner Jun 18, 2026
c6b04e2
bip-138: BIP380 content is a bare descriptor or a JSON document
pythcoiner Jun 18, 2026
99217c6
bip-138: reference BIP-0139 for wallet backup metadata
pythcoiner Jun 18, 2026
b1e3adc
bip-138: terminate generated test vectors with a trailing newline
pythcoiner Jun 18, 2026
56deb75
bip-138: allow multiple content items per payload
pythcoiner Jun 30, 2026
86f5c28
bip-138 treat content type 0x00 as the end of content items
pythcoiner Jul 15, 2026
1358003
bip-138 add string content type
pythcoiner Jul 15, 2026
fb52eaa
bip-138 document common derivation paths to try automatically
pythcoiner Jul 15, 2026
1e776e7
bip-138 pad individual secrets with decoys
pythcoiner Jul 15, 2026
9f1be26
bip-138 recommend sorting and deduplicating individual secrets
pythcoiner Jul 8, 2026
1de39be
bip-138 document why content LENGTH is mandatory
pythcoiner Jul 15, 2026
317b8fd
bip-138 reference the CHACHA20-POLY1305 rationale footnote
pythcoiner Jul 15, 2026
c1170d4
bip-138 require warning about excluded key expressions
pythcoiner Jul 15, 2026
ca0722c
bip-138 sync test vectors with the reference implementation
pythcoiner Jul 15, 2026
86e10c9
bip-138 recommend sorting and deduplicating derivation paths
pythcoiner Jul 15, 2026
ea22157
bip-138 add test vectors for sorting and deduplication
pythcoiner Jul 15, 2026
1a157a6
bip-138 saturate the decoy bucket at the count limit
pythcoiner Jul 15, 2026
090fbf0
bip-138 add a test vector for x-only key deduplication
pythcoiner Jul 15, 2026
f79d086
bip138: address review
pythcoiner Jul 16, 2026
d041c01
bip138: add a backward compatibility section
pythcoiner Jul 16, 2026
5d44116
bip138: address review
pythcoiner Jul 16, 2026
e1b3525
bip138: add Requires header
pythcoiner Jul 16, 2026
1b1513e
bip138: add acknowledgements
pythcoiner Jul 16, 2026
65b4c38
bip138: address review
pythcoiner Jul 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions README.mediawiki
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,13 @@ users (see also: [https://en.bitcoin.it/wiki/Economic_majority economic majority
| Christopher Gilliard
| Specification
| Deployed
|-
| [[bip-0138.md|138]]
| Applications
| Compact Encryption Scheme for Non-seed Wallet Data
| Pyth
| Specification
| Draft
|- style="background-color: #ffcfcf"
| [[bip-0140.mediawiki|140]]
| Consensus (soft fork)
Expand Down
600 changes: 600 additions & 0 deletions bip-0138.md

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions bip-0138/test_vectors/bip380_descriptor_backup.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[
{
"description": "Descriptor with change descriptor",
"valid": true,
"document": {
"version": 1,
"descriptor_sets": [
{
"archived": false,
"birth_time": 1710000000,
"range": [0, 999],
"descriptor": "wpkh([d34db33f/84h/1h/0h]tpubDC5FSnBiZDMmhiuCmWAYsLwgLYrrT9rAqvTySfuCCrgsWz8wxMXUS9Tb9iVMvcRbvFcAHGkMD5Kx8koh4GquNGNTfohfk7pgjhaPCdXpoba/0/*)",
"change_descriptor": "wpkh([d34db33f/84h/1h/0h]tpubDC5FSnBiZDMmhiuCmWAYsLwgLYrrT9rAqvTySfuCCrgsWz8wxMXUS9Tb9iVMvcRbvFcAHGkMD5Kx8koh4GquNGNTfohfk7pgjhaPCdXpoba/1/*)"
}
]
}
},
{
"description": "BIP389 multipath descriptor",
"valid": true,
"document": {
"version": 1,
"descriptor_sets": [
{
"archived": false,
"birth_time": 1710000000,
"range": [0, 999],
"descriptor": "wpkh([d34db33f/84h/1h/0h]tpubDC5FSnBiZDMmhiuCmWAYsLwgLYrrT9rAqvTySfuCCrgsWz8wxMXUS9Tb9iVMvcRbvFcAHGkMD5Kx8koh4GquNGNTfohfk7pgjhaPCdXpoba/<0;1>/*)"
}
]
}
}
]
92 changes: 92 additions & 0 deletions bip-0138/test_vectors/bip388.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
[
{
"description": "single pkh policy",
"valid": true,
"document": {
"keys": [
"[d34db33f/44'/0'/0']xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL"
],
"policy": "pkh(@0/**)"
}
},
{
"description": "multiple policy sets with metadata",
"valid": true,
"document": {
"version": 1,
"policy_sets": [
{
"keys": [
"[6738736c/48'/0'/0'/2']xpub6FC1fXFP1GXLX5TKtcjHGT4q89SDRehkQLtbKJ2PzWcvbBHtyDsJPLtpLtkGqYNYZdVVAjRQ5kug9CsapegmmeRutpP7PW4u4wVF9JfkDhw",
"[b2b1f0cf/48'/0'/0'/2']xpub6EWhjpPa6FqrcaPBuGBZRJVjzGJ1ZsMygRF26RwN932Vfkn1gyCiTbECVitBjRCkexEvetLdiqzTcYimmzYxyR1BZ79KNevgt61PDcukmC7"
],
"policy": "wsh(sortedmulti(2,@0/**,@1/**))",
"archived": true,
"range": [
0,
999
],
"birth_time": 1710000000
},
{
"keys": [
"[d34db33f/44'/0'/0']xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL"
],
"policy": "pkh(@0/**)"
}
]
}
},
{
"description": "version not one",
"valid": false,
"document": {
"version": 2,
"policy_sets": [
{
"keys": [
"[d34db33f/44'/0'/0']xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL"
],
"policy": "pkh(@0/**)"
}
]
}
},
{
"description": "missing policy",
"valid": false,
"document": {
"keys": [
"[d34db33f/44'/0'/0']xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL"
]
}
},
{
"description": "empty policy",
"valid": false,
"document": {
"keys": [
"[d34db33f/44'/0'/0']xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL"
],
"policy": ""
}
},
{
"description": "empty keys",
"valid": false,
"document": {
"keys": [],
"policy": "pkh(@0/**)"
}
},
{
"description": "single literal pubkey in keys",
"valid": false,
"document": {
"keys": [
"0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"
],
"policy": "pkh(@0/**)"
}
}
]
37 changes: 37 additions & 0 deletions bip-0138/test_vectors/chacha20poly1305_encryption.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[
{
"description": "Basic encryption with short plaintext",
"nonce": "000102030405060708090a0b",
"plaintext": "48656c6c6f",
"secret": "0000000000000000000000000000000000000000000000000000000000000000",
"ciphertext": "7df9cb9a0ac5851cc054b14d05f781127b2b0d31fa"
},
{
"description": "Empty plaintext should fail",
"nonce": "000102030405060708090a0b",
"plaintext": "",
"secret": "0000000000000000000000000000000000000000000000000000000000000000",
"ciphertext": null
},
{
"description": "Encryption with zeroed nonce should fail",
"nonce": "000000000000000000000000",
"plaintext": "00000000000000000000000000000000",
"secret": "0000000000000000000000000000000000000000000000000000000000000000",
"ciphertext": null
},
{
"description": "Encryption with all FFs",
"nonce": "ffffffffffffffffffffffff",
"plaintext": "ffffffffffffffffffffffffffffffff",
"secret": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"ciphertext": "22d8bfc313e141bd692c82cec7785b29a0e5d5014c0d3b2d3a8b00548cd8d221"
},
{
"description": "Longer plaintext",
"nonce": "0f1e2d3c4b5a69788796a5b4",
"plaintext": "546869732069732061206c6f6e67657220706c61696e746578742074686174207368756c6420626520656e637279707465642070726f7065726c792e",
"secret": "deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef",
"ciphertext": "2af094190e2b43a02b8dd6bfc25a8833f84f81bc6f690d75f0214e466ef392616c4644bee65118c444a926e1e365b3a7ba0509a5636524eb4e5722f5926938f32e4df79237acb6dd4a6ccbc4"
}
]
82 changes: 82 additions & 0 deletions bip-0138/test_vectors/content_type.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
[
{
"description": "Bip 138",
"valid": true,
"content": "01008a"
},
{
"description": "Bip 380",
"valid": true,
"content": "01017c"
},
{
"description": "Bip 388",
"valid": true,
"content": "010184"
},
{
"description": "Bip 329",
"valid": true,
"content": "010149"
},
{
"description": "Bip 999",
"valid": true,
"content": "0103e7"
},
{
"description": "Bip max",
"valid": true,
"content": "01ffff"
},
{
"description": "Bip min",
"valid": true,
"content": "010000"
},
{
"description": "Propietary 00010203",
"valid": true,
"content": "020400010203"
},
{
"description": "String",
"valid": true,
"content": "0300"
},
{
"description": "TYPE 0x00 ends the content items",
"valid": false,
"content": "00"
},
{
"description": "Invalid BIP (insufficient bytes)",
"valid": false,
"content": "0100"
},
{
"description": "Invalid proprietary (missing data)",
"valid": false,
"content": "0201"
},
{
"description": "Invalid proprietary (TYPE_LENGTH exceeds payload)",
"valid": false,
"content": "020500"
},
{
"description": "Invalid string (metadata must be empty)",
"valid": false,
"content": "030161"
},
{
"description": "TYPE >= 0x80 stops parsing",
"valid": false,
"content": "ff"
},
{
"description": "TYPE >= 0x80 stops parsing",
"valid": false,
"content": "ff000000"
}
]
Loading