<p>The leaf nodes are in the same order as the transactions in the block. This order is chosen by the miners (other than the coinbase being first).</p>
<p>Please see here for more info: <a href="https://bitcoin.stackexchange.com/a/46768/51948">https://bitcoin.stackexchange.com/a/46768/51948</a></p>
<p>CVE-2012-2459 is detailed <a href="https://bitcointalk.org/?topic=102395" rel="nofollow noreferrer">here</a>. The relevant fix:</p>
<blockquote>
<p>The problem was fixed by Gavin Andresen in Bitcoin commit be8651d [1] by rejecting blocks with duplicate transactions in CheckBlock, preventing them from being cached at all.</p>
</blockquote>
<p>So essentially the Merkle tree itself still has the same issue, but it can never be a problem in practice when used in Bitcoin blocks.</p>

CC BY-SA 4.0
2022-01-16T09:54:29.880Z
2022-01-16T20:37:04.243Z
2022-01-16T20:37:04.243Z
meshcollider
<p>As far as I know, the first one is the coinbase transaction</p>

<transactions><merkle-tree><spv>
What are the detailed rules for Merkle tree generation? Specifically the order of the leaf nodes
KHJUAF403456ZS3K564WAEF
# What are the detailed rules for Merkle tree generation? Specifically the order of the leaf nodes

(Asked by: username_0 on 2022-01-16)

As far as I know, the first one is the coinbase transaction

**Tags:** transactions, merkle-tree, spv


---

## 1 answers

### Answer by username_1 on 2022-01-16. Score: 1

The leaf nodes are in the same order as the transactions in the block. This order is chosen by the miners (other than the coinbase being first).

Please see here for more info: <https://bitcoin.stackexchange.com/a/46768/51948>

CVE-2012-2459 is detailed [here](https://bitcointalk.org/?topic=102395). The relevant fix:

> The problem was fixed by Gavin Andresen in Bitcoin commit be8651d [1] by rejecting blocks with duplicate transactions in CheckBlock, preventing them from being cached at all.

So essentially the Merkle tree itself still has the same issue, but it can never be a problem in practice when used in Bitcoin blocks.


---

