0

What fields does Ethereum use when creating a hash for a transaction? Suppose the following:

  1. The blockchain has three blocks block0 <- block1 <- block2
  2. There's a transaction transaction2 which is originally in block2 with hash transactionHash2
  3. The blockchain gets reorged such that it's now block0 <- block3 <- block4
  4. transaction2 is now in block4

Would we expect that transaction2 has the same hash now that it's in a different block with a different parent block?

1 Answer 1

1

What fields does Ethereum use when creating a hash for a transaction?

There are a few transaction types supported by the network, therefore the fields needed to sign, serialize, and then generate the transaction hash vary.

Below are links to the go-ethereum repository where the different transaction types are defined (with their requisite fields/components):

Would we expect that transaction2 has the same hash now that it's in a different block with a different parent block?

Yes. The block a transaction is included in is independent of the transaction object itself. Before even submitting your signed transaction to the network, you can generate your transaction hash (the hash is a fingerprint of the transaction data).

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.