Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: dbbit on March 14, 2014, 06:52:30 PM



Title: Why does some coinbase scripts not check public key hash?
Post by: dbbit on March 14, 2014, 06:52:30 PM
The answer is probably staring me right in the face, but I'll blame it on a late night...


I notice that in some cases the Coinbase vout will require a full 'OP_DUP OP_HASH160 <public-key-hash> OP_EQUALVERIFY OP_CHECKSIG' check:

E.g.
https://blockchain.info/tx/87282ec5f79d582a026f83de1e83fc1f1f7504459be9d5ec12966977379dd618


However, in other cases the Coinbase vout will just require a sig check (and a clear public key?):
<public-key> OP_CHECKSIG

E.g.:
https://blockchain.info/tx/3168d7c390c411ff62102fddfc09b667f5b02bd5cb074ba790288784b831a996


What makes the difference? (i.e. is it a different mining client? Pool software vs. solo miner vs. version etc.)



Title: Re: Why does some coinbase scripts not check public key hash?
Post by: 12648430 on March 14, 2014, 09:56:16 PM
Originally, pay-to-pubkey was the standard transaction type. The main benefit of using pay-to-pubkeyhash is that it allows for much shorter addresses (since a RIPEMD160 is much shorter than a pubkey); other than that it takes slightly more time and space than pay-to-pubkey. When mining, you don't need to share the address you're mining to except in the coinbase transaction itself, so there's no reason not to keep doing it the slightly simpler way.

The only benefit I can think of to mining to a pay-to-pubkeyhash is the theoretical situation where a serious vulnerability in secp256k1 has been found; receiving via pay-to-pubkeyhash doesn't reveal your pubkey until you're in the act of spending from that address, and allows less opportunity for someone to crack your key. Of course, no one expects that to happen any time soon.


Title: Re: Why does some coinbase scripts not check public key hash?
Post by: dbbit on March 14, 2014, 10:01:16 PM
The main benefit of using pay-to-pubkeyhash is that it allows for much shorter addresses (since a RIPEMD160 is much shorter than a pubkey); other than that it takes slightly more time and space than pay-to-pubkey. When mining, you don't need to share the address you're mining to except in the coinbase transaction itself, so there's no reason not to do it the slightly simpler way. (Historically, the reason is that pay-to-pubkey was originally the standard transaction type). The only benefit I can think of to mining to a pay-to-pubkeyhash instead of is the theoretical situation where a serious vulnerability in secp256k1 has been found; receiving via pay-to-pubkeyhash doesn't reveal your pubkey until you're in the act of spending from that address, and allows less opportunity for someone to crack your key. Of course, no one expects that to happen any time soon.

Thanks. That makes sense. So in Bitcoin I found that consistently older blocks are pay-to-pubkey and newer ones are pay-to-pubkeyhash.

In Mazacoin however I find these randomly all over the place.

Is it now generally the state of the world that pool software all use pay-to-pubkeyhash and individual -qt clients all use pay-to-pubkey? (I noticed all my solo-mined Mazacoin blocks are pay-to-pubkey for example).


Title: Re: Why does some coinbase scripts not check public key hash?
Post by: 12648430 on March 14, 2014, 10:06:32 PM
bitcoind's built-in cpu miner uses pay-to-pubkey; external mining software can choose its own transaction type.