From 608f40b4980ab56bf3b95381c172791d39786223 Mon Sep 17 00:00:00 2001 From: Andrew Chow Date: Sun, 27 Jun 2021 20:27:33 -0400 Subject: Specify BIP 383: Multisig descriptors --- bip-0383.mediawiki | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 bip-0383.mediawiki (limited to 'bip-0383.mediawiki') diff --git a/bip-0383.mediawiki b/bip-0383.mediawiki new file mode 100644 index 0000000..6b74950 --- /dev/null +++ b/bip-0383.mediawiki @@ -0,0 +1,78 @@ +
+  BIP: 383
+  Layer: Applications
+  Title: Multisig Output Script Descriptors
+  Author: Pieter Wuille 
+          Andrew Chow 
+  Comments-Summary: No comments yet.
+  Comments-URI: https://github.com/bitcoin/bips/wiki/Comments:BIP-0383
+  Status: Draft
+  Type: Informational
+  Created: 2021-06-27
+  License: BSD-2-Clause
+
+ +==Abstract== + +This document specifies multi(), and sortedmulti() output script descriptors. +Both functions take a threshold and one or more public keys and produce a multisig output script. +multi() specifies the public keys in the output script in the order given in the descriptor while sortedmulti() sorts the public keys lexicographically when the output script is produced. + +==Copyright== + +This BIP is licensed under the BSD 2-clause license. + +==Motivation== + +The most common complex script used in Bitcoin is a threshold multisig. +These expressions allow specifying multisig scripts as a descriptor. + +==Specification== + +Two new script expressions are defined: multi(), and sortedmulti(). +Both expressions produce the scripts of the same template and take the same arguments. +They are written as multi(k,KEY_1,KEY_2,...,KEY_n). +k is the threshold - the number of keys that must sign the input for the script to be valid. +KEY_1,KEY_2,...,KEY_n are the key expressions for the multisig. k must be less than or equal to n. + +multi() and sortedmulti() expressions can be used as a top level expression, or inside of either a sh() or wsh() descriptor. +Depending on the higher level descriptors, there may be restrictions on the type of public keys that can be included. + +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). +Otherwise the maximum number of keys is 20. + +The output script produced also depends on the value of k. If k is less than or equal to 16: +
+OP_k KEY_1 KEY_2 ... KEY_n OP_CHECKMULTISIG
+
+ +if k is greater than 16: +
+k KEY_1 KEY_2 ... KEY_n OP_CHECKMULTISIG
+
+ +===sortedmulti()=== + +The only change for sortedmulti() is that the keys are sorted lexicographically prior to the creation of the output script. +This sorting is on the keys that are to be put into the output script, i.e. after all extended keys are derived. + +===Multiple Extended Keys=== + +When one or more the key expressions in a multi() or sortedmulti() expression are extended keys, the derived keys use the same child index. +This changes the keys in lockstep and allows for output scripts to be indexed in the same way that the derived keys are indexed. + +==Test Vectors== + +TBD + +==Backwards Compatibility== + +multi(), and sortedmulti() descriptors use the format and general operation specified in [[bip-0380.mediawiki|380]]. +As these are a wholly new descriptors, they are not compatible with any implementation. +However the scripts produced are standard scripts so existing software are likely to be familiar with them. + +==Reference Implemntation== + +multi(), and multi() descriptors have been implemented in Bitcoin Core since version 0.17. -- cgit v1.2.3