Can you give a simple step-by-step example for a taproot transaction with bitcoin-cli on Testnet?


1 Answer 1


Steps that I followed to do a transaction which creates a P2TR output:

  1. Copy XPUB from test vectors mentioned in BIP 86
  1. Convert XPUB (mainnet) to TPUB (testnet) using Bitcoin Extended Public Key Converter
  1. Create a blank descriptor wallet with private keys disabled:
bitcoin-cli -named createwallet wallet_name=taproot_wallet blank=true disable_private_keys=true descriptors=true
  1. Save the descriptor info in a text file for TPUB we got from step 2 (descriptor.txt):
    "desc": "tr([8868ab13/86'/1'/0']tpubDC3pD7UZXnsgh3EBjbtBQiB1FnLask7UHBSunZ1DPK4dCFFZoFRkgxHB8gt42FvLzx1DpxfHWxAsYaY6b643RVcGjDxXxns7wKKYnnfEcbB/0/*)#06sjusfa",
    "timestamp": "now",
    "active": true,
    "internal": false,
    "range": [
    "next": 0

I have copied this format from listdescriptors output for a new descriptor wallet that had private keys enabled.

  1. Import this descriptor in wallet we created in step 3:
bitcoin-cli -rpcwallet=taproot_wallet importdescriptors "$(cat descriptor.txt)"
  1. This is a watch only wallet with a taproot descriptor TPUB that can be used to create new bech32m address:
bitcoin-cli -rpcwallet=taproot_wallet getnewaddress "" "bech32m"
  1. Send some bitcoin from another wallet:


I had compiled bitcoind with branch used by Sjors Provoost in PR #2260

  • But how do you spend from that taproot output? I guess you have to do the same steps while using a privKey instead of a xPub, right?
    – RobinLinus
    Aug 11, 2021 at 14:19
  • Yes use XPRV for mainnet and TPRV for testnet. Test vectors in BIP 86 had no TPRV so I had to follow the steps mentioned in this answer.
    – user103136
    Aug 11, 2021 at 14:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.