Changeset View
Changeset View
Standalone View
Standalone View
doc/descriptors.md
Show All 25 Lines | |||||
- `multi(1,022f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4,025cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc)` represents a bare *1-of-2* multisig. | - `multi(1,022f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4,025cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc)` represents a bare *1-of-2* multisig. | ||||
- `sh(multi(2,022f01e5e15cca351daff3843fb70f3c2f0a1bdd05e5af888a67784ef3e10a2a01,03acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe))` represents a P2SH *2-of-2* multisig. | - `sh(multi(2,022f01e5e15cca351daff3843fb70f3c2f0a1bdd05e5af888a67784ef3e10a2a01,03acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe))` represents a P2SH *2-of-2* multisig. | ||||
- `pk(xpub661MyMwAqRbcFtXgS5sYJABqqG9YLmC4Q1Rdap9gSE8NqtwybGhePY2gZ29ESFjqJoCu1Rupje8YtGqsefD265TMg7usUDFdp6W1EGMcet8)` refers to a single P2PK output, using the public key part from the specified xpub. | - `pk(xpub661MyMwAqRbcFtXgS5sYJABqqG9YLmC4Q1Rdap9gSE8NqtwybGhePY2gZ29ESFjqJoCu1Rupje8YtGqsefD265TMg7usUDFdp6W1EGMcet8)` refers to a single P2PK output, using the public key part from the specified xpub. | ||||
- `pkh(xpub68Gmy5EdvgibQVfPdqkBBCHxA5htiqg55crXYuXoQRKfDBFA1WEjWgP6LHhwBZeNK1VTsfTFUHCdrfp1bgwQ9xv5ski8PX9rL2dZXvgGDnw/1'/2)` refers to a single P2PKH output, using child key *1'/2* of the specified xpub. | - `pkh(xpub68Gmy5EdvgibQVfPdqkBBCHxA5htiqg55crXYuXoQRKfDBFA1WEjWgP6LHhwBZeNK1VTsfTFUHCdrfp1bgwQ9xv5ski8PX9rL2dZXvgGDnw/1'/2)` refers to a single P2PKH output, using child key *1'/2* of the specified xpub. | ||||
- `pkh([d34db33f/44'/0'/0']xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL/1/*)` describes a set of P2PKH outputs, but additionally specifies that the specified xpub is a child of a master with fingerprint `d34db33f`, and derived using path `44'/0'/0'`. | - `pkh([d34db33f/44'/0'/0']xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL/1/*)` describes a set of P2PKH outputs, but additionally specifies that the specified xpub is a child of a master with fingerprint `d34db33f`, and derived using path `44'/0'/0'`. | ||||
## Reference | ## Reference | ||||
Descriptors consist of several types of expressions. The top level expression is always a `SCRIPT`. | Descriptors consist of several types of expressions. The top level expression is either a `SCRIPT`, or `SCRIPT#CHECKSUM` where `CHECKSUM` is an 8-character alphanumeric descriptor checksum. | ||||
`SCRIPT` expressions: | `SCRIPT` expressions: | ||||
- `sh(SCRIPT)` (top level only): P2SH embed the argument. | - `sh(SCRIPT)` (top level only): P2SH embed the argument. | ||||
- `pk(KEY)` (anywhere): P2PK output for the given public key. | - `pk(KEY)` (anywhere): P2PK output for the given public key. | ||||
- `pkh(KEY)` (anywhere): P2PKH output for the given public key (use `addr` if you only know the pubkey hash). | - `pkh(KEY)` (anywhere): P2PKH output for the given public key (use `addr` if you only know the pubkey hash). | ||||
- `combo(KEY)` (top level only): an alias for the collection of `pk(KEY)` and `pkh(KEY)`. | - `combo(KEY)` (top level only): an alias for the collection of `pk(KEY)` and `pkh(KEY)`. | ||||
- `multi(k,KEY_1,KEY_2,...,KEY_n)` (anywhere): k-of-n multisig script. | - `multi(k,KEY_1,KEY_2,...,KEY_n)` (anywhere): k-of-n multisig script. | ||||
- `addr(ADDR)` (top level only): the script which ADDR expands to. | - `addr(ADDR)` (top level only): the script which ADDR expands to. | ||||
▲ Show 20 Lines • Show All 93 Lines • ▼ Show 20 Lines | |||||
steps, or for dumping wallet descriptors including private key material. | steps, or for dumping wallet descriptors including private key material. | ||||
### Compatibility with old wallets | ### Compatibility with old wallets | ||||
In order to easily represent the sets of scripts currently supported by | In order to easily represent the sets of scripts currently supported by | ||||
existing Bitcoin ABC wallets, a convenience function `combo` is provided, | existing Bitcoin ABC wallets, a convenience function `combo` is provided, | ||||
which takes as input a public key, and constructs the P2PK and P2PKH | which takes as input a public key, and constructs the P2PK and P2PKH | ||||
scripts for that key. | scripts for that key. | ||||
### Checksums | |||||
Descriptors can optionally be suffixed with a checksum to protect against | |||||
typos or copy-paste errors. | |||||
These checksums consist of 8 alphanumeric characters. As long as errors are | |||||
restricted to substituting characters in `0123456789()[],'/*abcdefgh@:$%{}` | |||||
for others in that set and changes in letter case, up to 4 errors will always | |||||
be detected in descriptors up to 501 characters, and up to 3 errors in longer | |||||
ones. For larger numbers of errors, or other types of errors, there is a | |||||
roughly 1 in a trillion chance of not detecting the errors. | |||||
All RPCs in Bitcoin ABC will include the checksum in their output. Only | |||||
certain RPCs require checksums on input, including `deriveaddress` and | |||||
`importmulti`. The checksum for a descriptor without one can be computed | |||||
using the `getdescriptorinfo` RPC. |