And also, some examples comparing a legacy vs. SegWit transaction format would be really helpful.
Legacy Addresses (P2PKH)These are the original Bitcoin addresses, easily identified by their starting digit "1" (e.g., 1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa).
Legacy addresses generate larger transaction sizes because they include signatures directly in the transaction structure. This increased size consumes more block space, which often translates to higher transaction fees. The main benefit of legacy addresses is universal wallet support, given they’ve been in use since Bitcoin’s inception.
SegWit Addresses (P2SH and Bech32)Segregated Witness (SegWit) was introduced to solve transaction malleability and improve block efficiency. SegWit addresses come in two main forms:
P2SH (Pay-to-Script-Hash) addresses that start with "3" (e.g., 3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy)
Bech32 (Native SegWit) addresses that start with "bc1" (e.g., bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq)