Introduces a non-backwards compatible wallet type which contains a set of output descriptors.
A new RPC method importdescriptor
works like importmulti
but for one descriptor at a time and with fewer options.
Each wallet descriptor has a purpose
: current receive, current change, archive (receive & change)
The current receive and change purposes can have one descriptor with address type bech32 and one with address type base58. It builds on top of #15590 for that.
getnewaddress
finds correct receive descriptor based on address type, which must be either bech32
or legacy
(base58).
Usage:
0bitcoin-cli createwallet true true true
1bitcoin-cli importdescriptor "wpkh([00000000/84h/1h/0h]tpub.../1/*)#...."
2bitcoin-cli importdescriptor "wpkh([00000000/84h/1h/0h]tpub.../1/*)#..." '{"internal": true}, "timestamp": "now"}'
3bitcoin-cli getnewaddress "SegWit"
4bitcoin-cli importdescriptor "sh(wpkh([00000000/49h/1h/0h]tpub.../1/*))#...."
5bitcoin-cli getnewaddress "Pre SegWit" legacy
6bitcoin-cli dumpwallet "dump" # only way to see the descriptors at the moment
This initial version will have several limitations (ignoring the TODO list below). It paves the way towards usage with hardware wallets in #14912.
- only available through
createwallet
followed byimportdescriptor
- no upgrade path yet
- no private keys allowed
- doesn’t serialise descriptor cache
TODO:
- fix methods that deal with labels
- fix signmessage
- fix getrawchangeaddress
- improve getwalletinfo
- decide on descriptor serialization (currently stores a string)
For followup PR:
- (re)scan wallet transactions matching descriptor
- transaction creation (e.g. get change address from change descriptor)
- private key support
- multisig support