<p>The witness stack of the first input only has one item, even though it's spending a P2WPKH output which requires two items. Since the item is 64 bytes long, I'd presume it's a Schnorr signature and you meant to spend a P2TR output instead.</p>

CC BY-SA 4.0
2024-08-09T20:45:54.417Z
I fixed it. but right now its giving me invalid schnorr signatue
Vinay Sawant
CC BY-SA 4.0
2024-08-03T16:12:38.027Z
2024-08-03T16:12:38.027Z
Vojtěch Strnad
<p>I am trying to send a transaction on my Bitcoin regtest node, but I keep encountering the following error:</p>
<pre><code>Status Err(&quot;RPC error: Object {\&quot;code\&quot;: Number(-26), \&quot;message\&quot;: String(\&quot;non-mandatory-script-verify-flag (Witness program hash mismatch)\&quot;)}&quot;)
</code></pre>
<p>Here is the transaction in hex format:</p>
<pre><code>01000000000102a2ffd68c47fb375a78e8e5a8c62a8a2bb978cebee138c01d7af081d0841d0140000000000001000000e1f85331fdecdcb29d3a43d6e63c447e37747e761b66030d69b9325fc48ff68c00000000000100000004a68601000000000022512036d5748a7817424eca90e0d5a9f41cc2a0c843528872ba9d05a20eabd09c4065ae5b01000000000024512251207062783e946190c8d1043a2491633cfb20ac91f06869514471bf98fe0245f34310270000000000002251204238ecdae980e5ce65c70d50043d58ef8014bb2ef7adf9bfa43ddadc33d493ad0000000000000000096a5d06008b0101630100024730440220448546af85c40d4be09872013ef1a8cfeb9516cd39cf0bc22be28e61eb666350022018f5be97709b5b980aa5ce81f8a27e45621444d6385c6548209912bc48b48d9701210301cc8e443c2c8bfc286f01d203c325b4088ecc1106cd7421321a720253fc91ad0c000000
</code></pre>
<p>My RPC URL is:</p>
<pre><code>http://localhost:18443
</code></pre>
<p>Below is the decoded transaction:</p>
<pre class="lang-json prettyprint-override"><code>{
    &quot;txid&quot;: &quot;e7b3866f253f2464b39893f3f74f8a7aabf810dd33444685fac0e64be6b7e89f&quot;,
    &quot;hash&quot;: &quot;099fb30f2ad1ae01ec974047b9a7c387c3b86bd8efc4d227e93f28ddd57bdb74&quot;,
    &quot;version&quot;: 1,
    &quot;size&quot;: 351,
    &quot;vsize&quot;: 269,
    &quot;weight&quot;: 1074,
    &quot;locktime&quot;: 12,
    &quot;vin&quot;: [
        {
            &quot;txid&quot;: &quot;40011d84d081f07a1dc038e1bece78b92b8a2ac6a8e5e8785a37fb478cd6ffa2&quot;,
            &quot;vout&quot;: 0,
            &quot;scriptSig&quot;: {
                &quot;asm&quot;: &quot;&quot;,
                &quot;hex&quot;: &quot;&quot;
            },
            &quot;sequence&quot;: 1
        },
        {
            &quot;txid&quot;: &quot;8cf68fc45f32b9690d03661b767e74377e443ce6d6433a9db2dcecfd3153f8e1&quot;,
            &quot;vout&quot;: 0,
            &quot;scriptSig&quot;: {
                &quot;asm&quot;: &quot;&quot;,
                &quot;hex&quot;: &quot;&quot;
            },
            &quot;txinwitness&quot;: [
                &quot;30440220448546af85c40d4be09872013ef1a8cfeb9516cd39cf0bc22be28e61eb666350022018f5be97709b5b980aa5ce81f8a27e45621444d6385c6548209912bc48b48d9701&quot;,
                &quot;0301cc8e443c2c8bfc286f01d203c325b4088ecc1106cd7421321a720253fc91ad&quot;
            ],
            &quot;sequence&quot;: 1
        }
    ],
    &quot;vout&quot;: [
        {
            &quot;value&quot;: 0.00100006,
            &quot;n&quot;: 0,
            &quot;scriptPubKey&quot;: {
                &quot;asm&quot;: &quot;1 36d5748a7817424eca90e0d5a9f41cc2a0c843528872ba9d05a20eabd09c4065&quot;,
                &quot;desc&quot;: &quot;rawtr(36d5748a7817424eca90e0d5a9f41cc2a0c843528872ba9d05a20eabd09c4065)#gp0fk5kf&quot;,
                &quot;hex&quot;: &quot;512036d5748a7817424eca90e0d5a9f41cc2a0c843528872ba9d05a20eabd09c4065&quot;,
                &quot;address&quot;: &quot;bc1pxm2hfznczapyaj5sur26naquc2svss6j3pet48g95g82h5yugpjs25muxj&quot;,
                &quot;type&quot;: &quot;witness_v1_taproot&quot;
            }
        },
        {
            &quot;value&quot;: 0.00089006,
            &quot;n&quot;: 1,
            &quot;scriptPubKey&quot;: {
                &quot;asm&quot;: &quot;1 51207062783e946190c8d1043a2491633cfb20ac91f06869514471bf98fe0245f343&quot;,
                &quot;desc&quot;: &quot;addr(bc1p2ys8qcnc862xryxg6yzr5fy3vv70kg9vj8cxs623g3cmlx87qfzlxsc3cylxd)#sp4wxhtc&quot;,
                &quot;hex&quot;: &quot;512251207062783e946190c8d1043a2491633cfb20ac91f06869514471bf98fe0245f343&quot;,
                &quot;address&quot;: &quot;bc1p2ys8qcnc862xryxg6yzr5fy3vv70kg9vj8cxs623g3cmlx87qfzlxsc3cylxd&quot;,
                &quot;type&quot;: &quot;witness_unknown&quot;
            }
        },
        {
            &quot;value&quot;: 0.0001,
            &quot;n&quot;: 2,
            &quot;scriptPubKey&quot;: {
                &quot;asm&quot;: &quot;1 4238ecdae980e5ce65c70d50043d58ef8014bb2ef7adf9bfa43ddadc33d493ad&quot;,
                &quot;desc&quot;: &quot;rawtr(4238ecdae980e5ce65c70d50043d58ef8014bb2ef7adf9bfa43ddadc33d493ad)#2x7uc7k6&quot;,
                &quot;hex&quot;: &quot;51204238ecdae980e5ce65c70d50043d58ef8014bb2ef7adf9bfa43ddadc33d493ad&quot;,
                &quot;address&quot;: &quot;bc1pgguwekhfsrjuuew8p4gqg02ca7qpfwew77kln0ay8hddcv75jwksufvfww&quot;,
                &quot;type&quot;: &quot;witness_v1_taproot&quot;
            }
        },
        {
            &quot;value&quot;: 0,
            &quot;n&quot;: 3,
            &quot;scriptPubKey&quot;: {
                &quot;asm&quot;: &quot;OP_RETURN 13 008b01016301&quot;,
                &quot;desc&quot;: &quot;raw(6a5d06008b01016301)#53e7sytq&quot;,
                &quot;hex&quot;: &quot;6a5d06008b01016301&quot;,
                &quot;type&quot;: &quot;nulldata&quot;
            }
        }
    ]
}
</code></pre>
<p>Also, here is the detailed hex for the signed transaction:</p>
<pre><code>01000000000102a2ffd68c47fb375a78e8e5a8c62a8a2bb978cebee138c01d7af081d0841d0140000000000001000000e1f85331fdecdcb29d3a43d6e63c447e37747e761b66030d69b9325fc48ff68c00000000000100000004a68601000000000022512036d5748a7817424eca90e0d5a9f41cc2a0c843528872ba9d05a20eabd09c4065ae5b01000000000024512251207062783e946190c8d1043a2491633cfb20ac91f06869514471bf98fe0245f34310270000000000002251204238ecdae980e5ce65c70d50043d58ef8014bb2ef7adf9bfa43ddadc33d493ad0000000000000000096a5d06008b01016301014020ef582e42d51c0879f5ef445272107ea3146be874a9370b1dbba3e3f3ded31eddc05af7b1afe06d3d597dd2c3ee3ebf04803a764835804e6a724f6fb1c63056024730440220448546af85c40d4be09872013ef1a8cfeb9516cd39cf0bc22be28e61eb666350022018f5be97709b5b980aa5ce81f8a27e45621444d6385c6548209912bc48b48d9701210301cc8e443c2c8bfc286f01d203c325b4088ecc1106cd7421321a720253fc91ad0c000000
</code></pre>
<p>Signed Txn</p>
<pre class="lang-json prettyprint-override"><code>                                
{
    &quot;txid&quot;: &quot;e7b3866f253f2464b39893f3f74f8a7aabf810dd33444685fac0e64be6b7e89f&quot;,
    &quot;hash&quot;: &quot;af75b76a6b5de75acdd4f27121939f574135c78e46807127ea3df118f09e7189&quot;,
    &quot;version&quot;: 1,
    &quot;size&quot;: 416,
    &quot;vsize&quot;: 285,
    &quot;weight&quot;: 1139,
    &quot;locktime&quot;: 12,
    &quot;vin&quot;: [
        {
            &quot;txid&quot;: &quot;40011d84d081f07a1dc038e1bece78b92b8a2ac6a8e5e8785a37fb478cd6ffa2&quot;,
            &quot;vout&quot;: 0,
            &quot;scriptSig&quot;: {
                &quot;asm&quot;: &quot;&quot;,
                &quot;hex&quot;: &quot;&quot;
            },
            &quot;txinwitness&quot;: [
                &quot;20ef582e42d51c0879f5ef445272107ea3146be874a9370b1dbba3e3f3ded31eddc05af7b1afe06d3d597dd2c3ee3ebf04803a764835804e6a724f6fb1c63056&quot;
            ],
            &quot;sequence&quot;: 1
        },
        {
            &quot;txid&quot;: &quot;8cf68fc45f32b9690d03661b767e74377e443ce6d6433a9db2dcecfd3153f8e1&quot;,
            &quot;vout&quot;: 0,
            &quot;scriptSig&quot;: {
                &quot;asm&quot;: &quot;&quot;,
                &quot;hex&quot;: &quot;&quot;
            },
            &quot;txinwitness&quot;: [
                &quot;30440220448546af85c40d4be09872013ef1a8cfeb9516cd39cf0bc22be28e61eb666350022018f5be97709b5b980aa5ce81f8a27e45621444d6385c6548209912bc48b48d9701&quot;,
                &quot;0301cc8e443c2c8bfc286f01d203c325b4088ecc1106cd7421321a720253fc91ad&quot;
            ],
            &quot;sequence&quot;: 1
        }
    ],
    &quot;vout&quot;: [
        {
            &quot;value&quot;: 0.00100006,
            &quot;n&quot;: 0,
            &quot;scriptPubKey&quot;: {
                &quot;asm&quot;: &quot;1 36d5748a7817424eca90e0d5a9f41cc2a0c843528872ba9d05a20eabd09c4065&quot;,
                &quot;desc&quot;: &quot;rawtr(36d5748a7817424eca90e0d5a9f41cc2a0c843528872ba9d05a20eabd09c4065)#gp0fk5kf&quot;,
                &quot;hex&quot;: &quot;512036d5748a7817424eca90e0d5a9f41cc2a0c843528872ba9d05a20eabd09c4065&quot;,
                &quot;address&quot;: &quot;bc1pxm2hfznczapyaj5sur26naquc2svss6j3pet48g95g82h5yugpjs25muxj&quot;,
                &quot;type&quot;: &quot;witness_v1_taproot&quot;
            }
        },
        {
            &quot;value&quot;: 0.00089006,
            &quot;n&quot;: 1,
            &quot;scriptPubKey&quot;: {
                &quot;asm&quot;: &quot;1 51207062783e946190c8d1043a2491633cfb20ac91f06869514471bf98fe0245f343&quot;,
                &quot;desc&quot;: &quot;addr(bc1p2ys8qcnc862xryxg6yzr5fy3vv70kg9vj8cxs623g3cmlx87qfzlxsc3cylxd)#sp4wxhtc&quot;,
                &quot;hex&quot;: &quot;512251207062783e946190c8d1043a2491633cfb20ac91f06869514471bf98fe0245f343&quot;,
                &quot;address&quot;: &quot;bc1p2ys8qcnc862xryxg6yzr5fy3vv70kg9vj8cxs623g3cmlx87qfzlxsc3cylxd&quot;,
                &quot;type&quot;: &quot;witness_unknown&quot;
            }
        },
        {
            &quot;value&quot;: 0.0001,
            &quot;n&quot;: 2,
            &quot;scriptPubKey&quot;: {
                &quot;asm&quot;: &quot;1 4238ecdae980e5ce65c70d50043d58ef8014bb2ef7adf9bfa43ddadc33d493ad&quot;,
                &quot;desc&quot;: &quot;rawtr(4238ecdae980e5ce65c70d50043d58ef8014bb2ef7adf9bfa43ddadc33d493ad)#2x7uc7k6&quot;,
                &quot;hex&quot;: &quot;51204238ecdae980e5ce65c70d50043d58ef8014bb2ef7adf9bfa43ddadc33d493ad&quot;,
                &quot;address&quot;: &quot;bc1pgguwekhfsrjuuew8p4gqg02ca7qpfwew77kln0ay8hddcv75jwksufvfww&quot;,
                &quot;type&quot;: &quot;witness_v1_taproot&quot;
            }
        },
        {
            &quot;value&quot;: 0,
            &quot;n&quot;: 3,
            &quot;scriptPubKey&quot;: {
                &quot;asm&quot;: &quot;OP_RETURN 13 008b01016301&quot;,
                &quot;desc&quot;: &quot;raw(6a5d06008b01016301)#53e7sytq&quot;,
                &quot;hex&quot;: &quot;6a5d06008b01016301&quot;,
                &quot;type&quot;: &quot;nulldata&quot;
            }
        }
    ]
}
                   
</code></pre>
<p>I have verified the signatures and the public keys. Can someone help me identify the issue and fix this transaction error?</p>
<p>For the input of the account tx:</p>
<pre><code># bcmd -rpcwallet=&quot;mywallet&quot; gettransaction 40011d84d081f07a1dc038e1bece78b92b8a2ac6a8e5e8785a37fb478cd6ffa2
{
  &quot;amount&quot;: 0.00000000,
  &quot;fee&quot;: -0.00009901,
  &quot;confirmations&quot;: 162,
  &quot;blockhash&quot;: &quot;67b7007b27e35047f7c7dff6412c49458546bfc196b6208e72bef24380fcc44f&quot;,
  &quot;blockheight&quot;: 143,
  &quot;blockindex&quot;: 1,
  &quot;blocktime&quot;: 1722672138,
  &quot;txid&quot;: &quot;40011d84d081f07a1dc038e1bece78b92b8a2ac6a8e5e8785a37fb478cd6ffa2&quot;,
  &quot;wtxid&quot;: &quot;287650b835e50a27f272834d1d13863745eaffce8c8913f46a2af4ab68e0425d&quot;,
  &quot;walletconflicts&quot;: [],
  &quot;time&quot;: 1722672138,
  &quot;timereceived&quot;: 1722672138,
  &quot;bip125-replaceable&quot;: &quot;no&quot;,
  &quot;details&quot;: [
    {
      &quot;address&quot;: &quot;bcrt1q7hz4y2eq3r6pj4y8fwvc53cyetv3k6ucfv4nhc&quot;,
      &quot;category&quot;: &quot;send&quot;,
      &quot;amount&quot;: -0.00010006,
      &quot;label&quot;: &quot;&quot;,
      &quot;vout&quot;: 0,
      &quot;fee&quot;: -0.00009901,
      &quot;abandoned&quot;: false
    },
    {
      &quot;address&quot;: &quot;bcrt1q7hz4y2eq3r6pj4y8fwvc53cyetv3k6ucfv4nhc&quot;,
      &quot;parent_descs&quot;: [
        &quot;wpkh(tpubD6NzVbkrYhZ4YA6tv2BJdjxPVGx3qgb8QVsTqxbB9YwEQY8dKej5FyX5wQXxVHtKxqQgSw7D9XucsnKZ2iodSFXM4EpjdENvruaGxyMp5Y4/84'/1'/0'/0/*)#a5rks7y5&quot;
      ],
      &quot;category&quot;: &quot;receive&quot;,
      &quot;amount&quot;: 0.00010006,
      &quot;label&quot;: &quot;&quot;,
      &quot;vout&quot;: 0
    }
  ],
  &quot;hex&quot;: &quot;02000000000102dd9c61c543ef92e03a39f584b517a7fd10937bcc033e9704f833561a6eae2f9e0000000000fdffffffbaec46fce03948d7f19ad6d856867b366b0bc6b7e5a4b05d0c7d212aa5fa28ac0200000000fdffffff011627000000000000160014f5c5522b2088f41954874b998a4704cad91b6b9802473044022039f78eda2a2926e4e722ddcd09c866dd6183fb623001bbf63208d4206620b03302204af1a6f7c55b33ae2826995100bfc6b93dd0322b43745f23158c2f760d4e09d6012103e6b1b50b7f1ec077385a978a0be708e11767245251075cb7f88ba11645783031024730440220192d300622f517aef52505b5c4b2a4566e843b74688de43e96d21a7634c03bf702203781b12538ff5dcc3ed96f96029a4bb136814a79c07d27d73ee72fa09a0355e8012103e6b1b50b7f1ec077385a978a0be708e11767245251075cb7f88ba1164578303100000000&quot;
}
</code></pre>
<p>For the input of the funding:</p>
<pre><code># bcmd -rpcwallet=&quot;faucet&quot; gettransaction 8cf68fc45f32b9690d03661b767e74377e443ce6d6433a9db2dcecfd3153f8e1
{
  &quot;amount&quot;: 25.00000000,
  &quot;confirmations&quot;: 143,
  &quot;generated&quot;: true,
  &quot;blockhash&quot;: &quot;30cb027232dfe5905b4c996908bf39f436e4cfd2855e5447bd46d210f20bb30b&quot;,
  &quot;blockheight&quot;: 165,
  &quot;blockindex&quot;: 0,
  &quot;blocktime&quot;: 1722684106,
  &quot;txid&quot;: &quot;8cf68fc45f32b9690d03661b767e74377e443ce6d6433a9db2dcecfd3153f8e1&quot;,
  &quot;wtxid&quot;: &quot;4b0989ba070a394bf837b949def1d87dfd004ddf8212897d207b3977021c55cd&quot;,
  &quot;walletconflicts&quot;: [],
  &quot;time&quot;: 1722684104,
  &quot;timereceived&quot;: 1722684104,
  &quot;bip125-replaceable&quot;: &quot;no&quot;,
  &quot;details&quot;: [
    {
      &quot;address&quot;: &quot;bcrt1q23mtqw3hnsyvux5wr2kpwes6lkc3zsy5zaxzzm&quot;,
      &quot;parent_descs&quot;: [
        &quot;wpkh(tpubD6NzVbkrYhZ4YcdAPzo9agcpA4gyTtW1gZCKtEpcVnGfJ5Qg4txwbUFMfYs4RrMJXXf51MUsdj5mroJtZMuTWCrHhpdfdBUqVSrQp6XnHgs/84'/1'/0'/0/*)#peesvaay&quot;
      ],
      &quot;category&quot;: &quot;generate&quot;,
      &quot;amount&quot;: 25.00000000,
      &quot;label&quot;: &quot;faucet&quot;,
      &quot;vout&quot;: 0
    }
  ],
  &quot;hex&quot;: &quot;020000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff0402a50000ffffffff0200f90295000000001600145476b03a379c08ce1a8e1aac17661afdb11140940000000000000000266a24aa21a9ede2f61c3f71d1defd3fa999dfa36953755c690689799962b48bebd836974e8cf90120000000000000000000000000000000000000000000000000000000000000000000000000&quot;
}
</code></pre>

CC BY-SA 4.0
2024-08-02T08:57:30.773Z
Hi Vinay, can you also include in your post the two transactions whose outputs are being spent?
Vojtěch Strnad
CC BY-SA 4.0
2024-08-03T13:57:23.023Z
@VojtěchStrnad Hi I have updated the post and posted the two UTXOs I am trying to spend. Your help and response is greatly appreciated.
Vinay Sawant
CC BY-SA 4.0
2024-08-03T14:16:29.513Z
I just noticed your first input has no witness data, that's probably not intentional?
Vojtěch Strnad
CC BY-SA 4.0
2024-08-03T14:51:49.297Z
@VojtěchStrnad Thats for unsigned Transaction it should be empty, Check one more hex I added its for Signed Txn
Vinay Sawant
<bitcoin-core><taproot>
Witness Program Hash Mismatch Error When Sending a Signed Transaction on Regtest
Vinay Sawant
# Witness Program Hash Mismatch Error When Sending a Signed Transaction on Regtest

(Asked by: username_0 on 2024-08-02)

I am trying to send a transaction on my Bitcoin regtest node, but I keep encountering the following error:
Status Err("RPC error: Object {\"code\": Number(-26), \"message\": String(\"non-mandatory-script-verify-flag (Witness program hash mismatch)\")}")

Here is the transaction in hex format:
01000000000102a2ffd68c47fb375a78e8e5a8c62a8a2bb978cebee138c01d7af081d0841d0140000000000001000000e1f85331fdecdcb29d3a43d6e63c447e37747e761b66030d69b9325fc48ff68c00000000000100000004a68601000000000022512036d5748a7817424eca90e0d5a9f41cc2a0c843528872ba9d05a20eabd09c4065ae5b01000000000024512251207062783e946190c8d1043a2491633cfb20ac91f06869514471bf98fe0245f34310270000000000002251204238ecdae980e5ce65c70d50043d58ef8014bb2ef7adf9bfa43ddadc33d493ad0000000000000000096a5d06008b0101630100024730440220448546af85c40d4be09872013ef1a8cfeb9516cd39cf0bc22be28e61eb666350022018f5be97709b5b980aa5ce81f8a27e45621444d6385c6548209912bc48b48d9701210301cc8e443c2c8bfc286f01d203c325b4088ecc1106cd7421321a720253fc91ad0c000000

My RPC URL is:
http://localhost:18443

Below is the decoded transaction:
{
    "txid": "e7b3866f253f2464b39893f3f74f8a7aabf810dd33444685fac0e64be6b7e89f",
    "hash": "099fb30f2ad1ae01ec974047b9a7c387c3b86bd8efc4d227e93f28ddd57bdb74",
    "version": 1,
    "size": 351,
    "vsize": 269,
    "weight": 1074,
    "locktime": 12,
    "vin": [
        {
            "txid": "40011d84d081f07a1dc038e1bece78b92b8a2ac6a8e5e8785a37fb478cd6ffa2",
            "vout": 0,
            "scriptSig": {
                "asm": "",
                "hex": ""
            },
            "sequence": 1
        },
        {
            "txid": "8cf68fc45f32b9690d03661b767e74377e443ce6d6433a9db2dcecfd3153f8e1",
            "vout": 0,
            "scriptSig": {
                "asm": "",
                "hex": ""
            },
            "txinwitness": [
                "30440220448546af85c40d4be09872013ef1a8cfeb9516cd39cf0bc22be28e61eb666350022018f5be97709b5b980aa5ce81f8a27e45621444d6385c6548209912bc48b48d9701",
                "0301cc8e443c2c8bfc286f01d203c325b4088ecc1106cd7421321a720253fc91ad"
            ],
            "sequence": 1
        }
    ],
    "vout": [
        {
            "value": 0.00100006,
            "n": 0,
            "scriptPubKey": {
                "asm": "1 36d5748a7817424eca90e0d5a9f41cc2a0c843528872ba9d05a20eabd09c4065",
                "desc": "rawtr(36d5748a7817424eca90e0d5a9f41cc2a0c843528872ba9d05a20eabd09c4065)#gp0fk5kf",
                "hex": "512036d5748a7817424eca90e0d5a9f41cc2a0c843528872ba9d05a20eabd09c4065",
                "address": "bc1pxm2hfznczapyaj5sur26naquc2svss6j3pet48g95g82h5yugpjs25muxj",
                "type": "witness_v1_taproot"
            }
        },
        {
            "value": 0.00089006,
            "n": 1,
            "scriptPubKey": {
                "asm": "1 51207062783e946190c8d1043a2491633cfb20ac91f06869514471bf98fe0245f343",
                "desc": "addr(bc1p2ys8qcnc862xryxg6yzr5fy3vv70kg9vj8cxs623g3cmlx87qfzlxsc3cylxd)#sp4wxhtc",
                "hex": "512251207062783e946190c8d1043a2491633cfb20ac91f06869514471bf98fe0245f343",
                "address": "bc1p2ys8qcnc862xryxg6yzr5fy3vv70kg9vj8cxs623g3cmlx87qfzlxsc3cylxd",
                "type": "witness_unknown"
            }
        },
        {
            "value": 0.0001,
            "n": 2,
            "scriptPubKey": {
                "asm": "1 4238ecdae980e5ce65c70d50043d58ef8014bb2ef7adf9bfa43ddadc33d493ad",
                "desc": "rawtr(4238ecdae980e5ce65c70d50043d58ef8014bb2ef7adf9bfa43ddadc33d493ad)#2x7uc7k6",
                "hex": "51204238ecdae980e5ce65c70d50043d58ef8014bb2ef7adf9bfa43ddadc33d493ad",
                "address": "bc1pgguwekhfsrjuuew8p4gqg02ca7qpfwew77kln0ay8hddcv75jwksufvfww",
                "type": "witness_v1_taproot"
            }
        },
        {
            "value": 0,
            "n": 3,
            "scriptPubKey": {
                "asm": "OP_RETURN 13 008b01016301",
                "desc": "raw(6a5d06008b01016301)#53e7sytq",
                "hex": "6a5d06008b01016301",
                "type": "nulldata"
            }
        }
    ]
}

Also, here is the detailed hex for the signed transaction:
01000000000102a2ffd68c47fb375a78e8e5a8c62a8a2bb978cebee138c01d7af081d0841d0140000000000001000000e1f85331fdecdcb29d3a43d6e63c447e37747e761b66030d69b9325fc48ff68c00000000000100000004a68601000000000022512036d5748a7817424eca90e0d5a9f41cc2a0c843528872ba9d05a20eabd09c4065ae5b01000000000024512251207062783e946190c8d1043a2491633cfb20ac91f06869514471bf98fe0245f34310270000000000002251204238ecdae980e5ce65c70d50043d58ef8014bb2ef7adf9bfa43ddadc33d493ad0000000000000000096a5d06008b01016301014020ef582e42d51c0879f5ef445272107ea3146be874a9370b1dbba3e3f3ded31eddc05af7b1afe06d3d597dd2c3ee3ebf04803a764835804e6a724f6fb1c63056024730440220448546af85c40d4be09872013ef1a8cfeb9516cd39cf0bc22be28e61eb666350022018f5be97709b5b980aa5ce81f8a27e45621444d6385c6548209912bc48b48d9701210301cc8e443c2c8bfc286f01d203c325b4088ecc1106cd7421321a720253fc91ad0c000000

Signed Txn
                                
{
    "txid": "e7b3866f253f2464b39893f3f74f8a7aabf810dd33444685fac0e64be6b7e89f",
    "hash": "af75b76a6b5de75acdd4f27121939f574135c78e46807127ea3df118f09e7189",
    "version": 1,
    "size": 416,
    "vsize": 285,
    "weight": 1139,
    "locktime": 12,
    "vin": [
        {
            "txid": "40011d84d081f07a1dc038e1bece78b92b8a2ac6a8e5e8785a37fb478cd6ffa2",
            "vout": 0,
            "scriptSig": {
                "asm": "",
                "hex": ""
            },
            "txinwitness": [
                "20ef582e42d51c0879f5ef445272107ea3146be874a9370b1dbba3e3f3ded31eddc05af7b1afe06d3d597dd2c3ee3ebf04803a764835804e6a724f6fb1c63056"
            ],
            "sequence": 1
        },
        {
            "txid": "8cf68fc45f32b9690d03661b767e74377e443ce6d6433a9db2dcecfd3153f8e1",
            "vout": 0,
            "scriptSig": {
                "asm": "",
                "hex": ""
            },
            "txinwitness": [
                "30440220448546af85c40d4be09872013ef1a8cfeb9516cd39cf0bc22be28e61eb666350022018f5be97709b5b980aa5ce81f8a27e45621444d6385c6548209912bc48b48d9701",
                "0301cc8e443c2c8bfc286f01d203c325b4088ecc1106cd7421321a720253fc91ad"
            ],
            "sequence": 1
        }
    ],
    "vout": [
        {
            "value": 0.00100006,
            "n": 0,
            "scriptPubKey": {
                "asm": "1 36d5748a7817424eca90e0d5a9f41cc2a0c843528872ba9d05a20eabd09c4065",
                "desc": "rawtr(36d5748a7817424eca90e0d5a9f41cc2a0c843528872ba9d05a20eabd09c4065)#gp0fk5kf",
                "hex": "512036d5748a7817424eca90e0d5a9f41cc2a0c843528872ba9d05a20eabd09c4065",
                "address": "bc1pxm2hfznczapyaj5sur26naquc2svss6j3pet48g95g82h5yugpjs25muxj",
                "type": "witness_v1_taproot"
            }
        },
        {
            "value": 0.00089006,
            "n": 1,
            "scriptPubKey": {
                "asm": "1 51207062783e946190c8d1043a2491633cfb20ac91f06869514471bf98fe0245f343",
                "desc": "addr(bc1p2ys8qcnc862xryxg6yzr5fy3vv70kg9vj8cxs623g3cmlx87qfzlxsc3cylxd)#sp4wxhtc",
                "hex": "512251207062783e946190c8d1043a2491633cfb20ac91f06869514471bf98fe0245f343",
                "address": "bc1p2ys8qcnc862xryxg6yzr5fy3vv70kg9vj8cxs623g3cmlx87qfzlxsc3cylxd",
                "type": "witness_unknown"
            }
        },
        {
            "value": 0.0001,
            "n": 2,
            "scriptPubKey": {
                "asm": "1 4238ecdae980e5ce65c70d50043d58ef8014bb2ef7adf9bfa43ddadc33d493ad",
                "desc": "rawtr(4238ecdae980e5ce65c70d50043d58ef8014bb2ef7adf9bfa43ddadc33d493ad)#2x7uc7k6",
                "hex": "51204238ecdae980e5ce65c70d50043d58ef8014bb2ef7adf9bfa43ddadc33d493ad",
                "address": "bc1pgguwekhfsrjuuew8p4gqg02ca7qpfwew77kln0ay8hddcv75jwksufvfww",
                "type": "witness_v1_taproot"
            }
        },
        {
            "value": 0,
            "n": 3,
            "scriptPubKey": {
                "asm": "OP_RETURN 13 008b01016301",
                "desc": "raw(6a5d06008b01016301)#53e7sytq",
                "hex": "6a5d06008b01016301",
                "type": "nulldata"
            }
        }
    ]
}
                   

I have verified the signatures and the public keys. Can someone help me identify the issue and fix this transaction error?
For the input of the account tx:
# bcmd -rpcwallet="mywallet" gettransaction 40011d84d081f07a1dc038e1bece78b92b8a2ac6a8e5e8785a37fb478cd6ffa2
{
  "amount": 0.00000000,
  "fee": -0.00009901,
  "confirmations": 162,
  "blockhash": "67b7007b27e35047f7c7dff6412c49458546bfc196b6208e72bef24380fcc44f",
  "blockheight": 143,
  "blockindex": 1,
  "blocktime": 1722672138,
  "txid": "40011d84d081f07a1dc038e1bece78b92b8a2ac6a8e5e8785a37fb478cd6ffa2",
  "wtxid": "287650b835e50a27f272834d1d13863745eaffce8c8913f46a2af4ab68e0425d",
  "walletconflicts": [],
  "time": 1722672138,
  "timereceived": 1722672138,
  "bip125-replaceable": "no",
  "details": [
    {
      "address": "bcrt1q7hz4y2eq3r6pj4y8fwvc53cyetv3k6ucfv4nhc",
      "category": "send",
      "amount": -0.00010006,
      "label": "",
      "vout": 0,
      "fee": -0.00009901,
      "abandoned": false
    },
    {
      "address": "bcrt1q7hz4y2eq3r6pj4y8fwvc53cyetv3k6ucfv4nhc",
      "parent_descs": [
        "wpkh(tpubD6NzVbkrYhZ4YA6tv2BJdjxPVGx3qgb8QVsTqxbB9YwEQY8dKej5FyX5wQXxVHtKxqQgSw7D9XucsnKZ2iodSFXM4EpjdENvruaGxyMp5Y4/84'/1'/0'/0/*)#a5rks7y5"
      ],
      "category": "receive",
      "amount": 0.00010006,
      "label": "",
      "vout": 0
    }
  ],
  "hex": "02000000000102dd9c61c543ef92e03a39f584b517a7fd10937bcc033e9704f833561a6eae2f9e0000000000fdffffffbaec46fce03948d7f19ad6d856867b366b0bc6b7e5a4b05d0c7d212aa5fa28ac0200000000fdffffff011627000000000000160014f5c5522b2088f41954874b998a4704cad91b6b9802473044022039f78eda2a2926e4e722ddcd09c866dd6183fb623001bbf63208d4206620b03302204af1a6f7c55b33ae2826995100bfc6b93dd0322b43745f23158c2f760d4e09d6012103e6b1b50b7f1ec077385a978a0be708e11767245251075cb7f88ba11645783031024730440220192d300622f517aef52505b5c4b2a4566e843b74688de43e96d21a7634c03bf702203781b12538ff5dcc3ed96f96029a4bb136814a79c07d27d73ee72fa09a0355e8012103e6b1b50b7f1ec077385a978a0be708e11767245251075cb7f88ba1164578303100000000"
}

For the input of the funding:
# bcmd -rpcwallet="faucet" gettransaction 8cf68fc45f32b9690d03661b767e74377e443ce6d6433a9db2dcecfd3153f8e1
{
  "amount": 25.00000000,
  "confirmations": 143,
  "generated": true,
  "blockhash": "30cb027232dfe5905b4c996908bf39f436e4cfd2855e5447bd46d210f20bb30b",
  "blockheight": 165,
  "blockindex": 0,
  "blocktime": 1722684106,
  "txid": "8cf68fc45f32b9690d03661b767e74377e443ce6d6433a9db2dcecfd3153f8e1",
  "wtxid": "4b0989ba070a394bf837b949def1d87dfd004ddf8212897d207b3977021c55cd",
  "walletconflicts": [],
  "time": 1722684104,
  "timereceived": 1722684104,
  "bip125-replaceable": "no",
  "details": [
    {
      "address": "bcrt1q23mtqw3hnsyvux5wr2kpwes6lkc3zsy5zaxzzm",
      "parent_descs": [
        "wpkh(tpubD6NzVbkrYhZ4YcdAPzo9agcpA4gyTtW1gZCKtEpcVnGfJ5Qg4txwbUFMfYs4RrMJXXf51MUsdj5mroJtZMuTWCrHhpdfdBUqVSrQp6XnHgs/84'/1'/0'/0/*)#peesvaay"
      ],
      "category": "generate",
      "amount": 25.00000000,
      "label": "faucet",
      "vout": 0
    }
  ],
  "hex": "020000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff0402a50000ffffffff0200f90295000000001600145476b03a379c08ce1a8e1aac17661afdb11140940000000000000000266a24aa21a9ede2f61c3f71d1defd3fa999dfa36953755c690689799962b48bebd836974e8cf90120000000000000000000000000000000000000000000000000000000000000000000000000"
}

**Tags:** bitcoin-core, taproot

> **Comments:**
> **username_1**: Hi Vinay, can you also include in your post the two transactions whose outputs are being spent?  
> **username_0**: @VojtěchStrnad Hi I have updated the post and posted the two UTXOs I am trying to spend. Your help and response is greatly appreciated.  
> **username_1**: I just noticed your first input has no witness data, that's probably not intentional?  
> **username_0**: @VojtěchStrnad Thats for unsigned Transaction it should be empty, Check one more hex I added its for Signed Txn  

---

## 1 answers

### Answer by username_1 on 2024-08-03. Score: 1

The witness stack of the first input only has one item, even though it's spending a P2WPKH output which requires two items. Since the item is 64 bytes long, I'd presume it's a Schnorr signature and you meant to spend a P2TR output instead.

> **Comments:**
> **username_0**: I fixed it. but right now its giving me invalid schnorr signatue  

---

