4

Is there an address format for P2WPKH or P2WSH? If P2WPKH uses the same address format as P2PKH, how does a sender's wallet know which one to use?

0

2 Answers 2

7
+50

Yes. The format used for encoding native version 0 Segwit scriptPubKeys (P2WPKH and P2WSH) is bech32, defined by BIP173. The format used for encoding Segwit scriptPubKeys version 1 and above is bech32m, defined in BIP350.

0
5

Is there an address format for P2WPKH or P2WSH?

No. BIP142 would have provided an address format for these output scripts, but it is in "deferred" status and expected to remain that way. Wallet developers are being encouraged to discuss a new address format on the bitcoin-dev mailing list, and it is my understanding that one proposal may be coming soon.

In the meantime, BIP70 supports paying to arbitrary outputs, so it can be used for the native segwit outputs, as can any other software that communicates using its own protocol (such as payment channel software like that being used for various Lightning Network implementations).

If P2WPKH uses the same address format as P2PKH, how does a wallet know which one to use?

Although the new address proposal will probably not use base58check like the current address formats for P2PKH and P2SH, the now-deferred proposal in BIP142 explains how this could easily be done by changing the first byte of the address (which is a version number):

"For P2WPKH address, the address version is 6 (0x06) for a main-network address or 3 (0x03) for a testnet address.

"For P2WSH address, the address version is 10 (0x0A) for a main-network address or 40 (0x28) for a testnet address."

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.