Glossary | Coinbase Transaction

Coinbase Transaction Generation Transaction

A coinbase transaction is the first transaction in a block. Miners use it to collect the block reward, and any additional transaction fees.

It's like putting your details on a self-addressed envelope so you can collect prize winnings.


When a miner creates a candidate block, the very first space for a transaction is reserved for the coinbase transaction.

Every block must have a coinbase transaction.

Every block must have a coinbase transaction.


A coinbase transaction is only slightly different to normal transaction data. The main difference is its single "blank" input, which we call the coinbase:

Raw Data (source)

  • The TXID is all zeros. (We're not referencing an existing transaction)
  • The VOUT is all f's (the maximum hexadecimal value for this field). (Again, because we're not trying to refer to an existing output).
  • The scriptSig can actually contain any data you like.1,2 (Because we do not have to unlock anything).

Other than that, you just need to be sure that the sum of your output values does not exceed the block reward + transaction fees you're collecting.


BIP 34

As of BIP 34 the scriptSig must start with a push of the height of the block. This change was made to prevent coinbase transactions from having the same TXID.


In the transaction data above, the 03 gives us the number of bytes being pushed, so the next 3 bytes ec5906 indicates the height of the block.

ec5906 is 416236 when you swap the endianness and convert to decimal.

Messages in coinbase transactions.

Miners often use the scriptSig for strings of text. You just have to decode them (from Hex to ASCII) to read them.

Here are some interesting ones:

Coinbase Transaction scriptSig (decoded) Notes
8b50f51b49f27e7bb0efb0b3bf38d12ce4f7e6258b90a75802a394cb585c879d BitFury/BIP100/ Miners typically include the name of their mining pool.
d0ec21e1d73d06be76c2b5b1e5ec486085bda8264229046c11b95f66f2eded83 /HaoBTC/Sun Chun Yu: Zhuang Yuan, will you marry me?/ You can put any string of text in to it.
4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b The Times 03/Jan/2009 Chancellor on brink of second bailout for banks This is the first coinbase transaction, mined by Satoshi Nakamoto.

A coinbase transaction must be 100 blocks deep before you can spend its outputs.

This is a safeguard to prevent outputs that originate from the coinbase transaction from becoming unspendable (in the event the mined block moves out of the active chain due to a fork).