Skip to content

Commit 608f40b

Browse files
committed
Specify BIP 383: Multisig descriptors
1 parent fb56a18 commit 608f40b

File tree

3 files changed

+91
-0
lines changed

3 files changed

+91
-0
lines changed

README.mediawiki

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,6 +1071,13 @@ Those proposing changes should consider that ultimately consent may rest with th
10711071
| Pieter Wuille, Andrew Chow
10721072
| Informational
10731073
| Draft
1074+
|-
1075+
| [[bip-0383.mediawiki|383]]
1076+
| Applications
1077+
| Multisig Output Script Descriptors
1078+
| Pieter Wuille, Andrew Chow
1079+
| Informational
1080+
| Draft
10741081
|}
10751082

10761083
<!-- IMPORTANT! See the instructions at the top of this page, do NOT JUST add BIPs here! -->

bip-0380.mediawiki

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,4 +252,10 @@ This Table lists all available Script expressions and the BIPs specifying them.
252252
|-
253253
| <tt>wsh(SCRIPT)</tt>
254254
| [[bip-0382.mediawiki|382]]
255+
|-
256+
| <tt>multi(NUM, KEY, ..., KEY)</tt>
257+
| [[bip-0383.mediawiki|383]]
258+
|-
259+
| <tt>sortedmulti(NUM, KEY, ..., KEY)</tt>
260+
| [[bip-0383.mediawiki|383]]
255261
|}

bip-0383.mediawiki

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<pre>
2+
BIP: 383
3+
Layer: Applications
4+
Title: Multisig Output Script Descriptors
5+
Author: Pieter Wuille <[email protected]>
6+
Andrew Chow <[email protected]>
7+
Comments-Summary: No comments yet.
8+
Comments-URI: https://github.com/bitcoin/bips/wiki/Comments:BIP-0383
9+
Status: Draft
10+
Type: Informational
11+
Created: 2021-06-27
12+
License: BSD-2-Clause
13+
</pre>
14+
15+
==Abstract==
16+
17+
This document specifies <tt>multi()</tt>, and <tt>sortedmulti()</tt> output script descriptors.
18+
Both functions take a threshold and one or more public keys and produce a multisig output script.
19+
<tt>multi()</tt> specifies the public keys in the output script in the order given in the descriptor while <tt>sortedmulti()</tt> sorts the public keys lexicographically when the output script is produced.
20+
21+
==Copyright==
22+
23+
This BIP is licensed under the BSD 2-clause license.
24+
25+
==Motivation==
26+
27+
The most common complex script used in Bitcoin is a threshold multisig.
28+
These expressions allow specifying multisig scripts as a descriptor.
29+
30+
==Specification==
31+
32+
Two new script expressions are defined: <tt>multi()</tt>, and <tt>sortedmulti()</tt>.
33+
Both expressions produce the scripts of the same template and take the same arguments.
34+
They are written as <tt>multi(k,KEY_1,KEY_2,...,KEY_n)</tt>.
35+
<tt>k</tt> is the threshold - the number of keys that must sign the input for the script to be valid.
36+
<tt>KEY_1,KEY_2,...,KEY_n</tt> are the key expressions for the multisig. <tt>k</tt> must be less than or equal to <tt>n</tt>.
37+
38+
<tt>multi()</tt> and <tt>sortedmulti()</tt> expressions can be used as a top level expression, or inside of either a <tt>sh()</tt> or <tt>wsh()</tt> descriptor.
39+
Depending on the higher level descriptors, there may be restrictions on the type of public keys that can be included.
40+
41+
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 <tt>n</tt>.
42+
When used at the top level, there can only be at most 3 keys.
43+
When used inside of a <tt>sh()</tt> expression, there can only be most 15 compressed public keys (this is limited by the P2SH script limit).
44+
Otherwise the maximum number of keys is 20.
45+
46+
The output script produced also depends on the value of <tt>k</tt>. If <tt>k</tt> is less than or equal to 16:
47+
<pre>
48+
OP_k KEY_1 KEY_2 ... KEY_n OP_CHECKMULTISIG
49+
</pre>
50+
51+
if <tt>k</tt> is greater than 16:
52+
<pre>
53+
k KEY_1 KEY_2 ... KEY_n OP_CHECKMULTISIG
54+
</pre>
55+
56+
===<tt>sortedmulti()</tt>===
57+
58+
The only change for <tt>sortedmulti()</tt> is that the keys are sorted lexicographically prior to the creation of the output script.
59+
This sorting is on the keys that are to be put into the output script, i.e. after all extended keys are derived.
60+
61+
===Multiple Extended Keys</tt>===
62+
63+
When one or more the key expressions in a <tt>multi()</tt> or <tt>sortedmulti()</tt> expression are extended keys, the derived keys use the same child index.
64+
This changes the keys in lockstep and allows for output scripts to be indexed in the same way that the derived keys are indexed.
65+
66+
==Test Vectors==
67+
68+
TBD
69+
70+
==Backwards Compatibility==
71+
72+
<tt>multi()</tt>, and <tt>sortedmulti()</tt> descriptors use the format and general operation specified in [[bip-0380.mediawiki|380]].
73+
As these are a wholly new descriptors, they are not compatible with any implementation.
74+
However the scripts produced are standard scripts so existing software are likely to be familiar with them.
75+
76+
==Reference Implemntation==
77+
78+
<tt>multi()</tt>, and <tt>multi()</tt> descriptors have been implemented in Bitcoin Core since version 0.17.

0 commit comments

Comments
 (0)