Native Segwit P2WPKH
Read more about P2WPKH in BIP141
P2WPKH is the native Segwit version of a Pay to Public Key hash.
The scripts and script data are spread out as follows
witness: SIGNATURE PUBKEY scriptSig: empty Previous output scriptPubKey: 0 20-BYTE-KEY-HASH
Each Bitcoin full node will parse the scriptPubKey
and check the witness program size. If it is 20 bytes long, it is interpreted as a P2WPKH program.
Then each validating node checks that:
-
the witness stack is
<sig>
+<pubKey>
-
the HASH160 of the public key match the 20-byte witness program
-
verify the signature against the public key with the CHECKSIG operation
Comparing with a traditional P2PKH output, the P2WPKH equivalent occupies 3 less bytes in the scriptPubKey, and moves the signature and public key from the scriptSig to the witness data stack.