2

I'm trying to understand how a block is put together. From here, I know that the extra nonce used to be in the format:

pblock->vtx[0].vin[0].scriptSig = CScript() << pblock->nTime << CBigNum(nExtraNonce);

What does this syntax mean? Exactly what elements does the script sig contain and in what order?

1

What does this syntax mean?

It's C++ for "set the scriptSig of the first input in the first transaction in this block to have the same contents as a script with the encoded nTime followed by the encoded nExtraNone".

Exactly what elements does the script sig contain and in what order?

It contains the block's nTime, followed by by the nExtraNonce.

How is the extra nonce formatted?

An example from this time period would be in the scriptSig from the coinbase transaction of block #185000:

04d508de4f02e82d

If we parse this script sig, it is:

04 -- Number of bytes in group of data
  d508de4f -- 4 bytes. The little endian timestamp.
02 -- Number of bytes in group of data
  e82d --  the little endian extranonce

Notice when you reverse the bytes in d508de4f, you get 4fde08d5, which when you convert it to a timestamp is Sun Jun 17 2012 12:41:57 GMT-0400 (EDT). When you byte-reverse e82d (reversed is 2de8), and decode an integer from the hex, you get 11,752 for an extranonce value.

  • Has this always been the way the first transaction scriptSig is formatted? – aj_black Sep 13 '16 at 19:11
  • As you can see in the question you linked to, no, it has not always been this way. In addition, there are only a few requirements about how the miner has to format their coinbase's scriptSigs, they can add any extra data they want to. – morsecoder Sep 13 '16 at 19:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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