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

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

Copy XPUB from test vectors mentioned in BIP 86

xpub6BgBgsespWvERF3LHQu6CnqdvfEvtMcQjYrcRzx53QJjSxarj2afYWcLteoGVky7D3UKDP9QyrLprQ3VCECoY49yfdDEHGCtMMj92pReUsQ


Convert XPUB (mainnet) to TPUB (testnet) using Bitcoin Extended Public Key Converter

tpubDC3pD7UZXnsgh3EBjbtBQiB1FnLask7UHBSunZ1DPK4dCFFZoFRkgxHB8gt42FvLzx1DpxfHWxAsYaY6b643RVcGjDxXxns7wKKYnnfEcbB


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


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": [
      0,
      999
    ],
    "next": 0
  }
]

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

Import this descriptor in wallet we created in step 3:

bitcoin-cli -rpcwallet=taproot_wallet importdescriptors "$(cat descriptor.txt)"


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"

tb1p5cyxnuxmeuwuvkwfem96lqzszd02n6xdcjrs20cac6yqjjwudpxqp3mvzv


Send some bitcoin from another wallet:

https://blockstream.info/testnet/tx/2035ead4a9d0c8e2da1184924abc9034d26f2a7093371183ef12891623b235d1
I had compiled bitcoind with branch used by Sjors Provoost in PR #2260

109222: <p>Can you give a simple step-by-step example for a taproot transaction with bitcoin-cli on Testnet?</p>
 -1: <p>Steps that I followed to do a transaction which creates a P2TR output:</p>
<ol>
<li>Copy XPUB from test vectors mentioned in <a href="https://github.com/bitcoin/bips/blob/master/bip-0086.mediawiki" rel="nofollow noreferrer">BIP 86</a></li>
</ol>
<pre><code>xpub6BgBgsespWvERF3LHQu6CnqdvfEvtMcQjYrcRzx53QJjSxarj2afYWcLteoGVky7D3UKDP9QyrLprQ3VCECoY49yfdDEHGCtMMj92pReUsQ
</code></pre>
<ol start="2">
<li>Convert XPUB (mainnet) to TPUB (testnet) using <a href="https://jlopp.github.io/xpub-converter/" rel="nofollow noreferrer">Bitcoin Extended Public Key Converter</a></li>
</ol>
<pre><code>tpubDC3pD7UZXnsgh3EBjbtBQiB1FnLask7UHBSunZ1DPK4dCFFZoFRkgxHB8gt42FvLzx1DpxfHWxAsYaY6b643RVcGjDxXxns7wKKYnnfEcbB
</code></pre>
<ol start="3">
<li>Create a blank descriptor wallet with private keys disabled:</li>
</ol>
<pre><code>bitcoin-cli -named createwallet wallet_name=taproot_wallet blank=true disable_private_keys=true descriptors=true
</code></pre>
<ol start="4">
<li>Save the descriptor info in a text file for TPUB we got from step 2 (descriptor.txt):</li>
</ol>
<pre><code>[
  {
    &quot;desc&quot;: &quot;tr([8868ab13/86'/1'/0']tpubDC3pD7UZXnsgh3EBjbtBQiB1FnLask7UHBSunZ1DPK4dCFFZoFRkgxHB8gt42FvLzx1DpxfHWxAsYaY6b643RVcGjDxXxns7wKKYnnfEcbB/0/*)#06sjusfa&quot;,
    &quot;timestamp&quot;: &quot;now&quot;,
    &quot;active&quot;: true,
    &quot;internal&quot;: false,
    &quot;range&quot;: [
      0,
      999
    ],
    &quot;next&quot;: 0
  }
]
</code></pre>
<p>I have copied this format from <code>listdescriptors</code> output for a new descriptor wallet that had private keys enabled.</p>
<ol start="5">
<li>Import this descriptor in wallet we created in step 3:</li>
</ol>
<pre><code>bitcoin-cli -rpcwallet=taproot_wallet importdescriptors &quot;$(cat descriptor.txt)&quot;
</code></pre>
<ol start="6">
<li>This is a watch only wallet with a taproot descriptor TPUB that can be used to create new bech32m address:</li>
</ol>
<pre><code>bitcoin-cli -rpcwallet=taproot_wallet getnewaddress &quot;&quot; &quot;bech32m&quot;
</code></pre>
<pre><code>tb1p5cyxnuxmeuwuvkwfem96lqzszd02n6xdcjrs20cac6yqjjwudpxqp3mvzv
</code></pre>
<ol start="7">
<li>Send some bitcoin from another wallet:</li>
</ol>
<p><a href="https://blockstream.info/testnet/tx/2035ead4a9d0c8e2da1184924abc9034d26f2a7093371183ef12891623b235d1" rel="nofollow noreferrer">https://blockstream.info/testnet/tx/2035ead4a9d0c8e2da1184924abc9034d26f2a7093371183ef12891623b235d1</a></p>
<p>I had compiled bitcoind with branch used by Sjors Provoost in <a href="https://github.com/bitcoin/bitcoin/pull/22260" rel="nofollow noreferrer">PR #2260</a></p>
