Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
bigspider committed Feb 21, 2023
1 parent 162c675 commit da3e117
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions bip-wallet-policies.mediawiki
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@ Each element of the key origin information vector is a <tt>KEY</tt> expression.

The wallet policy is invalid if any placeholder expression with additional derivation steps is used when the corresponding key information is not an xpub.

A wallet policy must have at least one key placeholder and the corresponding key.

The key information vector should be ordered so that placeholder <tt>@i</tt> never appear for the first time before an occurrence of <tt>@j</tt> for some j < i</tt>; for example, the first placeholder is always <tt>@0</tt>, the next one is <tt>@1</tt>, etc.

=== Descriptor derivation ===
Expand Down Expand Up @@ -229,7 +231,7 @@ Avoiding key reuse among different wallet accounts is also extremely important,

== Examples ==

In the examples in this section, the vector of key information items is omitted. See the test vectors below for a complete
In the examples in this section, the vector of key information items is omitted. See the test vectors below for complete examples.

Common single-signature account patterns:
* <tt>pkh(@0/**)</tt> (legacy).
Expand All @@ -239,10 +241,10 @@ Common single-signature account patterns:
Common multisignature schemes:
* <tt>wsh(multi(2,@0,@1))</tt> - SegWit 2-of-2 multisignature, keys in order.
* <tt>sh(sortedmulti(2,@0,@1,@3))</tt> - Legacy 2-of-3 multisignature, sorted keys.
* <tt>sh(sortedmulti(2,@0,@1,@2))</tt> - Legacy 2-of-3 multisignature, sorted keys.
Some miniscript policies in <tt>wsh</tt>:
* <tt>wsh(and_v(v:pk(key_user),or_d(pk(key_service),older(12960))))</tt> - Trust-minimized second factor, degrading to a single signature after about 90 days.
* <tt>wsh(and_v(v:pk(@0),or_d(pk(@1),older(12960))))</tt> - Trust-minimized second factor, degrading to a single signature after about 90 days.
* <tt>wsh(thresh(3,pk(@0/**),s:pk(@1/**),s:pk(@2/**),sln:older(12960)))</tt> - A 3-of-3 wallet that becomes a 2-of-3 if coins are not spent for about 90 days.
* <tt>wsh(t:or_c(pk(@0/**),and_v(v:pk(@1/**),or_c(pk(@2/**),v:hash160(00112233445566778899aabbccddeeff00112233)))))</tt> - BOLT #3 offered HTLC policy.
* <tt>wsh(andor(pk(@0/**),or_i(and_v(v:pkh(@1/**),hash160(00112233445566778899aabbccddeeff00112233)),older(1008)),pk(@2/**)))</tt> - BOLT #3 received HTLC policy.
Expand Down Expand Up @@ -295,7 +297,7 @@ TBD: add examples with taproot scripts and miniscript.

== Backwards Compatibility ==

The <tt>@</tt> character used for key placeholders is not part of the syntax of output script descriptors, therefore any valid descriptor template is not a valid descriptor template. Vice versa, any descriptor template with at least one key placeholder is not a valid output script descriptor.
The <tt>@</tt> character used for key placeholders is not part of the syntax of output script descriptors, therefore any valid output descriptor with at least one `KEY` expression is not a valid descriptor template. Vice versa, any descriptor template with at least one key placeholder is not a valid output script descriptor.

Adoption of wallet policies in software and harder wallets is opt-in. Conversion from wallet policies to the corresponding descriptors is programmatically extremely easy, and conversion from descriptors to wallet policies (when respecting the required patterns) can be automated. See the reference implementation below for some examples of conversion.

Expand Down

0 comments on commit da3e117

Please sign in to comment.