# Transaction Merkle Trees

When constructing a **Merkle Tree** of Bitcoin transactions, the **leaf nodes** are made up of **Transaction IDs (TXIDs)**.

Each TXID represents the **cryptographic fingerprint of a transaction.**

***

### How Transaction IDs Are Created

Transactions are generally arranged in the order they are received across the network. However, due to **network latency**, this order isn’t always fixed or consistent across all nodes.

Each **TXID** is produced by passing the **serialized string of the raw transaction data** through the **SHA-256** algorithm **twice**, a process known as **double hashing (HASH256)**.

This ensures that the resulting **32-byte TXID** securely represents all the transaction’s contents — including:

* The **source of funds (wallet address)**
* The **amount transferred**
* The **locking conditions**
* Any **embedded metadata or scripts**

Every part of a Merkle Tree — from its **leaves** to its **interior nodes** and **root** — is formed using this **double SHA-256 process**, creating a chain of trust that ties every transaction securely to its block.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://hub.bsvblockchain.org/higher-learning/bsv-academy/bitcoin-primitives-merkle-trees/merkle-trees-in-bitcoin-and-bsv/transaction-merkle-trees.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
