<p>This is not possible, both are sha256 hashes, and contain no markers as to their origin.</p>

CC BY-SA 4.0
2019-11-12T13:10:22.183Z
I was expected the same but wanted an expert opinion on this. Thanks for answering.
B Sameer Kumar Subudhi
CC BY-SA 4.0
2019-11-12T13:01:22.933Z
2019-11-12T13:01:22.933Z
Raghav Sood
<p>There is no explicit marker that identifies a hash as being related to a transaction/block, but as mentioned by OP, there is an implicit assumption that can be made, due to the difficulty target for blocks that is imposed by the network’s nodes. </p>

<p>Pragmatically, this means that a hash with an improbably low value could be assumed to be a potential block hash. Note that whether or not this represents a <em>valid</em> block cannot be known from the hash alone. While it is possible for a transaction hash to have an equivalently low value, this is incredibly unlikely (assuming someone isn’t grinding through transaction hashes to find a value below the difficulty target, but doing so would be extremely expensive, for no real gain).  </p>

<p>Conversely, a hash of any arbitrary value is likely not a valid block hash, as it would fail to satisfy the network’s difficulty requirement. </p>

<p>All of that said, in order to determine if the hash in question is actually related to a <strong>valid</strong> block/transaction, you will need knowledge of the current network state (ie, you will need to verify it using some sort of bitcoin fullnode). </p>

<p>TL;DR:</p>

<ul>
<li><p>An improbably low hash value <strong>may</strong> be representative of a block, or a transaction (though highly improbable). A full node is required to verify the validity of this hash, in any case. </p></li>
<li><p>An arbitrary hash value <strong>may</strong> be representative of a transaction, but again a full node is required to verify the validity of this hash. </p></li>
</ul>

CC BY-SA 4.0
2019-11-12T21:24:03.943Z
2019-11-12T21:24:03.943Z
chytrik
<p>Is there a logic based on which one can determine if a given 32-bit hash corresponds to a transaction or a block without enquiring a bitcoin-client?  </p>

<p>In other words, how do I differentiate or validate a given 32-bit hash as a transaction or block identifier?</p>

<p>I understand, that a valid block hash is restricted by the difficulty limits (that offer lower and upper bounds). Is there something similar to validate a transaction hash?<br>
<strong>Reference:</strong> <a href="https://en.bitcoin.it/wiki/Difficulty#How_is_difficulty_stored_in_blocks.3F" rel="nofollow noreferrer">How is difficulty stored in blocks?
</a></p>

<bitcoin-core><transactions><block-hash>
Difference between block hash and transaction hash in bitcoin-core
B Sameer Kumar Subudhi
# Difference between block hash and transaction hash in bitcoin-core

(Asked by: username_0 on 2019-11-12)

Is there a logic based on which one can determine if a given 32-bit hash corresponds to a transaction or a block without enquiring a bitcoin-client?

In other words, how do I differentiate or validate a given 32-bit hash as a transaction or block identifier?

I understand, that a valid block hash is restricted by the difficulty limits (that offer lower and upper bounds). Is there something similar to validate a transaction hash?  
**Reference:** [How is difficulty stored in blocks?](https://en.bitcoin.it/wiki/Difficulty#How_is_difficulty_stored_in_blocks.3F)

**Tags:** bitcoin-core, transactions, block-hash


---

## 2 answers

### Answer by username_1 on 2019-11-12. Score: 1 | Accepted answer

This is not possible, both are sha256 hashes, and contain no markers as to their origin.

> **Comments:**
> **username_0**: I was expected the same but wanted an expert opinion on this. Thanks for answering.  

---

### Answer by username_2 on 2019-11-12. Score: 1

There is no explicit marker that identifies a hash as being related to a transaction/block, but as mentioned by OP, there is an implicit assumption that can be made, due to the difficulty target for blocks that is imposed by the network’s nodes.

Pragmatically, this means that a hash with an improbably low value could be assumed to be a potential block hash. Note that whether or not this represents a *valid* block cannot be known from the hash alone. While it is possible for a transaction hash to have an equivalently low value, this is incredibly unlikely (assuming someone isn’t grinding through transaction hashes to find a value below the difficulty target, but doing so would be extremely expensive, for no real gain).

Conversely, a hash of any arbitrary value is likely not a valid block hash, as it would fail to satisfy the network’s difficulty requirement.

All of that said, in order to determine if the hash in question is actually related to a **valid** block/transaction, you will need knowledge of the current network state (ie, you will need to verify it using some sort of bitcoin fullnode).

TL;DR:

* An improbably low hash value **may** be representative of a block, or a transaction (though highly improbable). A full node is required to verify the validity of this hash, in any case.
* An arbitrary hash value **may** be representative of a transaction, but again a full node is required to verify the validity of this hash.


---

