9

I am currently having a blonde moment.

The ScriptPubKey provides a hashed version of the receivers public key.

scriptPubKey OP_DUP OP_HASH160 OP_EQUALVERIFY OP_CHECKSIG

However, if I give someone my bitcoin address to send me money - how does the sender retrieve my public key and then hash it? As the pubKeyHash != my bitcoin address

I am probably forgetting something very obvious - but it has had my head bambuzzled this morning.

  • 1
    "pubKeyHash != my bitcoin address" You're wrong here. The address contains the public key hash, along with a version number and checksum. – Tim S. Mar 13 '14 at 20:04
8

Addresses are really just shorthands for particular scripts. The standard address type (starting with a '1' on mainnet) does in fact correspond to the exact type of script you gave above.

If you base58 decode such an address, you end up with a byte string of the form 0x00 + [20-byte hash] + [4-byte checksum]. The corresponding script is OP_DUP OP_HASH160 [20-byte hash] OP_EQUALVERIFY OP_CHECKSIG.

So, in a way, your address does contain the public key's hash.

-2

The sender does not need to know your public key, only the bitcoin address you provide which can be different each time. You use the public key later to redeem the funds and send to another address.

  • the bitcoin address is the public key. – hafnero Mar 13 '14 at 20:11
  • 2
    No, you are confusing the bitcoin address with the public key. You can create many diferrent bitcoin addresses using your public key and private key. You will need the public key to redeem the funds of the transaction. – 99Percent Mar 14 '14 at 1:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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