user87898: We know the merkel tree is branchs of transaction hash so that root of tree is hash that show in block header. If i want to find a specific transaction, how i can?

user60443: In order to verify if a transaction is part of a merkle tree, you have to calculate the hash of the transaction id and it's sibling, and verify that the value is correct. For example,
Merkle Verification
We’ll start with a simple 2 leaf example (see the First Bitcoin Transaction):

Lets assume that hashes Ha and Hb have already been calculated from the data Ta and Tb and that:
Ha = b1fea52486ce0c62bb442b530a3f0132b826c74e473d1f2c220bfa78111c5082
Hb = f4184fc596403b9d638783cf57adfe4c75c605f6356fbc91338530e9831e9e16

First, we must reverse the bytes (they need to be little endian) because that is how Bitcoin calculates the hashes. You can use this python script, if you like:
#!/usr/bin/env python
line = raw_input("Input original hex string\n")
n = 2
orig_list = [line[i:i+n] for i in range(0, len(line), n)]
reversed_list = orig_list[::-1]
reversed = ''.join(reversed_list)
print reversed

We get:
Ha = 82501c1178fa0b222c1f3d474ec726b832013f0a532b44bb620cce8624a5feb1
Hb = 169e1e83e930853391bc6f35f605c6754cfead57cf8387639d3b4096c54f18f4

Then, the node (and root in this case) Hab is calculated by concatenating the two and hashing with sha256 twice (i.e. hash256):
$ printf "82501c1178fa0b222c1f3d474ec726b832013f0a532b44bb620cce8624a5feb1169e1e83e930853391bc6f35f605c6754cfead57cf8387639d3b4096c54f18f4" | xxd -r -p | openssl sha256
(stdin)= a24ee7fb7333f85c16560ed8850a1773d6977ce7a4936367eaf72f8fff33797e
$ printf "a24ee7fb7333f85c16560ed8850a1773d6977ce7a4936367eaf72f8fff33797e" | xxd -r -p | openssl sha256
(stdin)= ff104ccb05421ab93e63f8c3ce5c2c2e9dbb37de2764b3a3175c8166562cac7d

Now, reverse the bytes! (back to big endian):
7dac2c5666815c17a3b36427de37bb9d2e2c5ccec3f8633eb91a4205cb4c10ff

https://medium.com/coinmonks/how-to-manually-verify-the-merkle-root-of-a-bitcoin-block-command-line-7881397d4db1

user38618: To search for a transaction in a merkle root, one must know the TXID of the transaction being looked for. It's not possible to search for leaves (transaction IDs) that satisfy a complex pattern [without scanning each of the transactions]. After the TXID and the TXIDs of other transactions in that block are acquired, the tree is traversed by hashing (For details, please see Why is the full Merkle path needed to verify a transaction?) The transaction is proved to be a part of the block if the final hash is equal to the merkle root.

user208: A common misconception is that a Merkle tree is a data structure which makes finding elements in it easier. It does not. While it does have a tree structure, it is not a search tree like a B-tree or Red-Black or Patricia tree.
As far as searching for data goes, it is conceptually just a list (the leaves of the tree) with a number of associated hash values. Searching in it is exactly as hard as searching in a list is. If the list is sorted, that can be done in O(log n) time, but if the list is not sorted, you need to do an O(n) exhaustive search.
So what is a Merkle tree then useful for?
Proofs. A Merkle tree lets one party prove that a particular element is in it, to anyone who knows the tree's root hash.
So in practice the answer to "How do I find something in a Merkle tree?" is "You don't. You let someone else search for you, and have them show you a proof of what they found.".

87898: <p>We know the merkel tree is branchs of transaction hash so that root of tree is hash that show in block header. If i want to find a specific transaction, how i can?</p>
 60443: <p>In order to verify if a transaction is part of a merkle tree, you have to calculate the hash of the transaction id and it's sibling, and verify that the value is correct. For example,</p>

<h2>Merkle Verification</h2>

<p>We’ll start with a simple 2 leaf example (see the <a href="https://www.blockchain.com/en/btc/block/00000000d1145790a8694403d4063f323d499e655c83426834d4ce2f8dd4a2ee" rel="nofollow noreferrer">First Bitcoin Transaction</a>):</p>

<p><a href="https://i.stack.imgur.com/U5vD7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/U5vD7.png" alt="2 leaf merkle tree"></a></p>

<p>Lets assume that hashes <code>Ha</code> and <code>Hb</code> have already been calculated from the data <code>Ta</code> and <code>Tb</code> and that:</p>

<pre><code>Ha = b1fea52486ce0c62bb442b530a3f0132b826c74e473d1f2c220bfa78111c5082
Hb = f4184fc596403b9d638783cf57adfe4c75c605f6356fbc91338530e9831e9e16
</code></pre>

<p>First, we must reverse the bytes (they need to be little endian) because that is how Bitcoin calculates the hashes. You can use this python script, if you like:</p>

<pre><code>#!/usr/bin/env python
line = raw_input("Input original hex string\n")
n = 2
orig_list = [line[i:i+n] for i in range(0, len(line), n)]
reversed_list = orig_list[::-1]
reversed = ''.join(reversed_list)
print reversed
</code></pre>

<p>We get:</p>

<pre><code>Ha = 82501c1178fa0b222c1f3d474ec726b832013f0a532b44bb620cce8624a5feb1
Hb = 169e1e83e930853391bc6f35f605c6754cfead57cf8387639d3b4096c54f18f4
</code></pre>

<p>Then, the node (and root in this case) <code>Hab</code> is calculated by concatenating the two and hashing with sha256 twice (i.e. hash256):</p>

<pre><code>$ printf "82501c1178fa0b222c1f3d474ec726b832013f0a532b44bb620cce8624a5feb1169e1e83e930853391bc6f35f605c6754cfead57cf8387639d3b4096c54f18f4" | xxd -r -p | openssl sha256
(stdin)= a24ee7fb7333f85c16560ed8850a1773d6977ce7a4936367eaf72f8fff33797e
$ printf "a24ee7fb7333f85c16560ed8850a1773d6977ce7a4936367eaf72f8fff33797e" | xxd -r -p | openssl sha256
(stdin)= ff104ccb05421ab93e63f8c3ce5c2c2e9dbb37de2764b3a3175c8166562cac7d
</code></pre>

<p>Now, reverse the bytes! (back to big endian):</p>

<pre><code>7dac2c5666815c17a3b36427de37bb9d2e2c5ccec3f8633eb91a4205cb4c10ff
</code></pre>

<p><a href="https://medium.com/coinmonks/how-to-manually-verify-the-merkle-root-of-a-bitcoin-block-command-line-7881397d4db1" rel="nofollow noreferrer">https://medium.com/coinmonks/how-to-manually-verify-the-merkle-root-of-a-bitcoin-block-command-line-7881397d4db1</a></p>
 38618: <p>To search for a transaction in a merkle root, one must know the TXID of the transaction being looked for. It's not possible to search for leaves (transaction IDs) that satisfy a complex pattern [without scanning each of the transactions]. After the TXID and the TXIDs of other transactions in that block are acquired, the tree is traversed by hashing (For details, please see <a href="https://bitcoin.stackexchange.com/questions/50674/why-is-the-full-merkle-path-needed-to-verify-a-transaction">Why is the full Merkle path needed to verify a transaction?</a>) The transaction is proved to be a part of the block if the final hash is equal to the merkle root.</p>
 208: <p>A common misconception is that a Merkle tree is a data structure which makes finding elements in it easier. It does not. While it does have a tree structure, it is not a search tree like a B-tree or Red-Black or Patricia tree.</p>

<p>As far as searching for data goes, it is conceptually just a list (the leaves of the tree) with a number of associated hash values. Searching in it is exactly as hard as searching in a list is. If the list is sorted, that can be done in O(log n) time, but if the list is not sorted, you need to do an O(n) exhaustive search.</p>

<p>So what is a Merkle tree then useful for?</p>

<p>Proofs. A Merkle tree lets one party <em>prove</em> that a particular element is in it, to anyone who knows the tree's root hash.</p>

<p>So in practice the answer to "How do I find something in a Merkle tree?" is "You don't. You let someone else search for you, and have them show you a proof of what they found.".</p>
