I searched around for an answer to this question, however couldn't find one. So let's assume we've a raw ethereum transaction and before broadcasting we'd like to know the transaction hash. Is it possible to find out the hash before it's being broadcasted (i.e. via eth_sendRawTransaction RPC method).

For instance for raw transaction hex:


I get this transaction: https://kovan.etherscan.io/tx/0x58e5a0fc7fbc849eddc100d44e86276168a8c7baaa5604e44ba6f5eb8ba1b7eb

Is it possible to decode raw transaction so that this hash is known before hand? Note that I am storing private keys outside of applications such as geth/parity.

  • 1
    Please correct me if I am wrong: after mining transaction you receive the same transaction hash as after getting keccak256 hash from raw tx? My tests show that keccak256 hash of raw signed tx is NOT equal to transactionHash generated by ethereum while mining. I would appreciate if somebody could tell me how exactly transactionHashes are generated as there is no iformation available even in yellow paper of ethereum. Jan 7, 2018 at 17:36

1 Answer 1


Ok, so asked it a couple of minutes too soon. As the name implies it's a hash, hash of what? Hash of your raw hex in example:


Hashed using keccak256 (for instance can be found here: https://wiki.parity.io/JSONRPC-web3-module#web3_sha3): and the result as expected is:


So ended up being a short rhetorical question. However if someone has similar question... hope this helps!

  • It is not a stupid question. In Bitcoin, a hash of the transaction is presented in the opposite endianness so even though you may think that there is only one way to represent a hash as a string, that is not the case. Oct 14, 2018 at 18:22
  • 1
    Is this a hash of the signed transaction or the unsigned transaction? For the purposes of validating transaction data, can I derive a transaction hash just from the transaction data itself without knowledge of the private key? Oct 27, 2019 at 20:26
  • 1
    This is hash from the signed raw hex. I don't imagine you could derive it from unsigned data, since unsigned transaction has different "raw" representation and as such the hash of this would be also different than the hash of signed hex.
    – Kristaps
    Oct 28, 2019 at 21:59
  • No this is unsigned raw hex. The transaction must be hashed before it is signed. Geth verifies the transaction validity by hashing the txn message and applying ecrecover to the hash and hash signature. Raw transactions don't get signed as it is inefficient to do so. Dec 9, 2022 at 21:23

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.