Bech32 (starts with bc1) and P2SH (starts with 3) can both be used for segwit transactions. I know bech32 is supposed to create smaller transactions, but I'd like to know how much smaller (than P2SH). How do transactions coming from a normal single-key address compare?
bech32 produces smaller transactions than P2SH segwit transactions.
- one extra byte per output to create P2SH outputs than to create bech32 utxos (P2SH uses
OP_EQUALin addition to a 20 byte hash in its script, whereas bech32 just uses a fixed
00byte in addition to a 20 byte hash), and
- 23 extra bytes per input to spend from P2SH utxos than from bech32 utxos (P2SH has to produce the script that was hashed when spending in the sigscript, which takes 23 bytes to encode - bech32 has no non-witness sigscript at all).
Basically P2SH requires a script hash, native SegWit doesn't, and everything else is much the same. Native SegWit provides the script when the output is created, and P2SH provides it when the output is spent.
They are both just an encoding. The resulting tx could be exactly identical. In real life however people use bech32 just fur native segwit transactions, while p2sh is used as a wrapper around segwit. the tx is actually a tiny bit smaller when using p2sh.