Skip to content

P2PKH

P2PKH-style signature lock.

txt
Contract P2PKH:
    # Lock to a 20-byte public-key hash stored in `self.pubKeyHash`.

    # The spender supplies a signature and the full public key.
    def verify(sig: hex, pubKey: hex):
        # Clone the key before hashing so the original remains available for signature verification.
        pubKey_copy = pubKey.Clone()

        # The derived hash must match the hash embedded in this instance.
        pubKeyHash = Hash160(pubKey_copy)
        EqualVerify(pubKeyHash, self.pubKeyHash)

        # `CheckSig` leaves the boolean result for the spending path.
        result = CheckSig(sig, pubKey)