2

I would consider myself quite up-to-par with the concept and in-depth functionalities of SegWit (segregated witness).

I just don't understand one key aspect of it; P2SH and bech32 addresses.

  1. why on earth was it necessary to create new address formats, what does that do for segwit?
  2. Were the new address formats made as a reason to help segwits implementation, or do they serve a different use-case. (i.e similar to segwits transition to "weight" which had nothing to do with fixing tx malleability but rather optimizing blocks).

I don't see how a P2PKH address couldn't be used in a segwit transaction. The ECDSA signature is still the source of validity of a transaction in segwit

1 Answer 1

3

There had to be a way to distinguish between segwit addresses and "legacy" addresses so that software could correctly identify the type of transaction it needed to create.

The obvious approach would have been to use a new "version number" on the usual Base58 address format (like how P2PKH addresses start with 1, P2SH start with 3, so maybe SegWit could have started with S).

However, the totally new Bech32 address format had a lot of useful improvements unrelated just to SegWit. It was just a good time to introduce it. Benefits include much better error detection (and correction), better security to avoid hash collisions in P2WSH scripts because the hash encoded is longer, less ambiguity when transcribing addresses since mixed case isn't allowed (which also allows more efficient encoding in QR codes), and more descriptive human-readable prefixes.

Your Answer

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

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