script – Why cannot P2PKH’s scriptPubKey be shortened to solely OP_CHECKSIG?


The script achieves two issues:

  1. Ensures the offered public key matches the offered signature
  2. Ensures the offered public key results in the identical handle script the utxo was locked with.

A P2PKH script comprises the hash of the general public key. While you spend the cash, you present a public key, and a signature.

First, the script duplicates the offered public key, then runs it by hash160, and compares the output to the hash embedded within the locking script.

As soon as that examine passes, it validates the offered signature in opposition to the identical public key. This ensures that the signature comes from the identical key that was used to generate the handle.

Supply hyperlink

Leave a reply