Page Content

Tutorials

Pay to Public Key(P2PK): Original Bitcoin Transaction Output

In blockchain systems like Bitcoin, Pay to Public Key (P2PK) is a fundamental and early form of transaction output. It is a basic script pattern that essentially ties a set quantity of cryptocurrency to a particular public key. The basic idea is simple: those monies can only be unlocked and spent by the designated private key holder.

One way to conceptualize a P2PK transaction is as sending coins to a “P.O. Box” (the public key), to which anybody can send Bitcoin mail, but only the key owner can access it.

 Pay to Public Key (P2PK)
P2PK

How P2PK Works

The way money can be spent is determined by the scripting mechanism of Bitcoin. A “locking script” (ScriptPubKey) is included in each transaction output, which establishes constraints. In order to spend the funds, a new transaction’s input must include a “unlocking script” (ScriptSig) that meets these requirements.

This is how Pay to Public Key functions:

Creating the Output (ScriptPubKey):

  • The sender inserts the recipient’s complete public key and an OP_CHECKSIG opcode into the ScriptPubKey to generate a Pay to Public Key lock.
  • The standard appearance of the ScriptPubKey is OP_PUSHBYTES_65 . “OP_CHECKSIG.”
  • Both a 33-byte compressed public key and a 65-byte uncompressed public key are possible.
  • “These funds can only be spent if a valid signature for this public key is provided,” is what this script essentially says.

Spending the Output (ScriptSig):

  • A legitimate cryptographic signature in their ScriptSig is required from the recipient, who possesses the private key that corresponds to the public key, in order to unlock and spend the cash.
  • The signature, such as OP_PUSHBYTES_72 , is usually contained in the ScriptSig.

Verification (Execution):

  • The network node combines the ScriptSig and ScriptPubKey before verifying the transaction.
  • The OP_CHECKSIG opcode then confirms that the supplied signature is legitimate against the public key that was initially in the locking script when the combined script executes.
  • The recipient can spend the money if the transaction is deemed legitimate and OP_1 is added to the stack with the valid signature. If it’s invalid, the script fails and OP_0 is pushed.
  • The fact that an elliptic curve (secp256k1) is used to produce the public key and matching private key must be understood. Reverse engineering a private key from a public key is impossible without cracking the underlying encryption (ECDSA).

Historical Context and Current Usage

Pay to Public Key is rarely used nowadays and is regarded as a legacy script pattern. It has great historical significance:

  • Pay to Public Key has existed since January 3, 2009, when the Bitcoin genesis block was produced.
  • In the early Bitcoin transactions, Satoshi Nakamoto employed this technique first.
  • Examples include the first-ever Bitcoin transaction between Satoshi Nakamoto and Hal Finney, as well as the Coinbase transaction in the genesis block.
  • Because Satoshi wanted simplicity without the extra complexity of P2PKH and because Hal Finney was accustomed to direct public key cryptography, Satoshi used Pay to Public Key for both outputs in that initial transaction, even though P2PKH was available.
  • Coinbase transactions from the early blocks of the blockchain are where Pay to Public Key is most frequently found because the initial Bitcoin Core miner would pay block rewards to a Pay to Public Key.
  • Pay to Public Key was also supported by early Bitcoin mining software for CPUs, which helped to accelerate its uptake.
  • Although it was important in the beginning, it hasn’t been used much since.

Advantages and Limitations Compared to P2PKH

Despite being essential, Pay to Public Key has mostly been superseded by Pay-to-Pubkey-Hash (P2PKH) because of its higher level of security and ease of use.

Advantages of P2PK:

Simple Script: Pay to Public Key is easier to construct and requires less cryptographic hashing than other Bitcoin scripts like P2PKH or P2SH because of its considerably simpler design. It is thought to be the most basic script for Bitcoin locking.

Compatibility: Sending Bitcoin from wallets that employ Pay to Public Key format to wallets that use more recent, safe address forms is simple for users.

Limitations of P2PK:

Security (Public Key Exposure): With Pay to Public Key, as soon as the money is transferred, the public key is made visible on the blockchain. With P2PKH, on the other hand, the public key is only disclosed after the money has been spent. Even though it is computationally challenging to determine a Private Key from a public key, this vulnerability poses a potential security issue, particularly in light of upcoming developments in quantum computing.

In comparison to other script types, Pay to Public Key format wallets are anticipated to be more susceptible to quantum assaults. According to Deloitte research, more over 4 million Bitcoins, or roughly 19% of the entire supply, are presently stored in P2PK format wallets, which may be vulnerable to quantum attacks.

Public Key Length and Convenience: The transaction output must contain the complete, lengthy public key for Pay to Public Key to function. Bitcoin addresses are typically 26–34 characters long, whereas public keys are 64 characters long. As a result, sending and receiving funds is less convenient.

Lack of Error Checking: A checksum is included in Bitcoin addresses (P2PKH) to assist prevent typos, but Pay to Public Key public keys lack built-in error checks. When entering public keys by hand, this may marginally raise the chance of mistakes.

Wallet Support: Sending bitcoins to addresses (which translate to P2PKH scripts) is the main convenience feature of Bitcoin wallets. Consequently, creating a Pay to Public Key manually in a raw transaction is currently the only method to use it.

Does P2PK Have an Address?

A P2PK doesn’t have a physical location. Blockchain explorers, however, occasionally show addresses for Pay to Public Key locking scripts. This is due to the explorer’s application of HASH160 (SHA-256 + RIPEMD 160) to the P2PK’s public key, which was subsequently transformed into a Base58 address. This address is what the address would have been in the event that it had been a P2PKH locking script. Technically speaking, a Pay to Public Key locking script does not have an address. Using an address as a search query, this display’s sole usefulness is for blockchain research, which enables one to determine whether coins have been locked to the same public key via P2PK or P2PKH.

Summary Table

FeatureP2PK
Funds locked toPublic Key
Unlock bySignature from private key
PrivacyLower (public key revealed early)
Still used?Rare — mostly replaced by P2PKH
Example in BitcoinEarly blocks, like the ones mined by Satoshi
Agarapu Geetha
Agarapu Geetha
My name is Agarapu Geetha, a B.Com graduate with a strong passion for technology and innovation. I work as a content writer at Govindhtech, where I dedicate myself to exploring and publishing the latest updates in the world of tech.
Index