mirror of
https://github.com/bitcoin/bips.git
synced 2025-05-12 12:03:29 +00:00
Specify BIP 381: Non-segwit descriptors
This commit is contained in:
parent
71f435e76b
commit
bd12ea7e9d
@ -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
|
||||
|}
|
||||
|
||||
<!-- IMPORTANT! See the instructions at the top of this page, do NOT JUST add BIPs here! -->
|
||||
|
@ -238,4 +238,12 @@ This Table lists all available Script expressions and the BIPs specifying them.
|
||||
! Expression
|
||||
! BIP
|
||||
|-
|
||||
| <tt>pk(KEY)</tt>
|
||||
| [[bip-0381.mediawiki|381]]
|
||||
|-
|
||||
| <tt>pkh(KEY)</tt>
|
||||
| [[bip-0381.mediawiki|381]]
|
||||
|-
|
||||
| <tt>sh(SCRIPT)</tt>
|
||||
| [[bip-0381.mediawiki|381]]
|
||||
|}
|
||||
|
83
bip-0381.mediawiki
Normal file
83
bip-0381.mediawiki
Normal file
@ -0,0 +1,83 @@
|
||||
<pre>
|
||||
BIP: 381
|
||||
Layer: Applications
|
||||
Title: Non-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-0381
|
||||
Status: Draft
|
||||
Type: Informational
|
||||
Created: 2021-06-27
|
||||
License: BSD-2-Clause
|
||||
</pre>
|
||||
|
||||
==Abstract==
|
||||
|
||||
This document specifies <tt>pk()</tt>, <tt>pkh()</tt>, and <tt>sh()</tt> output script descriptors.
|
||||
<tt>pk()</tt> descriptors take a key and produces a P2PK output script.
|
||||
<tt>pkh()</tt> descriptors take a key and produces a P2PKH output script.
|
||||
<tt>sh()</tt> 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: <tt>pk()</tt>, <tt>pkh()</tt>, and <tt>sh()</tt>.
|
||||
|
||||
===<tt>pk()</tt>===
|
||||
|
||||
The <tt>pk(KEY)</tt> 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:
|
||||
<pre>
|
||||
<KEY> OP_CHECKSIG
|
||||
</pre>
|
||||
|
||||
===<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.
|
||||
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:
|
||||
<pre>
|
||||
OP_DUP OP_HASH160 <KEY_hash160> OP_EQUALVERIFY OP_CHECKSIG
|
||||
</pre>
|
||||
|
||||
===<tt>sh()</tt>===
|
||||
|
||||
The <tt>sh(SCRIPT)</tt> 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.
|
||||
<tt>sh()</tt> 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 <tt>SCRIPT</tt> argument to <tt>sh()</tt>.
|
||||
|
||||
The output script produced is:
|
||||
<pre>
|
||||
OP_HASH160 <SCRIPT_hash160> OP_EQUAL
|
||||
</pre>
|
||||
|
||||
==Test Vectors==
|
||||
|
||||
TBD
|
||||
|
||||
==Backwards Compatibility==
|
||||
|
||||
<tt>pk()</tt>, <tt>pkh()</tt>, and <tt>sh()</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>pk()</tt>, <tt>pkh()</tt>, and <tt>sh()</tt> descriptors have been implemented in Bitcoin Core since version 0.17.
|
Loading…
x
Reference in New Issue
Block a user