From bd12ea7e9ddde4c7bd70bf3c4e13e98f941fcc4d Mon Sep 17 00:00:00 2001 From: Andrew Chow Date: Sun, 27 Jun 2021 18:49:37 -0400 Subject: Specify BIP 381: Non-segwit descriptors --- README.mediawiki | 7 +++++ bip-0380.mediawiki | 8 ++++++ bip-0381.mediawiki | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 98 insertions(+) create mode 100644 bip-0381.mediawiki diff --git a/README.mediawiki b/README.mediawiki index 8ca70a6..bfd297d 100644 --- a/README.mediawiki +++ b/README.mediawiki @@ -1057,6 +1057,13 @@ Those proposing changes should consider that ultimately consent may rest with th | Pieter Wuille, Andrew Chow | Informational | Draft +|- +| [[bip-0381.mediawiki|381]] +| Applications +| Non-Segwit Output Script Descriptors +| Pieter Wuille, Andrew Chow +| Informational +| Draft |} diff --git a/bip-0380.mediawiki b/bip-0380.mediawiki index 36ba824..f6472b8 100644 --- a/bip-0380.mediawiki +++ b/bip-0380.mediawiki @@ -238,4 +238,12 @@ This Table lists all available Script expressions and the BIPs specifying them. ! Expression ! BIP |- +| pk(KEY) +| [[bip-0381.mediawiki|381]] +|- +| pkh(KEY) +| [[bip-0381.mediawiki|381]] +|- +| sh(SCRIPT) +| [[bip-0381.mediawiki|381]] |} diff --git a/bip-0381.mediawiki b/bip-0381.mediawiki new file mode 100644 index 0000000..a5d624e --- /dev/null +++ b/bip-0381.mediawiki @@ -0,0 +1,83 @@ +
+  BIP: 381
+  Layer: Applications
+  Title: Non-Segwit Output Script Descriptors
+  Author: Pieter Wuille 
+          Andrew Chow 
+  Comments-Summary: No comments yet.
+  Comments-URI: https://github.com/bitcoin/bips/wiki/Comments:BIP-0381
+  Status: Draft
+  Type: Informational
+  Created: 2021-06-27
+  License: BSD-2-Clause
+
+ +==Abstract== + +This document specifies pk(), pkh(), and sh() output script descriptors. +pk() descriptors take a key and produces a P2PK output script. +pkh() descriptors take a key and produces a P2PKH output script. +sh() descriptors take a script and produces a P2SH output script. + +==Copyright== + +This BIP is licensed under the BSD 2-clause license. + +==Motivation== + +Prior to the activation of Segregated Witness, there were 3 main standard output script formats: P2PK, P2PKH, and P2SH. +These expressions allow specifying those formats as a descriptor. + +==Specification== + +Three new script expressions are defined: pk(), pkh(), and sh(). + +===pk()=== + +The pk(KEY) expression can be used in any context or level of a descriptor. +It takes a single key expression as an argument and produces a P2PK 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. + +The output script produced is: +
+ OP_CHECKSIG
+
+ +===pkh()=== + +The pkh(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 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. + +The output script produced is: +
+OP_DUP OP_HASH160  OP_EQUALVERIFY OP_CHECKSIG
+
+ +===sh()=== + +The sh(SCRIPT) expression can only be used as a top level expression. +It takes a single script expression as an argument and produces a P2SH output script. +sh() expressions also create a redeemScript 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 sh(). + +The output script produced is: +
+OP_HASH160  OP_EQUAL
+
+ +==Test Vectors== + +TBD + +==Backwards Compatibility== + +pk(), pkh(), and sh() 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== + +pk(), pkh(), and sh() descriptors have been implemented in Bitcoin Core since version 0.17. -- cgit v1.2.3