What is Nostr?
Anthony Towns [ARCHIVE] /
npub17rl…9l2h
2023-06-07 22:59:58
in reply to nevent1q…w8hh

Anthony Towns [ARCHIVE] on Nostr: 📅 Original date posted:2021-10-14 📝 Original message:On Sat, Oct 09, 2021 at ...

📅 Original date posted:2021-10-14
📝 Original message:On Sat, Oct 09, 2021 at 04:49:42PM +0000, Pieter Wuille via bitcoin-dev wrote:
> You can construct a taproot-capable wallet in Bitcoin Core as follows:
> * Have or create a descriptor wallet (createwallet RPC, with descriptors=true).
> * Import a taproot descriptor (of the form "tr(KEY)"), as active descriptor
> (with active=true), where KEY can be a tprv.../* or any other supported key
> expression.
> * Get a new address with addresstype=bech32m

Running master (which has PR#21500 merged), then the above can be
done with:

1. create a descriptor wallet

bitcoin-cli -signet -named createwallet wallet_name=descwallet descriptors=true load_on_startup=true

2. get the associated bip32 tprv private key

TPRV=$(bitcoin-cli -rpcwallet=descwallet -signet listdescriptors true | jq '.descriptors | .[].desc' | sed 's/^.*(//;s/[)/].*//' | uniq | head -n1)

(This step requires PR#21500 to extract the wallet's tprv; you'll need to
be running an updated version of bitcoin-cli here as well as bitcoind. You
could also generate the tprv some other way.)

3. construct the taproot descriptor per BIP 86

DESC="tr($TPRV/86'/1'/0'/0/*)"
CHK="$(bitcoin-cli -rpcwallet=descwallet -signet getdescriptorinfo "$DESC" | jq -r .checksum)"

4. import the descriptor

bitcoin-cli -rpcwallet=descwallet -signet importdescriptors "[{\"desc\": \"$DESC#$CHK\", \"active\": true, \"timestamp\": \"now\", \"range\": [0,1000], \"next_index\": 1}]"

5. get an address

bitcoin-cli -rpcwallet=descwallet -signet getnewaddress '' bech32m

You can then use the signet faucet to send a few million ssats to that
address directly.

Same stuff works with testnet, though I'm not sure if any testnet faucets
will accept bech32m addresses directly.

This is all a bit deliberately cumbersome prior to taproot activating on
mainnet; once that happens and PR#22364 is merged, you'll only need to
do steps (1) and (5).

Cheers,
aj
Author Public Key
npub17rld56k4365lfphyd8u8kwuejey5xcazdxptserx03wc4jc9g24stx9l2h