Skip to content

Commit d7fbe7d

Browse files
committed
Merge #14778: A few minor formatting fixes and clarifications to descriptors.md
8284756 A few minor formatting fixes and clarifications to descriptors.md (John Newbery) Pull request description: Fixes some markdown formatting issues, and also adds a few clarifications. Tree-SHA512: b12fc94035c075a990756e22fb60b95e6c851c80c8a60fc8fc46b07c6749df4d257401889be4d930996432ac08850770077e667fe48473140f38b94c8e9eacdc
2 parents 3dda4c5 + 8284756 commit d7fbe7d

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

doc/descriptors.md

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -59,19 +59,20 @@ Descriptors consist of several types of expressions. The top level expression is
5959
- Followed by zero or more `/NUM` or `/NUM'` path elements to indicate unhardened or hardened derivation steps between the fingerprint and the key or xpub/xprv root that follows
6060
- A closing bracket `]`
6161
- Followed by the actual key, which is either:
62-
- Hex encoded public keys (66 characters starting with `02` or `03`, or 130 characters starting with `04`).
62+
- Hex encoded public keys (either 66 characters starting with `02` or `03` for a compressed pubkey, or 130 characters starting with `04` for an uncompressed pubkey).
6363
- Inside `wpkh` and `wsh`, only compressed public keys are permitted.
6464
- [WIF](https://en.bitcoin.it/wiki/Wallet_import_format) encoded private keys may be specified instead of the corresponding public key, with the same meaning.
65-
-`xpub` encoded extended public key or `xprv` encoded private key (as defined in [BIP 32](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki)).
65+
- `xpub` encoded extended public key or `xprv` encoded extended private key (as defined in [BIP 32](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki)).
6666
- Followed by zero or more `/NUM` unhardened and `/NUM'` hardened BIP32 derivation steps.
6767
- Optionally followed by a single `/*` or `/*'` final step to denote all (direct) unhardened or hardened children.
6868
- The usage of hardened derivation steps requires providing the private key.
69-
- Anywhere a `'` suffix is permitted to denote hardened derivation, the suffix `h` can be used instead.
69+
70+
(Anywhere a `'` suffix is permitted to denote hardened derivation, the suffix `h` can be used instead.)
7071

7172
`ADDR` expressions are any type of supported address:
72-
- P2PKH addresses (base58, of the form `1...`). Note that P2PKH addresses in descriptors cannot be used for P2PK outputs (use the `pk` function instead).
73-
- P2SH addresses (base58, of the form `3...`, defined in [BIP 13](https://github.com/bitcoin/bips/blob/master/bip-0013.mediawiki)).
74-
- Segwit addresses (bech32, of the form `bc1...`, defined in [BIP 173](https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki)).
73+
- P2PKH addresses (base58, of the form `1...` for mainnet or `[nm]...` for testnet). Note that P2PKH addresses in descriptors cannot be used for P2PK outputs (use the `pk` function instead).
74+
- P2SH addresses (base58, of the form `3...` for mainnet or `2...` for testnet, defined in [BIP 13](https://github.com/bitcoin/bips/blob/master/bip-0013.mediawiki)).
75+
- Segwit addresses (bech32, of the form `bc1...` for mainnet or `tb1...` for testnet, defined in [BIP 173](https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki)).
7576

7677
## Explanation
7778

@@ -83,10 +84,9 @@ imaginable, though they may not be optimal: P2SH-P2PK, P2SH-P2PKH,
8384
P2WSH-P2PK, P2WSH-P2PKH, P2SH-P2WSH-P2PK, P2SH-P2WSH-P2PKH.
8485

8586
To describe these, we model these as functions. The functions `pk`
86-
(P2PK), `pkh` (P2PKH) and `wpkh` (P2WPKH) take as input a public key in
87-
hexadecimal notation (which will be extended later), and return the
87+
(P2PK), `pkh` (P2PKH) and `wpkh` (P2WPKH) take as input a `KEY` expression, and return the
8888
corresponding *scriptPubKey*. The functions `sh` (P2SH) and `wsh` (P2WSH)
89-
take as input a script, and return the script describing P2SH and P2WSH
89+
take as input a `SCRIPT` expression, and return the script describing P2SH and P2WSH
9090
outputs with the input as embedded script. The names of the functions do
9191
not contain "p2" for brevity.
9292

@@ -95,7 +95,7 @@ not contain "p2" for brevity.
9595
Several pieces of software use multi-signature (multisig) scripts based
9696
on Bitcoin's OP_CHECKMULTISIG opcode. To support these, we introduce the
9797
`multi(k,key_1,key_2,...,key_n)` function. It represents a *k-of-n*
98-
multisig policy, where any *k* out of the *n* provided public keys must
98+
multisig policy, where any *k* out of the *n* provided `KEY` expressions must
9999
sign.
100100

101101
Key order is significant. A `multi()` expression describes a multisig script
@@ -138,7 +138,7 @@ Instead, it should be written as `xpub.../1/*`, where xpub corresponds to
138138
`m/44'/0'/0'`.
139139

140140
When interacting with a hardware device, it may be necessary to include
141-
the entire path from the master down. BIP174 standardizes this by
141+
the entire path from the master down. [BIP174](https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki) standardizes this by
142142
providing the master key *fingerprint* (first 32 bit of the Hash160 of
143143
the master pubkey), plus all derivation steps. To support constructing
144144
these, we permit providing this key origin information inside the
@@ -150,6 +150,10 @@ fingerprint plus optional derivation steps (hardened and unhardened)
150150
surrounded by brackets, identifying the master and derivation path the key or xpub
151151
that follows was derived with.
152152

153+
Note that the fingerprint of the parent only serves as a fast way to detect
154+
parent and child nodes in software, and software must be willing to deal with
155+
collisions.
156+
153157
### Including private keys
154158

155159
Often it is useful to communicate a description of scripts along with the

0 commit comments

Comments
 (0)