1

So, through an odd bug in hacking some stuff onto Bitcoin, I encountered a peculiar thing.

Basically, I managed to generate an transaction with 2 outputs. The first output was a typical txout

DUP HASH160 20:905a...a998 EQUALVERIFY CHECKSIG

However, a bug caused the second output (the change output, to send it back to myself) to be a mining generate transaction script:

33:025c...6718 CHECKSIG

This was not considered a non-standard TX, and as far as I can tell, was interpreted as a valid transaction for sending coins and block explorers see it as being sent to the proper address.

What exactly is the difference between these two scripts? What is the significance of using a mining script for a transaction?

1 Answer 1

2

One is a pay-to-pubkey-hash script (the typical script represented by normal addresses), the other is a pay-to-pubkey script. Both are perfectly valid and standard.

The reason for using direct pay-to-pubkey in coinbases is because they are older. For most purposes pay-to-pubkey-hash is superior (you don't need to know the full public key of the recipient, there is a standard address type for them, there is a marginal security benefit, and they require less space in the validation database). However, direct pay-to-pubkey is just as valid, and the mining code was never adapted to use pubkey hashes instead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.