<blockquote>
  <p>What does this syntax mean?</p>
</blockquote>

<p>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".</p>

<blockquote>
  <p>Exactly what elements does the script sig contain and in what order?</p>
</blockquote>

<p>It contains the block's <code>nTime</code>, followed by by the <code>nExtraNonce</code>.</p>

<blockquote>
  <p>How is the extra nonce formatted?</p>
</blockquote>

<p>An example from this time period would be in the scriptSig from <a href="https://blockchain.info/tx/30d6f63aca6cef1ed958c35b83ca35e042ccff36e75d9c195534f0f6a7a8d31a" rel="nofollow">the coinbase transaction of block #185000</a>:</p>

<pre><code>04d508de4f02e82d
</code></pre>

<p>If we parse this script sig, it is:</p>

<pre><code>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
</code></pre>

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

CC BY-SA 3.0
2016-09-13T19:11:36.513Z
Has this always been the way the first transaction scriptSig is formatted?
aj_black
CC BY-SA 3.0
2016-09-13T19:21:05.740Z
As you can see in [the question you linked to](http://bitcoin.stackexchange.com/questions/36455/determining-a-blocks-extranonce-value), 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
CC BY-SA 3.0
2016-09-13T16:03:05.630Z
2016-09-13T16:03:05.630Z
morsecoder
<p>I'm trying to understand how a block is put together. From <a href="https://bitcoin.stackexchange.com/questions/36455/determining-a-blocks-extranonce-value">here</a>, I know that the extra nonce used to be in the format: </p>

<pre><code>pblock-&gt;vtx[0].vin[0].scriptSig = CScript() &lt;&lt; pblock-&gt;nTime &lt;&lt; CBigNum(nExtraNonce);
</code></pre>

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

<block><hash><coinbase-transaction><nonce>
How is the extra nonce formatted?
aj_black
# How is the extra nonce formatted?

(Asked by: username_0 on 2016-09-12)

I'm trying to understand how a block is put together. From [here](https://bitcoin.stackexchange.com/questions/36455/determining-a-blocks-extranonce-value), 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?

**Tags:** block, hash, coinbase-transaction, nonce


---

## 1 answers

### Answer by username_1 on 2016-09-13. Score: 1 | Accepted answer

> 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](https://blockchain.info/tx/30d6f63aca6cef1ed958c35b83ca35e042ccff36e75d9c195534f0f6a7a8d31a):

```
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.

> **Comments:**
> **username_0**: Has this always been the way the first transaction scriptSig is formatted?  
> **username_1**: As you can see in [the question you linked to](http://bitcoin.stackexchange.com/questions/36455/determining-a-blocks-extranonce-value), 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.  

---

