Bitcoin Forum
June 22, 2024, 04:11:39 AM *
News: Voting for pizza day contest
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Why is the public key in a coinbase transaction?  (Read 1113 times)
kens (OP)
Newbie
*
Offline Offline

Activity: 16
Merit: 0


View Profile
February 14, 2014, 04:15:27 PM
 #1

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
InsanityDev
Full Member
***
Offline Offline

Activity: 140
Merit: 100


View Profile
February 14, 2014, 05:12:12 PM
 #2

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.

kens (OP)
Newbie
*
Offline Offline

Activity: 16
Merit: 0


View Profile
February 15, 2014, 07: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:
<sig> <pubkey>
But to spend something from a coinbase transaction, the next transaction will have the scriptSig alone without the pubkey:
<sig>

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?
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!