Pay to R Puzzle Hash
Abstract
Motivation
Specification
.unlock
<ECDSA sig> # This is the first stack element and represents the ECDSA digital signature provided by the
# solver. It must have an R component that, when hashed with SHA256 and then RIPEMD160,
# produces the same value as the <hash> specified in the locking script. The S component can
# be computed using any key of the solver's choosing.
<key> # This is the second stack element and represents the private key that was used to compute the S component of the
# signature. It can be any key of the solver's choosing, as long as it produces a valid S component for the signature that
# was provided as the first stack element.
.lock
OVER # Duplicates the second stack element (the signature) so that it can be used later in the script. Now the stack has
# three elements, <signature> <key> <signature> and we can work with the top <signature> without bothering the bottom one.
3 SPLIT #
NIP #
TRUE SPLIT # This section of the script picks out the R-value from the signature.
SWAP #
SPLIT #
DROP #
HASH160 # Here, we hash the R-value with SHA256 and then again with RIPEMD160 (the combined operation is HASH160).
<hash> EQUALVERIFY # The hash we calculated in the previous step is compared with <hash> and if they are not equal then the script fails.
CHECKSIG # Finally, the ECDSA signature is checked.Serialization Format (Base58)
Examples
How it Works
Security Considerations
Implementations
Last updated
Was this helpful?

