7

People seem to be using "native segwit" and "bech32" interchangeably. Are they really the same thing?

12

TL;DR: Native segwit refers to segwit outputs without P2SH-wrapper. Bech32 is the address format used to represent native segwit-v0 locking scripts.

Wrapped segwit vs native segwit

When segwit activated, it introduced the zeroth generation of segwit, segwit-v0. The corresponding locking scripts came in two flavors:

  1. The forward-compatible "wrapped segwit" or "nested segwit" output types wrap the witness program in a Pay to Script Hash (P2SH) output. There are two variants, P2SH-P2WPKH for single-sig, and P2SH-P2WSH for arbitrary scripts including multisig. As all P2SH addresses, wrapped segwit outputs get encoded using Base58Check. The wrapping allows any P2SH-enabled wallets to send to wrapped segwit addresses.
  2. The compatibility-breaking "native segwit" output types which can only be paid to by segwit-enabled wallets. Native segwit outputs are more blockspace efficient because they avoid the additional data necessary for the P2SH-wrapper by resolving the witness program directly. Native segwit locking scripts get encoded using the newly introduced bech32 address format (BIP-173) (for v0 native segwit outputs).

Other uses of Bech32

Bech32 is also used for other purposes such as e.g. encoding Lightning invoices. Originally, it was planned to use Bech32 for later native segwit output versions as well. However, after a mutability weakness was discovered, and surveys found that many wallets did not properly handle sending to higher segwit versions, an amended version of Bech32 is in discussion. This amended version of Bech32 would use a different checksum constant to explicitly break forward-compatibility, i.e. require wallets to upgrade to create segwit-v1 outputs. Breaking forward-compatibility protects wallets from burning funds by incorrectly downgrading segwit-v1 addresses to segwit-v0 addresses, and allows the mutability weakness to be fixed.

Native segwit-v1 to use Bech32m

The proposed Taproot soft fork introduces the native segwit-v1 output type, Pay to Taproot (P2TR), which would be the first native segwit output type to use this amended Bech32 address format, called "Bech32m" proposed by BIP-350.

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.