<p>A coinbase transaction is characterised by "previous_output" field of the <a href="https://en.bitcoin.it/wiki/Protocol_specification#tx" rel="noreferrer">transaction</a> being 32 bytes of zeros and 4 bytes of 0xFF. It should be the first transaction of the block, but I'm not sure whether all the clients enforce this rule. The signature script of the coinbase transaction need not obey the <a href="https://en.bitcoin.it/wiki/Script" rel="noreferrer">Script protocol</a>, but as far as I remember the first block's script pushes data onto the stack and then pops it off. The data encoded in the <a href="https://en.bitcoin.it/wiki/Genesis_block" rel="noreferrer">Genesis Block</a> represents the famous headline of Times:</p>

<blockquote>
  <p>The Times 03/Jan/2009 Chancellor on brink of second bailout for banks</p>
</blockquote>

<p>And was used as a way to prove that the block was created no sooner than on 2009 01 03, but can also be speculated that it relates to Satoshi's intent when creating Bitcoin - to counter debt-driven currencies.</p>

CC BY-SA 3.0
2012-10-07T00:25:58.863Z
Yes, the coinbase must be the first and only the first transaction of a block. This is a network rule, and any client not enforcing it risks ending up on a fork.
Pieter Wuille
CC BY-SA 3.0
2012-10-06T20:41:59.503Z
2012-10-06T20:41:59.503Z
ThePiachu
<p>Coinbase input scripts can contain arbitrary data. No data is required currently. Bitcoind creates coinbase input scripts so that they are properly-formed scripts, but this is not required.</p>

CC BY-SA 3.0
2012-10-06T18:44:54.673Z
As of BIP34, nversion==2 blocks are required to have the block height encoded as a minimal-size data push in the coinbase.
Pieter Wuille
CC BY-SA 3.0
2012-10-07T00:24:36.433Z
Also, the size of the coinbase script must be between 2 and 100 bytes.
Pieter Wuille
CC BY-SA 3.0
2012-10-06T14:37:31.107Z
2012-10-06T14:37:31.107Z
theymos
<p>The input script of the coinbase transaction of block number 1 (right after the genesis block) looks like this: 04ffff001d010b</p>

<p>How do I recognize this as a coinbase transaction? </p>

<p>Do I simply know that this is a coinbase transaction because it is the first transaction in the block?</p>

<p>Does the coinbase script have to have a special format?</p>

CC BY-SA 3.0
2012-10-06T13:59:41.190Z
I tried to find the answer on the Bitcoin wiki, but that particular page is empty even though it is linked from the protocol specification page: https://en.bitcoin.it/wiki/Coinbase_transaction
Jan
<script><coinbase-transaction>
What is the format of coinbase input scripts?
Jan
# What is the format of coinbase input scripts?

(Asked by: username_0 on 2012-10-06)

The input script of the coinbase transaction of block number 1 (right after the genesis block) looks like this: 04ffff001d010b

How do I recognize this as a coinbase transaction?

Do I simply know that this is a coinbase transaction because it is the first transaction in the block?

Does the coinbase script have to have a special format?

**Tags:** script, coinbase-transaction

> **Comments:**
> **username_0**: I tried to find the answer on the Bitcoin wiki, but that particular page is empty even though it is linked from the protocol specification page: https://en.bitcoin.it/wiki/Coinbase_transaction  

---

## 2 answers

### Answer by username_1 on 2012-10-06. Score: 6

A coinbase transaction is characterised by "previous\_output" field of the [transaction](https://en.bitcoin.it/wiki/Protocol_specification#tx) being 32 bytes of zeros and 4 bytes of 0xFF. It should be the first transaction of the block, but I'm not sure whether all the clients enforce this rule. The signature script of the coinbase transaction need not obey the [Script protocol](https://en.bitcoin.it/wiki/Script), but as far as I remember the first block's script pushes data onto the stack and then pops it off. The data encoded in the [Genesis Block](https://en.bitcoin.it/wiki/Genesis_block) represents the famous headline of Times:

> The Times 03/Jan/2009 Chancellor on brink of second bailout for banks

And was used as a way to prove that the block was created no sooner than on 2009 01 03, but can also be speculated that it relates to Satoshi's intent when creating Bitcoin - to counter debt-driven currencies.

> **Comments:**
> **username_2**: Yes, the coinbase must be the first and only the first transaction of a block. This is a network rule, and any client not enforcing it risks ending up on a fork.  

---

### Answer by username_3 on 2012-10-06. Score: 1

Coinbase input scripts can contain arbitrary data. No data is required currently. Bitcoind creates coinbase input scripts so that they are properly-formed scripts, but this is not required.

> **Comments:**
> **username_2**: As of BIP34, nversion==2 blocks are required to have the block height encoded as a minimal-size data push in the coinbase.  
> **username_2**: Also, the size of the coinbase script must be between 2 and 100 bytes.  

---

