P2PK, or "Pay to Pub Key" transactions in full form, are one specific type of payment in the Bitcoin script. P2PK has been around since the Bitcoin genesis block was created on January 3, 2009. This article will explain everything you need to know about P2PK payments.
How Does P2PK Work?
Sending Bitcoin (BTC) from one address to another requires the coding of a transaction with a basic Bitcoin Script on the Bitcoin protocol. The steps involved with P2PK transactions are quite simple compared to other payment types, like P2PKH and P2SH.
When a P2PK transaction is created and submitted to a blockchain’s peer to peer network, the sender is forwarding funds from their own wallet to the “public key,” or pubkey for short, of another user. All that the receiver must do in order to spend the funds (i.e. use them in a future transaction) is prove that they are the owner of the public key to which the funds were sent.
It’s important to note the relationship between a Bitcoin private key and a public key. The pubkey, as the name suggests, can safely be revealed to the network without major security risks. In contrast, one’s private key must always be kept secret.
The pubkey, and the private key from which it was derived, are a pair of keys generated from an elliptic curve named secp256k1. Without breaking the cryptography behind it (i.e., the ECDSA Elliptic curve digital signature algorithm), it is impossible to reverse engineer a private key from the public key
Thus, to make a P2PK payment, the transaction script only needs to contain the corresponding public key and the CHECKSIG opcode (OP_CHECKSIG). When the script runs, OP_CHECKSIG checks whether the digital signature of the private key in use corresponds to the public key to which the funds were sent. If the transaction input is valid, OP_CHECKSIG unlocks the funds and the recipient is free to spend them in a future transaction.
Advantages and Limitations of P2PK Payments
While P2PK payments were once the most common transaction type on the Bitcoin blockchain, the functionality is somewhat limited. Most users agree that the limitations of P2PK outweigh the advantages. This has led to the development of new Bitcoin Scripts that have replaced P2PK and improved the user experience.
Simple Script: The design of P2PK is much simpler than other Bitcoin scripts, like P2PKH or P2SH, making it much easier to implement compared to scripts that require cryptographic hashing. This advantage is potentially debatable, partly because the more complex P2PKH was also deployed when the Bitcoin network launched in 2009.
Compatibility: Users holding BTC in P2PK format wallets have the ability to easily send these funds to wallets that use newer, more secure address formats.
Security: Because making P2PK transactions makes the public key visible to the network, there is one less layer of security between a potential hacker and the private key.
If the hacker has only a user’s Bitcoin wallet address, they would need to break encryption twice to reveal the private key— once to get from the address to the public key (breaking both the SHA-256 and RIPEMD-160 algorithms), and then once again to get from the private key to the public key (breaking ECDSA encryption). If the hacker already knows the public key, there is one less step to reaching the private key and stealing the funds. In reality, this is still impossible to do. Bitcoin network’s Elliptic Curve Digital Signature Algorithm (ECDSA) is considered to be highly secure.
The long-term challenge is how to protect ECDSA against advances in quantum computing that could eventually enable someone to ‘crack’ the code’ (e.g. reverse engineer the correct private key). Various development teams are working towards creating a quantum secure blockchain to defend against the future development of quantum computers. When that day comes, P2PK format wallets are expected to be the most vulnerable of all script types.
Public Key Length: Having to use a public key is inconvenient for sending and receiving BTC payments. Although public addresses are also long alphanumeric strings of 26-34 characters, public keys are longer by comparison at 64 characters. They also don’t have built-in error checks. This may slightly increase the possibility of errors when typing or copy/pasting public keys on computers or mobile devices.
Is P2PK Still Used Today?
The short answer is not really. P2PK was an important type of payment when Bitcoin launched in 2009. That’s because it was the only option besides P2PKH. In 2009 and 2010, 50 BTC block rewards were actually sent via P2PK, and early BTC mining software for CPUs supported P2PK. This helped enable it to gain traction among early adopters.
It is also worth noting that P2PK transactions were used for the coinbase transaction in Bitcoin’s genesis block as well as the first P2P payment of BTC from Satoshi Nakamoto to Hal Finney. The continued use of P2PK has been quite minimal despite its early importance.
According to research from Deloitte, more than 4 Million BTC (around 19% of the total supply) is currently sitting in P2PK format wallets. All P2PK format wallets and reused P2PKH wallets could be at risk from quantum attacks at some point in the future.
Quantum-Secure Transactions On Komodo With Dilithium
Developing quantum secure blockchains is an important step for the blockchain space to remain secure in the coming years and decades. That's why the Komodo Development Team implemented the Crystals-Dilithium digital signature scheme to the Antara Framework in March 2019. Anyone can create a quantum-secured blockchain within the Komodo ecosystem via the Dilithium module.
One of the modifications of Dilithium allows users to create a new type of quantum secure, human-readable address. Dilithium also enables a mere 32 bytes of data (the transaction ID of the registration transaction) to refer to 3 kilobytes of data (the uncompressed Dilithium public key).
If you're interested in learning more about Dilithium, you can read the Developer Docs for the Dilithium module here.
If you'd like to learn more about blockchain technology and keep up with Komodo's progress, subscribe to our newsletter. Begin your blockchain journey with Komodo today.