Author

Topic: Why is the public key in a coinbase transaction? (Read 1110 times)

newbie
Activity: 16
Merit: 0
February 15, 2014, 03:13:06 PM
#3
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?
full member
Activity: 140
Merit: 100
A technical question: Why does a coinbase transaction put the public key itself in the scriptPubKey, while a regular transaction puts the public key hash (address) in the scriptPubKey? (And as a consequence, the scriptSig to redeem a coinbase transaction doesn't include the public key, unlike the scriptSig to redeem a regular transaction.)

Is there a motivation behind this, or is it an arbitrary implementation detail?

Reference: https://en.bitcoin.it/wiki/Script#Standard_Generation_Transaction_.28pay-to-pubkey.29

A standard transaction spends a previous output, that output was associated with a public key. In order to be "spendable" the system needs to verify that the person holds the private key corresponding to the public key, so a signature is created to prove that whoever is trying to use that output as an input (spend it) owns the private key needed to do so. Thus two parts, signature and public key hash.

Coinbase has no previous input, so the only required information is the public key with which is to be associated, and this doesn't need to be a public key anybody has a private key for, it could just be an arbitrary number.

Put another way, coinbase transactions have no input(s) to verify/spend.. general transactions always have input(s) that need verified with a signature.
newbie
Activity: 16
Merit: 0
A technical question: Why does a coinbase transaction put the public key itself in the scriptPubKey, while a regular transaction puts the public key hash (address) in the scriptPubKey? (And as a consequence, the scriptSig to redeem a coinbase transaction doesn't include the public key, unlike the scriptSig to redeem a regular transaction.)

Is there a motivation behind this, or is it an arbitrary implementation detail?

Reference: https://en.bitcoin.it/wiki/Script#Standard_Generation_Transaction_.28pay-to-pubkey.29
Jump to: