Home › Glossary › P2WPKH

P2WPKH

Also called: Pay to Witness Public Key Hash, native SegWit address, bc1q address, SegWit v0 address, P2SH-P2WPKH, nested SegWit.

P2WPKH (Pay to Witness Public Key Hash) is the native SegWit single-key output type. Its bc1q addresses are always 42 characters long.

P2WPKH, Pay to Witness Public Key Hash, is the SegWit version of a single-key payment. Like P2PKH, it locks coins to a hash of one public key, but the signature and key move into the witness. Its addresses start with bc1q.

How it works

BIP 141 defines it as a version 0 witness program of exactly 20 bytes:

scriptPubKey: 0 <20-byte key hash>    (0x0014{20 bytes}, 22 bytes)
witness:      <signature> <public key>

The scriptSig is empty. Nodes check that the HASH160 of the public key matches the program, then verify the ECDSA signature using the BIP 143 signature hash, which commits to the amount being spent. Only compressed public keys are accepted by standard relay policy.

The address is the program in Bech32 (BIP 173): always 42 characters, such as bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4 from the BIP's examples. Testnet addresses start with tb1q.

Why it matters

Witness bytes count a quarter as much toward block weight as other bytes, so spending a P2WPKH output is cheaper than spending P2PKH, and the output itself is 3 bytes smaller. Moving signatures out of the transaction ID also fixed third-party malleability. SegWit activated at block 481,824 on 24 August 2017.

Wallets derive P2WPKH keys on the BIP 84 path m/84'/0'/0' and export them as zpub. The older wrapped form, P2SH-P2WPKH (BIP 49), puts the same program inside P2SH to get a 3... address. Compare BIP 44 vs BIP 84 or read the address types guide.

BIPs that define P2WPKH

Related terms

  • P2PKH: P2PKH (Pay to Public Key Hash) is Bitcoin's original single-key output type: coins locked to a public key hash, with addresses starting with 1.
  • Bech32: Bech32 is the checksummed base32 address format from BIP 173, used for native SegWit version 0 addresses that start with bc1q.
  • Witness: The witness is the part of a SegWit transaction that holds signatures and scripts, kept out of the txid so it can't be changed to alter the transaction ID.
  • SegWit (Segregated Witness): SegWit (Segregated Witness) is the 2017 soft fork that moved signatures into a separate witness, fixing malleability and introducing block weight.
  • P2WSH: P2WSH (Pay to Witness Script Hash) is the native SegWit output for scripts such as multisig: a 32-byte script hash with a 62-character bc1q address.

Learn more

Guides