

This heavily reduces the risks associated with a plain P2PK script as the hashing algorithms used provide a considerable barrier to determining the public key a priori. Pay to Public Key Hash is a widely used standard locking script format, that works similarly to P2PK but instead of pushing the public key, it pushes a hash of the public key, commonly referred to as an address.

That is, if it ever becomes possible to create a signature using a public key (not currently known to be possible), the public key is readily available. Decreased security in the event of a break in the ECDSA signature algorithm.More data to be transferred to request funds, since a public key is larger than the addresses used in other standard scripts.NOTE: Pay to Public Key is a largely obsolete type of locking script due to its property of leaking the public key of the recipient before the output is unlocked, resulting in: The data pushed must be either a compressed or uncompressed public key with appropriate length (33 bytes if the key is compressed, 65 bytes if it is not) for the type for the script to be recognized as P2PK.Ĭheck the public key at the top of the stack against the signature below it on the stack. If the signature is valid for the specified public key in the locking script, the output is allowed to be spent.Īdd the recipient’s public key to the stack. The P2PK locking script expects the unlocking script to push a signature to the stack. It is possible to have transactions without these standard locking script formats mined into a block, but such transactions are at a disadvantage due since they will not be as widely propagated.


The below locking script formats are regarded as “standard” on the Bitcoin Cash network and, as a result, are the three forms of transactions that will be relayed among nodes for mining. If the unlocking script were run second, it could end by removing any values currently on the stack and replacing it with a success value.įor more information about how script execution works, see Script. The rest of the script execution is to be provided in an unlocking script in a future transaction’s input.Įvery locking script is executed after the unlocking script. Locking scripts do this by defining a set of operations that must end in a successful script execution. A locking script is a Script that is used dictate how funds can be spent in the future.
