When you create a "Pay To Public Key" transaction, you need to know the receiver's public key. How can we know receiver's public key?

You can get public key hash from address like this, but I'm not sure how to get public key.

FYI: scriptPubkey in P2PK scriptPubKey: OP_CHECKSIG

1 Answer 1


In most cases, if you really want to use a P2PK transaction, you would have to ask the receiver to tell you their public key.

You can't determine the public key from the address alone. The address is a hash of the public key, and hash functions are one-way. So if all you have is an address, you can't use a P2PK transaction.

If the receiver has previously had other transactions sent to the desired address, and has spent at least one of those transactions, then the public key was included as part of the spending transaction's signature. So in that case, the public key is in the blockchain, and you could use it to make a P2PK transaction.

I'm not sure why you would bother, though. P2PK transactions are pretty much obsolete, and P2PKH should be used for all normal purposes.

  • So at the beginning of Bitcoin, everybody needed to get public key from receivers? I heard that P2PK is still used in coinbase transactions. If so, miners are set a public key in coinbase? Commented Oct 6, 2016 at 16:51
  • @SatoshiNakanishi: That's true, Bitcoin Core uses P2PK when it produces coinbase transactions. In that case it is using the miner's own key, generated by Bitcoin Core itself, so of course it knows the public key. But this is mostly a holdover from old code. It's legal to use P2PKH in a coinbase transaction, and other mining software can do so; it just happens that Bitcoin Core uses P2PK. Commented Oct 6, 2016 at 16:54
  • At the beginning of Bitcoin history, everybody needed to get public key from receivers? Commented Oct 11, 2016 at 3:47
  • @SatoshiNakanishi: They didn't need to; as far as I know P2PKH was legal from the outset. But some people apparently used P2PK for regular transactions also (e.g. the first non-coinbase transaction in block 170). In that case, yes, you would have to get the public key from the intended recipient. But that's not really any harder than getting an address, which you also have to get from the intended recipient. Commented Oct 11, 2016 at 3:57

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.