Take the 2-minute tour ×
Bitcoin Stack Exchange is a question and answer site for Bitcoin crypto-currency enthusiasts. It's 100% free, no registration required.

I'm currently trying to generate the genesis block with my code and I've stumbled upon the TxIn sequence field that is not explained in the Protocol Specification wiki page, nor does it seem to appear in the block explorer. What is the way the value of this field is calculated, and what was its value for the genesis block?

share|improve this question

1 Answer 1

up vote 14 down vote accepted

Sequence numbers aren't shown on the Bitcoin Block Explorer HTML pages because they are not used by the network currently. Non-default sequence numbers would be shown on raw block/tx pages, but I'm not sure whether this has ever happened.

Sequence numbers are intended to be used for replacement. Replacement is currently disabled, but how it would work is:

  • You send a transaction with a LockTime in the future and a sequence number of 0. The transaction is then not considered by the network to be "final", and it can't be included in a block until the specified LockTime is reached.
  • Before LockTime expires, you can replace the transaction with as many new versions as you want. Newer versions have higher sequence numbers.
  • If you ever want to lock the transaction permanently, you can set the sequence number to UINT_MAX. Then the transaction is considered to be final, even if LockTime has not been reached.

This is useful in several cases. For example, two parties can use it to set up a "prepared transaction". Once the prepared transaction is created, the parties can move money between each other instantly, securely, and without fees. So you could set one of these up with an exchange and withdraw and deposit without waiting for confirmations.

Since replacement is not used currently, all transactions Bitcoin creates have LockTime = 0 and Sequence = UINT_MAX. This is the case with the genesis block's generation transaction.

share|improve this answer
2  
How does the network determine whether to accept a new version as a replacement transaction? Could an attacker replace transactions maliciously? –  jl6 Dec 23 '11 at 16:54
3  
Non-default sequence numbers have happened. Once in January 2011 and 6 times in February 2011. The sequence number was zero in each case. See transaction c99c49da4c38af669dea436d3e73780dfdb6c1ecf9958baa52960e8baee30e73 for an example. blockexplorer.com/rawtx/… –  Chris Moore Feb 11 '12 at 4:38
    
For reference UINT_MAX = 4294967295U –  makerofthings7 Mar 8 at 6:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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