Post
Topic
Board Beginners & Help
Re: Why is the public key in a coinbase transaction?
by
kens
on 15/02/2014, 19:13:06 UTC
Thank you for your reply, but I'm asking something much more obscure that I noticed after studying transactions in hex for hours. As you say, since a coinbase transaction isn't spending anything, it doesn't need a scriptSig and arbitrary data can be put in the coinbase field.

But I'm talking about the scriptPubKey in the output. A normal transaction puts the public key hash here, but a coinbase transaction puts the actual public key here.

That is, the scriptPubKey of a normal transaction is:
OP_DUP OP_HASH160 addr OP_EQUALVERIFY OP_CHECKSIG

But the scriptPubKey of a coinbase transaction is different:
public-key OP_CHECKSIG

A consequence is that to spend something from a normal transaction, the next transaction will have the scriptSig:

But to spend something from a coinbase transaction, the next transaction will have the scriptSig alone without the pubkey:


As far as I can tell, there is no reason for the two transactions to be handled differently. I expect you could do either transaction either way.

My question is if there is a reason for these two different scripts? Or is it just an arbitrary implementation detail?