## ScriptSig (coinbase) structure of the Genesis Block

4

0

From original bitcoin c++ source code:

// Genesis Block:
// CBlock(hash=000000000019d6, ver=1, hashPrevBlock=00000000000000, hashMerkleRoot=4a5e1e, nTime=1231006505, nBits=1d00ffff, nNonce=2083236893, vtx=1)
//   CTransaction(hash=4a5e1e, ver=1, vin.size=1, vout.size=1, nLockTime=0)
//     CTxIn(COutPoint(000000, -1), coinbase 04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73)
//     CTxOut(nValue=50.00000000, scriptPubKey=0x5F1DF16B2B704C8A578D0B)
//   vMerkleTree: 4a5e1e


...

txNew.vin[0].scriptSig = CScript() << 486604799 << CBigNum(4) << vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));


We could see that scriptSig is: 04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73

Let's see closer:

04 - ?

ffff001d - 486604799 aka 0x1d00ffff

010445 - ?

5468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73 - The Times 03/Jan/2009 Chancellor on brink of second bailout for banks

I don't understand what are 04 and 010445. How can I get them? At wiki page of Genesis Block (https://en.bitcoin.it/wiki/Genesis_block) in ScriptSig line there is nothting about 010445.

Update. I have found that coinbase has a prefix with a byte indicating the length of nBits. In the Genesis Block length of Nbits are 4: 0x1d, 0x00, 0xff, 0xff. So, I know what is 04 but i stil don't know about 010445(( – Vitali Grabovski – 2013-09-04T15:08:33.620

11

Here is a breakdown of the entire genesis block:

01000000 - version
0000000000000000000000000000000000000000000000000000000000000000 - prev block
3BA3EDFD7A7B12B27AC72C3E67768F617FC81BC3888A51323A9FB8AA4B1E5E4A - merkle root
29AB5F49 - timestamp
FFFF001D - bits
1DAC2B7C - nonce
01 - number of transactions
01000000 - version
01 - input
0000000000000000000000000000000000000000000000000000000000000000FFFFFFFF - prev output
4D - script length
04FFFF001D0104455468652054696D65732030332F4A616E2F32303039204368616E63656C6C6F72206F6E206272696E6B206F66207365636F6E64206261696C6F757420666F722062616E6B73 - scriptsig
FFFFFFFF - sequence
01 - outputs
00F2052A01000000 - 50 BTC
43 - pk_script length
4104678AFDB0FE5548271967F1A67130B7105CD6A828E03909A67962E0EA1F61DEB649F6BC3F4CEF38C4F35504E51EC112DE5C384DF7BA0B8D578A4C702B6BF11D5FAC - pk_script
00000000 - lock time


Decoding the ScriptSig:

04 - push the next 4 bytes to stack
FFFF001D - 4 bytes pushed, they appear to be the same as bits
01 - push the next 1 byte to stack
04 - 1 byte pushed
45 - push the next 69 bytes to stack
5468652054696D65732030332F4A616E2F32303039204368616E63656C6C6F72206F6E206272696E6B206F66207365636F6E64206261696C6F757420666F722062616E6B73 - pushed bytes, "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks"


So 010445 are in fact part of 2 operations - 01 pushes 04 to the stack, 45 pushes the message to the stack. As to why push 04, beats me, maybe it was just testing to make sure something works? Some internal counter used by Satoshi during Genesis block creation? Since the script of a coin generation transaction is really meaningless, we might never know.

Thanks for the answer but I still don't know what is 010445 because there is no explanation in breakdown about 010445. 010445 is simply part of the sequence in breakdown. – Vitali Grabovski – 2013-09-04T15:44:55.327

@VitaliGrabovski Sorry about that, I broke things down a bit more. I explained 010445. – ThePiachu – 2013-09-04T16:17:37.200