8

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?

1
  • 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: en.bitcoin.it/wiki/Coinbase_transaction
    – Jan
    Oct 6, 2012 at 13:59

2 Answers 2

6

A coinbase transaction is characterised by "previous_output" field of the transaction 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, 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 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.

1
  • 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. Oct 7, 2012 at 0:25
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.

2
  • 3
    As of BIP34, nversion==2 blocks are required to have the block height encoded as a minimal-size data push in the coinbase. Oct 6, 2012 at 18:44
  • 2
    Also, the size of the coinbase script must be between 2 and 100 bytes. Oct 7, 2012 at 0:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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