From fb56a18c890af8b269987b2e6664765ffc05a5c1 Mon Sep 17 00:00:00 2001 From: Andrew Chow Date: Sun, 27 Jun 2021 19:35:45 -0400 Subject: Specify BIP 382: Segwit descriptors --- README.mediawiki | 7 ++++++ bip-0380.mediawiki | 6 +++++ bip-0381.mediawiki | 2 +- bip-0382.mediawiki | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 bip-0382.mediawiki diff --git a/README.mediawiki b/README.mediawiki index bfd297d..1d8164a 100644 --- a/README.mediawiki +++ b/README.mediawiki @@ -1064,6 +1064,13 @@ Those proposing changes should consider that ultimately consent may rest with th | Pieter Wuille, Andrew Chow | Informational | Draft +|- +| [[bip-0382.mediawiki|382]] +| Applications +| Segwit Output Script Descriptors +| Pieter Wuille, Andrew Chow +| Informational +| Draft |} diff --git a/bip-0380.mediawiki b/bip-0380.mediawiki index f6472b8..e48afe0 100644 --- a/bip-0380.mediawiki +++ b/bip-0380.mediawiki @@ -246,4 +246,10 @@ This Table lists all available Script expressions and the BIPs specifying them. |- | sh(SCRIPT) | [[bip-0381.mediawiki|381]] +|- +| wpkh(KEY) +| [[bip-0382.mediawiki|382]] +|- +| wsh(SCRIPT) +| [[bip-0382.mediawiki|382]] |} diff --git a/bip-0381.mediawiki b/bip-0381.mediawiki index a5d624e..8d7e391 100644 --- a/bip-0381.mediawiki +++ b/bip-0381.mediawiki @@ -46,7 +46,7 @@ The output script produced is: ===pkh()=== -The pkh(KEY) expression can be used as a top level expression, or inside of a sh() descriptor. +The pkh(KEY) expression can be used as a top level expression, or inside of either a sh() or wsh() descriptor. It takes a single key expression as an argument and produces a P2PKH output script. Depending on the higher level descriptors, there may be restrictions on the type of public keys that can be included. Such restrictions will be specified by those descriptors. diff --git a/bip-0382.mediawiki b/bip-0382.mediawiki new file mode 100644 index 0000000..0508d2b --- /dev/null +++ b/bip-0382.mediawiki @@ -0,0 +1,70 @@ +
+  BIP: 382
+  Layer: Applications
+  Title: Segwit Output Script Descriptors
+  Author: Pieter Wuille 
+          Andrew Chow 
+  Comments-Summary: No comments yet.
+  Comments-URI: https://github.com/bitcoin/bips/wiki/Comments:BIP-0382
+  Status: Draft
+  Type: Informational
+  Created: 2021-06-27
+  License: BSD-2-Clause
+
+ +==Abstract== + +This document specifies wpkh(), and wsh() output script descriptors. +wpkh() descriptors take a key and produces a P2WPKH output script. +wsh() descriptors take a script and produces a P2WSH output script. + +==Copyright== + +This BIP is licensed under the BSD 2-clause license. + +==Motivation== + +Segregated Witness added 2 additional standard output script formats: P2WPKH and P2WSH. +These expressions allow specifying those formats as a descriptor. + +==Specification== + +Two new script expressions are defined: wpkh(), and wsh(). + +===wpkh()=== + +The wpkh(KEY) expression can be used as a top level expression, or inside of a sh() descriptor. +It takes a single key expression as an argument and produces a P2WPKH output script. +Only keys which are/has compressed public keys can be contained in a wpkh() expression. + +The output script produced is: +
+OP_0 
+
+ +===wsh()=== + +The wsh(SCRIPT) expression can be used as a top level expression, or inside of a sh() descriptor. +It takes a single script expression as an argument and produces a P2WSH output script. +wsh() expressions also create a witnessScript which is required in order to spend outputs which use its output script. +This redeemScript is the output script produced by the SCRIPT argument to wsh(). +Any key expression found in any script expression contained by a wsh() expression must only produce compressed public keys. + +The output script produced is: +
+OP_0 
+
+ +==Test Vectors== + +TBD + +==Backwards Compatibility== + +wpkh(), and wsh() 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== + +wpkh(), and wsh() descriptors have been implemented in Bitcoin Core since version 0.17. -- cgit v1.2.3