<blockquote>
  <p>What exactly is the "Previous Index" and why is the value of it FFFFFFFF and not 00000000? Since the previous transaction doesn't exist, shouldn't it be 0 just like the previous hash?</p>
</blockquote>

<p>Coinbase transactions must have index FFFFFFFF, which is -1.</p>

<blockquote>
  <p>From my understanding, the input script contains arbitrary data chosen by the miner when constructing the coinbase transaction and can typically be decoded into ASCII.</p>
  
  <p>For example, this example input script (genesis block) decodes into ASCII as:</p>

<pre><code>ÿÿEThe Times 03/Jan/2009 Chancellor on brink of second bailout for banks
</code></pre>
  
  <p>Is this correct? And is this also used when the nonce overflows as an 'extraNonce'?</p>
</blockquote>

<p>Yes, it is exactly <code>ÿÿEThe Times 03/Jan/2009 Chancellor on brink of second bailout for banks</code>. Any part of coinbase can be used as the extranonce.</p>

<blockquote>
  <p>What is the input sequence? Why is it always 0xFFFFFFFF when the locktime is 0x00000000?</p>
</blockquote>

<p>See <a href="https://bitcoin.stackexchange.com/a/4995/38618">this</a> for details</p>

<blockquote>
  <p>What data is stored in the output script, and how can it be broken down to be decoded?</p>
</blockquote>

<p>It is a pay-to-pubkey output.</p>

<p><code>41</code> Push 65 bytes</p>

<p><code>04678AFDB0FE5548271967F1A67130B7105CD6A828E03909A67962E0EA1F61DEB649F6BC3F4CEF38C4F35504E51EC112DE5C384DF7BA0B8D578A4C702B6BF11D5F</code> Satoshi's public key</p>

<p><code>AC</code> OP_CHECKSIG</p>

CC BY-SA 4.0
2018-09-03T19:02:33.190Z
Thanks! Maybe this deserves a different question, but it appears that newer block coinbase transactions have their version as "02000000" indicating version 2. From what I [read here](http://learnmeabitcoin.com/glossary/coinbase-transaction) this was implemented in BIP34. However instead of the Version+NumberOfInputs+PreviousTXHash There appear to be extra fields. [This block](https://blockchain.info/rawtx/291a7971dfb8cd881294a63ec2af9064fc3010d1e7f36789de552077e9b87e6c?format=hex) for example, Has the version first, and then 3 bytes of something I cannot identify. Do you know what these are?
Mason Ticehurst
CC BY-SA 4.0
2018-09-04T00:06:08.693Z
BIP34 added the requirement that the coinbase scriptSig must start with a push of the block height.
Pieter Wuille
CC BY-SA 4.0
2018-09-03T08:23:18.573Z
2018-09-03T08:23:18.573Z
MCCCS
<p>I just have a few questions to help better my understanding of the coinbase transaction.</p>

<p>Example:</p>

<pre><code>01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff4d04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73ffffffff0100f2052a01000000434104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5fac00000000
</code></pre>

<p>From what I know currently, the format of the coinbase transaction typically looks something like this when decoded:</p>

<pre><code>TX Version:         01000000
# of Inputs:        01
Previous TX Hash:   0000000000000000000000000000000000000000000000000000000000000000
Previous Index:     FFFFFFFF
Input Script Len:   4D
Input Script:       04FFFF001D0104455468652054696D65732030332F4A616E2F32303039204368616E63656C6C6F72206F6E206272696E6B206F66207365636F6E64206261696C6F757420666F722062616E6B73
Input Sequence:     FFFFFFFF
# of Outputs:       01
Output Value (Sat): 00F2052A01000000
Output Script Len:  43
Output Script:      4104678AFDB0FE5548271967F1A67130B7105CD6A828E03909A67962E0EA1F61DEB649F6BC3F4CEF38C4F35504E51EC112DE5C384DF7BA0B8D578A4C702B6BF11D5FAC
Lock Time:          00000000
</code></pre>

<p>My first question:</p>

<p>What exactly is the "Previous Index" and why is the value of it FFFFFFFF and not 00000000? Since the previous transaction doesn't exist, shouldn't it be 0 just like the previous hash?</p>

<p>Second question:</p>

<p>From my understanding, the input script contains arbitrary data chosen by the miner when constructing the coinbase transaction and can typically be decoded into ASCII.</p>

<p>For example, this example input script (genesis block) decodes into ASCII as:</p>

<pre><code>ÿÿEThe Times 03/Jan/2009 Chancellor on brink of second bailout for banks
</code></pre>

<p>Is this correct? And is this also used when the nonce overflows as an 'extraNonce'?</p>

<p>Third question:</p>

<p>What is the input sequence? Why is it always 0xFFFFFFFF when the locktime is 0x00000000?</p>

<p>Final question (I promise):</p>

<p>What data is stored in the output script, and how can it be broken down to be decoded?</p>

<p>Thank you!</p>

<bitcoin-core><coinbase-transaction>
Variables in Coinbase Transaction & Decoding I/O Scripts
Mason Ticehurst
# Variables in Coinbase Transaction & Decoding I/O Scripts

(Asked by: username_0 on 2018-09-03)

I just have a few questions to help better my understanding of the coinbase transaction.

Example:

```
01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff4d04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73ffffffff0100f2052a01000000434104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5fac00000000

```

From what I know currently, the format of the coinbase transaction typically looks something like this when decoded:

```
TX Version:         01000000
# of Inputs:        01
Previous TX Hash:   0000000000000000000000000000000000000000000000000000000000000000
Previous Index:     FFFFFFFF
Input Script Len:   4D
Input Script:       04FFFF001D0104455468652054696D65732030332F4A616E2F32303039204368616E63656C6C6F72206F6E206272696E6B206F66207365636F6E64206261696C6F757420666F722062616E6B73
Input Sequence:     FFFFFFFF
# of Outputs:       01
Output Value (Sat): 00F2052A01000000
Output Script Len:  43
Output Script:      4104678AFDB0FE5548271967F1A67130B7105CD6A828E03909A67962E0EA1F61DEB649F6BC3F4CEF38C4F35504E51EC112DE5C384DF7BA0B8D578A4C702B6BF11D5FAC
Lock Time:          00000000

```

My first question:

What exactly is the "Previous Index" and why is the value of it FFFFFFFF and not 00000000? Since the previous transaction doesn't exist, shouldn't it be 0 just like the previous hash?

Second question:

From my understanding, the input script contains arbitrary data chosen by the miner when constructing the coinbase transaction and can typically be decoded into ASCII.

For example, this example input script (genesis block) decodes into ASCII as:

```
ÿÿEThe Times 03/Jan/2009 Chancellor on brink of second bailout for banks

```

Is this correct? And is this also used when the nonce overflows as an 'extraNonce'?

Third question:

What is the input sequence? Why is it always 0xFFFFFFFF when the locktime is 0x00000000?

Final question (I promise):

What data is stored in the output script, and how can it be broken down to be decoded?

Thank you!

**Tags:** bitcoin-core, coinbase-transaction


---

## 1 answers

### Answer by username_1 on 2018-09-03. Score: 0 | Accepted answer

> What exactly is the "Previous Index" and why is the value of it FFFFFFFF and not 00000000? Since the previous transaction doesn't exist, shouldn't it be 0 just like the previous hash?

Coinbase transactions must have index FFFFFFFF, which is -1.

> From my understanding, the input script contains arbitrary data chosen by the miner when constructing the coinbase transaction and can typically be decoded into ASCII.
>
> For example, this example input script (genesis block) decodes into ASCII as:
>
> ```
> ÿÿEThe Times 03/Jan/2009 Chancellor on brink of second bailout for banks
>
> ```
>
> Is this correct? And is this also used when the nonce overflows as an 'extraNonce'?

Yes, it is exactly `ÿÿEThe Times 03/Jan/2009 Chancellor on brink of second bailout for banks`. Any part of coinbase can be used as the extranonce.

> What is the input sequence? Why is it always 0xFFFFFFFF when the locktime is 0x00000000?

See [this](https://bitcoin.stackexchange.com/a/4995/38618) for details

> What data is stored in the output script, and how can it be broken down to be decoded?

It is a pay-to-pubkey output.

`41` Push 65 bytes

`04678AFDB0FE5548271967F1A67130B7105CD6A828E03909A67962E0EA1F61DEB649F6BC3F4CEF38C4F35504E51EC112DE5C384DF7BA0B8D578A4C702B6BF11D5F` Satoshi's public key

`AC` OP\_CHECKSIG

> **Comments:**
> **username_0**: Thanks! Maybe this deserves a different question, but it appears that newer block coinbase transactions have their version as "02000000" indicating version 2. From what I [read here](http://learnmeabitcoin.com/glossary/coinbase-transaction) this was implemented in BIP34. However instead of the Version+NumberOfInputs+PreviousTXHash There appear to be extra fields. [This block](https://blockchain.info/rawtx/291a7971dfb8cd881294a63ec2af9064fc3010d1e7f36789de552077e9b87e6c?format=hex) for example, Has the version first, and then 3 bytes of something I cannot identify. Do you know what these are?  
> **username_2**: BIP34 added the requirement that the coinbase scriptSig must start with a push of the block height.  

---

