2

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?

2 Answers 2

1

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

1
  • I was expected the same but wanted an expert opinion on this. Thanks for answering. Commented Nov 12, 2019 at 13:10
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.