Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: TierNolan on April 10, 2013, 03:35:56 PM



Title: Coinbase input script
Post by: TierNolan on April 10, 2013, 03:35:56 PM
This is the sig script to unlock the input into the coinbase transaction.  However, since the coinbase doesn't have an input, it was initially undefined.  It looks like the input transaction needs to be set to 0 though.

Since BIP-34 was accepted, the start of the coinbase transaction's script is the block height, i.e. 0x03 (the length) and then the height.  This was to make sure every coinbase transaction hashed to a different value, even if they paid out to the same address.

What is the rest of the coinbase script used for?  Is it just random data or do miners has some system for deciding what to set it to?  Why not leave it as short as possible, since that would make the transaction smaller?


Title: Re: Coinbase input script
Post by: Mike Hearn on April 10, 2013, 03:42:21 PM
It has an extraNonce in it, and is also these days used for flagging features that the miner supports.


Title: Re: Coinbase input script
Post by: TierNolan on April 10, 2013, 03:45:56 PM
It has an extraNonce in it, and is also these days used for flagging features that the miner supports.

What kind of features?  Is that other BIP's that use it for miners to "vote"?


Title: Re: Coinbase input script
Post by: TierNolan on April 10, 2013, 04:22:27 PM
Another question about coinbase transactions, do they have to be the first transaction in the block?


Title: Re: Coinbase input script
Post by: Zeilap on April 10, 2013, 04:51:18 PM
Another question about coinbase transactions, do they have to be the first transaction in the block?
Yes - in fact they must be, and all others must not be coinbase.