In the standard pay-to-pubKeyHash scriptSig, which form of the public key should be used. My understanding is that both the compressed (33 bytes) and the expanded (64 bytes) are both valid.

Is there any of these two that is considered "standard"? Will the reference implementation propagate transactions containing either form, or will it withhold one?

IMO, I should use the compressed version since it will result in smaller transactions.

2 Answers 2


Both are valid and accepted as canonical. They are NOT interchangeable however - the same public key in compressed form is hashed to a different address than that in uncompressed form. You can only use compressed form if the unspent output address is compressed.


One isn't canonical over the other but if you are creating new keys there is no reason to use anything but compressed keys. So you could say uncompressed keys are deprecated for new key creation. If you are writing wallet software or other tools it would be good practice to always create compressed keys by default. Uncompressed keys have no advantages and they make each input in a transaction 32 bytes larger.

Now for transactions involving existing keys you must use the form which hashes to the PubKeyHash provided in the PkScript (output script).

This private key:


has a public key in both of the following forms



they however hash to different PubKeyHashes

3294837233cf5e8b458fad15b7581e0dd5027ace (for uncompressed key)
fe9a562ce1129ecf42ec1e65cf4872049280082d (for compressed key)

So if you are trying to spend an P2PkH output which is locked to the PubKeyHash 3294837233cf5e8b458fad15b7581e0dd5027ace the ScriptSig in the input must be created using the uncompressed key. The scripting langugage will not check both forms. It just directly hashes the pubkey provided and verifies that it matches the pubkeyhash in the output. Remember an address is the pubkeyhash encoded in base58 so the output form is going to depend on which address you provide the sender.

Your Answer

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

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