I'm creating a non-mainstream client that processes and validates Bitcoin transactions and need to track transactions in my database.

  • How is the TxID generated and when does it change?

Specifically, since sequence is intended to update a transaction, and if the transactions hash were to change I would assume the txid hash would change s well.

When I look at this image of a Tx, it appears that the txid is marked as TxIn (VI)

  • Is it possible or useful for a script to verify the TxID and signature hash?

1 Answer 1


TxID is just a SHA256 hash of binary transation data, so it changes upon any modification of transaction. Therefore, one cannot include verification of TxID in the script in same transaction (if I correctly understood what you want to achieve).

  • Maybe I'm confused... Where is the TxID? Dec 20, 2012 at 23:08
  • 4
    The transaction id is used to refer to a transaction; it is not part of it. Dec 20, 2012 at 23:20
  • @PieterWuille Is the TxID a simple Sha256 hash of the tx data in it's entirety? Does that mean the TxID changes if the sequence # changes? How should I track revisions (new sequences) of the same tx? Dec 21, 2012 at 6:17
  • @makerofthings7 Yes, it is just hash of all data. If tx data changes then it is NOT the same tx.
    – aland
    Dec 21, 2012 at 8:13
  • 1
    It is a double-SHA256 of the serialized transaction. So indeed, the sequence number is part of. Changing the sequence number means you get a new transaction, but there is some (currently disabled) code in the reference client which can detect one transaction as a 'new version' of another, and replace it. Dec 21, 2012 at 10:39

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.