2

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

3

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."

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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