P2PK (Pay To PubKey)
  • Hash256
  • Hash160
  • Reverse Bytes
Youtube Twitter


Pay To Pubkey

P2PK (Pay To Pubkey) is a script pattern that locks an output to a public key.

It is a simpler version of the more-commonly used P2PKH locking script.

How does P2PK work?

A P2PK lock just contains a public key and a CHECKSIG opcode:

scriptPubKey 4104ae1a62fe09c5f51b13905f07f06b99a2f7159b2225f374cd378d71302fa28414e7aab37397f554a7df5f142c21c1b7303b8a0626f1baded5c72a704f7e6cd84cac
04ae1a62fe09c5f51b13905f07f06b99a2f7159b2225f374cd378d71302fa28414e7aab37397f554a7df5f142c21c1b7303b8a0626f1baded5c72a704f7e6cd84c OP_CHECKSIG
hex | opcodes inline | stack

To unlock it you just need to provide a valid signature:

scriptSig 4730440220576497b7e6f9b553c0aba0d8929432550e092db9c130aae37b84b545e7f4a36c022066cb982ed80608372c139d7bb9af335423d5280350fe3e06bd510e695480914f01
hex | opcodes inline | stack

When the script runs, the CHECKSIG opcode compares the signature against the public key, and pushes a 1 on to the stack if it is valid.

Where can you find P2PK scripts?

Despite being the simplest script for locking bitcoins to someone's public key, P2PK is not used as much as the similar (yet more complex) P2PKH script.

You'll most commonly find P2PK in coinbase transactions in the earlier blocks in the blockchain. This is because the original Bitcoin Core miner would use P2PK for the block reward when constructing a candidate block:1

Newer mining software tends to use P2PKH, so you don't see P2PK scripts in coinbase transactions as much these days.

Newer mining software tends to use P2PKH, so you don't see P2PK scripts in coinbase transactions as much these days.

Here are some examples of transactions using P2PK:

Why did Satoshi use P2PK in the Bitcoin Core miner?

Not sure. You'll have to ask her/him.

I think P2PKH was used as a convenient way for people to make transactions, as it allowed you to use addresses instead of passing around your public key (which is longer). However, the miner does not need the convenience of addresses, so P2PK made for a simpler choice.

Why don't we use P2PK more often?

Because Satoshi designed P2PKH so that we can send each other shorter addresses instead of full public keys.

See: Why do we have P2PKH as well as P2PK?

By Greg Walker,

Last Updated: 31 Jan 2019
  • 31 Jan 2019: script page checks and edits
  • 29 Jan 2019: Updated title images for script pages. Also added simple breadcrumb for these pages too.
  • 25 Jan 2019: removed unnecessary address code from example scripts
  • 25 Jan 2019: removed address
  • 25 Jan 2019: fixed link
  • 25 Jan 2019: script examples now have hex switches and show the tooltips thanks to using the output.js file in browser/transaction/output
  • 23 Jan 2019: First draft of P2PK, P2PKH, P2MS, and P2SH pages.
  • 25 May 2018: CSS - added subheading styling for h1 (example: glossary/p2pk)
  • 18 May 2018: added link to scriptPubKey
  • 18 May 2018: /glossary/p2pk - first draft

Hey there, it's Greg.

I'll let you know about cool website updates, or if something seriously interesting happens in bitcoin.

Don't worry, it doesn't happen very often.