Basic Structure
Descriptors consist of expressions with an optional checksum:CHECKSUM is an 8-character alphanumeric descriptor checksum that protects against typos.
SCRIPT Expressions
sh() - Pay-to-Script-Hash
sh() - Pay-to-Script-Hash
Usage: Nesting example:
sh(SCRIPT) (top level only)Creates a P2SH output that embeds the argument script.wsh() - Pay-to-Witness-Script-Hash
wsh() - Pay-to-Witness-Script-Hash
Usage:
wsh(SCRIPT) (top level or inside sh only)Creates a P2WSH output that embeds the argument script.pk() - Pay-to-Pubkey
pk() - Pay-to-Pubkey
Usage:
pk(KEY) (anywhere)Creates a P2PK output for the given public key.pkh() - Pay-to-Pubkey-Hash
pkh() - Pay-to-Pubkey-Hash
Usage:
pkh(KEY) (not inside tr)Creates a P2PKH output for the given public key.wpkh() - Pay-to-Witness-Pubkey-Hash
wpkh() - Pay-to-Witness-Pubkey-Hash
Usage:
wpkh(KEY) (top level or inside sh only)Creates a P2WPKH output for the given compressed pubkey.combo() - Legacy Compatibility
combo() - Legacy Compatibility
Usage:
combo(KEY) (top level only)Alias for pk(KEY) and pkh(KEY). If the key is compressed, also includes wpkh(KEY) and sh(wpkh(KEY)).multi() / sortedmulti() - Multisig
multi() / sortedmulti() - Multisig
Usage:
multi(k,KEY_1,KEY_2,...,KEY_n) (not inside tr)k-of-n multisig using OP_CHECKMULTISIG. Use sortedmulti for lexicographically sorted keys.multi_a() / sortedmulti_a() - Taproot Multisig
multi_a() / sortedmulti_a() - Taproot Multisig
Usage:
multi_a(k,KEY_1,KEY_2,...,KEY_N) (only inside tr)k-of-n multisig using OP_CHECKSIG, OP_CHECKSIGADD, and OP_NUMEQUAL for Taproot.tr() - Pay-to-Taproot
tr() - Pay-to-Taproot
Usage: With script paths:
tr(KEY) or tr(KEY,TREE) (top level only)P2TR output with the specified key as internal key, and optionally a tree of script paths.addr() - Address Reference
addr() - Address Reference
Usage:
addr(ADDR) (top level only)Expands to the script that the given address represents.raw() - Raw Script
raw() - Raw Script
Usage:
raw(HEX) (top level only)Uses the script whose hex encoding is HEX.KEY Expressions
KEY expressions can include optional key origin information and support multiple formats.Key Origin Information
Format:[fingerprint/path]KEY
[- Opening bracketd34db33f- 8 hex character fingerprint (first 32 bits of Hash160 of master pubkey)/44'/0'/0'- Derivation path (unhardened or hardened steps)]- Closing bracket
Supported Key Formats
Hex-Encoded Public Keys
Hex-Encoded Public Keys
Compressed: 66 characters starting with Uncompressed: 130 characters starting with Note: Only compressed keys are permitted inside
02 or 0304x-only (Taproot): 64 hex characters (inside tr and rawtr only)wpkh and wsh.WIF Private Keys
WIF Private Keys
WIF-encoded private keys can be specified instead of public keys.
Extended Keys (xpub/xprv)
Extended Keys (xpub/xprv)
BIP32 extended public or private keys with optional derivation paths.Basic xpub:With derivation path:With wildcard:Derivation path syntax:
/NUM- Unhardened derivation/NUM'or/NUM h- Hardened derivation/*- All unhardened children (default range: 0-1000)/*'or/*h- All hardened children
Multipath Descriptors
Specify receiving and change paths in a single descriptor using tuple notation:wpkh(xpub.../0/*)- Receiving addresseswpkh(xpub.../1/*)- Change addresses
TREE Expressions
For Taproot script trees insidetr():
Single script:
Checksums
Descriptors should include an 8-character checksum for error detection:- Detects up to 4 character substitution errors (descriptors ≤ 501 chars)
- Detects up to 3 errors in longer descriptors
- ~1 in trillion false negative rate for other error types
Address Types
Supported address formats foraddr() expressions:
- P2PKH:
1...(mainnet) or[nm]...(testnet) - P2SH:
3...(mainnet) or2...(testnet) - Segwit:
bc1...(mainnet) ortb1...(testnet) - bech32/bech32m format