8

In Bitcoin core, when generating a new address for receiving a payment, you get this dialogue:

Receive Address

There is a tick-box for "Generate Bech32 address".

I understand that this is a relatively new feature not yet supported by all wallets. The tooltip help claims that

Bech32 addresses ... are cheaper to spend from and offer better protection against typos"

  • How much cheaper than the "P2SH wrapped SegWit address"? (and why?)
  • Don't P2SH wrapped SegWit addresses include check-digits at the end?

I did find a 52-minute Youtube video where someone with a familiar name was giving a presentation on Bech32 but I'm hoping that it can be explained simply and concisely for the non-technical end-user wondering whether to click that check-box or not.

3 Answers 3

5

Native P2WPKH Unspent outputs save 23 bytes as their ScriptSigs are empty instead of 0x0014{20-byte-key-hash}.

2)

Yes, there's already a checksum of the same length.

The newer checksum algorithm is

Also, you might be interested in the list of Bech32 Advantages.

0
2

Transaction fee is based on the number of bytes in your transaction. Segwit allows to move a significant part of the transaction to a new structure called witness. Bytes in the witness get a 75% discount (4 witness bytes count as 1).

How much you save depends on your transaction. If it involves a lot of signatures that can be moved to the witness you save more. For example with 1sat/byte fee and a 200 byte transaction out of which 120 bytes are signatures, you would pay 200 satoshis using legacy addresses but you would pay 80 + (120/4) = 110 satoshi with segwit.

How much cheaper than the "P2SH wrapped SegWit address"? (and why?)

If you check the box you will get a P2WPKH address else you will get a P2SH-P2WPKH address. Both get the discount. If you want a legacy address you have to specify it via an RPC command or change a value in your config file.

Don't P2SH wrapped SegWit addresses include check-digits at the end?

All legacy addresses include a 4-byte checksum which is good for detecting if there is an error or not.

Bech32 uses error-correcting codes which are far superior. Instead of a binary output (correct/incorrect) they can find multiple errors, pinpoint the exact wrong character and even correct them automatically (up to a number of errors depending on the code length)

4
  • About the fee part: the question is about the size difference between P2SH-WP2PKH and native P2WPKH.
    – MCCCS
    Sep 5, 2018 at 14:39
  • "and even correct them automatically", no-- they don't correct them. If they did it would destroy the protection against sending funds to wrong places.
    – G. Maxwell
    Sep 6, 2018 at 3:13
  • The BIP even explicitly says not to perform the error correction. If your address is wrong, and you know it, you should go back to the receiver and ask for the correct address instead of trying to guess. It is allowed to suggest where the errors may be, though. Sep 6, 2018 at 10:08
  • @G.Maxwell I didn't mean to suggest that you should do it, just that it is a capability of error-correcting codes in general.
    – Mike D
    Sep 6, 2018 at 10:55
2

A P2SH-P2WPKH input weighs 363 WU (90.75 vbytes), and a P2WPKH input weighs 271 WU (67.75 vbytes) assuming low-r grinding on each. The outputs take 32 B and 31 B respectively. This means that a P2WPKH UTXO causes 24 vB less transaction weight across its lifecycle than a P2SH-P2WPKH UTXO. This amounts to a 19.55% transaction weight reduction (395 WU vs 491 WU).

Both P2SH-P2WPKH and P2WPKH move the signature and public key information to the witness section of the transaction. This causes that data to be discounted in the weight calculation compared to non-segwit P2PKH outputs which take 724 WU for output and low-r input in sum.

Both address formats use checksums, but as mentioned by other answers, bech32 is specifically designed to maximize error detection for likely transcription errors (a small count of insertions, omissions, and substitutions). Further, bech32 uses only lowercase symbols which removes the error source of mixing up the case of a letter.

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.