From 384a2e1351218abc154c75d9dbc98c1f795c0776 Mon Sep 17 00:00:00 2001 From: Oli Date: Thu, 6 Aug 2026 09:19:55 +0200 Subject: [PATCH 1/7] bip389: fix missing parenthesis in test vector --- bip-0389.mediawiki | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bip-0389.mediawiki b/bip-0389.mediawiki index 6940a451da..ec1d14f90c 100644 --- a/bip-0389.mediawiki +++ b/bip-0389.mediawiki @@ -65,7 +65,7 @@ Valid multipath descriptors followed by the descriptors they expand into as sub- * pkh(xprv9s21ZrQH143K31xYSDQpPDxsXRTUcvj2iNHm5NUtrGiGG5e2DtALGdso3pGz6ssrdK4PFmM8NSpSBHNqPqm55Qn3LqFtT2emdEXVYsCzC2U/<2147483647h;0>/0) ** pkh(xprv9s21ZrQH143K31xYSDQpPDxsXRTUcvj2iNHm5NUtrGiGG5e2DtALGdso3pGz6ssrdK4PFmM8NSpSBHNqPqm55Qn3LqFtT2emdEXVYsCzC2U/2147483647h/0) ** pkh(xprv9s21ZrQH143K31xYSDQpPDxsXRTUcvj2iNHm5NUtrGiGG5e2DtALGdso3pGz6ssrdK4PFmM8NSpSBHNqPqm55Qn3LqFtT2emdEXVYsCzC2U/0/0) -* wpkh([ffffffff/13h]xpub69H7F5d8KSRgmmdJg2KhpAK8SR3DjMwAdkxj3ZuxV27CprR9LgpeyGmXUbC6wb7ERfvrnKZjXoUmmDznezpbZb7ap6r1D3tgFxHmwMkQTPH/<1;3>/2/* +* wpkh([ffffffff/13h]xpub69H7F5d8KSRgmmdJg2KhpAK8SR3DjMwAdkxj3ZuxV27CprR9LgpeyGmXUbC6wb7ERfvrnKZjXoUmmDznezpbZb7ap6r1D3tgFxHmwMkQTPH/<1;3>/2/*) ** wpkh([ffffffff/13h]xpub69H7F5d8KSRgmmdJg2KhpAK8SR3DjMwAdkxj3ZuxV27CprR9LgpeyGmXUbC6wb7ERfvrnKZjXoUmmDznezpbZb7ap6r1D3tgFxHmwMkQTPH/1/2/*) ** wpkh([ffffffff/13h]xpub69H7F5d8KSRgmmdJg2KhpAK8SR3DjMwAdkxj3ZuxV27CprR9LgpeyGmXUbC6wb7ERfvrnKZjXoUmmDznezpbZb7ap6r1D3tgFxHmwMkQTPH/3/2/*) * multi(2,xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL/<1;2>/*,xpub68NZiKmJWnxxS6aaHmn81bvJeTESw724CRDs6HbuccFQN9Ku14VQrADWgqbhhTHBaohPX4CjNLf9fq9MYo6oDaPPLPxSb7gwQN3ih19Zm4Y/<3;4>/0/*) From 7517a8b2ac8fdb13e586d0e139a7f5b87ceab994 Mon Sep 17 00:00:00 2001 From: Oli Date: Thu, 6 Aug 2026 10:55:28 +0200 Subject: [PATCH 2/7] bip390: fix missing parenthesis in test vector --- bip-0390.mediawiki | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bip-0390.mediawiki b/bip-0390.mediawiki index a6b5526a67..31c819ab2d 100644 --- a/bip-0390.mediawiki +++ b/bip-0390.mediawiki @@ -102,7 +102,7 @@ Invalid descriptors * Cannot have multipath participants if musig() is also multipath: tr(musig(xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL/<0;1>,xpub68NZiKmJWnxxS6aaHmn81bvJeTESw724CRDs6HbuccFQN9Ku14VQrADWgqbhhTHBaohPX4CjNLf9fq9MYo6oDaPPLPxSb7gwQN3ih19Zm4Y)/<2;3>) * musig() cannot have hardened derivation steps: tr(musig(xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL,xpub68NZiKmJWnxxS6aaHmn81bvJeTESw724CRDs6HbuccFQN9Ku14VQrADWgqbhhTHBaohPX4CjNLf9fq9MYo6oDaPPLPxSb7gwQN3ih19Zm4Y)/0h/*) * musig() cannot have hardened child derivation: tr(musig(xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL,xpub68NZiKmJWnxxS6aaHmn81bvJeTESw724CRDs6HbuccFQN9Ku14VQrADWgqbhhTHBaohPX4CjNLf9fq9MYo6oDaPPLPxSb7gwQN3ih19Zm4Y)/0/*h) -* musig() cannot have participants with child derivation when musig() has derivation steps: tr(musig(xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL/*,xpub68NZiKmJWnxxS6aaHmn81bvJeTESw724CRDs6HbuccFQN9Ku14VQrADWgqbhhTHBaohPX4CjNLf9fq9MYo6oDaPPLPxSb7gwQN3ih19Zm4Y/*)/1/2 +* musig() cannot have participants with child derivation when musig() has derivation steps: tr(musig(xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL/*,xpub68NZiKmJWnxxS6aaHmn81bvJeTESw724CRDs6HbuccFQN9Ku14VQrADWgqbhhTHBaohPX4CjNLf9fq9MYo6oDaPPLPxSb7gwQN3ih19Zm4Y/*)/1/2) ==Backwards Compatibility== From 9570a72d501c7a328bd1c8da07b0ee78af14310b Mon Sep 17 00:00:00 2001 From: Oli Date: Thu, 6 Aug 2026 09:25:36 +0200 Subject: [PATCH 3/7] bip389: remove H as valid hardened step indicator In BIP380 the capital letter H is explicitly defined as an invalid indicator for a hardened step. The "Invalid expression" section has explicit examples prefixed "Invalid hardened indicators" that show "0H/0H/0H" as being wrong. --- bip-0389.mediawiki | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bip-0389.mediawiki b/bip-0389.mediawiki index ec1d14f90c..43497061dd 100644 --- a/bip-0389.mediawiki +++ b/bip-0389.mediawiki @@ -38,12 +38,12 @@ For extended keys and their derivations paths in a Key Expression, BIP 380 state This is modified to state: * xpub encoded extended public key or xprv encoded extended private key (as defined in BIP 32) -** Followed by zero or more /NUM (may be followed by h, H, or ' to indicate a hardened step) path elements indicating BIP 32 derivation steps to be taken after the given extended key. -** Followed by zero or one / (each NUM may be followed by h, H, or ' to indicate a hardened step) path element indicating a tuple of BIP 32 derivation steps to be taken after the given extended key. -*** Followed by zero or more ;NUM (may be followed by h, H, or ' to indicate a hardened step) additional tuple values of BIP 32 derivation steps +** Followed by zero or more /NUM (may be followed by h or ' to indicate a hardened step) path elements indicating BIP 32 derivation steps to be taken after the given extended key. +** Followed by zero or one / (each NUM may be followed by h or ' to indicate a hardened step) path element indicating a tuple of BIP 32 derivation steps to be taken after the given extended key. +*** Followed by zero or more ;NUM (may be followed by h or ' to indicate a hardened step) additional tuple values of BIP 32 derivation steps *** Followed by a single >/ -** Followed by zero or more /NUM (may be followed by h, H, or ' to indicate a hardened step) path elements indicating BIP 32 derivation steps to be taken after the given extended key. -** Optionally followed by a single /* (may be followed by h, H, or ' to indicate a hardened step) final step to denote all direct unhardened or hardened children. +** Followed by zero or more /NUM (may be followed by h or ' to indicate a hardened step) path elements indicating BIP 32 derivation steps to be taken after the given extended key. +** Optionally followed by a single /* (may be followed by h or ' to indicate a hardened step) final step to denote all direct unhardened or hardened children. When a / is encountered, parsers should account for a presence of multiple descriptors where the first descriptor uses the first NUM, and a second descriptor uses the second NUM, and so on, until each NUM is accounted for in the production of public keys, scripts, and addresses, as well as descriptor import and export operations. Descriptors that contain multiple Key Expressions that each have a / must have tuples of exactly the same length so that they are derived in lockstep in the same way that /* paths in multiple Key expressions are handled. From 83c04884a14f0e308f533012406ab6c24d4a53ee Mon Sep 17 00:00:00 2001 From: Oli Date: Thu, 6 Aug 2026 09:27:58 +0200 Subject: [PATCH 4/7] bip386: remove stray space A stray space is not allowed inside such an expression. --- bip-0386.mediawiki | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bip-0386.mediawiki b/bip-0386.mediawiki index a95176e88d..9275ab02a9 100644 --- a/bip-0386.mediawiki +++ b/bip-0386.mediawiki @@ -104,7 +104,7 @@ Invalid Descriptors * Uncompressed public key: tr(04a34b99f22c790c4e36b2b3c2c35a36db06226e41c692fc82b8b56ac1c540c5bd5b8dec5235a0fa8722476c7709c02559e3aa73aa03918ba2d492eea75abea235) * tr() nested in wsh: wsh(tr(a34b99f22c790c4e36b2b3c2c35a36db06226e41c692fc82b8b56ac1c540c5bd)) * tr() nested in sh: sh(tr(a34b99f22c790c4e36b2b3c2c35a36db06226e41c692fc82b8b56ac1c540c5bd)) -* pkh() nested in tr: tr(a34b99f22c790c4e36b2b3c2c35a36db06226e41c692fc82b8b56ac1c540c5bd, pkh(L4rK1yDtCWekvXuE6oXD9jCYfFNV2cWRpVuPLBcCU2z8TrisoyY1)) +* pkh() nested in tr: tr(a34b99f22c790c4e36b2b3c2c35a36db06226e41c692fc82b8b56ac1c540c5bd,pkh(L4rK1yDtCWekvXuE6oXD9jCYfFNV2cWRpVuPLBcCU2z8TrisoyY1)) ==Backwards Compatibility== From d7854890ac7299863b1652868f2f6206dba44b4c Mon Sep 17 00:00:00 2001 From: Oli Date: Thu, 6 Aug 2026 09:37:33 +0200 Subject: [PATCH 5/7] bip386: update stale sentence New BIPs with more allowed expressions within a tr() tree have been added and are worth mentioning. --- bip-0386.mediawiki | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bip-0386.mediawiki b/bip-0386.mediawiki index 9275ab02a9..6cf5d74a22 100644 --- a/bip-0386.mediawiki +++ b/bip-0386.mediawiki @@ -97,6 +97,7 @@ Valid descriptors followed by the scripts they produce. Descriptors involving de ** 512017cf18db381d836d8923b1bdb246cfcd818da1a9f0e6e7907f187f0b2f937754 * tr(a34b99f22c790c4e36b2b3c2c35a36db06226e41c692fc82b8b56ac1c540c5bd,{pk(xprvA2JDeKCSNNZky6uBCviVfJSKyQ1mDYahRjijr5idH2WwLsEd4Hsb2Tyh8RfQMuPh7f7RtyzTtdrbdqqsunu5Mm3wDvUAKRHSC34sJ7in334/0),{{pk(xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL),pk(02df12b7035bdac8e3bab862a3a83d06ea6b17b6753d52edecba9be46f5d09e076)},pk(L4rK1yDtCWekvXuE6oXD9jCYfFNV2cWRpVuPLBcCU2z8TrisoyY1)}}) ** 512071fff39599a7b78bc02623cbe814efebf1a404f5d8ad34ea80f213bd8943f574 +* tr(a34b99f22c790c4e36b2b3c2c35a36db06226e41c692fc82b8b56ac1c540c5bd,pkh(L4rK1yDtCWekvXuE6oXD9jCYfFNV2cWRpVuPLBcCU2z8TrisoyY1)) Invalid Descriptors @@ -104,7 +105,6 @@ Invalid Descriptors * Uncompressed public key: tr(04a34b99f22c790c4e36b2b3c2c35a36db06226e41c692fc82b8b56ac1c540c5bd5b8dec5235a0fa8722476c7709c02559e3aa73aa03918ba2d492eea75abea235) * tr() nested in wsh: wsh(tr(a34b99f22c790c4e36b2b3c2c35a36db06226e41c692fc82b8b56ac1c540c5bd)) * tr() nested in sh: sh(tr(a34b99f22c790c4e36b2b3c2c35a36db06226e41c692fc82b8b56ac1c540c5bd)) -* pkh() nested in tr: tr(a34b99f22c790c4e36b2b3c2c35a36db06226e41c692fc82b8b56ac1c540c5bd,pkh(L4rK1yDtCWekvXuE6oXD9jCYfFNV2cWRpVuPLBcCU2z8TrisoyY1)) ==Backwards Compatibility== @@ -113,8 +113,9 @@ As these are a set of wholly new descriptors, they are not compatible with any i However the scripts produced are standard scripts so existing software are likely to be familiar with them. Tree Expressions are largely incompatible with existing script expressions due to the restrictions in those expressions. -As of 2021-06-27, the only allowed script expression that can be used in a tree expression is pk(). -However there will be future BIPs that specify script expressions that can be used in tree expressions. +Of the script expressions that existed when this BIP was written, only pk() can be used in a tree expression. +Script expressions specified since then that can be used in a tree expression are the Miniscript expressions of [[bip-0379.md|379]], which +include a pkh() fragment, and the multi_a() and sortedmulti_a() expressions of [[bip-0387.mediawiki|387]]. ==Reference Implementation== From 279395a60c9ffe3b1736da8985940aaa9efed72b Mon Sep 17 00:00:00 2001 From: Oli Date: Thu, 6 Aug 2026 09:39:07 +0200 Subject: [PATCH 6/7] bip383: fix incomplete sentence --- bip-0383.mediawiki | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bip-0383.mediawiki b/bip-0383.mediawiki index b4008f71ab..d19a991568 100644 --- a/bip-0383.mediawiki +++ b/bip-0383.mediawiki @@ -39,7 +39,7 @@ Depending on the higher level descriptors, there may be restrictions on the type Depending on the higher level descriptors, there are also restrictions on the number of keys that can be present, i.e. the maximum value of n. When used at the top level, there can only be at most 3 keys. -When used inside of a sh() expression, there can only be most 15 compressed public keys (this is limited by the P2SH script limit). +When used inside of a sh() expression, there can only be at most 15 compressed public keys (this is limited by the P2SH script limit). Otherwise the maximum number of keys is 20. The output script produced will be From 19d6e7f204dba63c5c3f36a999c00c7dd3c24448 Mon Sep 17 00:00:00 2001 From: Oli Date: Thu, 6 Aug 2026 10:57:06 +0200 Subject: [PATCH 7/7] bip383: specify more precise script size limit The "15 compressed public keys" rule is not very precise and doesn't mention uncompressed ones. Core implements this differently as well: https://github.com/bitcoin/bitcoin/blob/master/src/script/descriptor.cpp#L2425 So we make the definition more precise. --- bip-0383.mediawiki | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bip-0383.mediawiki b/bip-0383.mediawiki index d19a991568..2ff792cd73 100644 --- a/bip-0383.mediawiki +++ b/bip-0383.mediawiki @@ -39,7 +39,11 @@ Depending on the higher level descriptors, there may be restrictions on the type Depending on the higher level descriptors, there are also restrictions on the number of keys that can be present, i.e. the maximum value of n. When used at the top level, there can only be at most 3 keys. -When used inside of a sh() expression, there can only be at most 15 compressed public keys (this is limited by the P2SH script limit). +When used inside of a sh() expression, the output script produced is the redeem script, +which is pushed as a single element in the spending scriptSig and must therefore not exceed the +520 byte limit on the size of a script element. +This allows at most 15 compressed public keys, or at most 7 uncompressed ones, as an uncompressed +key takes 66 bytes of the script rather than 34. Otherwise the maximum number of keys is 20. The output script produced will be