mirror of
https://github.com/bitcoin/bips.git
synced 2025-05-12 12:03:29 +00:00
Specify BIP 382: Segwit descriptors
This commit is contained in:
parent
bd12ea7e9d
commit
fb56a18c89
@ -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
|
||||
|}
|
||||
|
||||
<!-- IMPORTANT! See the instructions at the top of this page, do NOT JUST add BIPs here! -->
|
||||
|
@ -246,4 +246,10 @@ This Table lists all available Script expressions and the BIPs specifying them.
|
||||
|-
|
||||
| <tt>sh(SCRIPT)</tt>
|
||||
| [[bip-0381.mediawiki|381]]
|
||||
|-
|
||||
| <tt>wpkh(KEY)</tt>
|
||||
| [[bip-0382.mediawiki|382]]
|
||||
|-
|
||||
| <tt>wsh(SCRIPT)</tt>
|
||||
| [[bip-0382.mediawiki|382]]
|
||||
|}
|
||||
|
@ -46,7 +46,7 @@ The output script produced is:
|
||||
|
||||
===<tt>pkh()</tt>===
|
||||
|
||||
The <tt>pkh(KEY)</tt> expression can be used as a top level expression, or inside of a <tt>sh()</tt> descriptor.
|
||||
The <tt>pkh(KEY)</tt> expression can be used as a top level expression, or inside of either a <tt>sh()</tt> or <tt>wsh()</tt> 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.
|
||||
|
70
bip-0382.mediawiki
Normal file
70
bip-0382.mediawiki
Normal file
@ -0,0 +1,70 @@
|
||||
<pre>
|
||||
BIP: 382
|
||||
Layer: Applications
|
||||
Title: Segwit Output Script Descriptors
|
||||
Author: Pieter Wuille <pieter@wuille.net>
|
||||
Andrew Chow <andrew@achow101.com>
|
||||
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
|
||||
</pre>
|
||||
|
||||
==Abstract==
|
||||
|
||||
This document specifies <tt>wpkh()</tt>, and <tt>wsh()</tt> output script descriptors.
|
||||
<tt>wpkh()</tt> descriptors take a key and produces a P2WPKH output script.
|
||||
<tt>wsh()</tt> 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: <tt>wpkh()</tt>, and <tt>wsh()</tt>.
|
||||
|
||||
===<tt>wpkh()</tt>===
|
||||
|
||||
The <tt>wpkh(KEY)</tt> expression can be used as a top level expression, or inside of a <tt>sh()</tt> 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 <tt>wpkh()</tt> expression.
|
||||
|
||||
The output script produced is:
|
||||
<pre>
|
||||
OP_0 <KEY_hash160>
|
||||
</pre>
|
||||
|
||||
===<tt>wsh()</tt>===
|
||||
|
||||
The <tt>wsh(SCRIPT)</tt> expression can be used as a top level expression, or inside of a <tt>sh()</tt> descriptor.
|
||||
It takes a single script expression as an argument and produces a P2WSH output script.
|
||||
<tt>wsh()</tt> 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 <tt>SCRIPT</tt> argument to <tt>wsh()</tt>.
|
||||
Any key expression found in any script expression contained by a <tt>wsh()</tt> expression must only produce compressed public keys.
|
||||
|
||||
The output script produced is:
|
||||
<pre>
|
||||
OP_0 <SCRIPT_sha256>
|
||||
</pre>
|
||||
|
||||
==Test Vectors==
|
||||
|
||||
TBD
|
||||
|
||||
==Backwards Compatibility==
|
||||
|
||||
<tt>wpkh()</tt>, and <tt>wsh()</tt> 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==
|
||||
|
||||
<tt>wpkh()</tt>, and <tt>wsh()</tt> descriptors have been implemented in Bitcoin Core since version 0.17.
|
Loading…
x
Reference in New Issue
Block a user