<blockquote>
<p>For key path spending, why is there a merkle root?</p>
</blockquote>
<p>In the <code>&quot;given&quot;</code> section, only the internal private key is given. In key path spending, one signs with the tweaked private key. The tweaked private key is computed from the internal private key and the Merkle root.</p>
<blockquote>
<p>What leaf nodes were used to derive these merkle roots from inputs that contain no control blocks?</p>
</blockquote>
<p>That shouldn't matter for testing your key-path signing logic.</p>

CC BY-SA 4.0
2022-08-25T18:28:52.567Z
2022-08-25T22:05:10.497Z
2022-08-25T22:05:10.497Z
Pieter Wuille
<p>I'm referring to a page of <a href="https://github.com/bitcoin/bips/blob/master/bip-0341/wallet-test-vectors.json" rel="nofollow noreferrer">Taproot test vectors</a> provided in <a href="https://github.com/bitcoin/bips/blob/master/bip-0341.mediawiki#Test_vectors" rel="nofollow noreferrer">BIP 341</a>.</p>
<p>In the section called <code>keyPathSpending</code> and then <code>inputSpending</code> under that, there are 7 JSON objects that provide parameters to test tweaking keys and then signing and verifying data with Schnorr signatures. The first of these JSON objects contains <code>&quot;merkleRoot&quot;: null</code>. However, all of the others include a merkle root.</p>
<p>For example, the second one provides the following data:</p>
<pre><code>{
    &quot;given&quot;: {
        &quot;txinIndex&quot;: 1,
        &quot;internalPrivkey&quot;: &quot;1e4da49f6aaf4e5cd175fe08a32bb5cb4863d963921255f33d3bc31e1343907f&quot;,
        &quot;merkleRoot&quot;: &quot;5b75adecf53548f3ec6ad7d78383bf84cc57b55a3127c72b9a2481752dd88b21&quot;,
        &quot;hashType&quot;: 131
    },
    &quot;intermediary&quot;: {
        &quot;internalPubkey&quot;: &quot;187791b6f712a8ea41c8ecdd0ee77fab3e85263b37e1ec18a3651926b3a6cf27&quot;,
        &quot;tweak&quot;: &quot;cbd8679ba636c1110ea247542cfbd964131a6be84f873f7f3b62a777528ed001&quot;,
        &quot;tweakedPrivkey&quot;: &quot;ea260c3b10e60f6de018455cd0278f2f5b7e454be1999572789e6a9565d26080&quot;,
        &quot;sigMsg&quot;: &quot;0083020000000065cd1d00d7b7cab57b1393ace2d064f4d4a2cb8af6def61273e127517d44759b6dafdd9900000000808f891b00000000225120147c9c57132f6e7ecddba9800bb0c4449251c92a1e60371ee77557b6620f3ea3ffffffffffcef8fb4ca7efc5433f591ecfc57391811ce1e186a3793024def5c884cba51d&quot;,
        &quot;precomputedUsed&quot;: [],
        &quot;sigHash&quot;: &quot;325a644af47e8a5a2591cda0ab0723978537318f10e6a63d4eed783b96a71a4d&quot;
    },
    &quot;expected&quot;: {
        &quot;witness&quot;: [
            &quot;052aedffc554b41f52b521071793a6b88d6dbca9dba94cf34c83696de0c1ec35ca9c5ed4ab28059bd606a4f3a657eec0bb96661d42921b5f50a95ad33675b54f83&quot;
        ]
    }
},
</code></pre>
<p>For key path spending, why is there a merkle root? What leaf nodes were used to derive these merkle roots from inputs that contain no control blocks?</p>

<merkle-tree><taproot>
Merkle root for Taproot key path spending?
Zephyrus
# Merkle root for Taproot key path spending?

(Asked by: username_0 on 2022-08-25)

I'm referring to a page of [Taproot test vectors](https://github.com/bitcoin/bips/blob/master/bip-0341/wallet-test-vectors.json) provided in [BIP 341](https://github.com/bitcoin/bips/blob/master/bip-0341.mediawiki#Test_vectors).

In the section called `keyPathSpending` and then `inputSpending` under that, there are 7 JSON objects that provide parameters to test tweaking keys and then signing and verifying data with Schnorr signatures. The first of these JSON objects contains `"merkleRoot": null`. However, all of the others include a merkle root.

For example, the second one provides the following data:

```
{
    "given": {
        "txinIndex": 1,
        "internalPrivkey": "1e4da49f6aaf4e5cd175fe08a32bb5cb4863d963921255f33d3bc31e1343907f",
        "merkleRoot": "5b75adecf53548f3ec6ad7d78383bf84cc57b55a3127c72b9a2481752dd88b21",
        "hashType": 131
    },
    "intermediary": {
        "internalPubkey": "187791b6f712a8ea41c8ecdd0ee77fab3e85263b37e1ec18a3651926b3a6cf27",
        "tweak": "cbd8679ba636c1110ea247542cfbd964131a6be84f873f7f3b62a777528ed001",
        "tweakedPrivkey": "ea260c3b10e60f6de018455cd0278f2f5b7e454be1999572789e6a9565d26080",
        "sigMsg": "0083020000000065cd1d00d7b7cab57b1393ace2d064f4d4a2cb8af6def61273e127517d44759b6dafdd9900000000808f891b00000000225120147c9c57132f6e7ecddba9800bb0c4449251c92a1e60371ee77557b6620f3ea3ffffffffffcef8fb4ca7efc5433f591ecfc57391811ce1e186a3793024def5c884cba51d",
        "precomputedUsed": [],
        "sigHash": "325a644af47e8a5a2591cda0ab0723978537318f10e6a63d4eed783b96a71a4d"
    },
    "expected": {
        "witness": [
            "052aedffc554b41f52b521071793a6b88d6dbca9dba94cf34c83696de0c1ec35ca9c5ed4ab28059bd606a4f3a657eec0bb96661d42921b5f50a95ad33675b54f83"
        ]
    }
},

```

For key path spending, why is there a merkle root? What leaf nodes were used to derive these merkle roots from inputs that contain no control blocks?

**Tags:** merkle-tree, taproot


---

## 1 answers

### Answer by username_1 on 2022-08-25. Score: 1

> For key path spending, why is there a merkle root?

In the `"given"` section, only the internal private key is given. In key path spending, one signs with the tweaked private key. The tweaked private key is computed from the internal private key and the Merkle root.

> What leaf nodes were used to derive these merkle roots from inputs that contain no control blocks?

That shouldn't matter for testing your key-path signing logic.


---

